* { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --ink:        #1C2622;
      --ink-soft:   #475569;
      --paper:      #FAFAF9;
      --card:       #FFFFFF;
      --line:       #E5E1D8;
      --accent:     #025430;
      --accent-dark:#023F24;
      --sage:       #5B7D6B;
      --sage-bg:    #EAF0EC;
      --amber:      #92660F;
      --amber-bg:   #FAF1E0;
      --rust:       #C0392B;
      --rust-bg:    #FDEDEC;
      --slate-bg:   #EEF0F2;
    }

    body {
      font-family: 'Inter', -apple-system, sans-serif;
      background: var(--paper);
      min-height: 100vh;
      color: var(--ink-soft);
      -webkit-font-smoothing: antialiased;
    }

    h1, h2, h3 { font-family: 'Source Serif 4', serif; color: var(--ink); font-weight: 600; }

    /* ── Boot: shown while we check whether a session already exists,
       so a logged-in user never sees the login screen flash first ── */
    #boot-screen {
      min-height: 100vh; display: flex; align-items: center; justify-content: center;
      background: var(--paper);
    }
    #boot-screen .boot-spinner {
      width: 28px; height: 28px; border-radius: 50%;
      border: 3px solid var(--line); border-top-color: var(--accent);
      animation: boot-spin 0.7s linear infinite;
    }
    @keyframes boot-spin { to { transform: rotate(360deg); } }

    /* ── Login ── */
    #login-screen {
      min-height: 100vh; display: flex; align-items: center; justify-content: center;
      background: var(--paper); padding: 24px;
    }
    .login-shell {
      display: flex; width: 100%; max-width: 940px; min-height: 560px;
      border-radius: 14px; overflow: hidden;
      box-shadow: 0 30px 80px rgba(28,38,34,0.28);
    }

    /* Brand panel (left) */
    .login-brand {
      flex: 1 1 46%; position: relative; overflow: hidden;
      background: var(--ink); color: #fff;
      padding: 48px 44px; display: flex; flex-direction: column; justify-content: center;
    }
    .login-brand::before, .login-brand::after {
      content: ''; position: absolute; border-radius: 50%; filter: blur(70px); z-index: 0;
    }
    .login-brand::before { width: 340px; height: 340px; background: var(--accent); opacity: 0.28; top: -110px; left: -90px; }
    .login-brand::after  { width: 300px; height: 300px; background: var(--sage);   opacity: 0.22; bottom: -100px; right: -70px; }
    .login-brand > * { position: relative; z-index: 1; }
    .login-brand-logo {
      height: 40px; width: auto; max-width: 160px; object-fit: contain;
      background: #fff; border-radius: 8px; padding: 6px 10px; margin-bottom: 28px;
    }
    .login-brand h1 { font-family: 'Fraunces', serif; font-size: 34px; font-weight: 600; color: #fff; margin-bottom: 6px; letter-spacing: -0.01em; }
    .login-brand .login-sub {
      font-size: 12.5px; color: #C9D4DE; margin-bottom: 36px;
      text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
    }
    .login-feature-list { display: flex; flex-direction: column; gap: 16px; }
    .login-feature { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: rgba(255,255,255,0.85); }
    .login-feature-icon {
      width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
      background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
    }

    /* Form panel (right) */
    .login-form-panel {
      flex: 1 1 54%; background: var(--card);
      display: flex; align-items: center; justify-content: center; padding: 48px 40px;
    }
    .login-box { width: 100%; max-width: 340px; }
    .login-form-logo-wrap { text-align: center; margin-bottom: 32px; }
    .login-form-logo { height: 170px; width: auto; max-width: 100%; object-fit: contain; }
    .login-footer-note {
      margin-top: 22px; font-size: 11px; line-height: 1.6; color: #9CA3AF; text-align: center;
    }

    @media (max-width: 760px) {
      .login-shell { flex-direction: column; min-height: 0; max-width: 420px; }
      .login-brand { padding: 32px 30px; }
      .login-feature-list { display: none; }
      .login-form-panel { padding: 36px 30px; }
    }

    /* ── Login brand panel: starfield + constellation ── */
    .const-svg { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
    .star { fill: rgba(255,255,255,0.95); animation-name: star-twinkle; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
    .star-accent { fill: rgba(120,166,141,0.95); }
    @keyframes star-twinkle {
      0%, 100% { opacity: 0.12; }
      50% { opacity: 0.9; }
    }
    .star-hero { transform-box: fill-box; transform-origin: center; animation-name: star-hero-twinkle; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
    @keyframes star-hero-twinkle {
      0%, 100% { opacity: 0.25; transform: scale(0.7); }
      50%      { opacity: 1;    transform: scale(1.15); }
    }
    .const-line { stroke: rgba(255,255,255,0.6); stroke-width: 0.6; animation-name: line-fade; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
    @keyframes line-fade {
      0%, 100% { opacity: 0; }
      50% { opacity: 0.26; }
    }
    label {
      display: block; font-size: 12.5px; margin-bottom: 6px; color: var(--ink-soft);
      font-weight: 500;
    }
    input, select, textarea {
      width: 100%; padding: 10px 12px; margin-bottom: 16px;
      border: 1px solid #D8D4C9; border-radius: 3px; font-size: 14px; font-family: inherit;
      color: var(--ink); background: var(--card);
      transition: border-color 0.15s;
    }
    input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
    button {
      padding: 10px 18px; background: var(--accent); color: #fff;
      border: none; border-radius: 3px; font-size: 13.5px; cursor: pointer; font-family: inherit;
      font-weight: 600; letter-spacing: 0.01em;
      transition: background 0.15s;
    }
    button:hover { background: var(--accent-dark); }
    button.secondary { background: var(--slate-bg); color: var(--ink-soft); }
    button.secondary:hover { background: #DFE3E7; }
    button.danger { background: var(--card); color: var(--rust); border: 1px solid #E2CFC9; }
    button.danger:hover { background: var(--rust-bg); }
    button:disabled { background: #C7CCD1; cursor: not-allowed; }
    .btn-spinner {
      display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px;
      border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%;
      animation: btn-spin 0.7s linear infinite;
    }
    @keyframes btn-spin { to { transform: rotate(360deg); } }

    .otp-boxes { display: flex; gap: 7px; margin-bottom: 16px; }
    .otp-box {
      width: 100%; height: 50px; padding: 0; margin-bottom: 0;
      text-align: center; font-size: 19px; font-weight: 700; letter-spacing: 0;
    }
    .otp-box:focus { box-shadow: 0 0 0 3px rgba(2,84,48,0.14); }
    #login-error {
      color: var(--rust); background: var(--rust-bg); border-radius: 3px;
      padding: 10px 12px; font-size: 13px; margin-bottom: 16px; display: none;
    }


    /* ── App shell ── */
    #app-screen { display: none; }
    .topbar {
      background: var(--ink); color: #fff;
      padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
    }
    .topbar h1 { color: #fff; font-size: 17px; letter-spacing: -0.01em; }
    .topbar .who { font-size: 12.5px; color: #9AA5B1; }
    .topbar .who b { color: #fff; font-weight: 600; }
    .topbar .who a { color: #C9D4DE; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.25); }
    .topbar .who a:hover { color: #fff; }
    .content { padding: 0; }

    /* ── Sidebar navigation + content shell ── */
    .view-shell { display: flex; align-items: stretch; width: 100%; }
    .tab-content { flex: 1; min-width: 0; padding: 24px 28px; }

    /* ── Card / table ── */
    .card {
      background: var(--card); border: 1px solid var(--line); border-radius: 4px;
      padding: 18px 22px; margin-bottom: 16px;
    }
    .card-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
    }
    .card-header h2 { font-size: 15px; }

    table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
    th {
      text-align: left; padding: 9px 12px; font-size: 10.5px; text-transform: uppercase;
      letter-spacing: 0.06em; color: #8A8377; font-weight: 600; border-bottom: 1px solid var(--line);
      font-family: 'Inter', sans-serif;
    }
    td { padding: 15px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
    tr:last-child td { border-bottom: none; }
    tbody tr:hover { background: #FBFAF8; }

    .badge {
      padding: 3px 10px; border-radius: 2px; font-size: 11px; font-weight: 600;
      letter-spacing: 0.02em; display: inline-block;
    }
    .badge.admin    { background: var(--slate-bg); color: var(--accent-dark); }
    .badge.customer { background: #F1EFE8; color: #6B6354; }
    .badge.active   { background: var(--sage-bg); color: var(--sage); }
    .badge.inactive { background: var(--rust-bg); color: var(--rust); }
    .badge.status-active    { background: var(--sage-bg); color: var(--sage); }
    .badge.status-expired   { background: var(--rust-bg); color: var(--rust); }
    .badge.status-cancelled { background: var(--slate-bg); color: #64748B; }

    .row-actions { display: flex; gap: 6px; }
    .row-actions button { padding: 5px 11px; font-size: 12px; }

    /* ── Modal ── */
    .modal-overlay {
      display: none; position: fixed; inset: 0; background: rgba(28,38,34,0.55);
      align-items: center; justify-content: center; z-index: 200;
    }
    .modal-overlay.open { display: flex; }
    .modal-box {
      background: var(--card); border-radius: 4px; padding: 32px;
      width: 100%; max-width: 420px; border-top: 3px solid var(--accent);
      max-height: 88vh; overflow-y: auto;
    }
    .modal-box h2 { font-size: 17px; margin-bottom: 20px; }
    .modal-actions { display: flex; gap: 10px; margin-top: 6px; }
    #form-error, #contract-form-error {
      color: var(--rust); background: var(--rust-bg); border-radius: 3px;
      padding: 10px 12px; font-size: 13px; margin-bottom: 14px; display: none;
    }
    .req-mark { color: var(--rust); margin-left: 2px; }

    /* ── Customer view ── */
    .profile-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
    .profile-row:last-child { border-bottom: none; }
    .profile-row .lbl { font-size: 13px; color: #8A8377; }
    .profile-row .val { font-size: 13px; font-weight: 600; color: var(--ink); }

    .empty-state { text-align: center; padding: 44px; color: #9CA3AF; font-size: 13.5px; }

    /* ── Sidebar nav tabs (flush to the left edge, full height) ── */
    .nav-tabs {
      flex: 0 0 216px; width: 216px;
      display: flex; flex-direction: column; gap: 2px;
      background: var(--ink); border-radius: 0; padding: 20px 12px;
      position: sticky; top: 0; min-height: calc(100vh - 66px);
    }
    .nav-tab {
      display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
      padding: 10px 14px; font-size: 13.5px; font-weight: 600;
      cursor: pointer; color: #9CA3AF; background: transparent;
      border: none; border-left: 3px solid transparent; border-radius: 6px;
    }
    .nav-tab-icon { width: 18px; height: 18px; flex-shrink: 0; }
    .nav-tab.active { color: #fff; background: rgba(255,255,255,0.08); border-left-color: var(--accent); }
    .nav-tab:not(.active):hover { color: #E5E7EB; background: rgba(255,255,255,0.05); }

    .nav-tabs-footer {
      margin-top: auto; padding: 16px 10px 4px; text-align: center;
      font-size: 10.5px; line-height: 1.7; color: #6B7280;
    }

    .nav-tab.nav-tab-soon { color: #5B6472; cursor: default; }
    .nav-tab.nav-tab-soon:hover { color: #5B6472; background: transparent; }
    .nav-tab-soon-badge {
      margin-inline-start: auto;
      font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
      background: rgba(255,255,255,0.06); color: #8891A0;
      padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
    }

    @media (max-width: 760px) {
      .view-shell { flex-direction: column; }
      .nav-tabs {
        flex-direction: row; width: 100%; flex-basis: auto;
        overflow-x: auto; position: static; min-height: auto; gap: 4px;
      }
      .nav-tab { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
      .nav-tab.active { border-left-color: transparent; border-bottom-color: var(--accent); }
      .nav-subtabs.expanded { flex-direction: row; margin: 0; padding-left: 0; border-left: none; }
      .nav-subtab { white-space: nowrap; }
    }

    /* ── Sidebar sub-nav (nested items under a parent tab, e.g. Hosting → Website/Analytics) ── */
    .nav-subtabs {
      display: none; flex-direction: column; gap: 2px;
      margin: 2px 0 4px 21px; padding-left: 12px;
      border-left: 1px solid rgba(255,255,255,0.1);
    }
    .nav-subtabs.expanded { display: flex; }
    .nav-subtab {
      text-align: left; padding: 10px 14px; font-size: 12.5px; font-weight: 600;
      color: #9CA3AF; background: transparent; border: none; border-radius: 6px; cursor: pointer;
    }
    .nav-subtab.active { color: #fff; background: rgba(255,255,255,0.08); }
    .nav-subtab:not(.active):hover { color: #E5E7EB; background: rgba(255,255,255,0.05); }
    .rtl .nav-subtabs { margin: 2px 21px 4px 0; padding-left: 0; padding-right: 12px; border-left: none; border-right: 1px solid rgba(255,255,255,0.1); text-align: right; }

    /* ── Contract card (customer view) ── */
    .contract-block { border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px; margin-bottom: 12px; }
    .contract-block-header {
      display: flex; justify-content: space-between; align-items: baseline;
      margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
    }
    .contract-block-header h3 {
      font-size: 15px; letter-spacing: 0.01em;
    }
    .contract-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 14px; }
    .contract-field .lbl {
      font-size: 10.5px; color: #8A8377; text-transform: uppercase; letter-spacing: 0.06em;
      margin-bottom: 2px; font-weight: 600;
    }
    .contract-field .val { font-size: 13.5px; font-weight: 600; color: var(--ink); }

    .pdf-link-btn {
      display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
      background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 3px;
      text-decoration: none; border: none; cursor: pointer; font-family: inherit; font-weight: 600;
    }
    .pdf-link-btn:hover { background: var(--accent-dark); }
    .pdf-link-btn.disabled { background: var(--slate-bg); color: #9CA3AF; cursor: not-allowed; }

    .modal-box.wide { max-width: 580px; }
    .form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

    /* ── Overview stat cards (admin) ── */
    .stat-grid {
      display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px;
    }
    .stat-card {
      background: var(--card); border: 1px solid var(--line); border-radius: 4px;
      padding: 16px 18px; border-left: 3px solid var(--accent);
    }
    .stat-card.warn { border-left-color: var(--amber); }
    .stat-label {
      font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
      color: #8A8377; font-weight: 600; margin-bottom: 8px;
    }
    .stat-value { font-family: 'Source Serif 4', serif; font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; }
    .stat-sub { font-size: 11.5px; color: #9CA3AF; margin-top: 4px; }

    /* ── Overview rows (customer) ── */
    .overview-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 0; border-bottom: 1px solid var(--line);
    }
    .overview-row:last-child { border-bottom: none; }
    .overview-row-main { display: flex; align-items: baseline; gap: 12px; }
    .overview-row-main .contract-num { font-weight: 600; color: var(--ink); font-size: 13.5px; }
    .overview-row-main .days-left { font-size: 12.5px; color: #8A8377; }
    .overview-row-main .days-left.urgent { color: var(--amber); font-weight: 600; }
    .overview-link {
      font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 600;
      border-bottom: 1px solid transparent;
    }
    .overview-link:hover { border-bottom-color: var(--accent); }

    /* ── Asset health (customer dashboard) ── */
    .asset-health-grid {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
    }
    .health-tile {
      border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px;
      border-left: 3px solid var(--ink-soft);
    }
    .health-tile .h-count { font-family: 'Source Serif 4', serif; font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1; }
    .health-tile .h-label { font-size: 11.5px; color: #8A8377; margin-top: 4px; font-weight: 500; }
    .health-tile.c-sage  { border-left-color: var(--sage); }
    .health-tile.c-amber { border-left-color: var(--amber); }
    .health-tile.c-rust  { border-left-color: var(--rust); }
    .health-tile.c-slate { border-left-color: #94A3B8; }

    /* Status badge — dynamic colors from health_statuses.color */
    .status-pill {
      display: inline-block; padding: 3px 10px; border-radius: 2px;
      font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
    }
    .status-pill.c-sage   { background: var(--sage-bg);     color: var(--sage);      }
    .status-pill.c-amber  { background: var(--amber-bg);    color: var(--amber);     }
    .status-pill.c-rust   { background: var(--rust-bg);     color: var(--rust);      }
    .status-pill.c-slate  { background: var(--slate-bg);    color: #64748B;          }
    .status-pill.c-red    { background: var(--c-red-bg);    color: var(--c-red);     }
    .status-pill.c-blue   { background: var(--c-blue-bg);   color: var(--c-blue);    }
    .status-pill.c-purple { background: var(--c-purple-bg); color: var(--c-purple);  }
    .status-pill.c-teal   { background: var(--c-teal-bg);   color: var(--c-teal);    }
    .status-pill.c-green  { background: var(--c-green-bg);  color: var(--c-green);   }
    .status-pill.c-orange { background: var(--c-orange-bg); color: var(--c-orange);  }
    .status-pill.c-pink   { background: var(--c-pink-bg);   color: var(--c-pink);    }
    .status-pill.c-brown  { background: var(--c-brown-bg);  color: var(--c-brown);   }
    .status-pill.c-navy   { background: var(--c-navy-bg);   color: var(--c-navy);    }
    .status-pill.c-lime   { background: var(--c-lime-bg);   color: var(--c-lime);    }

    /* ── Asset cards (customer) ── */
    .asset-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
    .asset-card {
      border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px;
      cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
    }
    .asset-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
    .asset-card .a-name { font-weight: 600; color: var(--ink); font-size: 13.5px; margin-bottom: 4px; }
    .asset-card .a-meta { font-size: 12px; color: #8A8377; margin-bottom: 10px; }

    /* ── History timeline ── */
    .history-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .history-item:last-child { border-bottom: none; }
    .history-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--ink-soft); }
    .history-dot.c-sage  { background: var(--sage); }
    .history-dot.c-amber { background: var(--amber); }
    .history-dot.c-rust  { background: var(--rust); }
    .history-dot.c-slate { background: #94A3B8; }
    .history-body .h-status { font-weight: 600; font-size: 13px; color: var(--ink); }
    .history-body .h-date { font-size: 11.5px; color: #9CA3AF; margin-top: 1px; }
    .history-body .h-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }

    /* ── Graphical dashboard row ── */
    .dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
    .dash-card { display: flex; flex-direction: column; }
    .dash-card .section-score-content { max-height: 260px; overflow-y: auto; }
    @media (max-width: 760px) { .dash-row { grid-template-columns: 1fr; } }

    /* Donut chart — repurposed for bar chart */
    .donut-wrap { display: flex; flex-direction: column; gap: 0; width: 100%; }

    /* Asset bar chart */
    .asset-bar-summary { margin-bottom: 12px; }
    .asset-bar-total { font-family: 'Source Serif 4', serif; font-size: 26px; font-weight: 600; color: var(--ink); }
    .asset-bar-chart { display: flex; flex-direction: column; gap: 9px; }
    .asset-bar-row { display: grid; grid-template-columns: 1fr 2fr 28px; align-items: center; gap: 10px; }
    .asset-bar-label { font-size: 12px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .asset-bar-track { height: 8px; background: var(--slate-bg); border-radius: 100px; overflow: hidden; }
    .asset-bar-fill  { height: 100%; border-radius: 100px; transition: width 0.4s ease; }
    .asset-bar-count { font-size: 12px; font-weight: 700; color: var(--ink); text-align: right; }

    /* Contract timeline visual */
    .timeline-card-inner { padding-top: 4px; }
    .timeline-contract-row { margin-bottom: 18px; }
    .timeline-contract-row:last-child { margin-bottom: 0; }
    .timeline-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
    .timeline-top .t-num { font-size: 13px; font-weight: 600; color: var(--ink); }
    .timeline-top .t-days { font-size: 11.5px; color: #8A8377; }
    .timeline-top .t-days.urgent { color: var(--amber); font-weight: 600; }
    .timeline-track { position: relative; height: 8px; background: var(--slate-bg); border-radius: 100px; overflow: hidden; }
    .timeline-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 100px; }
    .timeline-fill.c-sage  { background: var(--sage); }
    .timeline-fill.c-amber { background: var(--amber); }
    .timeline-fill.c-rust  { background: var(--rust); }
    .timeline-dates { display: flex; justify-content: space-between; font-size: 10.5px; color: #9CA3AF; margin-top: 5px; }

    /* ── Visit report checklist ── */
    .report-asset-block { border: 1px solid var(--line); border-radius: 4px; margin-bottom: 14px; overflow: hidden; }
    .report-asset-header {
      background: var(--ink); color: #fff; padding: 10px 16px;
      display: flex; align-items: center; justify-content: space-between;
    }
    .report-asset-header h3 { font-size: 13.5px; font-family: 'Source Serif 4', serif; color: #fff; }
    .report-asset-header .a-sub { font-size: 11.5px; color: rgba(255,255,255,0.5); }
    .report-section-block { border-bottom: 1px solid var(--line); padding: 12px 16px; }
    .report-section-block:last-child { border-bottom: none; }
    .report-section-title { font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
    .report-check-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); gap: 12px; }
    .report-check-row:last-child { border-bottom: none; }
    .report-check-label { font-size: 13px; color: var(--ink-soft); flex: 1; }
    .result-btns { display: flex; gap: 4px; flex-shrink: 0; }
    .result-btn {
      padding: 4px 10px; border-radius: 3px; font-size: 11.5px; font-weight: 700;
      cursor: pointer; border: 1.5px solid var(--line); background: var(--card); color: var(--ink-soft);
      transition: all 0.1s; font-family: inherit;
    }
    .result-btn:hover { border-color: var(--accent); color: var(--accent); }
    .result-btn.selected-pass { background: var(--sage-bg); border-color: var(--sage); color: var(--sage); }
    .result-btn.selected-ok   { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
    .result-btn.selected-fail { background: var(--rust-bg); border-color: var(--rust); color: var(--rust); }
    .section-note-row { padding: 8px 0 4px; }
    .section-note-row input { margin-bottom: 0; font-size: 12.5px; padding: 7px 10px; }

    /* Report result badges (read-only view) */
    .result-badge { padding: 2px 9px; border-radius: 2px; font-size: 11px; font-weight: 700; display: inline-block; }
    .result-badge.pass { background: var(--sage-bg); color: var(--sage); }
    .result-badge.ok   { background: var(--amber-bg); color: var(--amber); }
    .result-badge.fail { background: var(--rust-bg); color: var(--rust); }
    .result-badge.none { background: var(--slate-bg); color: #64748B; }

    /* Report list rows */
    .report-list-item {
      display: flex; align-items: center; justify-content: space-between;
      padding: 12px 0; border-bottom: 1px solid var(--line); gap: 12px;
    }
    .report-list-item:last-child { border-bottom: none; }
    .report-list-main { display: flex; flex-direction: column; gap: 3px; }
    .report-list-num { font-size: 13.5px; font-weight: 700; color: var(--ink); }
    .report-list-sub { font-size: 12px; color: #8A8377; }
    /* ── Hero banner ── */
    .dash-hero-wrap {
      background: linear-gradient(135deg, var(--ink) 0%, #023F24 100%);
      border-radius: 12px; padding: 28px 28px 24px; margin-bottom: 18px;
      position: relative; overflow: hidden;
    }
    .dash-hero {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 24px; position: relative; z-index: 1;
    }
    .dash-hero-left { flex: 1; }
    .dash-hero-name { font-family: 'Source Serif 4', serif; font-size: 26px; font-weight: 600; color: #fff; margin-bottom: 6px; line-height: 1.2; }
    .dash-hero-sub { font-size: 12.5px; color: rgba(255,255,255,0.4); }
    .dash-hero-date {
      font-size: 13px; color: rgba(255,255,255,0.85); margin-top: 10px; font-weight: 500;
      background: rgba(255,255,255,0.1); border-radius: 6px;
      display: inline-flex; align-items: center; gap: 8px;
      padding: 6px 14px; backdrop-filter: blur(4px);
    }
    .dash-hero-right { flex-shrink: 0; }

    /* ── Language toggle ── */
    /* Hidden for now — initLanguage() still sets inline display:flex on login,
       this CSS override just suppresses it visually without touching the JS. */
    #lang-toggle { display: none !important; gap: 2px; background: rgba(255,255,255,0.12); border-radius: 6px; padding: 3px; }
    .lang-btn {
      padding: 4px 12px; border-radius: 4px; font-size: 12px; font-weight: 700;
      border: none; cursor: pointer; background: transparent; color: rgba(255,255,255,0.6);
      transition: all 0.15s; letter-spacing: 0.04em;
    }
    .lang-btn.active { background: #fff; color: var(--ink); }

    /* ── RTL support ── */
    .rtl { direction: rtl; font-family: 'Noto Sans Arabic', 'Source Serif 4', serif; }
    .rtl .nav-tab { flex-direction: row-reverse; text-align: right; border-left: none; border-right: 3px solid transparent; }
    .rtl .nav-tab.active { border-right-color: var(--accent); border-left-color: transparent; }
    .rtl .card-header { flex-direction: row-reverse; }
    .rtl .status-tile { border-left: none; border-right: 4px solid var(--ink-soft); }
    .rtl .status-tile.c-red    { border-right-color: var(--c-red);    border-left: none; }
    .rtl .status-tile.c-amber  { border-right-color: var(--c-amber);  border-left: none; }
    .rtl .status-tile.c-blue   { border-right-color: var(--c-blue);   border-left: none; }
    .rtl .status-tile.c-purple { border-right-color: var(--c-purple); border-left: none; }
    .rtl .status-tile.c-teal   { border-right-color: var(--c-teal);   border-left: none; }
    .rtl .status-tile.c-slate  { border-right-color: var(--c-slate);  border-left: none; }
    .rtl .status-tile.c-green  { border-right-color: var(--c-green);  border-left: none; }
    .rtl .status-tile.c-orange { border-right-color: var(--c-orange); border-left: none; }
    .rtl .status-tile.c-pink   { border-right-color: var(--c-pink);   border-left: none; }
    .rtl .status-tile.c-brown  { border-right-color: var(--c-brown);  border-left: none; }
    .rtl .status-tile.c-navy   { border-right-color: var(--c-navy);   border-left: none; }
    .rtl .status-tile.c-lime   { border-right-color: var(--c-lime);   border-left: none; }
    .rtl .asset-bar-row { direction: rtl; }
    .rtl .timeline-top { flex-direction: row-reverse; }
    .rtl .timeline-dates { flex-direction: row-reverse; }
    .rtl .icon-stat-card { text-align: right; }
    .rtl .dash-hero-left { text-align: right; }
    .rtl .section-score-top { flex-direction: row-reverse; }
    .rtl .report-list-item { flex-direction: row-reverse; }
    .rtl .row-actions { flex-direction: row-reverse; }
    .rtl .visit-asset-card { text-align: right; }
    .rtl .va-counts { flex-direction: row-reverse; }
    .rtl .st-tile-head { flex-direction: row-reverse; }

    /* ── Icon stat cards ── */
    .icon-stat-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; margin-bottom: 0; position: relative; z-index: 1; }
    .icon-stat-card {
      background: rgba(255,255,255,0.08);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 14px; padding: 20px 18px;
      display: flex; flex-direction: column; gap: 6px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.12);
    }
    .icon-stat-icon {
      width: 38px; height: 38px; border-radius: 10px;
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.2);
      display: flex; align-items: center; justify-content: center;
      margin-bottom: 6px;
    }
    .icon-stat-icon svg { width: 20px; height: 20px; color: #fff; }
    .icon-stat-value { font-family: 'Source Serif 4', serif; font-size: 32px; font-weight: 700; color: #fff; line-height: 1; }
    .icon-stat-label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.95); }
    .icon-stat-sub { font-size: 11.5px; color: rgba(255,255,255,0.5); }
    @media (max-width: 760px) { .icon-stat-grid { grid-template-columns: 1fr 1fr; } }

    /* ── Card icon badge (for card headers) ── */
    .card-icon {
      width: 30px; height: 30px; border-radius: 7px;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .card-icon svg { width: 16px; height: 16px; color: #fff; }
    /* ── Asset issue tags dashboard cards ── */
    .asset-tag-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
    .asset-tag-card-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
    .asset-tag-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
    .asset-tag-meta { font-size: 12px; color: #8A8377; }
    .asset-tag-section { margin-bottom: 6px; }
    .asset-tag-section-label { font-size: 11px; font-weight: 700; color: #8A8377; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }

    /* ── Issue tags ── */
    .tag-group-block { margin-bottom: 28px; }
    .tag-group-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
    .tag-group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .tag-group-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
    .tag-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }

    .tag-section-block { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
    .tag-section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--slate-bg); border-bottom: 1px solid var(--line); }
    .tag-section-title { font-size: 13px; font-weight: 700; color: var(--ink); }
    .tag-list { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
    .tag-item { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--slate-bg); border: 1px solid var(--line); font-size: 12px; }
    .tag-item-label { font-weight: 500; color: var(--ink); }
    .tag-item-del { cursor: pointer; color: var(--rust); font-size: 14px; line-height: 1; background: none; border: none; padding: 0; }
    .tag-add-row { display: flex; gap: 8px; padding: 8px 14px 12px; border-top: 1px solid var(--line); }
    .tag-add-row input { flex: 1; margin-bottom: 0; font-size: 12.5px; padding: 6px 10px; }

    /* Issue tag pills in visit report / dashboard */
    .issue-tag-pill { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #FEF9E7; color: #92660F; border: 1px solid #F0C06A; margin: 2px; }
    .issue-tag-pill.critical { background: #FDEDEC; color: #C0392B; border-color: #F5B7B1; }

    /* Issue checkboxes in visit form */
    .issue-checks-wrap { padding: 8px 0 4px 0; }
    .issue-check-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; color: var(--ink); }
    .issue-check-row input[type=checkbox] { width: 14px; height: 14px; margin-bottom: 0; flex-shrink: 0; cursor: pointer; }
    .sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 12px; }
    .sub-card { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; border-left: 4px solid var(--accent); }
    .sub-card.sub-active   { border-left-color: var(--sage); }
    .sub-card.sub-expiring { border-left-color: var(--amber); background: var(--amber-bg); }
    .sub-card.sub-expired  { border-left-color: var(--rust); background: var(--rust-bg); }
    .sub-software { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
    .sub-vendor   { font-size: 12px; color: #8A8377; margin-bottom: 8px; }
    .sub-dates    { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
    .sub-badge    { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
    .sub-badge.active   { background: var(--sage-bg); color: var(--sage); }
    .sub-badge.expiring { background: var(--amber-bg); color: var(--amber); }
    .sub-badge.expired  { background: var(--rust-bg); color: var(--rust); }
    .sub-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
    .sub-row:last-child { border-bottom: none; }
    .sub-row-left { flex: 1; }
    .sub-row-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
    .sub-row-meta { font-size: 12px; color: #8A8377; margin-top: 2px; }

    .section-score-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
    .section-score-row:last-child { border-bottom: none; }
    .section-score-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
    .section-score-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
    .section-score-counts { display: flex; gap: 10px; font-size: 11.5px; }
    .sc-pass { color: var(--sage); font-weight: 700; }
    .sc-ok   { color: var(--amber); font-weight: 700; }
    .sc-fail { color: var(--rust); font-weight: 700; }
    .sc-none { color: #9CA3AF; }
    .section-score-bar { height: 6px; border-radius: 100px; background: var(--slate-bg); display: flex; overflow: hidden; gap: 1px; }
    .score-bar-seg { height: 100%; border-radius: 100px; }
    .score-bar-seg.pass { background: var(--sage); }
    .score-bar-seg.ok   { background: var(--amber); }
    .score-bar-seg.fail { background: var(--rust); }

    /* ── Per-asset visit score cards ── */
    .visit-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
    .visit-asset-card { border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; }
    .visit-asset-card.no-report { border-style: dashed; opacity: 0.7; }
    .va-name { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
    .va-sub  { font-size: 11.5px; color: #8A8377; margin-bottom: 10px; }
    .va-date { font-size: 11px; color: #9CA3AF; margin-bottom: 8px; }
    .va-counts { display: flex; gap: 8px; margin-bottom: 10px; }
    .va-count { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 2px; }
    .va-count.pass { background: var(--sage-bg); color: var(--sage); }
    .va-count.ok   { background: var(--amber-bg); color: var(--amber); }
    .va-count.fail { background: var(--rust-bg); color: var(--rust); }
    .va-bar { height: 5px; border-radius: 100px; background: var(--slate-bg); display: flex; overflow: hidden; gap: 1px; }

    /* ── Status color system ── */
    :root {
      --c-red:    #C0392B; --c-red-bg:    #FDEDEC;
      --c-amber:  #92660F; --c-amber-bg:  #FAF1E0;
      --c-blue:   #1E5F8E; --c-blue-bg:   #E6F0F8;
      --c-purple: #5B21B6; --c-purple-bg: #EDE9FE;
      --c-teal:   #0EA5A0; --c-teal-bg:   #E0F7F6;
      --c-slate:  #475569; --c-slate-bg:  #EEF0F2;
      --c-green:  #1A6B3A; --c-green-bg:  #E4F3EB;
      --c-orange: #C2510E; --c-orange-bg: #FDF0E8;
      --c-pink:   #9D2C6E; --c-pink-bg:   #F9E8F3;
      --c-brown:  #6B3A2A; --c-brown-bg:  #F2EAE6;
      --c-navy:   #1C2F5E; --c-navy-bg:   #E5E9F4;
      --c-lime:   #4A7A1E; --c-lime-bg:   #EBF4E0;
    }

    /* ── Color picker ── */
    .color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
    .color-btn {
      display: flex; align-items: center; gap: 6px; padding: 6px 12px;
      border: 1.5px solid var(--line); border-radius: 3px; background: var(--card);
      font-size: 12.5px; color: var(--ink-soft); cursor: pointer; font-family: inherit;
      transition: border-color 0.15s;
    }
    .color-btn:hover { border-color: var(--accent); }
    .color-btn.selected { border-color: var(--ink); color: var(--ink); font-weight: 600; }
    .color-swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

    /* ── Icon picker ── */
    .icon-picker {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px;
      max-height: 180px; overflow-y: auto; overflow-x: hidden; margin-bottom: 16px;
      padding: 8px; border: 1px solid var(--line); border-radius: 4px;
    }
    .icon-pick-btn {
      height: 42px; display: flex; align-items: center; justify-content: center;
      border: 1.5px solid var(--line); border-radius: 5px; background: var(--card) !important;
      color: var(--ink-soft) !important; cursor: pointer; transition: all 0.12s; padding: 0;
    }
    .icon-pick-btn svg { width: 18px; height: 18px; display: block; flex-shrink: 0; stroke: currentColor; }
    .icon-pick-btn:hover { border-color: var(--accent); color: var(--accent) !important; background: var(--card) !important; }
    .icon-pick-btn.selected { border-color: var(--ink); background: var(--ink) !important; color: #fff !important; }

    /* Status icon badge (definition cards) */
    .status-icon-badge {
      width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center; color: #fff;
    }
    /* Status tile head (customer dashboard) */
    .st-tile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
    .st-icon {
      width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center; color: #fff;
    }
    /* Bar chart row icon */
    .bar-icon { display: inline-flex; align-items: center; margin-right: 5px; vertical-align: middle; }

    /* ── Status definition cards ── */
    .status-def-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
    .status-def-card {
      border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px;
      display: flex; flex-direction: column; gap: 10px;
    }
    .status-def-top { display: flex; align-items: flex-start; gap: 10px; flex: 1; }
    .status-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
    .status-def-name { font-size: 13px; font-weight: 600; color: var(--ink); }
    .status-def-desc { font-size: 11.5px; color: #8A8377; margin-top: 2px; }
    .status-def-actions { display: flex; gap: 6px; }
    .status-def-actions button { flex: 1; padding: 5px 8px; font-size: 12px; }

    /* ── Asset assignment list ── */
    .assign-asset-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px;
    }
    .assign-asset-row:last-child { border-bottom: none; }
    .assign-asset-left { display: flex; align-items: center; gap: 10px; flex: 1; }
    .assign-asset-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
    .assign-asset-sub  { font-size: 12px; color: #8A8377; }
    .resolved-tag { font-size: 11px; color: var(--sage); font-weight: 600; padding: 2px 8px; background: var(--sage-bg); border-radius: 2px; }

    /* ── Customer status tiles ── */
    .status-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
    .status-tile {
      border: 1px solid var(--line); border-radius: 4px; padding: 16px;
      cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
      border-left: 4px solid var(--ink-soft);
    }
    .status-tile:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
    .status-tile .st-count { font-family: 'Source Serif 4', serif; font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; margin-bottom: 6px; }
    .status-tile .st-name  { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
    .status-tile .st-click { font-size: 11px; color: #9CA3AF; margin-top: 4px; }
    .status-tile.c-red    { border-left-color: var(--c-red);    }
    .status-tile.c-amber  { border-left-color: var(--c-amber);  }
    .status-tile.c-blue   { border-left-color: var(--c-blue);   }
    .status-tile.c-purple { border-left-color: var(--c-purple); }
    .status-tile.c-teal   { border-left-color: var(--c-teal);   }
    .status-tile.c-slate  { border-left-color: var(--c-slate);  }
    .status-tile.c-green  { border-left-color: var(--c-green);  }
    .status-tile.c-orange { border-left-color: var(--c-orange); }
    .status-tile.c-pink   { border-left-color: var(--c-pink);   }
    .status-tile.c-brown  { border-left-color: var(--c-brown);  }
    .status-tile.c-navy   { border-left-color: var(--c-navy);   }
    .status-tile.c-lime   { border-left-color: var(--c-lime);   }

    /* Asset list inside status detail modal */
    .status-asset-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
    .status-asset-row:last-child { border-bottom: none; }
    .status-asset-row .sa-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }

    /* ── Ticketing ── */
    .ticket-row { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
    .ticket-row:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
    .ticket-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
    .ticket-subject { font-size: 13.5px; font-weight: 700; color: var(--ink); }
    .ticket-meta { font-size: 12px; color: #8A8377; }
    .ticket-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
    .ticket-badge.status-open        { background: var(--slate-bg); color: var(--accent-dark); }
    .ticket-badge.status-in_progress { background: var(--amber-bg); color: var(--amber); }
    .ticket-badge.status-resolved    { background: var(--sage-bg);  color: var(--sage); }
    .ticket-badge.status-closed      { background: #F1EFE8; color: #6B6354; }
    .ticket-badge.priority-low     { background: var(--slate-bg); color: #64748B; }
    .ticket-badge.priority-normal  { background: var(--slate-bg); color: var(--accent-dark); }
    .ticket-badge.priority-high    { background: var(--amber-bg); color: var(--amber); }
    .ticket-badge.priority-urgent  { background: var(--rust-bg);  color: var(--rust); }

    .ticket-msg { border-left: 3px solid var(--accent); background: var(--slate-bg); border-radius: 0 4px 4px 0; padding: 10px 14px; margin-bottom: 10px; }
    .ticket-msg.from-customer { border-left-color: var(--sage); background: var(--sage-bg); }
    .ticket-msg-meta { font-size: 11.5px; color: #8A8377; margin-bottom: 4px; font-weight: 600; }
    .ticket-msg-body { font-size: 13px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
    .status-asset-row .sa-sub  { font-size: 12px; color: #8A8377; margin-top: 2px; }