  :root {
    --bg:             #111111;
    --surface:        #1a1a1a;
    --surface-hover:  #222222;
    --border:         #2a2a2a;
    --border-strong:  #3a3a3a;
    --text-primary:   #ececec;
    --text-secondary: #cfcfcf;
    --text-tertiary:  #a8a8a8;
    --gold:           #C9A96E;
    --gold-dim:       rgba(201,169,110,0.12);
    --gold-subtle:    rgba(201,169,110,0.06);
    --warn:           #ffa726;
    --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    --mono: 'Cascadia Code', 'Consolas', ui-monospace, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
  *:focus:not(:focus-visible) { outline: none; }

  /* Scrollbar — slim, no arrows, no track */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); background-clip: content-box; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-corner { background: transparent; }
  body {
    background: var(--bg);
    margin: 0; padding: 0;
    height: 100vh; overflow: hidden;
    font-family: var(--font); color: var(--text-primary); font-size: 13px;
  }
  .frame { width: 100%; height: 100vh; display: flex; flex-direction: column; }
  .frame-label { display: none; }

  .flux {
    background: var(--bg);
    flex: 1;
    display: grid;
    grid-template-rows: 44px 1fr;
    overflow: hidden;
    min-height: 0;
  }

  /* Nav */
  .flux-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 16px; gap: 16px;
  }


  .flux-name { font-size: 20px; font-weight: 700; letter-spacing: 0.04em; color: var(--gold); }
  .flux-name-sub { font-size: 10px; color: var(--text-tertiary); letter-spacing: 0.04em; line-height: 1.2; margin-top: 2px; }
  .flux-nav-items { display: flex; align-items: stretch; height: 100%; flex: 1; }
  .flux-nav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 0 14px; font-size: 12px; font-weight: 500;
    color: var(--text-tertiary); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
  }
  .flux-nav-item svg { width: 13px; height: 13px; stroke-width: 1.75; }
  .flux-nav-item.active { color: var(--text-primary); border-bottom-color: var(--gold); }
  .flux-nav-item.ext { margin-left: auto; color: var(--text-tertiary); font-size: 11px; }
  .flux-nav-item.ext:hover { color: var(--gold); }

  /* Body */
  .flux-body { display: grid; grid-template-columns: 180px 1fr; flex: 1; min-height: 0; overflow: hidden; height: 100%; }

  /* Navrail */
  .navrail {
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 8px 6px; gap: 2px;
    overflow-y: auto; height: 100%;
  }
  .navrail-spacer { flex: 1; }
  .navrail-divider { height: 1px; background: var(--border); margin: 6px 8px; }
  a.navitem { text-decoration: none; }

  /* Money visibility toggle (lives in flux-nav) */
  .money-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 0 14px; height: 100%;
    color: var(--text-tertiary); font-size: 11px;
    cursor: pointer; border-right: 1px solid var(--border);
    user-select: none; transition: color 0.12s;
  }
  .money-toggle:hover { color: var(--text-primary); }
  .money-toggle svg { width: 14px; height: 14px; stroke-width: 1.75; }
  .money-toggle.on { color: var(--gold); }
  .money-toggle.on svg { color: var(--gold); }
  .navitem {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 6px;
    color: var(--text-secondary); font-size: 13px; cursor: pointer;
    border: 1px solid transparent;
  }
  .navitem svg { width: 14px; height: 14px; stroke-width: 1.75; flex-shrink: 0; color: var(--text-tertiary); }
  .navitem:hover { background: var(--surface-hover); color: var(--text-primary); }
  .navitem.active { background: var(--gold-subtle); color: var(--gold); border-color: rgba(201,169,110,0.15); }
  .navitem.active svg { color: var(--gold); }

  /* Page */
  .flux-page { padding: 20px; background: var(--bg); overflow-y: auto; display: flex; flex-direction: column; gap: 20px; height: 100%; }

  /* Stat Strip */
  .stat-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .stat-pill {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
  }
  .stat-num { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1; }
  .stat-num.gold { color: var(--gold); }
  .stat-num.warn { color: var(--warn); }
  .stat-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }

  /* Priority Jobs */
  .section-head {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px;
  }
  .section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-tertiary);
  }
  .prio-legend { display: flex; align-items: center; gap: 10px; }
  .prio-badge {
    display: flex; align-items: center; gap: 4px;
    font-size: 10px; color: var(--text-tertiary);
  }
  .prio-badge .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .prio-badge.critical .dot { background: #ef5350; }
  .prio-badge.high .dot { background: var(--warn); }
  .prio-badge.medium .dot { background: #42a5f5; }
  .prio-badge.low .dot { background: #a78bfa; }
  .section-link { font-size: 11px; color: var(--gold); cursor: pointer; margin-left: auto; }
  .section-link:hover { text-decoration: underline; }

  .jobs-list { display: flex; flex-direction: column; gap: 4px; }

  .job-row {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 11px 14px;
    display: grid;
    grid-template-columns: 18px 1fr auto auto;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
  }
  .job-row:hover { background: var(--surface-hover); border-color: var(--border-strong); }
  .job-row.critical { border-left: 3px solid #ef5350; }
  .job-row.high     { border-left: 3px solid var(--warn); }
  .job-row.medium   { border-left: 3px solid #42a5f5; }

  .job-prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .job-prio-dot.critical { background: #ef5350; }
  .job-prio-dot.high     { background: var(--warn); }
  .job-prio-dot.medium   { background: #42a5f5; }

  .job-info { min-width: 0; }
  .job-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .job-client { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

  .job-status {
    font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
    white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em;
  }
  .job-status.active { background: rgba(76,175,80,0.12); color: #4caf50; border: 1px solid rgba(76,175,80,0.2); }
  .job-status.scheduled { background: rgba(66,165,245,0.1); color: #42a5f5; border: 1px solid rgba(66,165,245,0.15); }
  .job-status.pending { background: rgba(255,167,38,0.1); color: var(--warn); border: 1px solid rgba(255,167,38,0.15); }

  .job-date { font-family: var(--mono); font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }

  /* ---------- Reusable Files section (FluxFiles.mount) ---------- */
  .fx-files { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
  .fx-files-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .fx-files-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); font-weight: 600; }
  .fx-files-drop {
    padding: 14px; border: 1px dashed var(--border); border-radius: 6px;
    text-align: center; color: var(--text-tertiary); font-size: 12px;
    cursor: pointer; transition: all 0.12s; margin-bottom: 8px;
    user-select: none;
  }
  .fx-files-drop:hover { border-color: var(--gold); color: var(--text-secondary); }
  .fx-files-drop.over { border-color: var(--gold); background: rgba(201,169,110,0.05); color: var(--text-primary); }
  .fx-files-list { display: flex; flex-direction: column; gap: 4px; }
  .fx-files-row {
    display: grid; grid-template-columns: 40px 1fr auto;
    align-items: center; gap: 10px; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: 5px; background: var(--bg);
  }
  .fx-files-row:hover { border-color: var(--border-strong); }
  .fx-file-icon {
    font-family: var(--mono); font-size: 9px; font-weight: 700;
    padding: 6px 4px; text-align: center; border-radius: 3px;
    background: var(--surface); color: var(--text-tertiary);
    border: 1px solid var(--border); letter-spacing: 0.04em;
  }
  .fx-file-icon.ext-pdf { color: #e57373; border-color: rgba(229,115,115,0.3); }
  .fx-file-icon.ext-jpg, .fx-file-icon.ext-jpeg, .fx-file-icon.ext-png,
  .fx-file-icon.ext-gif, .fx-file-icon.ext-webp, .fx-file-icon.ext-svg {
    color: #4caf50; border-color: rgba(76,175,80,0.3);
  }
  .fx-file-icon.ext-xls, .fx-file-icon.ext-xlsx, .fx-file-icon.ext-csv {
    color: #4caf50; border-color: rgba(76,175,80,0.3);
  }
  .fx-file-icon.ext-doc, .fx-file-icon.ext-docx { color: #42a5f5; border-color: rgba(66,165,245,0.3); }
  .fx-file-icon.ext-ppt, .fx-file-icon.ext-pptx { color: #ff9800; border-color: rgba(255,152,0,0.3); }
  .fx-file-icon.ext-zip { color: #a78bfa; border-color: rgba(167,139,250,0.3); }
  .fx-file-meta { min-width: 0; }
  .fx-file-name {
    display: block; color: var(--text-primary); text-decoration: none;
    font-size: 13px; word-break: break-all;
  }
  .fx-file-name:hover { color: var(--gold); text-decoration: underline; }
  .fx-file-sub { color: var(--text-tertiary); font-size: 11px; margin-top: 2px; font-family: var(--mono); }
  .fx-files-empty { text-align: center; padding: 16px; color: var(--text-tertiary); font-size: 12px; }
  .fx-file-del { padding: 4px 8px; min-width: 28px; }

  /* ---------- Shared FLUX file browser modal (browser-modal.js) ---------- */
  #browser-backdrop { z-index: 300; }
  .browser-dialog { width: min(720px, 96vw); display: flex; flex-direction: column; max-height: 80vh; padding: 18px; }
  .browser-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
  .browser-tab {
    padding: 8px 14px; cursor: pointer; user-select: none;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
    color: var(--text-tertiary); border: none; background: transparent;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: var(--font);
  }
  .browser-tab:hover { color: var(--text-primary); }
  .browser-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
  .browser-pane { flex: 1; min-height: 320px; overflow: hidden; display: flex; flex-direction: column; }
  .browser-crumbs {
    font-size: 12px; color: var(--text-tertiary); padding: 6px 4px 10px;
    border-bottom: 1px solid var(--border); margin-bottom: 8px;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  }
  .browser-crumb { color: var(--text-secondary); cursor: pointer; }
  .browser-crumb:hover { color: var(--gold); }
  .browser-crumb.last { color: var(--text-primary); cursor: default; font-weight: 500; }
  .browser-sep { color: var(--border-strong); }
  .browser-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
  .browser-item {
    display: grid; grid-template-columns: 30px 1fr auto; gap: 10px;
    align-items: center; padding: 8px 10px; border-radius: 5px;
    cursor: pointer; border: 1px solid transparent;
    transition: background 0.08s, border-color 0.08s;
  }
  .browser-item:hover { background: var(--bg); }
  .browser-item.selected { background: rgba(201,169,110,0.08); border-color: var(--gold); }
  .browser-item .ico { font-size: 16px; text-align: center; }
  .browser-item .name { color: var(--text-primary); font-size: 13px; word-break: break-all; }
  .browser-item .sub { color: var(--text-tertiary); font-size: 11px; font-family: var(--mono); }
  .browser-empty { text-align: center; padding: 24px; color: var(--text-tertiary); font-size: 12px; }
  .browser-paste { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .browser-paste label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); }
  .browser-paste input {
    background: var(--bg); border: 1px solid var(--border); color: var(--text-primary);
    padding: 8px 10px; border-radius: 5px; font-family: var(--font); font-size: 13px; outline: none;
  }
  .browser-paste input:focus { border-color: var(--gold); }

  /* ---------- Inline client-logo chip (used in Jobs + Billing tables) ---------- */
  .row-client {
    display: flex; align-items: center; gap: 10px; min-width: 0;
  }
  .row-logo {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 6px; background: transparent;
    border: 1px solid transparent;
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 0;
  }
  .row-logo.empty { background: var(--bg); border-color: var(--border); }
  .row-logo img { width: 100%; height: 100%; object-fit: contain; }
  .row-logo .initials {
    color: var(--text-tertiary); font-size: 10px; font-weight: 700;
    letter-spacing: 0.04em; user-select: none;
  }
  .row-client-text { min-width: 0; }
  /* Stacked client + site logo (site overlay at bottom-right) */
  .row-logo-stack {
    position: relative;
    width: 40px; height: 40px;
    flex-shrink: 0;
  }
  .row-logo-site {
    position: absolute;
    bottom: -3px; right: -3px;
    width: 20px; height: 20px;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .row-logo-site img { width: 100%; height: 100%; object-fit: contain; }

  /* ---------- Site footer (auto-injected by mobile-nav.js) ---------- */
  .flux-footer {
    margin-top: auto;
    padding: 18px 16px 22px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    text-align: center;
  }
  .flux-footer strong { color: var(--text-secondary); font-weight: 600; }
  .flux-footer .sep { color: var(--border-strong); }
  @media (max-width: 720px) {
    .flux-footer { font-size: 10px; gap: 4px; }
    .flux-footer .sep { display: none; }
  }

  /* ---------- Mobile fixes ---------- */
  /* Hamburger button + nav drawer wiring (visible only on narrow screens) */
  .page-burger {
    display: none;
    position: fixed; top: 10px; left: 10px; z-index: 95;
    background: var(--surface); border: 1px solid var(--border-strong);
    color: var(--gold); font-size: 22px; line-height: 1;
    width: 42px; height: 42px; border-radius: 6px;
    cursor: pointer; user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  }
  .page-title-fixed {
    display: none;
    position: fixed; top: 10px; right: 14px; z-index: 95;
    height: 42px; line-height: 42px;
    color: var(--gold); font-weight: 600; font-size: 14px;
    text-transform: uppercase; letter-spacing: 0.10em;
    pointer-events: none;
    max-width: calc(100vw - 80px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .page-burger:hover { color: var(--gold); border-color: var(--gold); }
  .page-nav-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    opacity: 0; pointer-events: none; transition: opacity 0.18s; z-index: 80;
  }
  body.nav-open .page-nav-backdrop { opacity: 1; pointer-events: auto; }

  @media (max-width: 900px) {
    /* Fall back to natural document scroll on narrow screens — the nested
       overflow:hidden + height:100vh chain can break momentum scroll. */
    html, body { height: auto; min-height: 100%; overflow-y: auto; overflow-x: hidden; }
    .frame, .flux { height: auto; min-height: 100vh; overflow: visible; }
    .flux-body { height: auto; min-height: 100vh; overflow: visible; }
    .flux-page { height: auto; min-height: 0; overflow: visible; padding: 12px; gap: 14px; }
    .page-burger { display: inline-flex; align-items: center; justify-content: center; }
    .page-title-fixed { display: block; }
    /* The page name now lives in the fixed top-right; hide the in-page title to avoid duplication */
    main.flux-page > .section-head:first-of-type > .section-title { display: none; }

    /* Per-page navrail becomes a left drawer */
    .navrail {
      position: fixed; top: 0; left: 0; bottom: 0;
      width: 260px; max-width: 84vw;
      transform: translateX(-100%);
      transition: transform 0.2s ease;
      z-index: 90;
      background: var(--surface);
      border-right: 1px solid var(--border-strong);
      box-shadow: 4px 0 20px rgba(0,0,0,0.4);
      overflow-y: auto;
    }
    body.nav-open .navrail { transform: translateX(0); }

    /* Main column claims the freed space */
    .flux-body { grid-template-columns: 1fr !important; }

    /* Wide content tables get horizontal scroll instead of crushing the layout */
    #jobs-wrap, #billing-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .jobs-table, .billing-table { min-width: 720px; }
    /* Tighter toolbars: search takes a full row on its own */
    .jobs-toolbar { gap: 8px; }
    .jobs-toolbar input[type=search] { flex: 1 1 100%; min-width: 0; }
    /* Stat strip: shrink + wrap */
    .stat-strip { gap: 8px; flex-wrap: wrap; }
    .stat-pill { padding: 8px 12px; }
    .stat-num { font-size: 20px; }
  }
