@font-face {
  font-family: 'Dana';
  src: url('/DanaVF.woff2') format('woff2-variations'), url('/DanaVF.woff2') format('woff2');
  font-weight: 100 600;
  font-display: swap;
}

:root {
  --bg: #000;
  --card: #0b0b0b;
  --surface: #1c1c1e;
  --surface-2: #262628;
  --line: #2c2c2e;
  --line-2: #48484a;
  --text: #f5f5f5;
  --muted: #9a9a9e;
  --primary: #173F35;
  --success: #16A36A;
  --success-bg: #0b2a1c;
  --warning: #F59E0B;
  --warning-bg: #2e1d05;
  --danger: #DC4141;
  --danger-bg: #2c0f0f;
  --blue: #3b82f6;
  --ok-t: #4ade80;
  --err-t: #f87171;
  --warn-t: #fbbf24;
  --blue-t: #60a5fa;
  --blue-bg: #0c1a33;
  --inv: #f2f2f2;
  --inv-t: #000;
  --tile: #050505;
  --ok-bg2: #06170e;
  color-scheme: dark;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  --bg: #eef0f3;
  --card: #ffffff;
  --surface: #f0f2f5;
  --surface-2: #e2e5ea;
  --line: #dde1e6;
  --line-2: #b9bfc8;
  --text: #121417;
  --muted: #5d6570;
  --success-bg: #dcf5e7;
  --warning-bg: #fff4d9;
  --danger-bg: #fde6e6;
  --ok-t: #15803d;
  --err-t: #b91c1c;
  --warn-t: #b45309;
  --blue-t: #1d4ed8;
  --blue-bg: #dde8ff;
  --inv: #121417;
  --inv-t: #ffffff;
  --tile: #ffffff;
  --ok-bg2: #eaf8f0;
  color-scheme: light;
}
/* رنگ دسته‌های روشن (زرد، کرم) روی زمینه سفید خوانا شود */
:root[data-theme="light"] .cat-pill,
:root[data-theme="light"] .batch-btn.has-cat .cat,
:root[data-theme="light"] .fchip.cat.on,
:root[data-theme="light"] .cat-picker.set .chev,
:root[data-theme="light"] .cat-opt.sel::after { color: color-mix(in srgb, var(--c) 60%, #000); }
:root[data-theme="light"] .card { box-shadow: 0 1px 3px rgba(0,0,0,.05); }
:root[data-theme="light"] .nz.filled { border-color: #22a35a; }
:root[data-theme="light"] .shift-card { background: var(--card); }
:root[data-theme="light"] .icon-btn { background: #dde2e8; border: 1px solid #c4cad3; color: #121417; }
:root[data-theme="light"] .drawer-head .x, :root[data-theme="light"] .sheet-head .x { background: #dde2e8; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Dana', Tahoma, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
b, strong, h1, h2, h3, h4 { font-weight: 600; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { flex: none; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; padding: 0 14px calc(28px + var(--safe-b)); }

/* ---------- نوار بالا ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 0 10px;
  background: var(--bg);
}
.icon-btn {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%; background: var(--surface);
  display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title .t1 { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sync {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  background: var(--success-bg); color: var(--ok-t);
}
.sync::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sync.pending { background: var(--warning-bg); color: var(--warning); }
.sync.pending::before { animation: pulse 1s infinite; }
.sync.offline { background: var(--danger-bg); color: var(--err-t); }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- کارت‌ها ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 19px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  background: var(--surface); color: var(--muted);
}
.pill.green { background: var(--success-bg); color: var(--ok-t); }
.pill.orange { background: var(--warning-bg); color: var(--warn-t); }
.pill.red { background: var(--danger-bg); color: var(--err-t); }
.pill.blue { background: var(--blue-bg); color: var(--blue-t); }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 20px; border-radius: 14px;
  background: var(--inv); color: var(--inv-t); font-size: 17px; font-weight: 500;
  width: 100%; transition: transform .06s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn:disabled { opacity: .35; }
.btn.outline { background: transparent; color: var(--text); border: 1.5px solid var(--line-2); }
.btn.green { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 42px; font-size: 14px; padding: 0 16px; width: auto; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ---------- ورود ---------- */
.login { min-height: calc(100dvh - 46px); display: flex; flex-direction: column; justify-content: center; padding: 24px 0; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand-logo { width: 60px; height: 60px; border-radius: 16px; flex: none; display: block; }
.brand-logo svg { width: 32px; height: 32px; }
.brand h1 { font-size: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; height: 56px; padding: 0 18px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  font-size: 17px; outline: none;
}
.input:focus { border-color: var(--success); }
textarea.input { height: 84px; padding: 12px 16px; resize: none; line-height: 1.6; }
select.input { appearance: none; }
.err { color: var(--err-t); font-size: 14px; min-height: 22px; margin: 4px 0 8px; }

/* ---------- نوبت‌ها (عکس ۱) ---------- */
.shift-card {
  display: block; width: 100%; text-align: right;
  border: 1.5px solid var(--line); border-radius: 20px;
  padding: 18px; margin-bottom: 12px; background: var(--bg);
}
.shift-card:active { transform: scale(.985); }
.shift-card.active { border-color: #e07b2a; }
.shift-card.done { border-color: #1f6f45; }
.shift-card .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.shift-card h3 { font-size: 22px; }
.shift-card .row2 { color: var(--muted); margin-top: 8px; }
.shift-card .row3 { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.shift-card .row3 { gap: 10px; }
.shift-card .row3 b { font-size: 19px; }
.shift-card .row3 b.sm { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.shift-card .row3 .muted { flex: none; }

/* ---------- دسته‌ها (عکس ۲) ---------- */
.batch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.batch-btn {
  min-height: 62px; border-radius: 10px; border: 1.5px solid var(--line-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1.2; padding: 6px 2px; position: relative; overflow: hidden;
}
.batch-btn:active { transform: scale(.95); }
.batch-btn { color: var(--text); }
.batch-btn.has-cat { border: 2.5px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--bg)); }
.batch-btn.has-cat .cat { color: var(--c); }
.batch-btn.has-cat .bar { background: var(--c); }
.batch-btn.last { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.batch-btn .cat { font-size: 11px; font-weight: 500; margin-top: 3px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.batch-btn .bar { position: absolute; bottom: 0; right: 0; height: 4px; }
.batch-btn.plain .bar { background: var(--success); }
.batch-btn.done-all::after { content: ''; position: absolute; top: 7px; left: 7px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.cat-pill { display: inline-flex; align-items: center; font-size: 12px; padding: 1px 10px; border-radius: 999px; border: 1.5px solid var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); white-space: nowrap; }
.cat-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 8px; vertical-align: -1px; flex: none; }

/* ---------- صفحه ثبت (عکس ۳ و ۵) ---------- */
.info-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.info-box { background: var(--surface); border-radius: 16px; padding: 10px 14px; }
.info-box .k { color: var(--muted); font-size: 13px; }
.info-box .v { font-weight: 600; font-size: 18px; }
.cat-picker {
  width: 100%; min-height: 58px; border-radius: 16px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1.5px dashed var(--line-2); font-size: 17px; font-weight: 500; margin-bottom: 12px;
}
.cat-picker.empty { color: var(--warning); border-color: var(--warning); }
.cat-picker.set { border: 2.5px solid var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 10%, transparent); }
.cat-picker.set .chev { color: var(--c); opacity: 1; }
.cat-picker .chev { opacity: .7; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.seg.seg-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 10px; }
.seg button { min-height: 46px; border-radius: 11px; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--inv); color: var(--inv-t); font-weight: 500; }

.progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.progress-row b { font-size: 18px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 14px; }
.progress > i { display: block; height: 100%; background: var(--success); border-radius: 99px; transition: width .25s; }
.progress.orange > i { background: #e07b2a; }

.nz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.nz {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--tile);
  min-height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px 2px; line-height: 1.25; position: relative;
}
.nz:active { transform: scale(.94); }
.nz .n { font-size: 13px; color: var(--muted); }
.nz .c { font-size: 21px; font-weight: 500; }
.nz .c.empty { color: var(--line-2); }
.nz .m { font-size: 17px; font-weight: 600; color: var(--ok-t); margin-top: 1px; }
.nz .m.dash { width: 26px; height: 3px; border-radius: 3px; background: var(--blue); margin: 9px 0 5px; }
.nz .flag { font-size: 12px; color: var(--warning); }
.nz.filled { border-color: #15803d; background: var(--ok-bg2); }
.nz.filled .c { color: var(--ok-t); }
.nz.mode-milk.filled .c { color: var(--text); font-size: 16px; }
.nz.mode-milk .c { font-size: 16px; }
.nz.warn { border-color: var(--warning); }
.nz.dup { border-color: var(--danger); background: var(--danger-bg); }
.nz .dot { position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.nz.noted:not(.dup) { border-color: var(--warning); }
.nz { color: var(--text); }
.hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.locked-banner { background: var(--danger-bg); color: var(--err-t); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }

/* ---------- پاپ‌آپ (عکس ۴ و ۶) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.72);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 100dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b));
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h3 { font-size: 19px; }
.sheet-head .x { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 20px; }

.entry-top { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-bottom: 10px; }
.entry-box { background: var(--surface); border-radius: 18px; padding: 10px 14px; }
.entry-box .k { font-size: 13px; color: var(--muted); }
.entry-box .v { font-size: 38px; font-weight: 600; line-height: 1.15; min-height: 44px; }
.entry-box.input-box { border: 2px solid var(--success); background: var(--ok-bg2); }
.entry-box.input-box .v::after { content: ''; display: inline-block; width: 3px; height: 32px; background: var(--ok-t); margin-left: 3px; vertical-align: -4px; animation: pulse 1s infinite; }
.entry-box.input-box .v.ph { color: var(--line-2); }

.milk-head { background: var(--surface); border-radius: 20px; padding: 12px 16px; text-align: center; margin-bottom: 10px; }
.milk-head .nzl { font-size: 15px; color: var(--muted); }
.milk-head .nzl b { display: block; font-size: 58px; line-height: 1.05; color: var(--text); }
.milk-head .cow { font-size: 18px; margin-top: 4px; }
.milk-head .cow span { display: inline-block; font-weight: 600; }
.milk-input { border: 2px solid var(--success); background: var(--ok-bg2); border-radius: 18px; padding: 8px 18px; display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.milk-input .v { font-size: 40px; font-weight: 600; }
.milk-input .v.ph { color: var(--line-2); }
.milk-input .u { color: var(--muted); }

.warn-line { background: var(--warning-bg); color: var(--warn-t); border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-bottom: 10px; }
.warn-line.red { background: var(--danger-bg); color: var(--err-t); }

.notes-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding-block: 8px !important; border-radius: 14px; padding: 0 14px; border: 1.5px solid var(--warning); color: var(--warn-t); margin-bottom: 10px; font-size: 15px; }
.notes-toggle.has { background: var(--warning-bg); }
.notes-panel { border: 1.5px solid var(--warning); border-radius: 14px; padding: 12px; margin: -4px 0 10px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.chip { flex: 1; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line-2); font-size: 15px; }
.chip.on { border: 2px solid var(--warning); color: var(--warn-t); background: var(--warning-bg); font-weight: 500; }
.chip.on::before { content: '\2713  '; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; direction: ltr; }
.key {
  min-height: 60px; border-radius: 14px; border: 1.5px solid var(--line-2);
  font-size: 28px; display: grid; place-items: center; color: var(--text);
}
.key:active { background: var(--inv); color: var(--inv-t); transform: scale(.95); }
.key.fn { font-size: 18px; color: var(--muted); }
.nav-row { display: flex; gap: 10px; }
.nav-row .btn.outline { flex: 0 0 96px; }
.nav-row .btn:not(.outline) { flex: 1; }

/* ---------- انتخاب دسته گاو ---------- */
.cat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cat-opt { min-height: 60px; border-radius: 14px; font-size: 16px; font-weight: 500; border: 2px solid var(--c); color: var(--text); position: relative; background: transparent; }
.cat-opt::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-left: 8px; }
.cat-opt.sel { background: color-mix(in srgb, var(--c) 22%, transparent); border-width: 3px; }
.cat-opt.sel::after { content: '\2713'; position: absolute; top: 4px; left: 10px; color: var(--c); }
.cat-opt small { display: block; font-size: 11px; font-weight: 400; opacity: .8; }

/* ---------- مدیر ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.stat { background: var(--surface); border-radius: 16px; padding: 12px; }
.stat .v { font-size: 24px; font-weight: 600; }
.stat .k { font-size: 13px; color: var(--muted); }
.big-num { font-size: 40px; font-weight: 600; line-height: 1.2; }
.shift-prog { margin-bottom: 14px; }
.shift-prog .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.shift-prog .top b { font-size: 17px; }
.shift-prog .sub { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; gap: 8px; }
.lock-btn { font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-2); }
.lock-btn.locked { border-color: var(--danger); color: var(--err-t); }

.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: right; padding: 10px 0; }
.menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-item .ic { width: 54px; height: 54px; border-radius: 16px; background: var(--surface); display: grid; place-items: center; flex: none; }
.menu-item .ic svg { width: 24px; height: 24px; }
.menu-item .tx { flex: 1; min-width: 0; }
.menu-item .tx b { display: block; font-size: 18px; }
.menu-item .tx span { font-size: 13px; color: var(--muted); }
.menu-item .chev { color: var(--muted); font-size: 20px; }

.list-item { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
.list-item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list-item .top b { font-size: 17px; }
.list-item .meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.list-item .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

table.res { width: 100%; border-collapse: collapse; font-size: 14px; }
table.res th, table.res td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.res th { color: var(--muted); font-weight: 400; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 100;
  background: var(--inv); color: var(--inv-t); border-radius: 16px; padding: 12px 20px; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.5); text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--success); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 360px) {
  .nz .c { font-size: 18px; }
  .entry-box .v { font-size: 32px; }
  .key { min-height: 54px; }
}

/* ---------- منوی همبرگری ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.7); animation: fade .15s; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(330px, 86vw);
  background: var(--card); border-left: 1px solid var(--line); padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 16px;
  overflow-y: auto; animation: slide .2s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.drawer-head > div:nth-child(2) { flex: 1; }
.drawer-head .x { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.brand-logo.sm { width: 44px; height: 44px; border-radius: 13px; }
.brand-logo.sm svg { width: 24px; height: 24px; }
.drawer .menu-item { border-radius: 14px; padding: 8px; border-top: 0 !important; }
.drawer .menu-item.cur { background: var(--surface); }
.drawer .menu-item .ic { width: 46px; height: 46px; border-radius: 13px; }
.drawer .menu-item .tx b { font-size: 16px; }

/* ---------- داشبورد ---------- */
.sec { font-size: 16px; margin: 4px 0 12px; }
.exp-row { background: var(--surface); border-radius: 14px; padding: 12px; margin: -4px 0 16px; }
.exp-row > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.link-btn { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; padding: 5px 8px 5px 10px; border-radius: 10px; border: 1px solid var(--line-2); color: var(--text); white-space: nowrap; flex: none; }
.tap-card { cursor: pointer; }
.tap-card .sup-row:active { background: var(--surface); }
.final-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--success); }
.final-card.done { border-color: var(--line-2); }
.final-card .btn { flex: none; }
.nt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; text-align: right; }
.nt-sum { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.nt-flag { background: var(--warning-bg); border: 1px solid var(--warning); border-radius: 8px; padding: 0 8px; }
.nt-note { color: var(--text); }
.issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.issue { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.issue b { font-size: 22px; color: var(--muted); }
.issue span { font-size: 12px; line-height: 1.4; }
.issue.has { border-color: var(--warning); color: var(--warn-t); }
.issue.has b { color: var(--warn-t); }
.issue.has.red { border-color: var(--danger); color: var(--err-t); }
.issue.has.red b { color: var(--err-t); }
.bar-row { margin-bottom: 12px; }
.bar-top { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 4px; }
.bar-top .cat-dot { margin-left: 0; }
.bar-top .muted { flex: 1; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }
.sup-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sup-row:last-child { border-bottom: 0; }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); font-size: 13px; margin-left: 4px; }
.grid-cards { display: grid; gap: 0 14px; }
@media (min-width: 520px) { .grid-cards { grid-template-columns: 1fr 1fr; } }

/* ---------- مشاهده رکوردها ---------- */
.filters select.input, .filters .input { height: 50px; font-size: 15px; margin-bottom: 10px; }
.search-box { position: relative; }
.search-box svg { position: absolute; right: 16px; top: 15px; width: 20px; height: 20px; color: var(--muted); }
.search-box .input { padding-right: 46px; }
.chip-scroll { display: flex; gap: 6px; overflow-x: auto; margin: 0 -18px 8px; padding: 0 18px 4px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fchip { white-space: nowrap; padding: 7px 14px; border-radius: 10px; border: 1.5px solid var(--line-2); font-size: 13px; color: var(--muted); }
.fchip.on { border-color: var(--warning); color: var(--warn-t); background: var(--warning-bg); }
.fchip.cat { border-color: color-mix(in srgb, var(--c) 45%, transparent); color: var(--text); }
.fchip.cat.on { border: 2px solid var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.more-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; font-size: 14px; color: var(--muted); }
.more-btn svg { width: 18px; height: 18px; }
.more-btn span:nth-child(3) { color: var(--warn-t); flex: 1; }
.more { padding-top: 6px; }
.flabel { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.switch-row > span { display: flex; flex-direction: column; }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; transition: background .15s; cursor: pointer; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: right .15s; }
.switch:checked { background: var(--success); }
.switch:checked::after { right: 25px; }

.sum-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; position: sticky; top: calc(66px + env(safe-area-inset-top, 0px)); z-index: 10; }
.sum-strip > div { background: var(--surface); border-radius: 12px; padding: 8px 4px; text-align: center; border: 1px solid var(--line); }
.sum-strip b { display: block; font-size: 17px; }
.sum-strip span { font-size: 11px; color: var(--muted); }
.rec { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.rec:active { background: var(--surface); }
.rec-main { display: flex; align-items: baseline; gap: 10px; }
.cow-no { font-size: 20px; }
.rec-pos { flex: 1; font-size: 13px; color: var(--muted); }
.rec-milk { font-size: 19px; color: var(--ok-t); white-space: nowrap; }
.rec-milk.none { color: var(--muted); font-size: 13px; font-weight: 400; }
.rec-milk.red { color: var(--err-t); }
.rec-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.rec-sub:empty { display: none; }
.rec-note { font-size: 13px; color: var(--warn-t); margin-top: 6px; border-right: 2px solid var(--warning); padding-right: 8px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--warning); color: var(--warn-t); }
.tag.red { border-color: var(--danger); color: var(--err-t); }
.warn-t { color: var(--warn-t); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cow-rec .rec-main { align-items: center; }
.m3 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.m3 > div { background: var(--surface); border-radius: 10px; padding: 4px; text-align: center; }
.m3 span { display: block; font-size: 11px; color: var(--muted); }
.m3 b { font-size: 16px; }
.m3 .tot { background: var(--success-bg); }
.m3 .tot b { color: var(--ok-t); }
.m3 .hl { outline: 1.5px solid var(--warning); }
.refresh-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

.theme-btn svg { width: 20px; height: 20px; }
.login-theme { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px; }

.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.opt-row .acts { display: flex; gap: 6px; flex: none; }
.opt-add { display: flex; gap: 8px; margin-top: 14px; }
.opt-add .input { height: 46px; font-size: 15px; }
.opt-add .btn { flex: none; min-height: 46px; }

/* ---------- نوار کناری دسکتاپ ---------- */
.side { display: none; }
@media (min-width: 1024px) {
  body.admin { padding-right: 300px; }
  body.admin .side {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 30;
    background: var(--card); border-left: 1px solid var(--line); padding: 20px 16px; overflow-y: auto;
  }
  body.admin .side .menu-item { border-radius: 14px; padding: 8px; border-top: 0 !important; }
  body.admin .side .menu-item.cur { background: var(--surface); }
  body.admin .side .menu-item .ic { width: 46px; height: 46px; border-radius: 13px; }
  body.admin .side .menu-item .tx b { font-size: 16px; }
  body.admin .side .menu-item:hover { background: var(--surface); }
  body.admin [data-act="menu"] { display: none; }
  body.admin #app { max-width: 820px; padding: 0 28px 40px; }
}

.install-card { display: flex; align-items: center; gap: 12px; }
.install-card img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.install-card > div { flex: 1; }
.install-card .btn { flex: none; }
.login .install-card { margin-top: 0; margin-bottom: 14px; }
.xl-file { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.xl-file svg { width: 32px; height: 32px; color: var(--ok-t); flex: none; }
.xl-file b { word-break: break-word; }
.steps { margin: 0 0 12px; padding-right: 20px; line-height: 2; }
.kbd { display: inline-block; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font-size: 13px; }

/* ---------- تنظیمات گاوداری ---------- */
.cat-rows { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 8px; border: 2px solid var(--c); border-radius: 14px; padding: 6px 8px; background: color-mix(in srgb, var(--c) 8%, transparent); }
.cat-row.off { opacity: .45; border-style: dashed; }
.cat-row input[type=color] { width: 40px; height: 40px; border: 0; padding: 0; border-radius: 50%; background: none; flex: none; cursor: pointer; }
.cat-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.cat-row input[type=color]::-webkit-color-swatch { border: 2px solid var(--line-2); border-radius: 50%; }
.cat-row .input { height: 42px; font-size: 15px; flex: 1; min-width: 0; }
.cat-acts { display: flex; gap: 4px; flex: none; }
.mini { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text); }
.mini:disabled { opacity: .3; }
.mini.danger { color: var(--err-t); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.save-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 35%); z-index: 15; }

/* ---------- تاریخچه ---------- */
.hist .rec-main { align-items: center; }
.hist-change { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; font-size: 18px; }
.hist-change .old { color: var(--muted); text-decoration: line-through; }
.hist-change .arrow { color: var(--muted); font-size: 14px; }
.hist-change .new { color: var(--ok-t); font-weight: 600; }
.tag.green { border-color: var(--success); color: var(--ok-t); }
.final-card.pending { border-color: var(--warning); }

/* ---------- امضای سازنده ---------- */
.credit { direction: ltr; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 16px calc(18px + var(--safe-b)); }
.credit a { color: var(--ok-t); font-weight: 500; }
.credit a:hover { text-decoration: underline; }

.share-qr { background: #fff; border-radius: 16px; padding: 12px; width: 220px; margin: 0 auto; }
.share-qr svg { display: block; width: 100%; height: auto; }

/* ---------- پیگیری مشکلات ---------- */
.done-n { font-size: 11px; color: var(--ok-t); }
.tk-btn { margin-top: 8px; }
.tk-line { margin-top: 6px; font-size: 13px; color: var(--ok-t); border-right: 2px solid var(--success); padding-right: 8px; }
.tk-line .muted { font-size: 12px; }
.tk-note { color: var(--text); font-size: 12px; }
.tk-info { background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.tk-cow { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 4px; }
.tk-acts { display: grid; gap: 8px; margin-bottom: 12px; }
.tk-act { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line-2); text-align: right; padding: 0 14px; font-size: 15px; }
.tk-act.on { border: 2px solid var(--success); background: var(--success-bg); color: var(--ok-t); font-weight: 500; }
.tk-act.on::before { content: '✓  '; }
