/* Palette matched to Farmland Stock Exchange: orange #EF8200 action,
     sage-green #5E9B75, dark olive, warm near-black #1D1819. Helvetica Neue type. */
  :root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-2: #faf8f2;
    --ink: #1d1819;
    --ink-2: #4a433f;
    --muted: #857b72;
    --line: #e9e3d9;
    --line-strong: #d8cfc0;
    --accent: #ef8200;
    --accent-ink: #ffffff;
    --accent-weak: rgba(239, 130, 0, .10);
    --success: #4a875f;
    --success-weak: rgba(94, 155, 117, .16);
    --warn: #b0432e;
    --warn-weak: rgba(176, 67, 46, .12);
    --shadow-sm: 0 1px 2px rgba(46, 36, 25, .06);
    --shadow-md: 0 1px 3px rgba(46, 36, 25, .07), 0 8px 24px rgba(46, 36, 25, .06);
    --shadow-lg: 0 16px 48px rgba(29, 24, 25, .20);
    --radius: 12px;
    --radius-sm: 8px;
    --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
    --ui: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #17120e;
      --surface: #211a14;
      --surface-2: #2a2119;
      --ink: #f4efe8;
      --ink-2: #cdc4b8;
      --muted: #9a8f81;
      --line: #322a20;
      --line-strong: #40362a;
      --accent: #ff9422;
      --accent-ink: #1d1208;
      --accent-weak: rgba(255, 148, 34, .16);
      --success: #74b48c;
      --success-weak: rgba(111, 176, 140, .18);
      --warn: #e2895f;
      --warn-weak: rgba(226, 137, 95, .16);
      --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
      --shadow-md: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .35);
      --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
    }
  }
  :root[data-theme="light"] {
    --bg: #f6f4ef; --surface: #ffffff; --surface-2: #faf8f2; --ink: #1d1819; --ink-2: #4a433f;
    --muted: #857b72; --line: #e9e3d9; --line-strong: #d8cfc0; --accent: #ef8200; --accent-ink: #fff;
    --accent-weak: rgba(239,130,0,.10); --success: #4a875f; --success-weak: rgba(94,155,117,.16);
    --warn: #b0432e; --warn-weak: rgba(176,67,46,.12);
    --shadow-md: 0 1px 3px rgba(46,36,25,.07), 0 8px 24px rgba(46,36,25,.06); --shadow-lg: 0 16px 48px rgba(29,24,25,.20);
  }
  :root[data-theme="dark"] {
    --bg: #17120e; --surface: #211a14; --surface-2: #2a2119; --ink: #f4efe8; --ink-2: #cdc4b8;
    --muted: #9a8f81; --line: #322a20; --line-strong: #40362a; --accent: #ff9422; --accent-ink: #1d1208;
    --accent-weak: rgba(255,148,34,.16); --success: #74b48c; --success-weak: rgba(111,176,140,.18);
    --warn: #e2895f; --warn-weak: rgba(226,137,95,.16);
    --shadow-md: 0 1px 3px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.35); --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
  }

  * { box-sizing: border-box; }
  .app, .app * { font-family: var(--ui); }
  .app {
    margin: 0; color: var(--ink); background: var(--bg);
    font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
    min-height: 100vh;
  }
  .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .hidden { display: none !important; }
  button { font: inherit; cursor: pointer; }
  a { color: inherit; }
  ::selection { background: var(--accent-weak); }

  /* ---------- Top bar ---------- */
  .topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 20px;
    padding: 12px 22px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .brand { display: flex; align-items: center; }
  .brand-logo { height: 30px; width: auto; display: block; filter: brightness(0); }
  @media (prefers-color-scheme: dark) { .brand-logo { filter: none; } }
  :root[data-theme="light"] .brand-logo { filter: brightness(0); }
  :root[data-theme="dark"] .brand-logo { filter: none; }

  .segmented { display: flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
  .segmented button {
    border: 0; background: transparent; color: var(--muted);
    padding: 6px 14px; border-radius: 7px; font-size: 13.5px; font-weight: 550; transition: .15s;
  }
  .segmented button:hover { color: var(--ink); }
  .segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

  .spacer { flex: 1; }
  .icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); display: grid; place-items: center; transition: .15s;
  }
  .icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
  .icon-btn svg { width: 17px; height: 17px; }

  .rep-switch { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
  .rep-switch .avatar { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650; }
  .rep-switch select { border: 0; background: transparent; color: var(--ink); font-weight: 550; font-size: 14px; padding-right: 4px; outline: none; }

  /* ---------- Layout ---------- */
  main { max-width: 1180px; margin: 0 auto; padding: 24px 22px 64px; }
  .view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
  .view-head h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
  .view-head .sub { color: var(--muted); font-size: 13.5px; }

  /* ---------- Toolbar ---------- */
  .toolbar { display: flex; gap: 10px; align-items: center; margin: 18px 0 14px; flex-wrap: wrap; }
  .search { position: relative; flex: 1; min-width: 220px; }
  .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
  .search input {
    width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    border-radius: 10px; padding: 10px 12px 10px 36px; font-size: 14px; outline: none; transition: .15s;
  }
  .search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
  .select {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
    border-radius: 10px; padding: 9px 12px; font-size: 13.5px; font-weight: 500; outline: none;
  }
  .btn {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    border-radius: 10px; padding: 9px 14px; font-size: 13.5px; font-weight: 550; transition: .15s;
    display: inline-flex; align-items: center; gap: 7px;
  }
  .btn:hover { border-color: var(--line-strong); }
  .btn svg { width: 15px; height: 15px; }
  .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }

  /* ---------- Table (desktop) ---------- */
  .table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden; }
  table { width: 100%; border-collapse: collapse; }
  thead th {
    text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  }
  thead th.right, td.right { text-align: right; }
  tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr { transition: background .12s; position: relative; }
  tbody tr:hover { background: var(--surface-2); }
  tbody tr.reached td:first-child { box-shadow: inset 3px 0 0 var(--success); }

  .who { display: flex; flex-direction: column; gap: 1px; }
  .who .name { font-weight: 600; letter-spacing: -.01em; cursor: pointer; }
  .who .name:hover { color: var(--accent); }
  .who .co { font-size: 12.5px; color: var(--muted); }
  .loc { font-size: 13px; color: var(--ink-2); }

  .phone-cell { display: flex; align-items: center; gap: 8px; }
  .tel { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink); font-weight: 550; font-size: 13.5px; white-space: nowrap; }
  .tel .dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); flex: none; }
  .tel .dot svg { width: 13px; height: 13px; }
  .tel:hover .num { color: var(--accent); }
  .log-btn {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
    border-radius: 8px; padding: 4px 9px; font-size: 12px; font-weight: 550; opacity: 0; transition: .12s; white-space: nowrap;
  }
  tr:hover .log-btn { opacity: 1; }
  .log-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }

  .lastcall { display: flex; align-items: center; gap: 8px; }
  .lastcall .num { font-size: 13px; color: var(--ink-2); }
  .chip {
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: .01em;
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  }
  .chip-overdue { background: var(--warn-weak); color: var(--warn); }
  .callcount { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--ink-2); }
  .callcount .of { color: var(--muted); font-size: 11px; }

  .pill {
    border: 0; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 6px; transition: .12s;
  }
  .pill .swatch { width: 6px; height: 6px; border-radius: 999px; }
  .pill-yes { background: var(--success-weak); color: var(--success); }
  .pill-yes .swatch { background: var(--success); }
  .pill-no { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
  .pill-no .swatch { background: var(--muted); }
  .note-preview { font-size: 12.5px; color: var(--muted); max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---------- Cards (mobile) ---------- */
  .cards { display: none; flex-direction: column; gap: 12px; }
  .ccard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
  .ccard.reached { border-left: 3px solid var(--success); }
  .ccard .cc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .ccard .cc-name { font-weight: 650; font-size: 17px; letter-spacing: -.01em; }
  .ccard .cc-co { color: var(--muted); font-size: 13px; margin-top: 1px; }
  .ccard .cc-call { display: flex; gap: 10px; margin-top: 14px; }
  .ccard .call-primary {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--accent); color: var(--accent-ink); text-decoration: none;
    padding: 14px; border-radius: 11px; font-weight: 650; font-size: 16px; min-height: 52px;
  }
  .ccard .call-primary svg { width: 18px; height: 18px; }
  .ccard .call-log { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 0 18px; border-radius: 11px; font-weight: 600; min-height: 52px; }
  .ccard .cc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
  .ccard .metaitem { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
  .ccard .cc-note { margin-top: 10px; font-size: 13px; color: var(--ink-2); padding-top: 10px; border-top: 1px solid var(--line); }

  /* ---------- Dashboard ---------- */
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
  .stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
  .stat .label { font-size: 12px; color: var(--muted); font-weight: 550; letter-spacing: .02em; }
  .stat .value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; }
  .stat .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .stat.accent .value { color: var(--accent); }
  .stat.good .value { color: var(--success); }
  .stat.warn .value { color: var(--warn); }

  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 20px 22px; }
  .panel h2 { font-size: 15px; margin: 0 0 2px; letter-spacing: -.01em; }
  .panel .psub { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
  .repbars { display: flex; flex-direction: column; gap: 22px; }
  .rb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .rb-head .avatar { width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 650; }
  .rb-head .rb-name { font-weight: 600; font-size: 14px; }
  .rb-head .rb-total { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }
  .bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; height: 108px; padding-top: 18px; border-bottom: 1px solid var(--line); }
  .barcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; position: relative; }
  .bar { width: 100%; max-width: 40px; background: var(--accent-weak); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .5s cubic-bezier(.2,.7,.2,1); position: relative; }
  .bar.cur { background: var(--accent); }
  .barcol .bv { position: absolute; top: -17px; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-2); }
  .barcol .bl { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

  /* ---------- Detail sheet ---------- */
  .overlay { position: fixed; inset: 0; background: rgba(10,12,16,.42); backdrop-filter: blur(2px); z-index: 50; display: flex; justify-content: flex-end; }
  .sheet { width: 460px; max-width: 100%; background: var(--surface); height: 100%; overflow: auto; box-shadow: var(--shadow-lg); padding: 22px 24px; animation: slidein .24s cubic-bezier(.2,.7,.2,1); }
  @keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .sheet, .bar { animation: none; transition: none; } }
  .sheet .sh-top { display: flex; justify-content: space-between; align-items: flex-start; }
  .sheet h2 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
  .sheet .sh-co { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
  .sh-actions { display: flex; gap: 8px; margin: 18px 0 20px; }
  .sh-actions .call-primary { flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px; background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 12px; border-radius: 10px; font-weight: 650; }
  .sh-actions .call-primary svg { width: 16px; height: 16px; }
  .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .kv .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
  .kv .v { font-size: 14px; }
  .notebox { margin: 18px 0; }
  .notebox textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; min-height: 62px; background: var(--surface); color: var(--ink); outline: none; }
  .notebox textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
  .notebox .row { display: flex; justify-content: flex-end; margin-top: 8px; }
  .timeline { display: flex; flex-direction: column; gap: 2px; }
  .tl-item { display: flex; gap: 12px; padding: 10px 0; }
  .tl-item .tl-mark { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
  .tl-item.call .tl-mark { background: var(--accent-weak); color: var(--accent); border-color: transparent; }
  .tl-item .tl-mark svg { width: 14px; height: 14px; }
  .tl-item .tl-when { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
  .tl-item .tl-what { font-size: 13.5px; margin-top: 1px; }

  .empty { text-align: center; color: var(--muted); padding: 48px 0; }

  /* ---------- Import modal / toast ---------- */
  .overlay.center { justify-content: center; align-items: flex-start; padding: 8vh 16px 16px; }
  .modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; padding: 24px; box-shadow: var(--shadow-lg); position: relative; animation: slidein .2s cubic-bezier(.2,.7,.2,1); }
  .modal h2 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.02em; }
  .modal-sub { font-size: 13.5px; color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
  .close-x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--bg); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
  .dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px; border: 2px dashed var(--line-strong); border-radius: 12px; cursor: pointer; color: var(--muted); transition: .15s; text-align: center; }
  .dropzone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
  .dropzone svg { width: 26px; height: 26px; }
  .dropzone span { font-size: 14px; font-weight: 550; }
  .import-preview { margin-top: 16px; font-size: 13px; }
  .import-preview .prev-head { color: var(--ink-2); margin-bottom: 8px; }
  .import-preview .prev-head strong { color: var(--accent); }
  .prev-table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .prev-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 7px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
  .prev-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .prev-table tr:last-child td { border-bottom: 0; }
  .prev-table .num { font-family: var(--mono); }
  .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
  .toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 550; z-index: 70; box-shadow: var(--shadow-lg); }
  @media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

  /* ---------- Admin ---------- */
  .admin-panel { padding: 6px 0; }
  .admin-cols { display: grid; grid-template-columns: 1fr 120px 110px 120px 150px; gap: 12px; align-items: center; padding: 10px 22px; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .admin-cols .perm-col { text-align: center; }
  .urow { display: grid; grid-template-columns: 1fr 120px 110px 120px 150px; gap: 12px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); }
  .urow:last-child { border-bottom: 0; }
  .urow.pending { background: var(--accent-weak); }
  .urow.disabled { opacity: .62; }
  .uwho { display: flex; align-items: center; gap: 11px; min-width: 0; }
  .uwho .avatar { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650; flex: none; }
  .uname { font-weight: 600; display: flex; align-items: center; gap: 7px; }
  .uemail { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .role-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
  .role-admin { background: var(--accent-weak); color: var(--accent); }
  .role-member { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
  .pill-pending { background: var(--accent-weak); color: var(--accent); }
  .pill-pending .swatch { background: var(--accent); }
  .pill-disabled { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
  .pill-disabled .swatch { background: var(--muted); }
  .perm-cell { display: flex; justify-content: center; }
  .switch { width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; border: 0; cursor: pointer; transition: background .15s; flex: none; padding: 0; }
  .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
  .switch.on { background: var(--success); }
  .switch.on::after { transform: translateX(18px); }
  .switch:disabled { opacity: .45; cursor: default; }
  .uact { display: flex; gap: 7px; justify-content: flex-end; }
  .link-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 550; cursor: pointer; padding: 6px 4px; }
  .link-btn:hover { color: var(--ink); }
  .link-btn.danger:hover { color: var(--warn); }
  .pending-banner { display: flex; align-items: center; gap: 12px; background: var(--accent-weak); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px; font-size: 14px; }
  .pending-banner strong { color: var(--accent); }
  .perm-label { display: none; }

  /* ---------- Responsive ---------- */
  @media (max-width: 780px) {
    .table-card { display: none; }
    .cards { display: flex; }
    .topbar { gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
    .segmented { order: 3; width: 100%; justify-content: space-between; }
    .segmented button { flex: 1; }
    main { padding: 16px 14px 60px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .sheet { width: 100%; }
    .admin-cols { display: none; }
    .urow { grid-template-columns: 1fr auto; gap: 10px 14px; }
    .urow .ustatus { justify-self: end; }
    .urow .perm-cell { grid-column: 1 / -1; justify-content: flex-start; align-items: center; gap: 10px; }
    .urow .perm-cell .perm-label { display: inline; font-size: 13px; color: var(--ink-2); }
    .urow .uact { grid-column: 1 / -1; justify-content: flex-start; }
  }

  /* ================= REAL-APP ADDITIONS ================= */
  html, body { margin: 0; padding: 0; }
  body { font-family: var(--ui); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }

  /* boot */
  .boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-size: 14px; }

  /* auth screen */
  .auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
  .auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); padding: 30px 28px; }
  .auth-logo { height: 34px; margin: 0 auto 22px; display: block; filter: brightness(0); }
  @media (prefers-color-scheme: dark) { .auth-logo { filter: none; } }
  :root[data-theme="dark"] .auth-logo { filter: none; }
  :root[data-theme="light"] .auth-logo { filter: brightness(0); }
  .auth-card h1 { font-size: 20px; margin: 0 0 4px; text-align: center; letter-spacing: -.02em; }
  .auth-card .auth-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 22px; line-height: 1.5; }
  .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
  .field input, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; background: var(--surface); color: var(--ink); outline: none; font-family: var(--ui); }
  .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
  .auth-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 4px; }
  .auth-alt { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 18px; }
  .auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; cursor: pointer; }
  .auth-msg { font-size: 13px; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.45; }
  .auth-msg.err { background: var(--warn-weak); color: var(--warn); }
  .auth-msg.ok { background: var(--success-weak); color: var(--success); }
  .auth-icon { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--accent-weak); color: var(--accent); }
  .auth-icon svg { width: 26px; height: 26px; }

  /* header user chip + menu */
  .header-right { display: flex; align-items: center; gap: 12px; position: relative; }
  .user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
  .user-chip:hover { border-color: var(--line-strong); }
  .user-chip .avatar { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650; }
  .user-chip .me-name { font-weight: 550; font-size: 14px; }
  .user-chip .chev { width: 14px; height: 14px; color: var(--muted); }
  .user-menu { position: absolute; top: 50px; right: 0; width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 15px; z-index: 45; }
  .user-menu .um-name { font-weight: 650; }
  .user-menu .um-email { font-size: 12.5px; color: var(--muted); margin: 2px 0 10px; word-break: break-all; }
  .user-menu .um-signout { width: 100%; justify-content: center; margin-top: 4px; }

  /* contact form */
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-grid .field { margin-bottom: 0; }
  .form-grid .full { grid-column: 1 / -1; }
  @media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
  .danger-link { border: 0; background: transparent; color: var(--warn); font-weight: 550; cursor: pointer; font-size: 13.5px; }


  /* Google sign-in */
  .auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
  .auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .btn-google { width: 100%; justify-content: center; gap: 10px; padding: 11px; font-size: 14px; font-weight: 600; }
  .btn-google svg { width: 18px; height: 18px; }

  /* Invite teammate */
  .invite-panel h2 { font-size: 15px; margin: 0 0 2px; letter-spacing: -.01em; }
  .invite-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
  .inv-input { flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); outline: none; }
  .inv-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
  .inv-perm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
  .invite-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
  .invite-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
  .invite-item .ii-email { font-weight: 600; }
  .invite-item .ii-perms { color: var(--muted); font-size: 12px; }
  .invite-item .ii-spacer { flex: 1; }
