/* Уурхай — гар утсанд эхэлж тааруулсан загвар. Өнгө бүр :root токеноор, харанхуй горимтой. */
:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --surface-3: #e8e6df;
  --line: #e3e1d9;
  --line-strong: #cbc8bd;
  --text: #15140f;
  --text-2: #4f4e49;
  --text-3: #85837a;
  --accent: #c2410c;
  --accent-hover: #a8380a;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee5;
  --accent-line: #f6c7ad;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0f7a3d;
  --good-soft: #e1f4e8;
  --bad: #c62828;
  --bad-soft: #fde6e6;
  --warn: #8f5d00;
  --warn-soft: #fcf1d6;
  --info: #1f5fae;
  --info-soft: #e3eefb;
  --focus: #2a78d6;
  --shadow-sm: 0 1px 2px rgba(20, 18, 10, .06);
  --shadow: 0 1px 2px rgba(20, 18, 10, .05), 0 6px 20px rgba(20, 18, 10, .06);
  --shadow-lg: 0 10px 40px rgba(20, 18, 10, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1b1b1a; --surface-2: #242422; --surface-3: #2e2e2b;
    --line: #2f2f2c; --line-strong: #45453f;
    --text: #f4f3ee; --text-2: #c6c5bb; --text-3: #8f8e86;
    --accent: #f07a3e; --accent-hover: #ff8c52; --accent-ink: #1a0d05; --accent-soft: #35211a; --accent-line: #6b3a22;
    --series-1: #3987e5; --series-2: #d95926;
    --good: #4cc77f; --good-soft: #153020; --bad: #f07272; --bad-soft: #3a1919;
    --warn: #e5b44e; --warn-soft: #33290f; --info: #7fb2f0; --info-soft: #182a40;
    --focus: #6da7ec;
    --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .45); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1b1b1a; --surface-2: #242422; --surface-3: #2e2e2b;
  --line: #2f2f2c; --line-strong: #45453f;
  --text: #f4f3ee; --text-2: #c6c5bb; --text-3: #8f8e86;
  --accent: #f07a3e; --accent-hover: #ff8c52; --accent-ink: #1a0d05; --accent-soft: #35211a; --accent-line: #6b3a22;
  --series-1: #3987e5; --series-2: #d95926;
  --good: #4cc77f; --good-soft: #153020; --bad: #f07272; --bad-soft: #3a1919;
  --warn: #e5b44e; --warn-soft: #33290f; --info: #7fb2f0; --info-soft: #182a40;
  --focus: #6da7ec;
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .45); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (max-width: 860px) { html, body { overflow-x: clip; } }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: -.01em; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.ic { width: 20px; height: 20px; flex: none; }

/* ---------- Товч ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); cursor: pointer; white-space: nowrap;
  font-weight: 600; font-size: 15px; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.lg { min-height: 54px; padding: 0 22px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; white-space: normal; line-height: 1.25; text-align: center; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Талбар ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); font-size: 16px; min-width: 0;
}
textarea.input { padding: 10px 14px; min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.input.big { min-height: 58px; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 6px; }
.field > .lbl { font-size: 14px; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.field > .lbl .req { color: var(--accent); }
.field .help { font-size: 13px; color: var(--text-3); }
.field .preview { font-size: 14px; color: var(--text-2); font-weight: 500; }
.field .err-msg { font-size: 13px; color: var(--bad); }
.field.invalid .input { border-color: var(--bad); }
.unit-wrap { position: relative; }
.unit-wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; pointer-events: none; }
.unit-wrap .input { padding-right: 56px; }

/* Сонголтын чипүүд */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  cursor: pointer; font-weight: 600; font-size: 15px; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--text-3); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip.accent.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.add { border-style: dashed; color: var(--text-2); }
.chip small { font-weight: 500; opacity: .75; }

/* Сегмент */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 0 12px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.big { display: flex; }
.seg.big button { flex: 1; min-height: 46px; font-size: 16px; }

/* Тоолуур (+/−) */
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-size: 24px; font-weight: 500; cursor: pointer; display: grid; place-items: center; line-height: 1;
  user-select: none;
}
.stepper button:active { background: var(--surface-3); transform: scale(.94); }
.stepper button.plus { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper input {
  width: 64px; height: 48px; text-align: center; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 0; background: transparent; border-radius: 10px;
}
.stepper input:focus { outline: none; background: var(--surface-2); }

/* ---------- Нүүр / нэвтрэх ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.landing-hero {
  padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  background: radial-gradient(120% 90% at 0% 100%, #4a2a14 0%, transparent 60%), linear-gradient(160deg, #1d1915 0%, #2b231b 70%, #36271b 100%);
  color: #f6efe6;
}
.landing-hero h1 { font-size: 42px; line-height: 1.08; margin: 0; letter-spacing: -.025em; }
.landing-hero p.lead { font-size: 17px; color: #ddd1c2; margin: 0; max-width: 540px; }
.benefits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 600px; }
.benefit { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09); border-radius: 14px; padding: 14px; }
.benefit b { display: block; color: #ffc29f; font-size: 15px; margin-bottom: 2px; }
.benefit span { color: #e7dccd; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.auth { display: grid; place-items: center; padding: 32px 16px; }
.benefits.mobile-only { display: none; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { margin: 18px 0 4px; font-size: 24px; }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; }
.tabs button { flex: 1; min-height: 42px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; font-weight: 600; color: var(--text-2); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; margin: 6px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 860px) {
  .landing { grid-template-columns: 1fr; }
  .landing-hero { padding: 28px 16px 24px; gap: 16px; }
  .landing-hero h1 { font-size: 28px; }
  .landing-hero p.lead { font-size: 15px; }
  .benefits { grid-template-columns: 1fr 1fr; gap: 8px; }
  .benefit { padding: 10px 12px; }
  .benefit span { font-size: 13px; }
  .auth { padding: 20px 16px 40px; place-items: start center; }
  .benefits.desktop-only { display: none; }
  .benefits.mobile-only { display: grid; margin-top: 24px; }
  .benefits.mobile-only .benefit { background: var(--surface); border: 1px solid var(--line); }
  .benefits.mobile-only .benefit b { color: var(--accent); }
  .benefits.mobile-only .benefit span { color: var(--text-2); }
}

/* ---------- Апп-ын бүтэц ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { padding: 2px 8px 14px; }
.side .company { padding: 0 10px 14px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.side .company b { display: block; color: var(--text); font-size: 14px; }
.nav-group { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 12px 12px 4px; text-transform: uppercase; letter-spacing: .04em; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 15px;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.side-foot .who { font-size: 13px; color: var(--text-2); padding: 4px 12px 8px; overflow: hidden; text-overflow: ellipsis; }
.side-foot .btn { justify-content: flex-start; font-weight: 500; }
.main { min-width: 0; padding: 26px 32px 64px; max-width: 1360px; width: 100%; }
.topbar { display: none; }
.bottom-nav { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 650; }
.card-b { padding: 12px 18px 18px; }
.hint { font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.5; }
.hint.info { background: var(--info-soft); color: var(--info); }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 22px 2px 10px; }

/* Сүлжээ/офлайн мэдэгдэл */
.netbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.netbar.off { background: var(--warn-soft); color: var(--warn); }
.netbar.pending { background: var(--info-soft); color: var(--info); }
.netbar.failed { background: var(--bad-soft); color: var(--bad); }
.netbar .btn { margin-left: auto; }

@media (max-width: 860px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  }
  .topbar .t-title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .t-sub { font-size: 12px; color: var(--text-2); }
  .main { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
  .page-head h1 { font-size: 22px; }
  .page-head { margin-bottom: 14px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--text-3); font-size: 11.5px; font-weight: 600;
  }
  .bottom-nav a svg { width: 24px; height: 24px; }
  .bottom-nav a.on { color: var(--accent); }
  .bottom-nav a.add-btn span.plus {
    width: 46px; height: 46px; border-radius: 15px; background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
  }
  .bottom-nav a.add-btn span.plus svg { width: 26px; height: 26px; }
  .card-h { padding: 14px 14px 0; }
  .card-b { padding: 10px 14px 14px; }
  .stepper button { width: 56px; height: 56px; font-size: 28px; }
  .stepper input { width: 60px; height: 56px; font-size: 24px; }
  .chip { min-height: 46px; }
  .seg.big button { min-height: 50px; }
}

/* ---------- Өнөөдөр (нүүр) ---------- */
.today-head { margin-bottom: 14px; }
.today-head .date { font-size: 14px; color: var(--text-2); font-weight: 500; }
.today-head h1 { margin: 2px 0 0; font-size: 26px; }
.hero {
  padding: 18px; border-radius: 18px; color: #fff;
  background: linear-gradient(140deg, #2b2119 0%, #3d2a1b 55%, #5a3317 100%);
  box-shadow: var(--shadow);
}
.hero .h-label { font-size: 13px; color: #e8d6c6; font-weight: 600; }
.hero .h-val { font-size: 34px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero .h-val small { font-size: 16px; font-weight: 600; color: #e8d6c6; margin-left: 4px; }
.hero .h-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; margin: 12px 0 8px; }
.hero .h-bar i { display: block; height: 100%; border-radius: 99px; background: #ff9a5c; }
.hero .h-sub { font-size: 14px; color: #efe2d4; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hero .h-sub b { color: #fff; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.action {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  min-height: 108px; padding: 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left;
  font-weight: 700; font-size: 16px; line-height: 1.25; color: var(--text); text-decoration: none;
}
.action:active { transform: scale(.98); }
.action .a-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); }
.action .a-ic svg { width: 24px; height: 24px; }
.action small { display: block; font-weight: 500; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.action.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); grid-column: span 2; min-height: 84px; flex-direction: row; align-items: center; justify-content: flex-start; }
.action.primary .a-ic { background: rgba(255,255,255,.18); color: inherit; }
.action.primary small { color: inherit; opacity: .85; }
.c-fuel .a-ic { background: #fdf0d8; color: #8f5d00; }
.c-cash .a-ic { background: #fde6e6; color: #b42323; }
.c-sale .a-ic { background: #e1f4e8; color: #0f7a3d; }
.c-hours .a-ic { background: #e3eefb; color: #1f5fae; }
:root[data-theme="dark"] .c-fuel .a-ic, :root[data-theme="dark"] .c-cash .a-ic, :root[data-theme="dark"] .c-sale .a-ic, :root[data-theme="dark"] .c-hours .a-ic { background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .c-fuel .a-ic, :root:not([data-theme="light"]) .c-cash .a-ic,
  :root:not([data-theme="light"]) .c-sale .a-ic, :root:not([data-theme="light"]) .c-hours .a-ic { background: var(--surface-2); }
}
.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.alert .al-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.alert .al-ic svg { width: 18px; height: 18px; }
.alert.warn .al-ic { background: var(--warn-soft); color: var(--warn); }
.alert.bad .al-ic { background: var(--bad-soft); color: var(--bad); }
.alert.info .al-ic { background: var(--info-soft); color: var(--info); }
.alert.good .al-ic { background: var(--good-soft); color: var(--good); }
.alert b { font-weight: 650; }
.alert .al-sub { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.mini .m-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.mini .m-val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.mini .m-val small { font-size: 13px; color: var(--text-2); font-weight: 600; margin-left: 2px; }
.mini .m-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .today-grid { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* Сүүлийн бүртгэлийн жагсаалт, гар утасны карт */
.list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.li .li-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.li .li-ic svg { width: 20px; height: 20px; }
.li .li-main { min-width: 0; flex: 1; }
.li .li-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .li-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .li-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.li .li-val small { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.li.pending .li-ic { background: var(--info-soft); color: var(--info); }
.day-head { display: flex; justify-content: space-between; padding: 10px 14px 6px; font-size: 13px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--line); }

/* ---------- Доороос гарах форм (sheet) ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(10, 9, 6, .45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog {
  background: var(--surface); width: 100%; max-width: 560px; max-height: calc(100vh - 32px);
  border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.dialog.wide { max-width: 860px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.dialog-h { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-h h3 { margin: 0; font-size: 18px; flex: 1; }
.dialog-b { padding: 18px 20px; overflow-y: auto; display: grid; gap: 18px; }
.dialog-f { padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface); }
.dialog-f .btn { flex: 1; min-width: 0; white-space: normal; line-height: 1.2; }
.dialog-f .btn.primary { flex: 1.4; }
.grab { display: none; }
@media (max-width: 860px) {
  .overlay { align-items: flex-end; padding: 0; }
  .dialog { max-width: none; min-width: 0; border-radius: 22px 22px 0 0; max-height: 94vh; animation: up .22s cubic-bezier(.2, .9, .3, 1); }
  .dialog.wide { max-width: none; }
  @keyframes up { from { transform: translateY(40%); opacity: .4; } }
  .grab { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; }
  .dialog-h { padding: 8px 12px 10px 18px; }
  .dialog-b { padding: 16px; }
  .dialog-f { padding: 12px 16px calc(12px + var(--safe-b)); }
}
.more-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--text-2); font-weight: 600; cursor: pointer; padding: 6px 0; font-size: 14px; }
.more-toggle svg { width: 16px; height: 16px; transition: transform .15s; }
.more-toggle.open svg { transform: rotate(180deg); }
.calc-note { font-size: 14px; color: var(--good); background: var(--good-soft); padding: 8px 12px; border-radius: 10px; font-weight: 500; }

/* ---------- Ээлжийн тайлан (алхамт) ---------- */
.wizard { max-width: 760px; margin: 0 auto; }
.wiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.wiz-top h1 { margin: 0; font-size: 22px; flex: 1; }
.steps { display: flex; gap: 6px; margin: 8px 0 18px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); }
.steps i.done { background: var(--accent); }
.step-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.step-sub { color: var(--text-2); margin: 0 0 16px; font-size: 15px; }
.wiz-bar {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; padding: 12px 0 calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.wiz-bar .btn { flex: 1; }
.wiz-bar .btn.primary { flex: 2; }
@media (max-width: 860px) { .wiz-bar { bottom: calc(var(--nav-h) + var(--safe-b)); } }
.eq-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 12px; }
.eq-card + .eq-card { margin-top: 10px; }
.eq-card .eq-h { display: flex; align-items: center; gap: 10px; }
.eq-card .eq-name { font-weight: 700; font-size: 17px; flex: 1; }
.eq-card .eq-meta { font-size: 13px; color: var(--text-2); }
.trip-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.trip-row .tr-l { min-width: 0; }
.trip-row .tr-mat { font-weight: 600; }
.trip-row .tr-calc { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.state-chips .chip { min-height: 40px; padding: 0 14px; font-size: 14px; }
.state-chips .chip.on.ok { background: var(--good); border-color: var(--good); color: #fff; }
.state-chips .chip.on.part { background: var(--warn); border-color: var(--warn); color: #fff; }
.state-chips .chip.on.stop { background: var(--bad); border-color: var(--bad); color: #fff; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.summary-table td { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.summary-table td.n { font-weight: 700; }
.summary-table tr:last-child td { border-bottom: 0; }
.done-screen { text-align: center; padding: 30px 10px; }
.done-screen .big-check { width: 78px; height: 78px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: grid; place-items: center; margin: 0 auto 14px; }
.done-screen .big-check svg { width: 42px; height: 42px; }
.done-screen h2 { margin: 0 0 6px; font-size: 24px; }

/* ---------- Excel маягийн хүснэгт ---------- */
.reg-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.reg-tabs::-webkit-scrollbar { display: none; }
.reg-tabs a { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); }
.reg-tabs a svg { width: 18px; height: 18px; }
.reg-tabs a.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.range { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 100%; }
.range .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.range .seg::-webkit-scrollbar { display: none; }
.range .seg button { flex: none; }
.range .input[type="date"] { width: 150px; min-height: 40px; font-size: 15px; }
.range .custom-dates.hidden { display: none; }
.sheet-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.sheet { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; font-size: 14px; }
.sheet th, .sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; height: 36px; white-space: nowrap; }
.sheet th:last-child, .sheet td:last-child { border-right: 0; }
.sheet thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left;
  font-weight: 600; color: var(--text-2); font-size: 13px; padding: 0 10px; cursor: pointer; user-select: none;
}
.sheet thead th.n { text-align: right; }
.sheet thead th .arrow { color: var(--accent); margin-left: 4px; }
.sheet .rn { width: 44px; min-width: 44px; text-align: center; color: var(--text-3); font-size: 12px; background: var(--surface-2); }
.sheet td .cell { display: block; padding: 0 10px; line-height: 36px; min-height: 36px; overflow: hidden; text-overflow: ellipsis; max-width: 280px; cursor: cell; }
.sheet td.n .cell { text-align: right; }
.sheet td .cell .u { color: var(--text-3); font-size: 12px; margin-left: 3px; }
.sheet tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.sheet td.editing { outline: 2px solid var(--focus); outline-offset: -2px; }
.sheet td input, .sheet td select { width: 100%; height: 35px; border: 0; padding: 0 10px; background: transparent; outline: none; min-width: 80px; font-size: 14px; }
.sheet td.n input { text-align: right; }
.sheet tr.newrow td { background: var(--accent-soft); }
.sheet tr.newrow td.rn { color: var(--accent); font-weight: 700; font-size: 16px; }
.sheet tr.newrow input::placeholder { color: var(--text-3); }
.sheet tr.saving td { opacity: .5; }
.sheet tr.flash td { animation: flash 1.2s; }
@keyframes flash { from { background: var(--good-soft); } }
.sheet tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 650; padding: 0 10px; z-index: 1; }
.sheet .act { width: 44px; min-width: 44px; text-align: center; }
.sheet .act button { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 5px; border-radius: 8px; }
.sheet tr:hover .act button, .sheet .act button:focus-visible { opacity: 1; }
.sheet .act button:hover { color: var(--bad); background: var(--bad-soft); }
.sheet .act svg { width: 16px; height: 16px; display: block; }
.empty { padding: 36px 16px; text-align: center; color: var(--text-2); }
.empty .e-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-3); }
.empty .e-ic svg { width: 28px; height: 28px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.totals-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; font-size: 14px; }
.totals-bar b { font-variant-numeric: tabular-nums; }

/* ---------- Самбар ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px; position: relative; }
.kpi .k-label { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-size: 26px; font-weight: 720; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 3px; }
.kpi .k-sub { font-size: 13px; color: var(--text-2); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qmark { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 11px; display: inline-grid; place-items: center; color: var(--text-3); cursor: help; background: none; padding: 0; }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--text-2); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .k-val { font-size: 21px; }
  .kpi .k-sub { font-size: 12px; }
}
.headline { font-size: 17px; line-height: 1.5; margin: 0 0 16px; color: var(--text-2); }
.headline b { color: var(--text); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.chart .bar.hover { filter: brightness(1.12); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--surface);
  padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow); max-width: 280px;
}
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.hbar-list { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.hbar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-row .track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-row .track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-row .v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 84px; text-align: right; }
.table-wrap { overflow-x: auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
.plain th, .plain td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.plain th { font-size: 12.5px; color: var(--text-2); font-weight: 650; white-space: nowrap; }
.plain th.n, .plain td.n { text-align: right; }
.plain tr:last-child td { border-bottom: 0; }
.plain tfoot td { font-weight: 700; border-top: 1.5px solid var(--line-strong); }

/* ---------- Тайлан ---------- */
.report { max-width: 1240px; }
.report section { margin-bottom: 14px; }
.report h2 { font-size: 16px; margin: 0 0 10px; }
.pl td.n { width: 200px; }
.pl tr.total td { font-weight: 750; border-top: 2px solid var(--line-strong); }
.pl tr.indent td:first-child { padding-left: 24px; color: var(--text-2); }
.disclaimer { font-size: 13px; color: var(--text-3); margin-top: 8px; }

/* ---------- Тохиргоо ---------- */
.settings { display: grid; gap: 14px; max-width: 1000px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-row .field { min-width: 160px; flex: 1; }
.plans td input { width: 120px; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); text-align: right; font-size: 14px; }
.eq-table td input, .eq-table td select { min-height: 38px; font-size: 14px; padding: 0 8px; border-radius: 9px; }
.eq-table td { padding: 6px 4px; vertical-align: middle; }

/* ---------- Анхны тохиргоо ---------- */
.onb { max-width: 720px; margin: 0 auto; }
.mineral-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 600px) { .mineral-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mineral {
  padding: 16px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: left;
  display: grid; gap: 4px; min-height: 96px;
}
.mineral b { font-size: 17px; }
.mineral span { font-size: 13px; color: var(--text-2); }
.mineral.on { border-color: var(--accent); background: var(--accent-soft); }
.quick-add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 120; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); }
@media (max-width: 860px) { .toasts { bottom: calc(var(--nav-h) + var(--safe-b) + 12px); } }
.toast { display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--surface); padding: 12px 14px 12px 16px; border-radius: 14px; font-size: 15px; box-shadow: var(--shadow-lg); animation: pop .18s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast .t-msg { flex: 1; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 8px; text-decoration: underline; text-underline-offset: 3px; }

@media print {
  .side, .topbar, .bottom-nav, .toolbar, .no-print, .toasts, .netbar, .reg-tabs { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* Засвар үйлчилгээ — техник бүрийн ТО карт */
.svc-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.svc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.svc.bad { border-color: var(--bad); }
.svc.warn { border-color: var(--warn); }
.svc .meter { margin-top: 0; }
.svc-top { display: flex; align-items: center; gap: 10px; }
.svc-name { flex: 1; min-width: 0; display: grid; }
.svc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-name small { color: var(--text-3); font-size: 12px; }
.svc-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.svc-foot .btn { flex: none; }
.input.invalid { border-color: var(--bad); }
.diff { font-size: 13px; margin-top: 4px; display: grid; gap: 2px; }
.diff s { color: var(--bad); text-decoration-thickness: 1px; }
.diff ins { color: var(--good); text-decoration: none; font-weight: 600; }
.reason { font-size: 13px; margin-top: 4px; padding: 4px 8px; border-left: 3px solid var(--line-strong); color: var(--text-2); }

/* Табель */
.timesheet th, .timesheet td { padding: 6px 5px; font-size: 13px; }
.timesheet td:first-child { white-space: nowrap; min-width: 140px; }
.timesheet .ts-bad { color: var(--bad); font-weight: 700; }
.crew-chips { flex-wrap: nowrap; gap: 6px; }
.crew-chips .chip { flex: 1; padding: 0 6px; font-size: 13px; justify-content: center; min-width: 0; }
.dialog-b .btn { white-space: normal; }
/* Grid/flex хүүхдүүд урт текстээр (nowrap) өргөсөхөөс сэргийлнэ */
.today-grid > *, .settings > *, .list > *, .svc-grid > *, .report > * { min-width: 0; }
.day-head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
