/* Hekmat demo — light, calm, brand navy + teal taken from the logo. */

@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #14325c;
  --navy-2: #1d4478;
  --teal: #2fb6a8;
  --teal-soft: #e3f6f3;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #16213a;
  --muted: #62708a;
  --dim: #98a3b8;
  --line: #e3e8f0;
  --sunk: #eef1f6;
  --ok: #15a36b;
  --ok-soft: #e2f6ec;
  --warn: #d98a0b;
  --warn-soft: #fdf1dc;
  --danger: #d6424b;
  --danger-soft: #fde8e9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 50, 92, .05), 0 4px 16px rgba(20, 50, 92, .06);
  --shadow-lg: 0 18px 50px rgba(20, 50, 92, .22);
  --font: 'Vazirmatn', Tahoma, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
svg { flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.code { font-family: var(--mono); letter-spacing: .02em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 55%, transparent); outline-offset: 2px; }

/* ------------------------------------------------------------------ frame */

.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.brand-sub { font-size: 12.5px; color: rgba(255,255,255,.6); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; border-radius: 10px;
  padding: 11px 14px; color: rgba(255,255,255,.72);
  cursor: pointer; text-align: start; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item .label { flex: 1; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(255,255,255,.13); color: #fff; font-weight: 700; }
.nav-item[aria-current="page"] svg { color: var(--teal); }
.nav-badge {
  font-size: 12px; min-width: 24px; text-align: center; padding: 0 7px;
  border-radius: 999px; background: rgba(255,255,255,.12);
}
.nav-live { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s infinite; }

.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12.5px; color: rgba(255,255,255,.65);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: #3ddc97; box-shadow: 0 0 0 4px rgba(61,220,151,.18); }
.dot.off { background: var(--danger); }

.main { padding: 30px 36px 110px; max-width: 1320px; width: 100%; min-width: 0; }
.view { animation: fade .25s ease; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 22px; }
.panel h2 { margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn svg { width: 19px; height: 19px; }
.btn:hover { border-color: #cbd3e1; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: #28a497; border-color: #28a497; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c1363f; border-color: #c1363f; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--sunk); border-color: transparent; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ----------------------------------------------------------------- home */

.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center;
  padding: 30px; overflow: hidden; position: relative;
  background: linear-gradient(120deg, #ffffff 40%, var(--teal-soft));
}
.hero-text p { color: var(--muted); margin: 8px 0 22px; max-width: 520px; font-size: 15.5px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 14px;
}
.steps b {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--navy); color: #fff; font-size: 14px;
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.kpi {
  display: flex; align-items: center; gap: 14px; padding: 18px; text-align: start; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi > span:last-child { display: flex; flex-direction: column; }
.kpi-icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: #e7edf7; color: var(--navy);
}
.kpi-icon svg { width: 24px; height: 24px; }
.kpi-icon.teal { background: var(--teal-soft); color: #1b8f83; }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.2; }

.live-banner {
  margin-top: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--radius);
  background: var(--navy); color: #fff; box-shadow: var(--shadow);
}
.live-banner .grow { flex: 1; min-width: 200px; }
.live-banner small { color: rgba(255,255,255,.7); display: block; }
.live-banner .btn { background: #fff; color: var(--navy); border-color: #fff; }

/* -------------------------------------------------------------- toolbar */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.search { position: relative; flex: 0 1 340px; min-width: 220px; }
.search svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--dim); }
.search input {
  width: 100%; height: 42px; padding-inline: 40px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
}
.search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: #cbd3e1; color: var(--ink); }
.chip[aria-checked="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .n { font-size: 12px; opacity: .75; }

/* ---------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }

.tile {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s, opacity .2s;
  animation: rise .3s ease both;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile-img { aspect-ratio: 1 / 1; background: var(--sunk); display: grid; place-items: center; overflow: hidden; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-img .ph { color: var(--dim); display: grid; place-items: center; gap: 4px; font-size: 12.5px; }
.tile-img .ph svg { width: 44px; height: 44px; }
.tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile-name { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile-meta .code { font-size: 11.5px; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tile-actions { display: flex; gap: 6px; margin-top: 8px; }
.tile-actions .btn { flex: 1; }
.tile-actions .btn-icon { flex: none; }

.badge {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.94); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.badge svg { width: 14px; height: 14px; }
.badge.ok { background: var(--ok); color: #fff; }
.badge.warn { background: var(--warn); color: #fff; }
.badge.miss { background: #fff; color: var(--danger); }
.badge.wait { background: rgba(255,255,255,.94); color: var(--muted); }
.count-pill {
  position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: rgba(22,33,58,.72); color: #fff;
}

.tile.fresh { animation: rise .3s ease both, glow 1.8s ease; }
.tile.no-rise { animation: none; }
.tile.no-rise.fresh { animation: glow 1.8s ease; }

/* item selection */
.tiles.selecting .tile { cursor: pointer; }
.tiles.selecting .tile-actions { visibility: hidden; }
.tick {
  position: absolute; top: 10px; inset-inline-end: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 9px; border: 2px solid #fff;
  background: rgba(22,33,58,.35); color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.tick svg { width: 17px; height: 17px; opacity: 0; }
.tile.selected { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal), var(--shadow-lg); }
.tile.selected .tick { background: var(--teal); border-color: var(--teal); }
.tile.selected .tick svg { opacity: 1; }

.selbar {
  position: fixed; bottom: 24px; inset-inline-start: calc(250px + 36px); inset-inline-end: 36px;
  max-width: 760px; margin-inline: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 18px; border-radius: 16px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg);
  animation: rise .2s ease; z-index: 20;
}
.selbar-count { font-weight: 700; }
.selbar-spacer { flex: 1; }
.selbar .btn-ghost { color: rgba(255,255,255,.8); }
.selbar .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.selbar .btn-icon { background: transparent; border-color: rgba(255,255,255,.2); color: #fff; }
.selbar .btn-primary { background: var(--teal); border-color: var(--teal); }

/* --------------------------------------------------------------- groups */

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.group-card { display: flex; flex-direction: column; overflow: hidden; animation: rise .3s ease both; }
.mosaic {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; aspect-ratio: 16 / 9; background: var(--sunk);
}
.mosaic > * { background: #e9edf4; overflow: hidden; display: grid; place-items: center; color: var(--dim); font-weight: 700; }
.mosaic > :first-child { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic svg { width: 26px; height: 26px; }
.mosaic.empty { display: grid; place-items: center; grid-template-columns: 1fr; grid-template-rows: 1fr; }
.group-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.group-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-title h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-actions { display: flex; gap: 8px; }
.group-actions .btn-primary { flex: 1; }

/* ---------------------------------------------------------------- check */

.pick-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pick-group {
  text-align: start; cursor: pointer; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.pick-group:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--teal); }
.pick-group .group-body { gap: 2px; }
.pick-group .go { color: var(--teal); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.pick-group .go svg { width: 18px; height: 18px; }

.check-head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center;
  padding: 24px; margin-bottom: 20px;
}
.ring { position: relative; width: 118px; height: 118px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--sunk); }
.ring .fg { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 26px; font-weight: 800; line-height: 1.1; }
.ring-label small { color: var(--muted); font-size: 12px; }
.check-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
}
.status-pill.live { background: var(--teal-soft); color: #13877b; }
.status-pill.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s infinite; }
.status-pill.done { background: var(--sunk); color: var(--muted); }
.check-instr { color: var(--muted); margin-top: 6px; }
.check-stats { display: flex; gap: 22px; margin-top: 12px; flex-wrap: wrap; font-size: 14px; }
.check-stats span { display: inline-flex; align-items: center; gap: 7px; }
.check-stats i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.check-side { display: flex; flex-direction: column; gap: 8px; }

.tile.missing .tile-img img, .tile.missing .tile-img .ph { filter: grayscale(1); opacity: .45; }
.tile.missing { background: #fbfcfd; }
.tile.missing.final { border-color: #f3c6c9; }
.tile.found { border-color: #a6e3c7; }
.tile.found .tile-img::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--ok); border-radius: var(--radius);
}
.tile.extra { border-style: dashed; }

.subhead { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.subhead h2 { font-size: 16px; }
.subhead .muted { font-size: 13.5px; }

/* ----------------------------------------------------------------- empty */

.empty {
  grid-column: 1 / -1; text-align: center; padding: 56px 20px;
  border: 2px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.6);
}
.empty > svg { width: 52px; height: 52px; color: var(--dim); }
.empty h3 { font-size: 17px; margin-top: 10px; }
.empty p { color: var(--muted); margin: 4px auto 18px; max-width: 420px; }

/* -------------------------------------------------------------- settings */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.endpoint {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 8px;
  padding: 10px 10px 10px 14px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--line);
}
.endpoint .code { flex: 1; direction: ltr; text-align: left; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select {
  height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; width: 100%;
}
.field input.code { text-align: left; }
.field input:focus, .field select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field .error { color: var(--danger); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.field .error svg { width: 16px; height: 16px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
#view-settings .input-row { margin-bottom: 8px; }

.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.suggest button {
  border: 1px solid #a8e0d9; background: var(--teal-soft); color: #13786d; border-radius: 8px;
  padding: 3px 10px; cursor: pointer; font-family: var(--mono); font-size: 12.5px; direction: ltr;
  animation: rise .25s ease;
}
.suggest button:hover { background: #cdeee9; }

/* --------------------------------------------------------------- dialogs */

.dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(820px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg); color: var(--ink); background: var(--card);
  max-height: calc(100vh - 40px);
}
.dialog[open] { animation: pop .2s ease; display: flex; flex-direction: column; }
.dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog::backdrop { background: rgba(14, 25, 48, .45); backdrop-filter: blur(2px); }
.dialog-sm { width: min(420px, calc(100vw - 32px)); }
.dialog-wide { width: min(980px, calc(100vw - 32px)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; }
.dialog-body { padding: 10px 22px 18px; overflow: auto; min-height: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbfd; }

.item-dialog-body { display: grid; grid-template-columns: 330px 1fr; gap: 24px; }
.photo-frame {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  background: var(--sunk); border: 2px dashed #cfd7e4; display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.photo-frame.over { border-color: var(--teal); background: var(--teal-soft); }
.photo-frame.has { border-style: solid; border-color: var(--line); }
.photo-frame img, .photo-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-frame video { background: #000; }
.photo-empty { display: grid; place-items: center; gap: 2px; color: var(--muted); text-align: center; padding: 10px; }
.photo-empty svg { width: 54px; height: 54px; color: var(--dim); margin-bottom: 4px; }
.photo-empty small { color: var(--dim); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .35s ease; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-actions .btn { flex: 1 1 140px; }
.photo-actions .btn-shutter { flex-basis: 100%; height: 48px; }

.pick-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; margin-bottom: 10px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.pick-grid .tile { cursor: pointer; animation: none; }
.pick-grid .tile-body { padding: 8px 10px 10px; }
.pick-grid .tile-name { font-size: 13.5px; }

.assign-list { display: grid; gap: 8px; margin-top: 6px; }
.assign-label { font-weight: 600; font-size: 14px; margin: 10px 0 4px; }
.assign-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.assign-row:hover { border-color: var(--teal); background: var(--teal-soft); }
.assign-row .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; color: var(--navy); overflow: hidden; }
.assign-row .ico img { width: 100%; height: 100%; object-fit: cover; }
.assign-row .ico svg { width: 20px; height: 20px; }
.assign-row .grow { flex: 1; }
.assign-row small { color: var(--muted); display: block; }

.confirm-body { text-align: center; padding-top: 26px; }
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); display: inline-grid; place-items: center; margin-bottom: 12px; }
.confirm-icon svg { width: 28px; height: 28px; }
.confirm-body p { margin-top: 6px; }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; bottom: 24px; inset-inline-start: 24px; display: grid; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff;
  box-shadow: var(--shadow-lg); animation: rise .2s ease; font-size: 14px;
}
.toast svg { width: 20px; height: 20px; }
.toast.ok svg { color: #3ddc97; }
.toast.err svg { color: #ff8a90; }

/* ------------------------------------------------------------ animations */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes glow { 0% { box-shadow: 0 0 0 4px var(--teal); } 100% { box-shadow: var(--shadow); } }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; inset-inline: 0; height: auto; z-index: 30;
    flex-direction: row; padding: 6px; box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; align-items: center; position: relative; }
  .nav-badge { display: none; }
  .nav-live { position: absolute; top: 6px; inset-inline-end: 22%; }
  .main { padding: 20px 16px 150px; }
  .selbar { inset-inline: 12px; bottom: 84px; }
  .toasts { bottom: 90px; inset-inline: 12px; }
  .item-dialog-body { grid-template-columns: 1fr; }
  .check-head { grid-template-columns: auto 1fr; }
  .check-side { grid-column: 1 / -1; flex-direction: row; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  h1 { font-size: 21px; }
}

.dev-state {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 6px;
  padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.dev-state::before { content: ''; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dev-state.on { background: var(--ok-soft); color: #0f7a50; }
.dev-state.on::before { background: var(--ok); box-shadow: 0 0 0 4px rgba(21,163,107,.18); }
.dev-state.off { background: var(--sunk); color: var(--muted); }
.dev-state.off::before { background: var(--dim); }

/* ---------------------------------------------------------------- phone */

.topbar, .label-short { display: none; }

@media (max-width: 860px) {
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 25;
    margin: 0 -16px 18px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--navy); color: #fff; box-shadow: 0 2px 12px rgba(20, 50, 92, .18);
  }
  .topbar img { border-radius: 50%; }
  .topbar-title { font-size: 18px; font-weight: 800; flex: 1; }
  .topbar-live { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255,255,255,.75); }

  .main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .sidebar { padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .nav { gap: 0; }
  .nav-item { min-width: 0; padding: 7px 2px; border-radius: 12px; font-size: 11px; font-weight: 600; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item .label { white-space: nowrap; flex: none; }
  .nav-item .label:has(+ .label-short) { display: none; }
  .nav-item .label-short { display: block; white-space: nowrap; }
  .nav-item[aria-current="page"] { background: rgba(255,255,255,.14); }

  h1 { font-size: 20px; }
  .page-head { margin-bottom: 14px; gap: 12px; }
  .page-head > div:first-child { width: 100%; }
  .page-head p { font-size: 13.5px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }

  .hero { padding: 20px; gap: 16px; }
  .hero-text p { margin: 6px 0 16px; font-size: 14px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .steps { display: none; }

  .kpis { gap: 10px; margin-top: 14px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; border-radius: 10px; }
  .kpi-icon svg { width: 20px; height: 20px; }
  .kpi-label { font-size: 12px; line-height: 1.4; }
  .kpi-value { font-size: 21px; }
  .section-head { margin: 22px 0 10px; }
  .section-head h2 { font-size: 15.5px; }
  .live-banner { padding: 14px 16px; }
  .live-banner .btn { width: 100%; }

  .toolbar { gap: 10px; margin-bottom: 14px; }
  .search { flex: 1 1 100%; min-width: 0; }
  /* One swipeable row instead of chips wrapping into a wall. */
  .chips { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-body { padding: 9px 10px 10px; gap: 2px; }
  .tile-name { font-size: 14px; }
  .tile-meta { font-size: 11.5px; }
  .tile-meta .code { font-size: 10.5px; }
  .tile-actions .btn { padding: 0 8px; }
  .badge { top: 7px; inset-inline-start: 7px; font-size: 11px; padding: 3px 8px; }
  .count-pill { top: 7px; inset-inline-end: 7px; }
  .tick { top: 7px; inset-inline-end: 7px; }

  .group-grid, .pick-groups { grid-template-columns: 1fr; gap: 12px; }

  .check-head { grid-template-columns: auto 1fr; gap: 14px; padding: 16px; }
  .ring { width: 88px; height: 88px; }
  .ring-label b { font-size: 20px; }
  .check-title h1 { font-size: 18px; }
  .check-instr { font-size: 13.5px; }
  .check-stats { gap: 6px 14px; font-size: 13px; grid-column: 1 / -1; }
  .check-side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .check-side .btn { flex: 1; }

  .settings-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }

  .selbar { inset-inline: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); padding: 8px 8px 8px 12px; gap: 8px; }
  .selbar-count { font-size: 13.5px; }
  .selbar .btn-ghost { padding: 0 8px; }
  .selbar .btn-primary, .selbar .btn-danger { padding: 0 12px; }
  .selbar .sel-delete-label { display: none; }
  .selbar #btn-sel-delete { width: 42px; padding: 0; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); inset-inline: 12px; }
  .toast { min-width: 0; max-width: none; }

  /* Dialogs become bottom sheets. */
  .dialog, .dialog-sm, .dialog-wide {
    width: 100vw; max-width: 100vw; max-height: 92dvh;
    margin: auto 0 0; border-radius: 20px 20px 0 0;
  }
  .dialog[open] { animation: sheet .22s ease; }
  .dialog-head { padding: 16px 16px 6px; }
  .dialog-body { padding: 8px 16px 16px; }
  .dialog-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .dialog-foot .btn { flex: 1; }
  .item-dialog-body { grid-template-columns: 1fr; gap: 16px; }
  .photo-frame { max-width: 280px; margin-inline: auto; width: 100%; }
  .photo-actions .btn { flex: 1 1 45%; }
  .pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dialog .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* 16px stops iOS Safari zooming into a field on focus. */
  .field input, .field select, .search input { font-size: 16px; }
}

@media (max-width: 360px) {
  .kpis { grid-template-columns: 1fr; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
