/*
 * Lantech Leads-AI design system, ported from the client-approved prototype
 * (docs/prototype/_source/parts/base.css). Theme-aware (light/dark via data-theme + system
 * preference). Uses unprefixed classes (.shell/.rail/.card/.tabs/.rules) so it coexists with the
 * legacy lt- stylesheet during the phased reskin; drop app.css once every page is converted.
 */
:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --card-2: #eaecef;
    --ink: #191c22;
    --muted: #565c66;
    --faint: #697180;
    --line: #e4e6ea;
    --line-strong: #cfd3da;
    --accent: #1f6feb;
    --accent-dark: #1a5fd0;
    --accent-wash: #e4edfd;
    --gold: #e0a417;
    --gold-ink: #4a3600;
    --sky: #1f6feb;
    --ok: #157a4e;
    --ok-wash: #e0f0e8;
    --warn: #925309;
    --warn-wash: #f7ecdb;
    --bad: #c53640;
    --bad-wash: #f9e6e7;
    --shadow: 0 1px 2px rgba(16,20,28,.05), 0 6px 18px rgba(16,20,28,.06);
    --shadow-lg: 0 10px 40px rgba(16,20,28,.16);
    --radius: 7px;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --ui: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0f1214;
      --card: #191d21;
      --card-2: #23282d;
      --ink: #eceef0;
      --muted: #a3adba;
      --faint: #7b8794;
      --line: #2c3238;
      --line-strong: #3d444c;
      --accent: #5aa2ff;
      --accent-dark: #7fb8ff;
      --accent-wash: #13233f;
      --gold: #e0a417;
      --gold-ink: #4a3600;
      --sky: #5aa2ff;
      --ok: #34d399;
      --ok-wash: #0d2a20;
      --warn: #f0a53c;
      --warn-wash: #37280f;
      --bad: #f4707d;
      --bad-wash: #37151b;
      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
      --shadow-lg: 0 12px 44px rgba(0,0,0,.55);
    }
  }
  :root[data-theme="light"] {
    --bg: #f3f4f6; --card: #ffffff; --card-2: #eaecef; --ink: #191c22; --muted: #565c66;
    --faint: #697180; --line: #e4e6ea; --line-strong: #cfd3da; --accent: #1f6feb; --accent-dark: #1a5fd0;
    --accent-wash: #e4edfd; --gold: #e0a417; --gold-ink: #4a3600; --sky: #1f6feb; --ok: #157a4e; --ok-wash: #e0f0e8; --warn: #925309; --warn-wash: #f7ecdb;
    --bad: #c53640; --bad-wash: #f9e6e7; --shadow: 0 1px 2px rgba(16,20,28,.05), 0 6px 18px rgba(16,20,28,.06);
    --shadow-lg: 0 10px 40px rgba(16,20,28,.16);
  }
  :root[data-theme="dark"] {
    --bg: #0f1214; --card: #191d21; --card-2: #23282d; --ink: #eceef0; --muted: #a3adba;
    --faint: #7b8794; --line: #2c3238; --line-strong: #3d444c; --accent: #5aa2ff; --accent-dark: #7fb8ff;
    --accent-wash: #13233f; --gold: #e0a417; --gold-ink: #4a3600; --sky: #5aa2ff; --ok: #34d399; --ok-wash: #0d2a20; --warn: #f0a53c; --warn-wash: #37280f;
    --bad: #f4707d; --bad-wash: #37151b; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 44px rgba(0,0,0,.55);
  }

  * { box-sizing: border-box; }
  td { color: var(--ink); } /* theme-swap repaint: cells must reference --ink directly, not inherit */
  /* Legacy app.css pins headings to a fixed light-mode slate (#0f172a); inside the new shell,
     headings must follow the theme. Scoped so un-converted lt- pages are unaffected. */
  .shell h1, .shell h2, .shell h3, .shell h4, .shell h5, .shell h6 { color: var(--ink); }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: var(--ui); font-size: 15px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  h1,h2,h3,h4 { margin: 0; text-wrap: balance; }
  button { font-family: inherit; cursor: pointer; }
  .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }

  /* ---- shell ---- */
  .shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
  .rail {
    border-right: 1px solid var(--line); background: var(--card); padding: 20px 14px;
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; }
  .brand .mark {
    width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.02em;
  }
  .brand .name { font-weight: 700; font-size: 15px; line-height: 1.1; color: var(--ink); }
  .brand .sub { font-size: 11px; color: var(--faint); }
  .nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 6px; font-weight: 700; }
  .nav-item {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
    color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  }
  .nav-item i { width: 16px; text-align: center; font-size: 13px; opacity: .85; }
  .nav-item:hover { background: var(--card-2); color: var(--ink); }
  .nav-item.active { background: var(--accent-wash); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
  .nav-item .pip { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 7px; }
  .nav-item .pip.amber { background: var(--warn); }
  .who .role { font-size: 11px; color: var(--faint); }
  .rail-foot { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); }
  .who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  .who .av { width: 28px; height: 28px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); border: 1px solid var(--line); }

  .main { min-width: 0; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, transparent);
    backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
  }
  .crumb { font-size: 13px; color: var(--faint); }
  .crumb b { color: var(--ink); font-weight: 600; }
  .topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
  .top-actions { display: flex; align-items: center; gap: 10px; }
  .concept-tag {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--accent); background: var(--accent-wash); padding: 5px 10px; border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  }
  .icon-btn {
    width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
    color: var(--muted); display: grid; place-items: center; font-size: 15px;
  }
  .icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

  .wrap { padding: 24px 28px 60px; max-width: 1320px; }

  /* ---- topbar global search (search_controller.js renders lt-search-* nodes; themed here,
         scoped so the legacy header styling is untouched) ---- */
  .topbar-search { position: relative; width: 300px; }
  .topbar-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; pointer-events: none; }
  .topbar-search input { width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px 8px 32px; }
  .topbar-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
  .topbar-search .lt-search-results { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 420px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 40; }
  .topbar-search .lt-search-results.visible { display: block; }
  .topbar-search .lt-search-results-header { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: 10px 14px 4px; }
  .topbar-search .lt-search-results-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
  .topbar-search .lt-search-results-item i { width: 16px; text-align: center; color: var(--faint); font-size: 12px; }
  .topbar-search .lt-search-results-item:hover, .topbar-search .lt-search-results-item.active { background: var(--accent-wash); }
  .topbar-search .lt-search-results-item-text { display: flex; flex-direction: column; min-width: 0; }
  .topbar-search .lt-search-results-item-label { font-weight: 600; }
  .topbar-search .lt-search-results-item-detail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-search .lt-search-results-empty { padding: 16px; text-align: center; color: var(--faint); font-size: 13px; }
  @media (max-width: 900px) { .topbar-search { width: 180px; } }

  /* ---- summary strip ---- */
  .summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
  .stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
  .stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
  .stat .v small { font-size: 13px; font-weight: 600; color: var(--muted); }
  .stat.live .v { color: var(--ok); }

  .layout { display: grid; grid-template-columns: 1fr 400px; gap: 22px; align-items: start; }

  /* ---- cards ---- */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .card + .card { margin-top: 18px; }
  .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
  .card-head .title { display: flex; align-items: center; gap: 11px; }
  .card-head .title .ci { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; font-size: 14px; }
  .card-head h3 { font-size: 15px; font-weight: 680; letter-spacing: -.01em; }
  .card-head .desc { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
  .card-body { padding: 6px 18px 18px; }

  .badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
  .badge.live { color: var(--ok); background: var(--ok-wash); }
  .badge.soon { color: var(--accent); background: var(--accent-wash); }
  .badge.order { color: var(--muted); background: var(--card-2); border: 1px solid var(--line); }
  .badge.warn { color: var(--warn); background: var(--warn-wash); }
  .badge.ok { color: var(--ok); background: var(--ok-wash); }
  .badge.bad { color: var(--bad); background: var(--bad-wash); }

  /* ---- tabs ---- */
  .tabs { display: flex; gap: 4px; padding: 6px; background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 18px; overflow-x: auto; }
  .tab { flex: 1; white-space: nowrap; border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .tab i { font-size: 12px; }
  .tab .n { font-size: 11px; background: var(--card); border: 1px solid var(--line); color: var(--faint); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
  .tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
  .tab[aria-selected="true"] i { color: var(--accent); }
  .panel { display: none; }
  .panel.show { display: block; animation: fade .25s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

  /* ---- segmented control (buttons or links); active via .active ---- */
  .seg { display: inline-flex; gap: 3px; background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
  .seg > button, .seg > a { border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 6px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
  .seg > button:hover, .seg > a:hover { color: var(--ink); }
  .seg > button.active, .seg > a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

  /* ---- tables ---- */
  .tbl-scroll { overflow-x: auto; }
  table.rules { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  table.rules th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  table.rules td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  table.rules tr:last-child td { border-bottom: none; }
  table.rules tr:hover td { background: var(--card-2); }
  .code-pill { font-family: var(--mono); font-size: 12px; background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--muted); }
  .person { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
  .person .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; }
  .row-tools { display: flex; gap: 6px; justify-content: flex-end; }
  .mini { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 7px; width: 28px; height: 28px; display: grid; place-items: center; font-size: 12px; }
  .mini:hover { color: var(--ink); border-color: var(--line-strong); }
  .mini.del:hover { color: var(--bad); border-color: var(--bad); }

  /* ---- form fields (also used outside the simulator) ---- */
  .field { margin-bottom: 12px; }
  .field label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin-bottom: 5px; }
  .field input, .field select {
    width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink); background: var(--card);
    border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px;
  }
  .field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
  .field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  /* ---- chips ---- */
  .chip-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
  .chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 11px; }
  .chip button { border: none; background: transparent; color: var(--faint); font-size: 12px; padding: 0; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
  .chip button:hover { background: var(--bad-wash); color: var(--bad); }
  .chip.add { background: transparent; border-style: dashed; color: var(--accent); cursor: pointer; padding: 5px 12px; font-weight: 600; }
  .chip.add:hover { background: var(--accent-wash); }

  .btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; border-radius: 9px; padding: 9px 15px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; }
  .btn:hover { border-color: var(--line-strong); }
  .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  .btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
  .btn.gold:hover { background: #ffcf2e; border-color: #ffcf2e; }
  .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
  .btn.danger:hover { background: var(--bad-wash); border-color: var(--bad); }
  .btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 8px 10px; }
  .btn.ghost:hover { background: var(--accent-wash); }
  .btn.block { width: 100%; justify-content: center; }
  .btn.sm { font-size: 12.5px; padding: 6px 11px; }
  .btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }

  /* ---- simulator ---- */
  .sim { position: sticky; top: 84px; }
  .sim .card-head { background: linear-gradient(180deg, var(--accent-wash), transparent); }
  .presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
  .preset { font-size: 11.5px; border: 1px solid var(--line); background: var(--card-2); color: var(--muted); border-radius: 999px; padding: 4px 10px; }
  .preset:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }

  .trace { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
  .trace-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 22px 8px; }
  .step { display: flex; gap: 11px; padding: 9px 0; }
  .step .ic { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--faint); }
  .step.hit .ic { background: var(--ok); border-color: var(--ok); color: #fff; }
  .step.miss .ic { color: var(--faint); }
  .step.hold .ic { background: var(--warn); border-color: var(--warn); color: #fff; }
  .step .body { min-width: 0; }
  .step .body .s-name { font-weight: 600; font-size: 13.5px; }
  .step .body .s-detail { font-size: 12.5px; color: var(--muted); }
  .step.hit .body .s-name { color: var(--ok); }
  .step.hold .body .s-name { color: var(--warn); }

  .result { margin-top: 14px; border-radius: 11px; padding: 16px; border: 1px solid var(--line); background: var(--card-2); }
  .result.assigned { background: var(--ok-wash); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
  .result.held { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
  .result .r-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
  .result.assigned .r-k { color: var(--ok); }
  .result.held .r-k { color: var(--warn); }
  .result .r-person { display: flex; align-items: center; gap: 11px; margin-top: 8px; }
  .result .r-person .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
  .result .r-person .nm { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
  .result .r-person .rl { font-size: 12.5px; color: var(--muted); }
  .result .r-why { margin-top: 11px; font-size: 12.5px; color: var(--muted); border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); padding-top: 10px; }
  .result .r-why b { color: var(--ink); font-weight: 650; }

  .note { display: flex; gap: 11px; align-items: flex-start; background: var(--warn-wash); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 11px; padding: 13px 15px; }
  .note i { color: var(--warn); font-size: 15px; margin-top: 2px; }
  .note .nt { font-weight: 650; font-size: 13.5px; }
  .note .nd { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

  .empty-state { text-align: center; color: var(--faint); font-size: 13.5px; padding: 26px 12px; }

  /* ---- modal theming: recolor the shared lt-modal shell + its form/alert body to the
         prototype palette. Scoped under .lt-modal (2-class specificity) so it overrides the
         legacy app.css single-class rules and touches nothing outside a modal. ---- */
  .lt-modal { background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); }
  .lt-modal .lt-modal-header { border-bottom: 1px solid var(--line); }
  .lt-modal .lt-modal-title { color: var(--ink); font-size: 16px; font-weight: 680; }
  .lt-modal .lt-modal-close { color: var(--muted); }
  .lt-modal .lt-modal-close:hover { background: var(--card-2); color: var(--ink); }
  .lt-modal .lt-modal-footer { border-top: 1px solid var(--line); background: var(--card-2); }
  .lt-modal .lt-form-label { color: var(--faint); }
  .lt-modal .lt-form-input, .lt-modal .lt-input, .lt-modal .lt-form-select, .lt-modal .lt-form-textarea {
    background: var(--card); border: 1px solid var(--line-strong); color: var(--ink);
  }
  .lt-modal .lt-form-input:focus, .lt-modal .lt-input:focus, .lt-modal .lt-form-select:focus, .lt-modal .lt-form-textarea:focus {
    outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
  }
  .lt-modal .lt-form-hint { color: var(--muted); }
  .lt-modal .lt-alert-info { background: var(--accent-wash); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
  .lt-modal .lt-alert-error { background: var(--bad-wash); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
  .lt-modal .lt-alert-success { background: var(--ok-wash); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
  .lt-modal .lt-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .lt-modal .lt-btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  .lt-modal .lt-btn-secondary { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
  .lt-modal .lt-btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }

  footer.pg { padding: 22px 28px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
  footer.pg b { color: var(--accent); }

  @media (max-width: 1080px) {
    .layout { grid-template-columns: 1fr; }
    .sim { position: static; }
    .summary { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 720px) {
    .shell { grid-template-columns: 1fr; }
    .rail { display: none; }
    .wrap { padding: 18px 16px 48px; }
    .topbar { padding: 14px 16px; }
    .field-2 { grid-template-columns: 1fr; }
  }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

  /* ---- Auth screens (login / MFA / forgot + reset password) ----
     These four pages still use the legacy .lt-external-* scaffolding from app.css,
     which is light-only (fixed #fff card, hardcoded gradient). Re-theme that shell
     with the shared tokens so signing in matches the app in both themes. Scoped to
     .lt-external-layout so nothing here leaks into the internal pages. */
  .lt-external-layout {
    background: var(--bg);
    font-family: var(--ui);
    color: var(--ink);
  }
  .lt-external-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
  }
  .lt-external-logo h1 { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
  .lt-external-logo h1 span { color: var(--accent); }
  .lt-external-title { font-size: 18px; font-weight: 650; color: var(--ink); }
  .lt-external-subtitle { color: var(--faint); font-size: 13.5px; }
  .lt-external-layout .lt-form-label {
    color: var(--faint); font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
  }
  .lt-external-layout .lt-form-input {
    background: var(--card); border: 1px solid var(--line-strong); color: var(--ink);
    border-radius: 7px; font-family: inherit; font-size: 14px; padding: 10px 12px;
  }
  .lt-external-layout .lt-form-input:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
  }
  /* Chrome paints its own pale-blue background on autofilled fields and ignores
     `background`. The inset shadow is the only way to override it, so saved
     credentials don't render as light boxes on the dark sign-in card. */
  .lt-external-layout .lt-form-input:-webkit-autofill,
  .lt-external-layout .lt-form-input:-webkit-autofill:hover,
  .lt-external-layout .lt-form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px var(--card) inset;
    caret-color: var(--ink);
  }
  .lt-external-layout .lt-form-hint,
  .lt-external-layout .lt-text-muted { color: var(--faint); }
  .lt-external-layout .lt-btn-primary {
    background: var(--accent); border: 1px solid var(--accent); color: #fff;
    border-radius: 7px; font-family: inherit; font-weight: 600;
  }
  .lt-external-layout .lt-btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  .lt-external-layout .lt-alert {
    border-radius: 7px; font-size: 13px; display: flex; align-items: center; gap: 8px;
  }
  .lt-external-layout .lt-alert-success {
    background: var(--ok-wash); color: var(--ok);
    border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  }
  .lt-external-layout .lt-alert-error {
    background: var(--bad-wash); color: var(--bad);
    border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
  }
  .lt-external-layout a { color: var(--accent); }
