:root {
  --bg: #f4f6f8;
  --card: #fff;
  --ink: #1c2430;
  --muted: #6b7785;
  --line: #dde3ea;
  --brand: #2563eb;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
h2 { font-size: 1.05rem; margin: 0 0 .6em; }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: .7rem 1.2rem;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.topbar nav a { margin-left: 1.1rem; color: var(--ink); }
.wrap { max-width: 960px; margin: 1.4rem auto; padding: 0 1.2rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

/* buttons */
.btn {
  display: inline-block; cursor: pointer;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: .5rem .9rem; border-radius: 8px; font-size: .95rem; line-height: 1;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }

/* flashes */
.flash { padding: .6rem .9rem; border-radius: 8px; margin: .6rem 0; border: 1px solid; }
.flash.ok   { background: #ecfdf3; color: var(--ok);   border-color: #abefc6; }
.flash.err  { background: #fef2f2; color: var(--err);  border-color: #fecaca; }
.flash.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }

/* dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.card-head { display: flex; align-items: center; gap: .5rem; }
.card-actions { display: flex; gap: .5rem; margin-top: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--ok); } .dot.off { background: #c4ccd6; }

/* blocks / forms */
.block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin: 1rem 0; }
label { display: block; margin: .6rem 0; font-weight: 600; }
label input, label select { font-weight: 400; }
input[type=text], input[type=url], input[type=password], input[type=number], select {
  display: block; width: 100%; max-width: 520px; margin-top: .25rem;
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; background: #fff;
}
input[type=file] { margin-top: .3rem; }
.actions-bar { display: flex; gap: .6rem; align-items: center; margin: 1.2rem 0; }

/* layout choices (mini previews) */
.layout-choices { display: flex; flex-wrap: wrap; gap: 1rem; }
.layout-choice { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-weight: 600; cursor: pointer; }
.mini { width: 90px; height: 56px; border: 2px solid var(--line); border-radius: 6px; display: grid; gap: 2px; padding: 3px; background: #eef2f7; }
.mini::before, .mini::after { content: ''; background: #b9c4d2; border-radius: 2px; }
.mini-full::before { grid-column: 1; }
.mini-full::after { display: none; }
.mini-full { grid-template-columns: 1fr; }
.mini-right { grid-template-columns: 7fr 3fr; }
.mini-bottom { grid-template-rows: 7fr 3fr; }

/* image picker (slideshow) */
.imgpick { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; }
.imgpick-item { display: inline-flex; flex-direction: column; align-items: center; width: 110px; margin: .3rem; font-weight: 400; font-size: .75rem; text-align: center; }
.imgpick-item img { width: 100px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }

/* media library */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.media-item { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem; text-align: center; }
.media-item img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.media-item figcaption { font-size: .75rem; color: var(--muted); word-break: break-all; margin: .3rem 0; }

/* v2 elementi */
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-user { color: var(--muted); margin-left: 1.1rem; font-size: .9rem; }
.url-row { display: flex; gap: .4rem; margin-top: .5rem; }
.url-row input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; margin: 0; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
label.check input { width: auto; margin: 0; }
.block.danger { border-color: #f3c9c9; }
.danger-btn { background: var(--err); border-color: var(--err); }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .4rem 0; }
.inline-form input { width: auto; margin: 0; }
.size-hint { font-weight: 400; }
.aspect-warn { margin-top: .5rem; }

/* galerije */
.thumbs { display: flex; gap: 4px; margin: .3rem 0; }
.thumbs img { width: 52px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.order-list { display: flex; flex-direction: column; gap: .4rem; }
.order-item { display: flex; align-items: center; gap: .6rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; }
.order-item img { width: 84px; height: 50px; object-fit: cover; border-radius: 4px; }
.order-num { width: 1.7em; color: var(--muted); text-align: right; }
.order-name { flex: 1; font-size: .85rem; word-break: break-all; }
.order-btns { display: flex; gap: .3rem; }
.u-list { width: 100%; border-collapse: collapse; }
.u-list td { padding: .55rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
.u-list tr:first-child td { border-top: 0; }

/* specifikacije */
.spec-row { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.spec-table { border-collapse: collapse; }
.spec-table th, .spec-table td { padding: .4rem .8rem; border: 1px solid var(--line); text-align: left; font-size: .9rem; }
.spec-table th { background: #eef3f8; }
.spec-diagram { width: 200px; height: 112px; border: 2px solid var(--line); border-radius: 6px; display: grid; gap: 3px; padding: 3px; background: #eef2f7; flex: none; }
.diagram-full { grid-template-columns: 1fr; }
.diagram-right { grid-template-columns: 72fr 28fr; }
.diagram-bottom { grid-template-rows: 78fr 22fr; }
.dz { background: #b9c4d2; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: .68rem; color: #34495e; text-align: center; padding: 2px; }

/* login */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 320px; text-align: center; }
.login-box h1 { margin: 0; }
.login-box label { text-align: left; }
.login-box .btn { width: 100%; margin-top: .6rem; }
