  /* ===== LIGHT THEME (default) ===== */
  :root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface2: #e4edf3;
    --surface3: #d8e4ed;
    --border: #dde3e9;
    --border2: #c8d4de;
    --text: #1a2632;
    --text2: #4a6478;
    --text3: #8fa3b4;
    --accent: #3b8fa8;
    --accent2: #2a7a94;
    --green: #2a8c60;
    --green2: #1e7050;
    --red: #c84040;
    --blue: #4a7ae8;
    --gold: #c47820;
    --text1: #1a2632;
    --radius: 14px;
    --radius-sm: 10px;
    --surface-dark: #2c3a47;
    --accent-muted: rgba(59,143,168,0.10);
    --accent-border: rgba(59,143,168,0.25);
  }

  /* ===== DARK THEME ===== */
  [data-theme="dark"] {
    --bg: #0f1519;
    --surface: #182028;
    --surface2: #1e2a34;
    --surface3: #263442;
    --border: #2c3a47;
    --border2: #384858;
    --text: #e8f0f6;
    --text2: #8ab0c8;
    --text3: #4a6880;
    --accent: #5ab0c8;
    --accent2: #4a9ab4;
    --green: #34c070;
    --green2: #28a058;
    --red: #e05555;
    --blue: #6890e8;
    --gold: #c8901c;
    --text1: #e8f0f6;
    --radius: 14px;
    --radius-sm: 10px;
    --surface-dark: #0a1018;
    --accent-muted: rgba(90,176,200,0.12);
    --accent-border: rgba(90,176,200,0.28);
  }

  /* Smooth theme transition */
  *, *::before, *::after {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
  }
  /* But NOT for things that shouldn't animate */
  img, svg, .toggle, input, select, textarea {
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    height: 100%;
    overflow: hidden;
  }
  body {
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* LAYOUT */
  .app-shell {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
  }
  .screen { display: none; flex-direction: column; flex: 1; padding-bottom: 88px; min-height: 0; }
  .screen.active { display: flex; }
  .screen#screen-diary.active { padding-bottom: 80px; overflow: hidden; }
  /* diary inner flex wrapper fills between topbar and nav */
  #screen-diary > div[style*="flex-direction:column"],
  #screen-diary > div[style*="flex-direction: column"] { flex:1; min-height:0; overflow:hidden; }
  /* Remove the generic padding-bottom on diary screen since we handle it above */
  #screen-diary.screen { padding-bottom: 80px; }
  #diary-view-month { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
  #diary-cal-grid { flex:1; min-height:0; }
  .scroll-content { flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 0; }

  /* TOP BAR */
  .topbar {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  #screen-diary .topbar { padding: 6px 10px; }
  .topbar-logo { font-size: 18px; font-weight: 800; letter-spacing: -0.6px; }
  .topbar-logo span { color: var(--accent); }
  .topbar-sub { font-size: 12px; color: var(--text3); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

  /* BOTTOM NAV */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    /* Safe area for iPhone home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 14px;
    cursor: pointer;
    transition: color 0.2s;
    color: var(--text3);
    font-size: 11px;
    font-weight: 500;
    gap: 5px;
    border: none;
    background: none;
    letter-spacing: 0.3px;
    /* Larger tap target */
    min-height: 56px;
  }
  .nav-item svg { width: 24px; height: 24px; }
  .nav-item.active { color: var(--accent); }
  .nav-item:hover { color: var(--text2); }
  /* Centre Home button — raised accent bubble */
  .nav-item-home {
    position: relative;
    top: -12px;
    background: var(--accent) !important;
    color: #fff !important;
    border-radius: 18px;
    padding: 11px 18px 11px !important;
    gap: 3px;
    box-shadow: 0 4px 16px rgba(44,58,71,0.45);
    min-width: 68px;
    flex: none;
  }
  .nav-item-home svg { stroke: #fff; }
  .nav-item-home.active { color: #fff !important; }
  .nav-item-home:hover { color: #fff !important; opacity: 0.9; }


  /* CARDS */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
  }
  .card-title { font-size: 14px; font-weight: 600; }
  .card-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .card-amount { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 500; color: var(--accent); }

  /* BADGES */
  .badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    font-family: 'JetBrains Mono', monospace;
  }
  .badge-pending { background: rgba(232,168,74,0.15); color: var(--accent); }
  .badge-paid { background: rgba(76,175,125,0.15); color: var(--green); }
  .badge-overdue { background: rgba(224,82,82,0.15); color: var(--red); }
  .badge-draft { background: rgba(160,157,152,0.12); color: var(--text2); }

  /* BUTTONS */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
  }
  .btn-primary { background: var(--accent); color: #0f0f0f; }
  .btn-primary:hover { background: var(--accent2); }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
  .btn-secondary:hover { background: var(--surface3); }
  .btn-ghost { background: transparent; color: var(--text2); }
  .btn-green { background: var(--green); color: #0f0f0f; }
  .btn-full { width: 100%; justify-content: center; }
  .btn-sm { padding: 7px 12px; font-size: 12px; }

  /* SECTION HEADERS */
  .section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text3);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 20px 0 10px;
    font-family: 'JetBrains Mono', monospace;
  }

  /* STATS ROW */
  .stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
  }
  .stat-label { font-size: 10px; color: var(--text3); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.5px; margin-bottom: 6px; text-transform: uppercase; }
  .stat-value { font-size: 22px; font-weight: 800; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.5px; }
  .stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

  /* FORMS */
  .form-group { margin-bottom: 14px; }
  .form-label { font-size: 11px; color: var(--text3); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.3px; margin-bottom: 6px; display: block; }
  .form-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
  }
  .form-input:focus { border-color: var(--accent); }
  .form-input::placeholder { color: var(--text3); }
  select.form-input { cursor: pointer; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }

  /* LINE ITEMS */
  .line-item {
    display: grid;
    grid-template-columns: 1fr 44px 54px 64px 24px;
    gap: 5px;
    align-items: center;
    margin-bottom: 8px;
  }
  .line-item-total { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--accent); }
  .remove-btn { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; padding: 0; transition: color 0.2s; }
  .remove-btn:hover { color: var(--red); }

  /* TOTALS */
  .totals-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 8px;
  }
  .totals-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
  .totals-row.grand { font-weight: 600; font-size: 15px; border-top: 1px solid var(--border2); margin-top: 6px; padding-top: 8px; }
  .totals-val { font-family: 'JetBrains Mono', monospace; color: var(--accent); }

  /* AI PANEL */
  .ai-panel {
    background: var(--accent-muted);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
  }
  .ai-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
  .ai-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 2s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
  .ai-title { font-size: 12px; font-weight: 600; color: var(--accent); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.3px; }
  .ai-input-row { display: flex; gap: 8px; }
  .ai-input {
    flex: 1;
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    outline: none;
  }
  .ai-input:focus { border-color: var(--accent); }
  .ai-input::placeholder { color: var(--text3); }
  .ai-response {
    background: rgba(0,0,0,0.04);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text2);
    margin-top: 10px;
    white-space: pre-wrap;
    display: none;
  }
  .ai-response.visible { display: block; }
  .ai-loading { display: none; align-items: center; gap: 8px; font-size: 12px; color: var(--text3); margin-top: 10px; }
  .ai-loading.visible { display: flex; }
  .ai-spinner { width: 14px; height: 14px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* TABS */
  .tabs { display: flex; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 16px; }
  .tab { flex: 1; padding: 8px; text-align: center; font-size: 12px; font-weight: 500; cursor: pointer; border-radius: 6px; transition: all 0.2s; color: var(--text3); border: none; background: none; font-family: 'Manrope', sans-serif; }
  .tab.active { background: var(--bg); color: var(--text1); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
  /* Books tabs: content-width, single row */
  #screen-books .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #screen-books .tab { flex: none; padding: 7px 10px; white-space: nowrap; font-size: 12px; }

  /* BOOKS / TRANSACTIONS */
  .tx-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .tx-row:last-child { border-bottom: none; }
  .tx-left { display: flex; align-items: center; gap: 10px; }
  .tx-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
  .tx-income .tx-icon { background: rgba(76,175,125,0.12); }
  .tx-expense .tx-icon { background: rgba(224,82,82,0.1); }
  .tx-name { font-size: 13px; font-weight: 500; }
  .tx-cat { font-size: 11px; color: var(--text3); margin-top: 1px; }
  .tx-amount { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; }
  .tx-income .tx-amount { color: var(--green); }
  .tx-expense .tx-amount { color: var(--red); }

  /* PROFIT BAR */
  .profit-bar-wrap { background: var(--surface2); border-radius: 4px; height: 6px; margin-top: 8px; overflow: hidden; }
  .profit-bar { height: 100%; border-radius: 4px; background: var(--green); transition: width 0.5s; }

  /* CLIENT LIST */
  .client-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .client-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--surface3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
  }
  .client-name { font-size: 14px; font-weight: 500; }
  .client-info { font-size: 11px; color: var(--text3); margin-top: 2px; }
  .client-arrow { margin-left: auto; color: var(--text3); }

  /* DIVIDER */
  .divider { height: 1px; background: var(--border); margin: 16px 0; }

  /* MODAL OVERLAY */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1200;
    display: none;
    align-items: flex-end;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.25s ease;
  }
  @keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  .modal-handle { width: 36px; height: 4px; background: var(--border2); border-radius: 2px; margin: 0 auto 16px; }
  .modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

  /* TOGGLE */
  .toggle-row { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; }
  .toggle-label { font-size: 13px; color: var(--text2); }
  .toggle {
    width: 40px; height: 22px;
    background: var(--border2);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
  }
  .toggle.on { background: var(--accent); }
  .toggle::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: left 0.2s;
  }
  .toggle.on::after { left: 21px; }

  /* EMPTY STATE */
  .empty { text-align: center; padding: 50px 20px; color: var(--text3); }
  .empty-icon { font-size: 40px; margin-bottom: 12px; }
  .empty-text { font-size: 14px; margin-bottom: 16px; }

  /* TOAST */
  .toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--green);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s;
    z-index: 300;
    pointer-events: none;
    white-space: nowrap;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  /* SELF ASSESSMENT */
  .sa-item { display:flex; gap:12px; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--border); }
  .sa-item:last-child { border-bottom:none; }
  .sa-check { width:22px; height:22px; border-radius:50%; background:var(--green); color:#fff; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; flex-shrink:0; margin-top:1px; }
  .sa-check.pending { background:var(--surface3); color:var(--text3); }
  .sa-label { font-size:13px; font-weight:500; }
  .sa-sub { font-size:11px; color:var(--text3); margin-top:2px; }
  .sa-figure-row { display:flex; justify-content:space-between; align-items:center; padding:6px 0; cursor:pointer; border-radius:6px; transition:background 0.1s; }
  .sa-figure-row:hover { background:var(--surface2); margin:0 -6px; padding:6px; }

  /* AI QUICK BUTTONS */
  .ai-quick-btn {
    background: var(--accent-muted);
    border: 1px solid rgba(59,143,168,0.2);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: 'Manrope', sans-serif;
  }
  .ai-quick-btn:hover { background: rgba(59,143,168,0.15); border-color: var(--accent); }

  /* QUOTE MODE SWITCHER */
  .quote-mode-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text3);
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Manrope', sans-serif;
  }
  .quote-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* CHASE TONE BUTTONS */
  .chase-tone-btn {
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
  }
  .chase-tone-btn:hover { border-color: var(--accent); }
  .chase-tone-btn.selected { border-color: var(--accent); background: var(--accent-muted); }


  /* REMINDER TEMPLATES */
  .reminder-tpl-btn {
    padding: 8px 6px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
    color: var(--text2);
    transition: all 0.15s;
    text-align: center;
  }
  .reminder-tpl-btn:hover { border-color: var(--accent); color: var(--accent); }
  .reminder-tpl-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* CONFIRMATION STATUS ROWS */
  .conf-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
  }
  .conf-row:last-child { border-bottom: none; }
  .conf-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* DIARY CALENDAR — bubble grid */
  .cal-day-hdr { text-align:center; font-size:10px; font-weight:700; color:var(--text3); font-family:'JetBrains Mono',monospace; padding:4px 2px 6px; letter-spacing:0.5px; }
  .cal-day {
    border-radius:10px;
    display:flex; flex-direction:column;
    align-items:stretch; justify-content:flex-start; cursor:pointer;
    border:none;
    background:var(--surface);
    box-shadow:0 1px 3px rgba(0,0,0,0.06);
    transition:transform 0.12s ease, box-shadow 0.12s ease;
    position:relative; overflow:hidden; padding:6px 5px 4px;
    min-height:52px;
  }
  .cal-day:active { transform:scale(0.96); box-shadow:0 1px 2px rgba(0,0,0,0.04); }
  .cal-day.other-month { opacity:0.0; pointer-events:none; box-shadow:none; background:transparent; }
  /* Date number */
  .cal-day > span {
    display:block; text-align:left; line-height:1;
    font-size:12px; font-weight:600; flex-shrink:0; color:var(--text2);
    margin-bottom:3px;
  }
  .cal-day.today {
    background:var(--surface);
    box-shadow:0 0 0 2px var(--accent), 0 2px 8px rgba(59,143,168,0.18);
  }
  .cal-day.today > span {
    color:var(--accent); font-weight:700;
  }
  .cal-day.has-jobs { background:var(--surface); }
  [data-theme="dark"] .cal-day { box-shadow:0 1px 3px rgba(0,0,0,0.25); }
  [data-theme="dark"] .cal-day.today { box-shadow:0 0 0 2px var(--accent), 0 2px 10px rgba(212,137,58,0.25); }
  /* pills inside cal-day */
  /* cal-day-pills kept for fallback — event bars now rendered as overlays */
  .cal-day-pills { display:none; }
  /* Spanning event bars */
  #diary-cal-grid { position:relative; }
  .cal-event-bar {
    position:absolute; cursor:pointer; z-index:2;
    pointer-events:auto;
    transition:opacity 0.12s, transform 0.1s;
    border-radius:5px !important;
    font-size:9px !important;
    font-weight:600 !important;
    letter-spacing:0 !important;
  }
  .cal-event-bar:active { opacity:0.75; transform:scale(0.97); }
  .cal-event-overflow {
    position:absolute; pointer-events:none; z-index:3;
  }
  /* colour swatches */
  .color-swatch {
    width:26px; height:26px; border-radius:50%; border:2.5px solid transparent;
    cursor:pointer; flex-shrink:0; transition: transform 0.12s, outline 0.12s;
    outline:2px solid transparent; outline-offset:2px;
  }
  .color-swatch:hover { transform:scale(1.15); }
  .color-swatch.active { border-color:#fff; outline:2px solid currentColor; outline-offset:2px; transform:scale(1.1); }

  /* DIARY WEEK STRIP */
  .week-pill { min-width:50px; border-radius:10px; padding:8px 4px; text-align:center; flex-shrink:0; border:1.5px solid var(--border); }
  .week-pill.busy { background:var(--accent-muted); border-color:var(--accent-border); }
  .week-pill.free { background:rgba(46,158,99,0.06); border-color:rgba(46,158,99,0.2); }
  .week-pill.today-pill { border-color:var(--accent); }
  .week-pill-day { font-size:9px; font-weight:600; color:var(--text3); font-family:'JetBrains Mono',monospace; letter-spacing:0.3px; }
  .week-pill-date { font-size:16px; font-weight:600; margin:2px 0; line-height:1; }
  .week-pill-label { font-size:9px; font-weight:600; letter-spacing:0.2px; }
  .week-pill.busy .week-pill-label { color:var(--accent); }
  .week-pill.free .week-pill-label { color:var(--green); }

  /* DIARY JOB ROW */
  .diary-job-row { display:flex; gap:12px; align-items:flex-start; padding:12px 0; border-bottom:1px solid var(--border); cursor:pointer; }
  .diary-job-row:last-child { border-bottom:none; }
  .diary-date-pill { min-width:44px; text-align:center; border-radius:8px; padding:5px 4px; flex-shrink:0; }

  /* DIARY VIEW TABS */
  .diary-view-tab {
    flex: 1; padding: 8px 4px; background: none; border: none;
    font-size: 12px; font-weight: 700; color: var(--text3);
    cursor: pointer; border-bottom: 2px solid transparent;
    font-family: 'Manrope', sans-serif; transition: all 0.15s;
  }
  .diary-view-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

  /* DAY / WEEK SLOT VIEW */
  .time-slot-row {
    display: flex; gap: 0; min-height: 48px; border-bottom: 1px solid var(--border);
  }
  .time-label {
    width: 44px; flex-shrink: 0; font-size: 10px; color: var(--text3);
    font-family: 'JetBrains Mono', monospace; padding: 4px 6px 0; text-align: right;
  }
  .slot-cell {
    flex: 1; border-left: 1px solid var(--border); min-height: 48px;
    cursor: pointer; transition: background 0.1s; position: relative;
  }
  .slot-cell:hover { background: rgba(59,143,168,0.05); }
  .slot-cell.has-job { background: rgba(59,143,168,0.1); }
  .slot-cell.has-job.confirmed { background: rgba(46,158,99,0.1); }
  .slot-appt {
    position: absolute; left: 2px; right: 2px; top: 2px;
    border-radius: 5px; padding: 3px 5px; font-size: 10px;
    font-weight: 600; line-height: 1.3; cursor: pointer; z-index: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .slot-appt.confirmed { background: rgba(46,158,99,0.25); color: var(--green); }
  .slot-appt.booked    { background: var(--accent-border); color: var(--accent); }
  .free-slot-pill {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; margin-bottom: 6px;
    background: rgba(46,158,99,0.07); border: 1px solid rgba(46,158,99,0.25);
    border-radius: var(--radius-sm); cursor: pointer;
  }
  .free-slot-pill:hover { border-color: var(--green); }
  .busy-slot-pill {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; margin-bottom: 6px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); opacity: 0.6;
  }

  /* DURATION PICKER */
  .dur-btn {
    padding: 6px 12px; background: var(--surface2); border: 1.5px solid var(--border);
    border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer;
    font-family: 'Manrope', sans-serif; color: var(--text2); transition: all 0.15s;
  }
  .dur-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* PIPELINE */
  .pipeline-col {
    min-width: 150px; flex-shrink: 0;
    background: var(--surface2); border-radius: var(--radius-sm);
    border: 1px solid var(--border); display: flex; flex-direction: column;
  }
  .pipeline-col-header {
    padding: 8px 10px; font-size: 10px; font-weight: 700;
    font-family: 'JetBrains Mono', monospace; letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border); display: flex;
    justify-content: space-between; align-items: center;
  }
  .pipeline-col-body { padding: 8px; flex: 1; min-height: 80px; }
  .pipeline-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
    cursor: pointer; transition: all 0.15s;
  }
  .pipeline-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0,0,0,0.12); }
  .pipeline-card-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
  .pipeline-card-val { font-size: 13px; font-weight: 700; color: var(--green); font-family: 'JetBrains Mono', monospace; margin-top: 3px; }
  .pipeline-card-age { font-size: 10px; color: var(--text3); margin-top: 2px; }
  .pipeline-add { padding: 6px 8px; font-size: 11px; color: var(--text3); text-align: center; cursor: pointer; border-top: 1px dashed var(--border); }
  .pipeline-add:hover { color: var(--accent); }

  /* PAY METHOD BUTTONS */
  .pay-method-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; background: var(--surface2); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 11px;
    font-weight: 500; font-family: 'Manrope', sans-serif; transition: all 0.15s;
    color: var(--text2);
  }
  .pay-method-btn.active { border-color: var(--green); background: rgba(46,158,99,0.08); color: var(--green); }

  /* BANK IMPORT TX ROWS */
  .bi-tx-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
    border-bottom: 1px solid var(--border); font-size: 12px;
  }
  .bi-tx-row:last-child { border-bottom: none; }
  .bi-cat-badge {
    font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
    white-space: nowrap; flex-shrink: 0;
  }

  /* REVIEW REQUEST */
  .rev-platform-btn {
    display:flex; flex-direction:column; align-items:center; gap:3px;
    padding:10px 6px; background:var(--surface2); border:1.5px solid var(--border);
    border-radius:var(--radius-sm); cursor:pointer; transition:all 0.15s;
    font-family:'Manrope',sans-serif;
  }
  .rev-platform-btn.active { border-color:var(--accent); background:var(--accent-muted); }
  .rev-platform-btn:hover { border-color:var(--accent); }

  /* WAITING LIST */
  .wl-item {
    display:flex; align-items:center; gap:12px; padding:10px 0;
    border-bottom:1px solid var(--border);
  }
  .wl-item:last-child { border-bottom:none; }
  .btn-green { background:rgba(46,158,99,0.1); color:var(--green); border:1px solid rgba(46,158,99,0.3); }
  .btn-green:hover { background:rgba(46,158,99,0.2); }

  /* JOB REMINDERS */
  .reminder-alert {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1.5px solid var(--accent-border);
    background: var(--accent-muted);
  }
  .reminder-alert.urgent { border-color: rgba(208,64,64,0.35); background: rgba(208,64,64,0.06); }
  .jr-tone-btn {
    padding: 8px 4px; background: var(--surface2); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 11px; font-weight: 500; cursor: pointer;
    font-family: 'Manrope', sans-serif; color: var(--text2); transition: all 0.15s;
  }
  .jr-tone-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* ITEM PICKER */
  .item-cat-tab {
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    color: var(--text2);
    transition: all 0.15s;
    font-family: 'Manrope', sans-serif;
  }
  .item-cat-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .item-cat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text3);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    padding: 10px 0 6px;
  }
  .item-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    margin: 3px;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
  }
  .item-pill:hover { border-color: var(--accent); }
  .item-pill.selected { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); font-weight: 500; }
  .item-pill.selected::before { content: '✓ '; }

  /* ONBOARDING */
  .onboarding {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    text-align: center;
  }
  .onboarding.hidden { display: none; }
  .ob-logo { font-size: 28px; font-weight: 600; letter-spacing: -1px; margin-bottom: 6px; }
  .ob-logo span { color: var(--accent); }
  .ob-sub { font-size: 14px; color: var(--text3); margin-bottom: 36px; }
  .ob-heading { font-size: 20px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
  .ob-desc { font-size: 13px; color: var(--text2); margin-bottom: 28px; line-height: 1.6; }
  .trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 360px; margin-bottom: 20px; }
  .trade-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: 'Manrope', sans-serif;
  }
  .trade-btn:hover { border-color: var(--accent); background: var(--surface2); }
  .trade-btn.selected { border-color: var(--accent); background: var(--accent-muted); }
  .trade-icon { font-size: 28px; }
  .trade-label { font-size: 13px; font-weight: 500; color: var(--text); }
  .trade-sub { font-size: 11px; color: var(--text3); }
  .ob-name-step { width: 100%; max-width: 360px; }
  .ob-step { display: none; flex-direction: column; align-items: center; width: 100%; }
  .ob-step.active { display: flex; }
  .ob-progress { display: flex; gap: 6px; margin-bottom: 32px; }
  .ob-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border2); transition: background 0.3s; }
  .ob-dot.active { background: var(--accent); }

  /* SIGNATURE PAD */
  .sig-canvas { width:100%; height:160px; border:2px dashed var(--border2); border-radius:var(--radius-sm); cursor:crosshair; background:var(--surface2); display:block; touch-action:none; }
  .sig-canvas.signed { border-color:var(--green); border-style:solid; }

  /* CONTRACT CARD */
  .contract-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; margin-bottom:12px; cursor:pointer; }
  .contract-parties { font-size:12px; color:var(--text3); margin-top:4px; }

  /* PRINT DOCUMENT - hidden on screen, shown when printing */
  .print-doc { display:none; }

  @media print {
    body > *:not(.print-doc) { display:none !important; }
    .print-doc {
      display:block !important;
      position:fixed; inset:0;
      background:#fff; padding:48px 56px;
      font-family:'Manrope',sans-serif;
      color:#1a1916; font-size:13px;
    }
    .print-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:32px; padding-bottom:24px; border-bottom:2px solid #1a1916; }
    .print-biz-name { font-size:24px; font-weight:700; letter-spacing:-0.5px; }
    .print-biz-sub { font-size:12px; color:#6b6860; margin-top:4px; line-height:1.6; }
    .print-doc-type { font-size:30px; font-weight:700; color:#c47d20; text-align:right; }
    .print-doc-meta { font-size:12px; color:#6b6860; text-align:right; margin-top:6px; line-height:1.8; }
    .print-body { display:grid; grid-template-columns:1fr 1fr; gap:32px; margin-bottom:28px; }
    .print-label { font-size:10px; font-weight:700; letter-spacing:1px; text-transform:uppercase; color:#9e9b93; margin-bottom:6px; }
    .print-value { font-size:14px; font-weight:600; }
    .print-sub-value { font-size:12px; color:#6b6860; margin-top:2px; }
    .print-table { width:100%; border-collapse:collapse; margin-bottom:20px; }
    .print-table th { font-size:10px; text-transform:uppercase; letter-spacing:0.5px; color:#9e9b93; border-bottom:1px solid #e2e0d8; padding:8px 0; text-align:left; font-weight:600; }
    .print-table th:nth-child(2), .print-table td:nth-child(2) { text-align:center; }
    .print-table th:last-child, .print-table td:last-child { text-align:right; }
    .print-table td { padding:10px 0; border-bottom:1px solid #f0efe9; }
    .print-totals-wrap { display:flex; justify-content:flex-end; margin-bottom:24px; }
    .print-totals { width:260px; }
    .print-total-row { display:flex; justify-content:space-between; padding:4px 0; font-size:13px; }
    .print-total-row.grand { font-size:16px; font-weight:700; border-top:2px solid #1a1916; margin-top:8px; padding-top:10px; }
    .print-deposit-box { background:#f5f4f1; border-radius:8px; padding:14px 16px; margin-bottom:24px; display:flex; justify-content:space-between; align-items:center; }
    .print-deposit-label { font-size:13px; font-weight:600; }
    .print-deposit-amt { font-size:16px; font-weight:700; color:#c47d20; }
    .print-notes { background:#f5f4f1; border-radius:8px; padding:14px 16px; margin-bottom:24px; font-size:12px; color:#6b6860; line-height:1.7; }
    .print-sig-section { display:grid; grid-template-columns:1fr 1fr; gap:48px; margin-top:40px; padding-top:24px; border-top:1px solid #e2e0d8; }
    .print-sig-line { border-top:1px solid #1a1916; padding-top:8px; font-size:11px; color:#9e9b93; margin-top:48px; }
    .print-footer { position:fixed; bottom:40px; left:56px; right:56px; border-top:1px solid #e2e0d8; padding-top:12px; font-size:10px; color:#9e9b93; display:flex; justify-content:space-between; }
  }

/* Enhancement layer */
:root { --focus-ring: 0 0 0 3px rgba(59,143,168,0.18); }
body.offline::before {
  content: "Offline mode";
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(208,64,64,0.95);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 6px 10px;
  border-radius: 0 0 10px 10px;
}
.screen { opacity: 0; transform: translateY(10px); transition: opacity .18s ease, transform .18s ease; }
.screen.active { opacity: 1; transform: translateY(0); }
.form-input:focus,
.btn:focus-visible,
.nav-item:focus-visible,
.tab:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.list-toolbar { display:flex; gap:8px; margin: 12px 0; }
.list-toolbar .form-input { flex:1; }
.list-summary { font-size: 11px; color: var(--text3); font-family: 'JetBrains Mono', monospace; letter-spacing: .03em; margin: 6px 0 10px; }
.empty-state { text-align:center; padding:40px 20px; color:var(--text3); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }


/* Safe modal + long-form usability fixes */
.modal-overlay {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overflow-y: auto;
  align-items: flex-start;
}
.modal {
  max-height: calc(100dvh - 24px);
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.scroll-content {
  padding-bottom: 120px;
}
#modal-client {
  z-index: 1400;
}
#modal-diary-add .modal,
#modal-quote .modal,
#modal-invoice .modal {
  max-height: calc(100dvh - 18px);
}
#modal-diary-add .modal button,
#modal-quote .modal button,
#modal-invoice .modal button {
  scroll-margin-bottom: 24px;
}


/* ===== MODAL FULL SCROLL FIX ===== */
.modal-overlay {
  align-items: flex-start !important;
  overflow-y: auto !important;
  padding: 16px 0;
}

.modal {
  max-height: 95vh !important;
  overflow-y: auto !important;
  display: flex;
  flex-direction: column;
}

.modal > *:last-child {
  margin-bottom: 80px; /* ensures bottom buttons visible */
}

/* Image preview polish */
#dj-image-preview img {
  border-radius: 12px;
}

#dj-remove-image {
  background: rgba(176,70,70,0.08);
  border:1px solid rgba(176,70,70,0.18);
  color: var(--red);
}


/* Booking image strip */
.booking-image-strip{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding-bottom:4px;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
}
.booking-image-thumb{
  position:relative;
  flex:0 0 92px;
  width:92px;
  height:92px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid var(--border);
  background:var(--surface2);
  scroll-snap-align:start;
}
.booking-image-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  cursor:pointer;
}
.booking-image-remove{
  position:absolute;
  top:6px;
  right:6px;
  width:24px;
  height:24px;
  border:none;
  border-radius:999px;
  background:rgba(0,0,0,0.72);
  color:#fff;
  font-size:13px;
  line-height:24px;
  text-align:center;
  cursor:pointer;
}

/* ===== IMAGE PREVIEW MODAL ===== */
#image-preview-modal {
  z-index: 9999 !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.92) !important;
}
/* Share card modal — card fixed at top, content scrolls below */
#modal-share-card .modal {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 !important;
  display: block !important;
  max-height: calc(100dvh - 24px) !important;
}
#modal-share-card .modal > .modal-handle {
  margin: 8px auto 0;
}

#image-preview-modal .modal {
  background: transparent !important;
  box-shadow: none !important;
  max-height: 95dvh !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
#image-preview-full {
  max-width: 100%;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 8px;
}

/* ===== IMAGE FULLSCREEN PREVIEW ===== */
.img-preview-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: rgba(0,0,0,0.92) !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  padding: 0 !important;
}
.img-preview-overlay #image-preview-full {
  max-width: 95vw;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

/* ===== MORE TRAY REDESIGN ===== */

/* Base tile shared styles */
.mtb-screen, .mtb-action, .mtb-util {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.mtb-screen:active, .mtb-action:active, .mtb-util:active {
  transform: scale(0.94);
  opacity: 0.85;
}
.mtb-screen span, .mtb-action span, .mtb-util span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

/* Screen tiles — neutral with accent icon */
.mtb-screen {
  background: var(--surface2);
}
.mtb-screen span { color: var(--text); }

/* Quick-add tiles — coloured tints */
.mtb-action { background: transparent; }
.mtb-green  { background: rgba(46,158,99,0.10); }
.mtb-green span  { color: var(--green); }
.mtb-red    { background: rgba(208,64,64,0.08); }
.mtb-red span    { color: var(--red); }
.mtb-blue   { background: rgba(58,127,212,0.10); }
.mtb-blue span   { color: var(--blue); }
.mtb-amber  { background: var(--accent-muted); }
.mtb-amber span  { color: var(--accent); }

/* Utility tiles — muted */
.mtb-util {
  background: var(--surface2);
}
.mtb-util span { color: var(--text2); }

/* Dark mode tints — slightly stronger so they read on dark surfaces */
[data-theme="dark"] .mtb-green { background: rgba(52,181,114,0.12); }
[data-theme="dark"] .mtb-red   { background: rgba(224,85,85,0.12); }
[data-theme="dark"] .mtb-blue  { background: rgba(77,143,224,0.12); }
[data-theme="dark"] .mtb-amber { background: rgba(212,137,58,0.12); }


/* ===== MOBILE FIXES ===== */

/* Prevent sideways scrolling */
html, body {
  overflow-x: hidden;
}

/* Ensure all elements fit screen */
* {
  max-width: 100%;
  box-sizing: border-box;
}

/* Fix tab overflow */
.tabs, .tab-bar, .top-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.tabs::-webkit-scrollbar,
.tab-bar::-webkit-scrollbar,
.top-tabs::-webkit-scrollbar {
  display: none;
}

/* Keep buttons inline and readable */
.tabs button,
.tab-bar button,
.top-tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Prevent grid overflow issues */
.grid, .row {
  max-width: 100%;
}


/* ===== UI POLISH ===== */

/* Cards */
.card, .book-item {
  border-radius:16px;
  padding:14px;
  box-shadow:0 4px 12px rgba(0,0,0,0.06);
  transition:transform 0.15s ease, box-shadow 0.15s ease;
}
.card:active, .book-item:active {
  transform:scale(0.98);
  box-shadow:0 2px 6px rgba(0,0,0,0.08);
}

/* Buttons */
.btn {
  border-radius:12px;
  font-weight:600;
  padding:10px 14px;
  transition:all 0.15s ease;
}
.btn:active {
  transform:scale(0.96);
}

/* Section spacing */
.section-label {
  margin-bottom:10px;
  font-weight:600;
  letter-spacing:0.3px;
}

/* Inputs */
input, select {
  border-radius:10px;
  padding:10px;
}

/* Improve text hierarchy */
h1, h2, h3 {
  letter-spacing:-0.3px;
}
.small, .text-muted {
  opacity:0.7;
}

/* Sticky action button (mobile) */
.sticky-action {
  position:fixed;
  bottom:16px;
  left:16px;
  right:16px;
  z-index:1000;
}


/* ===== UI POLISH V2 ===== */

/* Strong card hierarchy */
.book-item {
  display:flex;
  flex-direction:column;
  gap:6px;
}

.book-item-title {
  font-weight:700;
  font-size:14px;
}

.book-item-meta {
  font-size:12px;
  color:var(--text2);
}

/* Amount highlight (money, totals, VAT) */
.amount-strong {
  font-size:18px;
  font-weight:700;
  color:var(--text1);
}

/* Empty states */
.empty-state {
  text-align:center;
  padding:20px;
  color:var(--text2);
  font-size:13px;
}

/* Improve list spacing */
#tx-list .book-item {
  margin-bottom:10px;
}

/* Improve buttons in lists */
.book-item-actions {
  display:flex;
  justify-content:flex-end;
  gap:6px;
  margin-top:6px;
}

/* Section cards improvement */
.card {
  padding:16px;
}

/* Emphasise totals */
.highlight-box {
  padding:14px;
  border-radius:14px;
  background:rgba(0,0,0,0.03);
  margin-bottom:12px;
}


/* ===== DASHBOARD UPGRADE ===== */

/* Dashboard stat boxes */
.dashboard-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-bottom:16px;
}

.dashboard-card {
  padding:16px;
  border-radius:16px;
  background:linear-gradient(145deg,#ffffff,#f3f4f6);
  box-shadow:0 6px 14px rgba(0,0,0,0.06);
}

.dashboard-title {
  font-size:12px;
  color:var(--text2);
  margin-bottom:6px;
}

.dashboard-value {
  font-size:20px;
  font-weight:700;
  color:var(--text1);
}

/* Highlight VAT / totals */
.dashboard-card.primary {
  background:linear-gradient(145deg,#111827,#1f2937);
  color:#fff;
}

.dashboard-card.primary .dashboard-title {
  color:rgba(255,255,255,0.7);
}

.dashboard-card.primary .dashboard-value {
  color:#fff;
}

/* Section spacing */
.section-label {
  margin-top:10px;
}

/* Improve insight list */
#books-job-costing-list .card {
  margin-bottom:10px;
}


/* ===== COMPACT GRID TABS ===== */

/* Invoice / Quotes filter tabs — horizontal pills, not grid */
#screen-invoices .tabs,
#screen-quotes .tabs {
  display: flex !important;
  flex-direction: row !important;
  overflow-x: visible !important;
  gap: 6px !important;
  margin-bottom: 12px !important;
}

#screen-invoices .tabs button,
#screen-quotes .tabs button {
  flex: 1 !important;
  padding: 8px 12px !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}

/* Books tabs — clean underline style, full-width flush */
#screen-books .tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  gap: 0 !important;
  padding: 0 !important;
  background: var(--surface) !important;
  border: none !important;
  border-bottom: 2px solid var(--border) !important;
  border-radius: 0 !important;
  margin-bottom: 16px !important;
}

#screen-books .tabs::-webkit-scrollbar { display: none; }

#screen-books .tabs button {
  flex: 1 !important;
  min-width: 0 !important;
  padding: 11px 6px !important;
  border-radius: 0 !important;
  border: none !important;
  border-bottom: 3px solid transparent !important;
  margin-bottom: -2px !important;
  background: none !important;
  color: var(--text3) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  font-family: 'Manrope', sans-serif !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  text-align: center !important;
}

#screen-books .tabs button.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
  background: none !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

#screen-books .tabs button:active {
  transform: scale(0.97) !important;
}

/* All other tab strips: horizontal scrolling pills */
.tabs, .tab-bar, .top-tabs {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.tabs::-webkit-scrollbar,
.tab-bar::-webkit-scrollbar,
.top-tabs::-webkit-scrollbar {
  display: none;
}

.tabs button,
.tab-bar button,
.top-tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.03);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.tabs button.active,
.tab-bar button.active,
.top-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tabs button:active {
  transform: scale(0.97);
}

/* SETTINGS CLOSE BUTTON */

/* .settings-close removed — now inline sticky header */

/* ===== SOFT WARM REDESIGN — NEW COMPONENTS ===== */

/* Diary dark week strip */
.diary-week-strip-dark {
  background: var(--surface-dark);
  padding: 9px 12px 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
}
.diary-week-strip-dark .diary-prev-next {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 20px;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  flex-shrink: 0;
}
.diary-week-days {
  flex: 1;
  display: flex;
  gap: 3px;
}
.diary-wd-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 10px;
  padding: 5px 2px;
  cursor: pointer;
  transition: background 0.15s;
}
.diary-wd-item.diary-wd-selected {
  background: rgba(59,143,168,0.22);
}
.diary-wd-name {
  font-size: 7px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.2px;
}
.diary-wd-num {
  font-size: 15px;
  font-weight: 900;
  color: rgba(255,255,255,0.6);
  line-height: 1;
  letter-spacing: -0.5px;
}
.diary-wd-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
}
.diary-wd-item.diary-wd-selected .diary-wd-name { color: rgba(255,255,255,0.75); }
.diary-wd-item.diary-wd-selected .diary-wd-num { color: #fff; font-weight: 900; }
.diary-wd-item.diary-wd-selected .diary-wd-dot { background: var(--accent); }
.diary-wd-item.diary-wd-has .diary-wd-dot { background: rgba(255,255,255,0.28); }

/* Diary view-tabs row (below week strip) */
.diary-vtabs-row {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 7px 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.diary-vtabs-row-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

/* Books profit card — warm, no dark background */
.books-profit-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  border-top: 4px solid var(--accent);
  flex-shrink: 0;
  margin-bottom: 12px;
}
.books-profit-banner .bpb-eyebrow {
  font-size: 10px;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.books-profit-banner .bpb-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.books-profit-banner .bpb-val {
  font-size: 40px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -2.5px;
  line-height: 1;
}
.books-profit-banner .bpb-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 5px;
}
.books-profit-banner .bpb-right {
  text-align: right;
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
}
.books-profit-banner .bpb-rl {
  font-size: 9px;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.books-profit-banner .bpb-rv {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -1px;
}

/* Books 3-score row — bigger text */
.books-scores-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.books-score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}
.books-score-card .bsc-label {
  font-size: 9.5px;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
  font-weight: 600;
}
.books-score-card .bsc-val {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -1.2px;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.books-score-card .bsc-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
}

/* Books month breakdown card */
.books-month-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.books-month-card .bmc-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.books-month-card .bmc-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.books-month-card .bmc-net {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text3);
  font-weight: 600;
}
.books-month-card .bmc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.books-month-card .bmc-row:last-child { border-bottom: none; padding-bottom: 0; }
.books-month-card .bmc-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}
.books-month-card .bmc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.books-month-card .bmc-val {
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

/* Books SA / mileage compact rows */
.books-compact-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.books-compact-row.bcr-blue { border-left-color: var(--blue); }
.books-compact-row .bcr-left { flex: 1; }
.books-compact-row .bcr-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.books-compact-row .bcr-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.books-compact-row .bcr-right { text-align: right; }
.books-compact-row .bcr-val {
  font-size: 14px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.books-compact-row.bcr-blue .bcr-val { color: var(--blue); }
.books-compact-row .bcr-action {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  font-weight: 600;
}

/* Dashboard topbar icon button */
.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.topbar-icon-btn:hover { background: var(--surface3); }
.topbar-icon-btn svg { width: 16px; height: 16px; stroke: var(--text2); }

/* Activity row with left accent border */
.activity-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  border-left: 3px solid var(--accent);
  transition: all 0.15s;
}
.activity-row.ar-green { border-left-color: var(--green); }
.activity-row.ar-blue { border-left-color: var(--blue); }
.activity-row.ar-red { border-left-color: var(--red); }
.activity-row .ar-left { display: flex; align-items: center; gap: 10px; }
.activity-row .ar-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-row .ar-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.activity-row .ar-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.activity-row .ar-right { text-align: right; flex-shrink: 0; }
.activity-row .ar-amount {
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}
.activity-row .ar-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  display: inline-block;
  margin-top: 3px;
}


/* ===== BOOKS TAB BAR UPGRADE ===== */
#screen-books .tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  gap: 0 !important;
  padding: 0 !important;
  background: var(--surface) !important;
  border: none !important;
  border-bottom: 2px solid var(--border) !important;
  border-radius: 0 !important;
  margin-bottom: 16px !important;
}
#screen-books .tabs::-webkit-scrollbar { display: none; }
#screen-books .tab {
  flex: none !important;
  padding: 10px 14px !important;
  border-radius: 0 !important;
  border: none !important;
  background: none !important;
  color: var(--text3) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  font-family: 'Manrope', sans-serif !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -2px !important;
  transition: all 0.15s !important;
  letter-spacing: 0 !important;
}
#screen-books .tab.active {
  background: none !important;
  color: var(--accent) !important;
  font-weight: 800 !important;
  border-bottom-color: var(--accent) !important;
  box-shadow: none !important;
}
#screen-books .tab:hover:not(.active) {
  color: var(--text2) !important;
}

/* ===== DIARY COLOUR CATEGORIES ===== */
.diary-cat-section {
  margin-bottom: 14px;
}
.diary-cat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}
.diary-cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.diary-cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: all 0.15s;
  text-align: left;
}
.diary-cat-btn:active { transform: scale(0.97); }
.diary-cat-btn.active {
  border-color: var(--_cat-color, var(--accent));
  background: color-mix(in srgb, var(--_cat-color, var(--accent)) 10%, transparent);
}
.diary-cat-btn.active .diary-cat-name {
  color: var(--_cat-color, var(--accent));
}
.diary-cat-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.diary-cat-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.diary-cat-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 1px;
}
.diary-cat-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0 10px;
}
.diary-cat-custom-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 8px;
  font-weight: 600;
}

/* ===== DIARY CATEGORY DROPDOWN ===== */

/* The trigger button — looks like a select input */
.diary-cat-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: border-color 0.15s;
  text-align: left;
}
.diary-cat-trigger:focus,
.diary-cat-trigger:hover { border-color: var(--accent); }

.dct-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.dct-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.dct-arrow {
  font-size: 12px;
  color: var(--text3);
  margin-left: auto;
  flex-shrink: 0;
}

/* The dropdown panel */
.diary-cat-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  z-index: 200;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

/* Normal mode — selectable list */
.dcp-list { display: flex; flex-direction: column; }
.dcp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  text-align: left;
  width: 100%;
}
.dcp-row:last-child { border-bottom: none; }
.dcp-row:hover { background: var(--surface2); }
.dcp-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.dcp-dot.dcp-dot-lg { width: 20px; height: 20px; }
.dcp-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}



/* Edit mode */
.dcp-edit-list { display: flex; flex-direction: column; }
.dcp-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.dcp-edit-dot-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.dcp-edit-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dcp-edit-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  width: 100%;
  font-family: 'Manrope', sans-serif;
  outline: none;
}
.dcp-edit-name:focus { border-color: var(--accent); }
.dcp-edit-sub {
  font-size: 11px;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  width: 100%;
  font-family: 'Manrope', sans-serif;
  outline: none;
}
.dcp-edit-sub:focus { border-color: var(--accent); }
.dcp-del-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}
.dcp-del-btn:hover { color: var(--red); }
.dcp-add-btn {
  display: block;
  width: calc(100% - 28px);
  margin: 10px 14px 8px;
  padding: 8px;
  background: var(--surface2);
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: all 0.15s;
  text-align: center;
}
.dcp-add-btn:hover { border-color: var(--accent); color: var(--accent); }


/* ===== DIARY CATEGORY EDIT MODAL ROWS ===== */
.dce-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dce-row:last-child { border-bottom: none; }
.dce-color-label {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dce-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  border: 2px solid rgba(255,255,255,0.5);
}
.dce-name-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: 'Manrope', sans-serif;
  outline: none;
}
.dce-name-input:focus { border-color: var(--accent); }

.dce-del {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dce-del:hover { color: var(--red); }
.dce-add-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--surface2);
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: all 0.15s;
}
.dce-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
/* Make dce-list scrollable if many cats */
#dce-list { max-height: 50vh; overflow-y: auto; }


/* ===== DASHBOARD QUICK ACTION TILES — 4-across icon style ===== */
.dash-qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: transform 0.12s, box-shadow 0.12s;
  text-align: center;
}
.dash-qa-btn:hover {
  box-shadow: 0 2px 10px rgba(44,58,71,0.10);
  border-color: var(--accent);
}
.dash-qa-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.dash-qa-ic svg { width: 18px; height: 18px; }
.dash-qa-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* ===== DASHBOARD NAV TILES — full-width list rows ===== */
.dash-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  transition: transform 0.12s, box-shadow 0.12s;
  text-align: left;
  width: 100%;
  border-left: 3px solid var(--nav-accent, var(--accent));
}
.dash-nav-btn:hover {
  box-shadow: 0 2px 10px rgba(44,58,71,0.10);
}
.dash-nav-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-nav-ic svg { width: 16px; height: 16px; }
.dash-nav-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dash-nav-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.dash-nav-sub {
  font-size: 11px;
  color: var(--text3);
  display: block;
}
.dash-nav-arr {
  color: var(--text3);
  flex-shrink: 0;
}

/* ============================================================
   Pipeline View — v105
   ============================================================ */
.pipeline-summary {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  margin-top: 8px;
  gap: 0;
}
.ps-item { flex: 1; text-align: center; }
.ps-label { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text3); margin-bottom: 4px; }
.ps-value { font-size: 16px; font-weight: 700; color: var(--text1); }
.ps-amber { color: #d97706; }
.ps-green { color: var(--green); }
.ps-divider { width: 1px; height: 36px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.pipeline-columns {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.pipeline-columns::-webkit-scrollbar { height: 3px; }
.pipeline-columns::-webkit-scrollbar-track { background: transparent; }
.pipeline-columns::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.pipeline-col {
  min-width: 220px;
  max-width: 220px;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.pc-header-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pc-header-title { font-size: 12px; font-weight: 700; color: var(--text1); flex: 1; }
.pc-header-count { font-size: 11px; font-weight: 700; background: var(--border2); color: var(--text2); padding: 2px 7px; border-radius: 10px; }

.pc-cards { display: flex; flex-direction: column; gap: 8px; }

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  active-scale: 0.98;
}
.pipeline-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.pipeline-card:active { transform: scale(0.98); }
.pipeline-card.pc-paid { opacity: 0.65; }

.pc-ref { font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: 0.5px; font-family: 'DM Mono', monospace; margin-bottom: 3px; }
.pc-client { font-size: 13px; font-weight: 700; color: var(--text1); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-desc { font-size: 11px; color: var(--text3); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pc-amount { font-size: 14px; font-weight: 700; color: var(--text1); }
.pc-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.pc-badge-red { background: rgba(220,38,38,0.1); color: #dc2626; }
.pc-badge-amber { background: rgba(217,119,6,0.1); color: #d97706; }
.pc-badge-green { background: rgba(22,163,74,0.1); color: #16a34a; }

.pc-empty {
  text-align: center;
  padding: 24px 12px;
  font-size: 12px;
  color: var(--text3);
  background: var(--surface2);
  border: 1px dashed var(--border2);
  border-radius: 10px;
}

.pc-add-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px dashed var(--border2);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pc-add-btn:hover { background: var(--surface2); color: var(--accent); border-color: var(--accent); }

/* Pipeline Dashboard Card */
.dash-pipeline-btn {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
}
.dash-pipeline-btn:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.dp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dp-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text1); }
.dp-arrow { color: var(--text3); }
.dp-stages { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.dp-stage { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.dp-dot { width: 8px; height: 8px; border-radius: 50%; }
.dp-stage-label { font-size: 10px; color: var(--text3); font-weight: 500; white-space: nowrap; }
.dp-stage-count { font-size: 16px; font-weight: 700; color: var(--text1); }
.dp-count-red { color: #dc2626; }
.dp-count-green { color: var(--green); }
.dp-arrow-sep { font-size: 12px; color: var(--border2); flex-shrink: 0; margin-bottom: 16px; }

/* Pipeline Tabs v112 */
.pipeline-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px 12px 0;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.pipeline-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pipeline-tab-btn.active {
  color: var(--text1);
  border-bottom-color: var(--accent);
}
.pt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pt-count {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.pipeline-tab-btn.active .pt-count {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pipeline-tab-content {
  padding: 0 12px 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pipeline-tab-summary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text2);
}
.pipeline-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.pipeline-empty-icon { font-size: 40px; margin-bottom: 12px; }
.pipeline-empty-msg { font-size: 14px; line-height: 1.6; }

/* ============================================================
   Pipeline v113 — Polished tab design
   ============================================================ */
.pl-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.pl-tabs::-webkit-scrollbar { display: none; }

.pl-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  white-space: nowrap;
  transition: color 0.15s;
  flex-shrink: 0;
}
.pl-tab-active {
  color: var(--text1);
  border-bottom-color: var(--tab-color, var(--accent));
}
.pl-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  background: var(--surface2);
  color: var(--text3);
  transition: background 0.15s, color 0.15s;
}
.pl-content {
  padding: 14px 12px 80px;
}
.pl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* Cards */
.pl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow 0.12s, transform 0.12s;
}
.pl-card:active { transform: scale(0.99); }
.pl-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.pl-card-overdue { border-left: 3px solid #dc2626; }
.pl-card-paid { opacity: 0.7; }

.pl-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.pl-card-ref {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.5px;
  font-family: 'DM Mono', monospace;
}
.pl-card-client {
  font-size: 15px;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 2px;
}
.pl-card-desc {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.pl-card-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--text1);
}
.pl-card-age {
  font-size: 11px;
  color: var(--text3);
}

/* Badges */
.pl-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}
.pl-badge-red    { background: rgba(220,38,38,0.1);   color: #dc2626; }
.pl-badge-amber  { background: rgba(217,119,6,0.1);   color: #d97706; }
.pl-badge-green  { background: rgba(22,163,74,0.1);   color: #16a34a; }

/* Summary bar */
.pl-summary-bar {
  display: flex;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.pl-sb-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pl-sb-item span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
}
.pl-sb-item strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text1);
}

/* Empty state */
.pl-empty {
  text-align: center;
  padding: 56px 24px 32px;
}
.pl-empty-icon { font-size: 44px; margin-bottom: 14px; }
.pl-empty-msg {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.6;
  margin-bottom: 20px;
}
.pl-empty-btn {
  display: inline-block;
  padding: 11px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* FAB add button */
.pl-fab {
  width: 100%;
  padding: 13px;
  background: none;
  border: 1.5px dashed var(--border2);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
}
.pl-fab:hover {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--accent);
}
