
    *, *::before, *::after { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: Montserrat, ui-sans-serif, system-ui, sans-serif;
      background: #f9fafb;
      color: #030712;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }
    a { color: inherit; text-decoration: none; }

    /* Shell */
    .app-shell { display: flex; height: 100dvh; min-height: 100vh; background: #f9fafb; color: #030712; }
    .sidebar {
      width: 16rem;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      border-right: 1px solid #e5e7eb;
      background: #fff;
      box-shadow: 0 1px 2px rgba(0,0,0,.04);
    }
    .sidebar-user-card {
      margin: 1rem;
      padding: 0.75rem;
      border-radius: 0.75rem;
      border: 1px solid rgba(229,231,235,.8);
      background: rgba(249,250,251,.9);
      box-shadow: 0 1px 2px rgba(0,0,0,.04);
    }
    .sidebar-user-label {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.14em;
      color: #9ca3af;
      margin: 0 0 0.125rem;
    }
    .sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: #111827; margin: 0; }
    .sidebar-user-role { font-size: 0.75rem; color: #6b7280; margin: 0.125rem 0 0; text-transform: capitalize; }
    .sidebar-brand {
      padding: 0 1rem 0.75rem;
      font-size: 0.6875rem;
      font-weight: 600;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #6b7280;
    }
    .sidebar-nav { flex: 1; overflow-y: auto; padding: 0 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
    .sidebar-link {
      display: flex;
      align-items: center;
      gap: 0.625rem;
      padding: 0.625rem 0.75rem;
      border-radius: 0.5rem;
      font-size: 0.875rem;
      font-weight: 500;
      color: #4b5563;
      transition: background 0.15s, color 0.15s;
    }
    .sidebar-link:hover { background: #f9fafb; color: #111827; text-decoration: none; }
    .sidebar-link.active {
      background: rgba(184, 71, 47, 0.1);
      color: #963D28;
      box-shadow: inset 0 0 0 1px rgba(224, 122, 98, 0.4);
    }
    .sidebar-link svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; opacity: 0.85; }
    .sidebar-footer { border-top: 1px solid #e5e7eb; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.125rem; }
    .sidebar-footer-btn {
      display: flex;
      width: 100%;
      align-items: center;
      gap: 0.5rem;
      padding: 0.375rem 0.625rem;
      border: none;
      border-radius: 0.375rem;
      background: none;
      font: inherit;
      font-size: 0.8125rem;
      font-weight: 500;
      color: #4b5563;
      cursor: pointer;
      text-align: left;
    }
    .sidebar-footer-btn svg { width: 1rem; height: 1rem; flex-shrink: 0; opacity: 0.85; }
    .sidebar-footer-btn:hover { background: #f9fafb; color: #111827; }
    .sidebar-footer-btn.danger { color: #dc2626; }
    .sidebar-footer-btn.danger:hover { background: #fef2f2; color: #b91c1c; }

    .content-col { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
    .top-header {
      flex-shrink: 0;
      border-bottom: 1px solid #e5e7eb;
      background: #fff;
      padding: 0.75rem 1rem;
      box-shadow: 0 1px 2px rgba(0,0,0,.05);
    }
    @media (min-width: 640px) { .top-header { padding: 1rem 1.5rem; } }
    .top-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; }
    .top-header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; color: #111827; }
    @media (min-width: 640px) { .top-header h1 { font-size: 1.5rem; } }
    .top-header-sub { margin: 0.125rem 0 0; font-size: 0.8125rem; color: #6b7280; }
    .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

    .main-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 1.25rem 1rem; }
    @media (min-width: 640px) { .main-scroll { padding: 1.5rem; } }
    @media (min-width: 768px) { .main-scroll { padding: 1.5rem 1.75rem; } }
    @media (min-width: 1024px) { .main-scroll { padding: 1.75rem 2rem; } }

    .workspace { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
    @media (min-width: 640px) { .workspace { gap: 1rem; } }

    /* KPI */
    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.625rem;
    }
    @media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; } }
    @media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.875rem; } }
    .kpi-card {
      display: flex;
      flex-direction: column;
      gap: 0.375rem;
      min-width: 0;
      border-radius: 10px;
      border-width: 0.5px;
      border-style: solid;
      padding: 0.75rem 0.875rem;
      box-shadow: 0 1px 2px rgba(15,23,42,.04);
    }
    .kpi-tone-slate { border-color: rgba(148,163,184,.9); background: rgba(241,245,249,.85); }
    .kpi-tone-blue { border-color: rgba(59,130,246,.8); background: rgba(219,234,254,.95); }
    .kpi-tone-emerald { border-color: rgba(16,185,129,.8); background: rgba(209,250,229,.95); }
    .kpi-tone-violet { border-color: rgba(139,92,246,.8); background: rgba(237,233,254,.95); }
    .kpi-tone-indigo { border-color: rgba(99,102,241,.8); background: rgba(224,231,255,.95); }
    .kpi-tone-rose { border-color: rgba(244,63,94,.8); background: rgba(255,228,230,.95); }
    .kpi-label {
      font-size: 9px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #4b5563;
      margin: 0;
    }
    .kpi-value {
      margin: 0;
      font-size: 1.0625rem;
      font-weight: 400;
      font-variant-numeric: tabular-nums;
      letter-spacing: -0.01em;
      line-height: 1.2;
      color: #030712;
    }
    @media (min-width: 640px) { .kpi-value { font-size: 1.1875rem; } }
    .kpi-hint { margin: 0; font-size: 0.6875rem; color: #6b7280; }

    /* Panel */
    .panel {
      min-width: 0;
      border-radius: 0.75rem;
      border: 1px solid rgba(229,231,235,.78);
      background: #fff;
      box-shadow: 0 1px 2px rgba(15,23,42,.048);
      ring: 1px solid rgba(3,7,18,.026);
    }
    .panel-header {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-start;
      justify-content: space-between;
      gap: 0.75rem;
      padding: 1rem 1rem 0.875rem;
      border-bottom: 1px solid rgba(229,231,235,.8);
    }
    @media (min-width: 640px) { .panel-header { padding: 1rem 1.25rem 0.875rem; } }
    @media (min-width: 1024px) { .panel-header { padding: 1rem 1.5rem 0.875rem; } }
    .panel-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; color: #030712; }
    .panel-subtitle { margin: 0.125rem 0 0; font-size: 11px; color: #6b7280; font-variant-numeric: tabular-nums; }
    @media (min-width: 640px) { .panel-subtitle { font-size: 12px; } }

    .panel-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.5rem 0.75rem;
      padding: 0.75rem 1rem;
      border-bottom: 1px solid rgba(229,231,235,.8);
    }
    @media (min-width: 640px) { .panel-toolbar { padding: 0.75rem 1.25rem; } }
    @media (min-width: 1024px) { .panel-toolbar { padding: 0.75rem 1.5rem; } }
    .toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
    .toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-left: auto; }

    .input, .select, .textarea {
      border: 1px solid #d1d5db;
      border-radius: 0.5rem;
      padding: 0.5rem 0.75rem;
      font: inherit;
      font-size: 0.875rem;
      background: #fff;
      color: #111827;
    }
    .input:focus, .select:focus, .textarea:focus {
      outline: none;
      border-color: #3b82f6;
      box-shadow: 0 0 0 2px rgba(59,130,246,.25);
    }
    .select { height: 38px; padding-top: 0; padding-bottom: 0; width: auto; min-width: 9rem; }
    .input-search { height: 38px; min-width: 12rem; flex: 1; }
    .toolbar-label { font-size: 0.8125rem; font-weight: 500; color: #4b5563; white-space: nowrap; }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.375rem;
      height: 38px;
      padding: 0 0.75rem;
      border-radius: 0.5rem;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #374151;
      font: inherit;
      font-size: 0.875rem;
      font-weight: 500;
      cursor: pointer;
      white-space: nowrap;
    }
    .btn:hover { background: #f9fafb; }
    .btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }
    .btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
    .btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
    .btn-danger { border-color: #fecaca; background: #fff; color: #b91c1c; }
    .btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
    .btn-sm { height: 32px; padding: 0 0.625rem; font-size: 0.8125rem; }
    .btn-icon {
      width: 32px;
      height: 32px;
      padding: 0;
      flex-shrink: 0;
    }
    .btn-icon svg { width: 1rem; height: 1rem; }
    .row-actions { display: flex; align-items: center; gap: 0.375rem; justify-content: flex-end; }

    /* Table */
    .table-scroll { width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
    table.data-table {
      width: 100%;
      min-width: 60rem;
      border-collapse: collapse;
      text-align: left;
      font-size: 13px;
    }
    .data-table thead tr {
      border-bottom: 1px solid rgba(229,231,235,.82);
      background: rgba(249,250,251,.92);
    }
    .data-table th {
      padding: 0.375rem 0.75rem;
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.065em;
      color: #6b7280;
      white-space: nowrap;
    }
    @media (min-width: 1024px) { .data-table th { padding: 0.375rem 1.25rem; } }
    .data-table tbody { background: #fff; }
    .data-table tbody tr {
      border-bottom: 1px solid rgba(243,244,246,.92);
      transition: background 0.15s;
    }
    .data-table tbody tr:hover { background: rgba(248,250,252,.58); }
    .data-table td {
      padding: 0.375rem 0.75rem;
      vertical-align: middle;
      color: #111827;
    }
    @media (min-width: 1024px) { .data-table td { padding: 0.375rem 1.25rem; } }
    .empty { text-align: center; color: #6b7280; padding: 2rem 1rem; }

    .row-link { color: #2563eb; font-weight: 600; }
    .row-link:hover { text-decoration: underline; }
    .site-tag { font-size: 11px; color: #6b7280; margin-top: 0.125rem; }
    .requirement, .enquiry {
      max-width: 16rem;
      overflow: hidden;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      white-space: normal;
      word-break: break-word;
      color: #374151;
    }
    .enquiry-full { margin: 0; white-space: pre-wrap; word-break: break-word; color: #111827; line-height: 1.55; }
    .contact-card .detail-dl { gap: 0.75rem 1rem; }
    .detail-dl-meta { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }

    /* Badges */
    .badge {
      display: inline-flex;
      align-items: center;
      border-radius: 0.375rem;
      padding: 0.125rem 0.5rem;
      font-size: 10px;
      font-weight: 500;
      text-transform: capitalize;
      border: 1px solid transparent;
    }
    .badge-new { border-color: rgba(191,219,254,.48); background: rgba(239,246,255,.72); color: rgba(30,58,138,.95); }
    .badge-contacted { border-color: rgba(191,219,254,.48); background: rgba(219,234,254,.72); color: #1e40af; }
    .badge-qualified { border-color: rgba(167,243,208,.48); background: rgba(209,250,229,.72); color: #065f46; }
    .badge-proposal { border-color: rgba(221,214,254,.48); background: rgba(237,233,254,.72); color: #5b21b6; }
    .badge-negotiation { border-color: rgba(253,230,138,.48); background: rgba(254,243,199,.72); color: #92400e; }
    .badge-closed { border-color: rgba(229,231,235,.48); background: rgba(243,244,246,.72); color: #374151; }
    .badge-lost { border-color: rgba(254,202,202,.48); background: rgba(254,226,226,.72); color: #991b1b; }
    .badge-active { border-color: rgba(167,243,208,.48); background: rgba(209,250,229,.72); color: #065f46; }
    .badge-inactive { border-color: rgba(229,231,235,.48); background: rgba(243,244,246,.72); color: #374151; }
    .badge-suspended { border-color: rgba(254,202,202,.48); background: rgba(254,226,226,.72); color: #991b1b; }
    .badge-planning { border-color: rgba(191,219,254,.48); background: rgba(239,246,255,.72); color: rgba(30,58,138,.95); }
    .badge-in_progress { border-color: rgba(167,243,208,.48); background: rgba(209,250,229,.72); color: #065f46; }
    .badge-on_hold { border-color: rgba(253,230,138,.48); background: rgba(254,243,199,.72); color: #92400e; }
    .badge-completed { border-color: rgba(229,231,235,.48); background: rgba(243,244,246,.72); color: #374151; }
    .badge-cancelled { border-color: rgba(254,202,202,.48); background: rgba(254,226,226,.72); color: #991b1b; }
    .badge-priority-low { border-color: rgba(229,231,235,.48); background: rgba(243,244,246,.72); color: #374151; }
    .badge-priority-medium { border-color: rgba(253,230,138,.48); background: rgba(254,243,199,.72); color: #92400e; }
    .badge-priority-high { border-color: rgba(254,215,170,.48); background: rgba(255,237,213,.72); color: #9a3412; }
    .badge-priority-urgent { border-color: rgba(254,202,202,.48); background: rgba(254,226,226,.72); color: #991b1b; }

    /* Project cards */
    .project-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 0.625rem;
      padding: 0.5rem 0.75rem 0.75rem;
    }
    @media (min-width: 768px) { .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding: 0.625rem 1rem 1rem; } }
    @media (min-width: 1280px) { .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.875rem; padding: 0.625rem 1.25rem 1rem; } }
    .project-card {
      display: flex;
      flex-direction: column;
      min-width: 0;
      border-radius: 10px;
      border: 1px solid rgba(229,231,235,.78);
      background: #fff;
      padding: 0.75rem 0.875rem;
      box-shadow: 0 1px 2px rgba(15,23,42,.04);
      transition: border-color 0.15s, box-shadow 0.15s;
      text-decoration: none;
      color: inherit;
    }
    @media (min-width: 640px) { .project-card { padding: 0.875rem 1rem; } }
    .project-card:hover {
      border-color: rgba(209,213,219,.9);
      box-shadow: 0 1px 3px rgba(15,23,42,.06);
      text-decoration: none;
    }
    .project-card-title {
      margin: 0;
      font-size: 15px;
      font-weight: 600;
      letter-spacing: -0.015em;
      line-height: 1.35;
      color: #030712;
    }
    @media (min-width: 640px) { .project-card-title { font-size: 16px; } }
    .project-card-desc {
      margin: 0.25rem 0 0;
      font-size: 11px;
      line-height: 1.4;
      color: #6b7280;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    @media (min-width: 640px) { .project-card-desc { font-size: 12px; } }
    .project-card-badges { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
    .project-card-meta { margin-top: 0.625rem; display: flex; flex-direction: column; gap: 0.25rem; font-size: 12px; color: #4b5563; }
    .project-card-meta-row { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
    .project-card-meta-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .project-card-meta-icon { width: 14px; height: 14px; flex-shrink: 0; color: #9ca3af; }
    .project-timeline { margin-top: 0.625rem; }
    .project-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
    .project-timeline-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: #6b7280; margin: 0; }
    .project-timeline-pct { font-size: 10px; color: #6b7280; font-variant-numeric: tabular-nums; margin: 0; }
    .project-timeline-bar {
      margin-top: 0.25rem;
      height: 4px;
      width: 100%;
      overflow: hidden;
      border-radius: 999px;
      background: #f3f4f6;
    }
    .project-timeline-fill { height: 100%; border-radius: 999px; background: rgba(100,116,139,.5); }

    .card {
      border-radius: 0.75rem;
      border: 1px solid rgba(229,231,235,.78);
      background: #fff;
      padding: 1.25rem 1.5rem;
      box-shadow: 0 1px 2px rgba(15,23,42,.048);
    }
    .field { margin-bottom: 1rem; }
    label { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.375rem; }
    .textarea { width: 100%; min-height: 5rem; resize: vertical; }
    .field .input, .field .select, .field .textarea { width: 100%; }

    .detail-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 1rem;
    }
    @media (min-width: 768px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
    .section-title { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; color: #111827; }
    .detail-dl {
      display: grid;
      grid-template-columns: 7rem 1fr;
      gap: 0.5rem 1rem;
      margin: 0;
      font-size: 0.9375rem;
    }
    .detail-dl dt { color: #6b7280; font-weight: 500; }
    .detail-dl dd { margin: 0; color: #111827; }
    .back-link {
      display: inline-flex;
      align-items: center;
      gap: 0.375rem;
      color: #6b7280;
      font-size: 0.875rem;
      margin-bottom: 0.75rem;
    }
    .back-link:hover { color: #2563eb; text-decoration: none; }
    .comment-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
    .comment-item {
      border: 1px solid #e5e7eb;
      border-radius: 0.5rem;
      padding: 0.875rem 1rem;
      background: #f9fafb;
    }
    .comment-meta { font-size: 0.8125rem; color: #6b7280; margin-bottom: 0.375rem; }
    .comment-body { white-space: pre-wrap; word-break: break-word; font-size: 0.9375rem; color: #111827; }

    .alert { border-radius: 0.5rem; padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.875rem; }
    .alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
    .alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
    .alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
    .muted { color: #6b7280; font-size: 0.9375rem; }

    /* Dashboard two-column layout */
    .dashboard-two-col {
      display: grid;
      grid-template-columns: 1fr;
      gap: 1rem;
      align-items: stretch;
    }
    @media (min-width: 1024px) {
      .dashboard-two-col {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        gap: 1.25rem;
      }
    }
    .dashboard-funnel-col,
    .dashboard-charts-col {
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
    }
    .dashboard-funnel-col .capture-funnel-panel,
    .dashboard-charts-col .pie-chart-panel {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
      margin: 0;
    }
    .dashboard-funnel-col .capture-funnel-panel .panel-body,
    .dashboard-charts-col .pie-chart-panel .panel-body {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-height: 0;
    }
    .dashboard-charts-col {
      gap: 0.875rem;
    }

    /* Pie charts */
    .dashboard-charts-col .pie-chart-panel .panel-body { padding: 0.75rem 1rem 1rem; }
    .dashboard-charts-col .pie-chart-layout {
      flex-direction: column;
      align-items: center;
      gap: 0.75rem;
    }
    .dashboard-charts-col .pie-chart {
      width: 6.5rem;
      height: 6.5rem;
    }
    .dashboard-charts-col .pie-legend li {
      font-size: 0.75rem;
      margin-bottom: 0.3rem;
    }
    .pie-chart-panel .panel-body { padding: 1rem 1.25rem 1.25rem; }
    .pie-chart-layout {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1rem;
    }
    @media (min-width: 480px) {
      .pie-chart-layout {
        flex-direction: row;
        align-items: center;
      }
    }
    .pie-chart {
      width: 9.5rem;
      height: 9.5rem;
      border-radius: 50%;
      flex-shrink: 0;
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    }
    .pie-chart-empty {
      display: grid;
      place-items: center;
      background: #f3f4f6;
      color: #9ca3af;
      font-size: 0.8125rem;
      font-weight: 500;
    }
    .pie-legend {
      list-style: none;
      margin: 0;
      padding: 0;
      flex: 1;
      min-width: 0;
      width: 100%;
    }
    .pie-legend li {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.8125rem;
      margin-bottom: 0.4rem;
    }
    .pie-legend li:last-child { margin-bottom: 0; }
    .pie-swatch {
      width: 0.625rem;
      height: 0.625rem;
      border-radius: 2px;
      flex-shrink: 0;
    }
    .pie-legend-label {
      flex: 1;
      min-width: 0;
      color: #374151;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .pie-legend-value {
      color: #6b7280;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    /* Capture funnel */
    .capture-funnel-panel .panel-body { padding: 1rem 1.25rem 1.25rem; }
    @media (min-width: 640px) {
      .capture-funnel-panel .panel-body { padding: 1.25rem 1.5rem 1.5rem; }
    }
    .capture-funnel-grid {
      display: grid;
      grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
      column-gap: 0.75rem;
      row-gap: 0;
      align-items: stretch;
    }
    @media (min-width: 640px) {
      .capture-funnel-grid {
        grid-template-columns: minmax(0, 13.5rem) minmax(0, 1fr);
        column-gap: 0.875rem;
      }
    }
    .funnel-segment {
      grid-column: 1;
      width: 100%;
      height: 100%;
      min-height: 0;
      clip-path: var(--funnel-clip);
      overflow: hidden;
    }
    .funnel-detail + .funnel-segment {
      margin-top: -0.5px;
    }
    .funnel-segment-body {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      padding: 0 0.75rem;
      color: #fff;
      font-size: 0.75rem;
      font-weight: 600;
      line-height: 1.2;
      text-align: center;
    }
    @media (min-width: 640px) {
      .funnel-segment-body { font-size: 0.8125rem; }
    }
    .funnel-tone-green .funnel-segment-body { background: #43a047; }
    .funnel-tone-slate .funnel-segment-body { background: #64748b; }
    .funnel-tone-sky .funnel-segment-body { background: #42a5f5; }
    .funnel-tone-teal .funnel-segment-body { background: #26a69a; }
    .funnel-tone-blue .funnel-segment-body { background: #1e88e5; }
    .funnel-tone-orange .funnel-segment-body { background: #fb8c00; }
    .funnel-tone-amber .funnel-segment-body { background: #f9a825; }
    .funnel-detail {
      grid-column: 2;
      min-width: 0;
      min-height: 0;
      height: 100%;
      padding: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .funnel-detail-title {
      margin: 0;
      font-size: 0.6875rem;
      font-weight: 600;
      color: #111827;
      line-height: 1.2;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .funnel-detail-desc {
      margin: 0.1rem 0 0;
      font-size: 0.625rem;
      color: #6b7280;
      line-height: 1.3;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    @media (min-width: 640px) {
      .funnel-detail-title { font-size: 0.75rem; }
      .funnel-detail-desc { font-size: 0.6875rem; }
    }
    .funnel-detail-stat {
      margin: 0.15rem 0 0;
      font-size: 0.6875rem;
      font-weight: 700;
      color: #111827;
      font-variant-numeric: tabular-nums;
    }
    .funnel-detail-stat span {
      font-weight: 500;
      color: #6b7280;
    }

    /* Login */
    .login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: #f9fafb; }
    .login-card { width: 100%; max-width: 24rem; }
    .login-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; font-weight: 700; color: #111827; }
  

/* ============================================================
   1. Tokens
   ============================================================ */
:root {
  --brand-50:  #FDF4F1;
  --brand-100: #FAE5DE;
  --brand-200: #F3C7B9;
  --brand-300: #E8A38C;
  --brand-400: #D97B5C;
  --brand-500: #C25738;
  --brand-600: #B8472F;
  --brand-700: #963D28;
  --brand-800: #7A3322;
  --brand-900: #5E271A;

  --navy-700: #2A3945;
  --navy-800: #1F2B35;
  --navy-900: #17212A;
  --navy-950: #111A21;

  --ink:        #1A1715;
  --ink-2:      #3D3833;
  --muted:      #6E6862;
  --muted-2:    #938C84;
  --canvas:     #F5F3F0;
  --surface:    #FFFFFF;
  --surface-2:  #FAF9F7;
  --surface-3:  #F1EEEA;
  --line:       #E6E1DA;
  --line-2:     #EFEBE5;
  --line-strong:#D6CFC5;

  --ok-50: #ECFDF3; --ok-200:#A6F0C6; --ok-600:#087443; --ok-700:#05603A;
  --warn-50:#FFFAEB; --warn-200:#FEDF89; --warn-600:#B54708; --warn-700:#93370D;
  --danger-50:#FEF3F2; --danger-200:#FECDCA; --danger-600:#B42318; --danger-700:#912018;
  --info-50:#EFF8FF; --info-200:#B2DDFF; --info-600:#175CD3; --info-700:#1849A9;
  --violet-50:#F4F3FF; --violet-200:#D9D6FE; --violet-600:#5925DC;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-full: 999px;

  --sh-xs: 0 1px 2px rgba(26,23,21,.05);
  --sh-sm: 0 1px 3px rgba(26,23,21,.07), 0 1px 2px rgba(26,23,21,.04);
  --sh-md: 0 4px 12px -2px rgba(26,23,21,.09), 0 2px 4px -2px rgba(26,23,21,.05);
  --sh-lg: 0 12px 28px -6px rgba(26,23,21,.14), 0 4px 10px -4px rgba(26,23,21,.07);
  --sh-xl: 0 24px 56px -12px rgba(26,23,21,.22), 0 8px 20px -8px rgba(26,23,21,.10);
  --sh-focus: 0 0 0 3px var(--brand-100);

  --sidebar-w: 15.5rem;
  --header-h: 4rem;

  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

/* ============================================================
   2. Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Montserrat, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { letter-spacing: -0.018em; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:where(button) { cursor: pointer; }

.icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.icon-sm { width: 1rem; height: 1rem; flex-shrink: 0; }
.icon-xs { width: .875rem; height: .875rem; flex-shrink: 0; }
.icon-lg { width: 1.375rem; height: 1.375rem; flex-shrink: 0; }

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: .5rem; left: .5rem; z-index: 200;
  padding: .5rem .875rem; border-radius: var(--r-sm);
  background: var(--ink); color: #fff; font-size: .8125rem; font-weight: 600;
  transform: translateY(-160%); transition: transform .18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* ============================================================
   3. App shell
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 55%, var(--navy-950) 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: none;
  color: rgba(255,255,255,.72);
  position: relative;
  z-index: 60;
}

.brand-block {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.125rem 1.125rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
  display: block;
  height: 2.25rem;
  width: auto;
  max-width: 10.5rem;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}
.brand-logo-on-dark {
  /* Match sprealestates footer: white wordmark on dark chrome */
  filter: brightness(0) invert(1);
}
.brand-logo-lg {
  height: 2.75rem;
  max-width: 12rem;
}
.brand-mark {
  width: 2.125rem; height: 2.125rem; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brand-500), var(--brand-700));
  color: #fff; font-weight: 700; font-size: .8125rem; letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(184,71,47,.4), inset 0 1px 0 rgba(255,255,255,.18);
}
.brand-text { min-width: 0; }
.brand-name {
  margin: 0; font-size: .875rem; font-weight: 700; color: #fff;
  letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  margin: 0; font-size: .625rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.42);
}

.sidebar-nav {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: .875rem .625rem 1rem;
  display: flex; flex-direction: column; gap: .125rem;
}
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); background-clip: content-box; }

.nav-section {
  margin: .875rem .5rem .375rem;
  font-size: .5625rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.32);
}
.nav-section:first-child { margin-top: .125rem; }

.sidebar-link {
  position: relative;
  display: flex; align-items: center; gap: .625rem;
  padding: .5625rem .6875rem;
  border-radius: var(--r-sm);
  font-size: .8125rem; font-weight: 500;
  color: rgba(255,255,255,.68);
  box-shadow: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar-link.active {
  background: rgba(184,71,47,.2);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(217,123,92,.28);
}
.sidebar-link.active::before {
  content: ""; position: absolute; left: -.625rem; top: 50%;
  width: 3px; height: 1.125rem; transform: translateY(-50%);
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--brand-400);
}
.sidebar-link .icon { width: 1.0625rem; height: 1.0625rem; opacity: .82; }
.sidebar-link.active .icon { opacity: 1; }
.nav-count {
  margin-left: auto;
  min-width: 1.375rem; padding: 0 .375rem; height: 1.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.12);
  font-size: .625rem; font-weight: 700; color: #fff;
}
.nav-count.accent { background: var(--brand-600); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: .625rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.sidebar-user-menu { position: relative; }
.sidebar-user {
  display: flex; align-items: center; gap: .625rem;
  width: 100%;
  padding: .5rem .5rem;
  border-radius: var(--r-sm);
  margin: 0;
  border: 0; background: transparent; box-shadow: none;
  cursor: pointer; text-align: left;
  color: inherit; font: inherit;
  transition: background .15s var(--ease);
}
.sidebar-user:hover,
.sidebar-user-menu.open .sidebar-user {
  background: rgba(255,255,255,.07);
}
.sidebar-user-body { min-width: 0; flex: 1; }
.sidebar-user-name {
  margin: 0; font-size: .8125rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  margin: 0; font-size: .6875rem; color: rgba(255,255,255,.46);
  text-transform: capitalize;
}
.sidebar-user-chevron {
  flex-shrink: 0;
  color: rgba(255,255,255,.4);
  transition: transform .15s var(--ease);
}
.sidebar-user-menu.open .sidebar-user-chevron { transform: rotate(180deg); }
.sidebar-user-dropdown {
  position: absolute;
  left: 0; right: 0; bottom: calc(100% + .35rem);
  padding: .35rem;
  border-radius: var(--r-md);
  background: #1a2332;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
  z-index: 40;
  display: flex; flex-direction: column; gap: .15rem;
}
.sidebar-user-dropdown[hidden] { display: none; }
.sidebar-user-menu-item {
  display: flex; width: 100%; align-items: center; gap: .5rem;
  padding: .5rem .625rem; border: 0; border-radius: var(--r-sm);
  background: none; font-size: .8125rem; font-weight: 500;
  color: rgba(255,255,255,.78); text-align: left; cursor: pointer;
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-user-menu-item .icon,
.sidebar-user-menu-item .icon-sm { width: 1rem; height: 1rem; flex-shrink: 0; }
.sidebar-user-menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-user-menu-item.danger { color: rgba(255,255,255,.62); }
.sidebar-user-menu-item.danger:hover { background: rgba(239,68,68,.16); color: #FCA5A5; }
.sidebar-user-noscript {
  display: flex; flex-direction: column; gap: .15rem;
  margin-top: .25rem; padding-top: .25rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-footer-btn {
  display: flex; width: 100%; align-items: center; gap: .5rem;
  padding: .5rem .6875rem; border: 0; border-radius: var(--r-sm);
  background: none; font-size: .8125rem; font-weight: 500;
  color: rgba(255,255,255,.62); text-align: left; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-footer-btn .icon { width: 1rem; height: 1rem; }
.sidebar-footer-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-footer-btn.danger { color: rgba(255,255,255,.62); }
.sidebar-footer-btn.danger:hover { background: rgba(239,68,68,.16); color: #FCA5A5; }

.profile-hero {
  display: flex; align-items: center; gap: .875rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.profile-hero-body { min-width: 0; }
.profile-hero-name {
  margin: 0; font-size: 1.0625rem; font-weight: 600; color: var(--text);
}
.profile-hero-meta {
  margin: .2rem 0 0; font-size: .8125rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.input[readonly], .input:disabled {
  background: var(--surface-2, #f3f4f6);
  color: var(--text-muted);
  cursor: default;
}

.content-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.top-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(160%) blur(10px);
  padding: .75rem 1rem;
  box-shadow: none;
  z-index: 40;
}
@media (min-width: 640px) { .top-header { padding: .875rem 1.5rem; } }
.top-header-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .625rem 1rem;
}
.top-header h1 {
  margin: 0; font-size: 1.125rem; font-weight: 700; color: var(--ink);
  letter-spacing: -.022em;
}
@media (min-width: 640px) { .top-header h1 { font-size: 1.3125rem; } }
.top-header-sub { margin: .0625rem 0 0; font-size: .75rem; color: var(--muted); }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.header-lead { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.nav-toggle { display: none; }
@media (max-width: 1023px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; flex-shrink: 0;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink-2);
  }
  .nav-toggle:hover { background: var(--surface-3); }
}

.main-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 1rem;
  scroll-behavior: smooth;
}
@media (min-width: 640px) { .main-scroll { padding: 1.25rem 1.5rem 2.5rem; } }
@media (min-width: 1280px) { .main-scroll { padding: 1.5rem 2rem 3rem; } }

.workspace {
  width: 100%; max-width: 96rem; margin: 0 auto;
  min-width: 0; display: flex; flex-direction: column; gap: 1rem;
}
@media (min-width: 640px) { .workspace { gap: 1.125rem; } }

/* Mobile sidebar */
.nav-scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(23,33,42,.5);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
}
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform .26s var(--ease-out);
    box-shadow: var(--sh-xl);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
}

/* ============================================================
   4. Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  height: 2.375rem; padding: 0 .875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .8125rem; font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: background .14s var(--ease), border-color .14s var(--ease),
              box-shadow .14s var(--ease), transform .1s var(--ease), color .14s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); color: var(--ink); }
.btn:active { transform: translateY(.5px); box-shadow: none; }
.btn .icon, .btn .icon-sm { width: 1rem; height: 1rem; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  border-color: var(--brand-700);
  color: #fff;
  box-shadow: 0 1px 2px rgba(120,50,32,.28), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
  border-color: var(--brand-800); color: #fff;
}
.btn-dark {
  background: var(--navy-800); border-color: var(--navy-900); color: #fff;
  box-shadow: 0 1px 2px rgba(17,26,33,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-dark:hover { background: var(--navy-900); color: #fff; }
.btn-ghost {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-soft { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.btn-soft:hover { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-800); }
.btn-danger { border-color: var(--danger-200); background: var(--surface); color: var(--danger-600); }
.btn-danger:hover { background: var(--danger-50); border-color: #FDA29B; color: var(--danger-700); }
.btn-success { border-color: var(--ok-200); background: var(--surface); color: var(--ok-600); }
.btn-success:hover { background: var(--ok-50); color: var(--ok-700); }

.btn-lg { height: 2.75rem; padding: 0 1.125rem; font-size: .875rem; border-radius: var(--r-md); }
.btn-sm { height: 2rem; padding: 0 .625rem; font-size: .75rem; }
.btn-xs { height: 1.75rem; padding: 0 .5rem; font-size: .6875rem; border-radius: var(--r-xs); }
.btn-xs .icon, .btn-xs .icon-sm { width: .875rem; height: .875rem; }
.btn-block { width: 100%; }

.btn-icon { width: 2.375rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; }
.btn-icon.btn-xs { width: 1.75rem; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none;
}

/* Inline submit spinner, toggled by the client runtime */
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 1rem; height: 1rem;
  border: 2px solid currentColor; border-radius: 50%;
  border-top-color: transparent;
  color: var(--ink-2);
  visibility: visible;
  animation: spin .6s linear infinite;
}
.btn-primary.is-busy::after, .btn-dark.is-busy::after { color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-xs); overflow: hidden;
}
.btn-group .btn {
  border: 0; border-radius: 0; box-shadow: none; background: transparent; height: 2.125rem;
}
.btn-group .btn + .btn { border-left: 1px solid var(--line); }
.btn-group .btn.active { background: var(--surface-3); color: var(--ink); }

/* ============================================================
   5. Form controls
   ============================================================ */
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: .5rem .6875rem;
  font-size: .8125rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-xs);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--sh-focus);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-3); color: var(--muted); cursor: not-allowed;
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: #FDA29B;
}
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-50); }

.select {
  height: 2.375rem; padding: 0 2rem 0 .6875rem;
  min-width: 0; width: auto;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6862' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  background-size: 1rem 1rem;
  cursor: pointer;
}
.select-sm { height: 2rem; font-size: .75rem; padding-right: 1.75rem; }
.textarea { min-height: 5.5rem; resize: vertical; line-height: 1.6; }

.field { margin-bottom: 0; display: flex; flex-direction: column; gap: .3125rem; }
.field > label, .label {
  display: flex; align-items: center; gap: .375rem;
  font-size: .75rem; font-weight: 600; color: var(--ink-2); margin: 0;
  letter-spacing: -.003em;
}
.label-req { color: var(--brand-600); font-weight: 700; }
.field-hint { margin: 0; font-size: .6875rem; color: var(--muted); line-height: 1.45; }
.field-error {
  margin: 0; font-size: .6875rem; font-weight: 600; color: var(--danger-600);
  display: flex; align-items: center; gap: .25rem;
}
.field .input, .field .select, .field .textarea { width: 100%; }

.field-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .field-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .field-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.field-span-2 { grid-column: 1 / -1; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 2.25rem; }
.input-group-icon {
  position: absolute; left: .6875rem; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none;
}
.input-group-icon .icon { width: 1rem; height: 1rem; }
.input-suffix {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  font-size: .6875rem; color: var(--muted-2); font-weight: 600;
}
.input-password .input { padding-left: .875rem; padding-right: 2.5rem; }
.input-password-toggle {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted-2); cursor: pointer;
  transition: color .14s var(--ease), background .14s var(--ease);
}
.input-password-toggle:hover { color: var(--ink); background: var(--surface-2, rgba(0,0,0,.04)); }
.input-password-toggle .pw-hide { display: none; }
.input-password.revealed .input-password-toggle .pw-show { display: none; }
.input-password.revealed .input-password-toggle .pw-hide { display: inline-flex; }

.checkbox-row {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .5rem .625rem; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface);
  cursor: pointer; transition: border-color .14s var(--ease), background .14s var(--ease);
}
.checkbox-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.checkbox-row input[type="checkbox"], .checkbox-row input[type="radio"] {
  width: 1rem; height: 1rem; margin: .1875rem 0 0; flex-shrink: 0;
  accent-color: var(--brand-600); cursor: pointer;
}
.checkbox-row-body { min-width: 0; }
.checkbox-row-label { display: block; font-size: .8125rem; font-weight: 600; color: var(--ink); }
.checkbox-row-hint { display: block; font-size: .6875rem; color: var(--muted); }
.checkbox-row:has(input:checked) { border-color: var(--brand-300); background: var(--brand-50); }

.char-count { font-size: .625rem; color: var(--muted-2); font-weight: 600; margin-left: auto; }
.char-count.over { color: var(--danger-600); }

.form-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .625rem;
  padding-top: 1rem; margin-top: .25rem;
  border-top: 1px solid var(--line-2);
}
.form-actions .spacer { flex: 1; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: .1875rem; gap: .125rem;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.segmented a, .segmented button {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .3125rem .625rem; border: 0; border-radius: var(--r-xs);
  background: transparent; font-size: .75rem; font-weight: 600;
  color: var(--muted); white-space: nowrap;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented .active {
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs);
}
.segmented .icon, .segmented .icon-sm { width: .875rem; height: .875rem; }


/* ============================================================
   6. Cards, panels, sections
   ============================================================ */
.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--sh-sm);
}
.card-tight { padding: .875rem 1rem; }
.card-flush { padding: 0; overflow: hidden; }

.panel {
  min-width: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.panel-header {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: .75rem;
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.panel-title {
  margin: 0; font-size: .875rem; font-weight: 700; color: var(--ink);
  letter-spacing: -.015em; display: flex; align-items: center; gap: .5rem;
}
.panel-title .icon, .panel-title .icon-sm { color: var(--muted); }
.panel-subtitle { margin: .125rem 0 0; font-size: .6875rem; color: var(--muted); }
.panel-body { padding: 1.125rem; }
.panel-body-tight { padding: .75rem 1rem; }
.panel-footer {
  padding: .75rem 1.125rem;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: .625rem;
}

.panel-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .75rem 1.125rem;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface);
}
.toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1; min-width: 0; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-left: auto; }
.toolbar-label { font-size: .6875rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.input-search { min-width: 12rem; flex: 1 1 14rem; max-width: 26rem; }

.section-title {
  margin: 0 0 .875rem; font-size: .8125rem; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem;
}
.section-title .icon, .section-title .icon-sm { color: var(--muted-2); }
.eyebrow {
  font-size: .625rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted-2); margin: 0 0 .25rem;
}
.muted { color: var(--muted); font-size: .8125rem; }
.back-link {
  display: inline-flex; align-items: center; gap: .375rem;
  color: var(--muted); font-size: .75rem; font-weight: 600; margin-bottom: .25rem;
  transition: color .14s var(--ease);
}
.back-link:hover { color: var(--brand-600); }
.back-link .icon, .back-link .icon-sm { width: .875rem; height: .875rem; }

.page-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
@media (min-width: 1100px) { .page-grid.main-aside { grid-template-columns: minmax(0,1fr) 21rem; gap: 1.125rem; } }
@media (min-width: 1100px) { .page-grid.aside-main { grid-template-columns: 21rem minmax(0,1fr); gap: 1.125rem; } }
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: .625rem; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .625rem; }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-dl {
  display: grid; grid-template-columns: 7.5rem minmax(0,1fr);
  gap: .5rem .875rem; margin: 0; font-size: .8125rem; align-items: baseline;
}
.detail-dl dt { color: var(--muted); font-weight: 600; font-size: .75rem; }
.detail-dl dd { margin: 0; color: var(--ink); min-width: 0; word-break: break-word; }
.detail-dl-meta { margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--line-2); }

/* ============================================================
   7. Badges, chips, pills
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: .3125rem;
  border-radius: var(--r-full);
  padding: .1875rem .5rem;
  font-size: .6875rem; font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  text-transform: none;
  border: 1px solid transparent;
}
.badge .dot { width: .375rem; height: .375rem; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge .icon, .badge .icon-sm, .badge .icon-xs { width: .75rem; height: .75rem; }
.badge-lg { padding: .3125rem .6875rem; font-size: .75rem; }

.badge-new         { background: var(--info-50);   border-color: var(--info-200);   color: var(--info-700); }
.badge-contacted   { background: #EEF4FF;          border-color: #C7D7FE;           color: #3538CD; }
.badge-qualified   { background: var(--violet-50); border-color: var(--violet-200);  color: var(--violet-600); }
.badge-proposal    { background: #FDF2FA;          border-color: #FCCEEE;           color: #C11574; }
.badge-negotiation { background: var(--warn-50);   border-color: var(--warn-200);    color: var(--warn-700); }
.badge-closed      { background: var(--ok-50);     border-color: var(--ok-200);      color: var(--ok-700); }
.badge-lost        { background: var(--danger-50); border-color: var(--danger-200);  color: var(--danger-700); }

.badge-active { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.badge-inactive { background: var(--surface-3); border-color: var(--line-strong); color: var(--muted); }
.badge-suspended { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.badge-planning { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }
.badge-in_progress { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.badge-on_hold { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.badge-completed { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink-2); }
.badge-cancelled { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.badge-priority-low { background: var(--surface-3); border-color: var(--line-strong); color: var(--muted); }
.badge-priority-medium { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }
.badge-priority-high { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.badge-priority-urgent { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }

.badge-neutral { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink-2); }
.badge-brand { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.badge-ok { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.badge-warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.badge-danger { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.badge-info { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }
.badge-outline { background: var(--surface); border-color: var(--line-strong); color: var(--muted); }

.site-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .625rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted-2); margin-top: 0;
}
.site-tag::before {
  content: ""; width: .375rem; height: .375rem; border-radius: 50%;
  background: var(--muted-2);
}
.site-spbuilder::before { background: var(--brand-500); }
.site-spconclave::before { background: #3E7EA6; }

.chip {
  display: inline-flex; align-items: center; gap: .3125rem;
  height: 1.625rem; padding: 0 .375rem 0 .5625rem;
  border-radius: var(--r-full);
  border: 1px solid var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .6875rem; font-weight: 600;
}
.chip-remove {
  display: inline-grid; place-items: center;
  width: 1.0625rem; height: 1.0625rem; border: 0; border-radius: 50%;
  background: rgba(150,61,40,.12); color: inherit;
}
.chip-remove:hover { background: rgba(150,61,40,.24); }
.chip-remove .icon, .chip-remove .icon-xs { width: .625rem; height: .625rem; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }

/* ============================================================
   8. Avatars
   ============================================================ */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  font-size: .6875rem; font-weight: 700; letter-spacing: .01em;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  user-select: none;
}
.avatar-xs { width: 1.375rem; height: 1.375rem; font-size: .5625rem; }
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: .625rem; }
.avatar-lg { width: 2.75rem; height: 2.75rem; font-size: .875rem; }
.avatar-xl { width: 3.5rem; height: 3.5rem; font-size: 1.0625rem; }
.avatar-tone-0 { background: linear-gradient(140deg,#C25738,#963D28); }
.avatar-tone-1 { background: linear-gradient(140deg,#3E7EA6,#2A5A7A); }
.avatar-tone-2 { background: linear-gradient(140deg,#5B8C5A,#3D6B3C); }
.avatar-tone-3 { background: linear-gradient(140deg,#7C6BA8,#584A80); }
.avatar-tone-4 { background: linear-gradient(140deg,#B08447,#8A6532); }
.avatar-tone-5 { background: linear-gradient(140deg,#4F6C7F,#36505F); }
.avatar-muted { background: var(--surface-3); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }

.person { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.person-body { min-width: 0; }
.person-name {
  display: block; font-size: .8125rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person-meta {
  display: block; font-size: .6875rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================
   9. Stat tiles
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .625rem; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; } }
@media (min-width: 1180px) { .stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (min-width: 1180px) { .stat-grid.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); } }

.stat {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: .5rem;
  min-width: 0;
  padding: .875rem .9375rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  transition: box-shadow .16s var(--ease), transform .16s var(--ease), border-color .16s var(--ease);
}
a.stat:hover { box-shadow: var(--sh-md); transform: translateY(-1px); border-color: var(--line-strong); }
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--line-strong); opacity: .9;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.stat-label {
  margin: 0; font-size: .625rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.stat-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 1.75rem; height: 1.75rem; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--muted);
}
.stat-icon .icon, .stat-icon .icon-sm { width: .9375rem; height: .9375rem; }
.stat-value {
  margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.1;
  letter-spacing: -.03em; color: var(--ink);
}
.stat-foot { display: flex; align-items: center; gap: .375rem; flex-wrap: wrap; }
.stat-hint { margin: 0; font-size: .6875rem; color: var(--muted); }
.stat-delta {
  display: inline-flex; align-items: center; gap: .1875rem;
  font-size: .6875rem; font-weight: 700;
}
.stat-delta .icon, .stat-delta .icon-xs { width: .75rem; height: .75rem; }
.stat-delta.up { color: var(--ok-600); }
.stat-delta.down { color: var(--danger-600); }
.stat-delta.flat { color: var(--muted); }

.stat-tone-brand::after { background: linear-gradient(90deg,var(--brand-500),var(--brand-300)); }
.stat-tone-brand .stat-icon { background: var(--brand-50); color: var(--brand-600); }
.stat-tone-info::after { background: linear-gradient(90deg,#2E90FA,#84CAFF); }
.stat-tone-info .stat-icon { background: var(--info-50); color: var(--info-600); }
.stat-tone-ok::after { background: linear-gradient(90deg,#12B76A,#6CE9A6); }
.stat-tone-ok .stat-icon { background: var(--ok-50); color: var(--ok-600); }
.stat-tone-warn::after { background: linear-gradient(90deg,#F79009,#FEC84B); }
.stat-tone-warn .stat-icon { background: var(--warn-50); color: var(--warn-600); }
.stat-tone-danger::after { background: linear-gradient(90deg,#F04438,#FDA29B); }
.stat-tone-danger .stat-icon { background: var(--danger-50); color: var(--danger-600); }
.stat-tone-violet::after { background: linear-gradient(90deg,#7A5AF8,#BDB4FE); }
.stat-tone-violet .stat-icon { background: var(--violet-50); color: var(--violet-600); }

.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 1.5rem; margin-top: .125rem; }
.sparkline-bar {
  flex: 1; min-width: 2px; border-radius: 1px 1px 0 0;
  background: var(--line-strong);
  transition: background .14s var(--ease);
}
.stat:hover .sparkline-bar { background: var(--brand-300); }
.sparkline-bar.peak { background: var(--brand-500); }

/* Meter / progress */
.meter { height: .375rem; width: 100%; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--r-full); background: var(--brand-500); transition: width .4s var(--ease-out); }
.meter-fill.ok { background: #12B76A; }
.meter-fill.warn { background: #F79009; }
.meter-fill.danger { background: #F04438; }
.meter-fill.info { background: #2E90FA; }
.meter-lg { height: .5rem; }

/* ============================================================
   10. Tables
   ============================================================ */
.table-scroll { width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
table.data-table {
  width: 100%; min-width: 52rem;
  border-collapse: separate; border-spacing: 0;
  text-align: left; font-size: .8125rem;
}
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: .5rem .875rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: .625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
  white-space: nowrap;
}
.data-table thead th:first-child { padding-left: 1.125rem; }
.data-table thead th:last-child { padding-right: 1.125rem; }
.data-table thead th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table thead th a { display: inline-flex; align-items: center; gap: .25rem; color: inherit; }
.data-table thead th a:hover { color: var(--ink); }
.data-table thead th a .icon, .data-table thead th a .icon-xs { width: .6875rem; height: .6875rem; }

.data-table tbody tr {
  background: var(--surface);
  transition: background .13s var(--ease);
}
.data-table tbody tr + tr td { border-top: 1px solid var(--line-2); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr.row-danger { background: var(--danger-50); }
.data-table tbody tr.row-warn { background: #FFFCF5; }
.data-table td {
  padding: .625rem .875rem;
  vertical-align: middle;
  color: var(--ink-2);
}
.data-table td:first-child { padding-left: 1.125rem; }
.data-table td:last-child { padding-right: 1.125rem; }
.data-table td.tight { width: 1%; white-space: nowrap; }

.cell-primary { display: flex; flex-direction: column; gap: .0625rem; min-width: 0; }
.cell-title { font-size: .8125rem; font-weight: 600; color: var(--ink); }
a.cell-title:hover { color: var(--brand-600); }
.cell-sub { font-size: .6875rem; color: var(--muted); }
.cell-stack { display: flex; flex-direction: column; gap: .25rem; min-width: 0; align-items: flex-start; }
.cell-mono { font-variant-numeric: tabular-nums; font-size: .75rem; color: var(--ink-2); }
.cell-clamp {
  max-width: 18rem; color: var(--muted);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; white-space: normal; word-break: break-word; font-size: .75rem; line-height: 1.45;
}

.lead-cell {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  min-width: 0;
  max-width: 15.5rem;
}
.lead-cell-body {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  min-width: 0;
  flex: 1;
}
.lead-cell-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
a.lead-cell-name:hover { color: var(--brand-600); }
.lead-cell-city {
  font-size: .6875rem;
  color: var(--muted);
  line-height: 1.3;
}
.lead-cell-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3125rem;
  margin-top: .1875rem;
}

.cell-contact {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  max-width: 13.5rem;
}
.cell-contact-line {
  display: flex;
  align-items: center;
  gap: .25rem;
  min-width: 0;
}
.cell-contact-phone {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cell-contact-actions {
  display: inline-flex;
  align-items: center;
  gap: .0625rem;
  flex-shrink: 0;
}
.cell-contact-email {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.row-actions { display: flex; align-items: center; gap: .25rem; justify-content: flex-end; }
.row-link { color: var(--brand-600); font-weight: 600; }
.row-link:hover { text-decoration: underline; }
.enquiry, .requirement { max-width: 18rem; }
.enquiry-full { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); line-height: 1.6; font-size: .8125rem; }

/* Card layout for narrow screens */
@media (max-width: 767px) {
  .table-responsive table.data-table { min-width: 0; }
  .table-responsive thead { display: none; }
  .table-responsive tbody tr {
    display: grid; grid-template-columns: 1fr;
    gap: .375rem;
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--line-2);
  }
  .table-responsive tbody tr + tr td { border-top: 0; }
  .table-responsive td { padding: 0 !important; display: flex; gap: .625rem; align-items: baseline; }
  .table-responsive td::before {
    content: attr(data-label);
    flex: 0 0 5.5rem;
    font-size: .625rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--muted-2);
  }
  .table-responsive td.cell-hero { display: block; }
  .table-responsive td.cell-hero::before { display: none; }
  .table-responsive td.cell-actions { justify-content: flex-start; padding-top: .25rem !important; }
  .table-responsive td.cell-actions::before { display: none; }
  .table-responsive .row-actions { justify-content: flex-start; }
  .table-responsive .cell-clamp { max-width: none; }
}

/* ============================================================
   11. Empty states
   ============================================================ */
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .8125rem; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 2.75rem 1.5rem;
  gap: .25rem;
}
.empty-art {
  display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem; margin-bottom: .625rem;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  color: var(--muted-2);
  border: 1px solid var(--line);
}
.empty-art .icon, .empty-art .icon-lg { width: 1.5rem; height: 1.5rem; }
.empty-title { margin: 0; font-size: .9375rem; font-weight: 700; color: var(--ink); }
.empty-text { margin: 0; font-size: .8125rem; color: var(--muted); max-width: 26rem; line-height: 1.55; }
.empty-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .875rem; }

/* ============================================================
   12. Skeletons
   ============================================================ */
.skeleton {
  position: relative; overflow: hidden;
  border-radius: var(--r-xs);
  background: var(--surface-3);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-text { height: .75rem; }
.sk-title { height: 1rem; border-radius: var(--r-sm); }
.sk-line-sm { height: .625rem; }
.sk-circle { border-radius: 50%; }
.sk-w-25 { width: 25%; } .sk-w-40 { width: 40%; } .sk-w-50 { width: 50%; }
.sk-w-60 { width: 60%; } .sk-w-75 { width: 75%; } .sk-w-100 { width: 100%; }
.sk-badge { height: 1.25rem; width: 4.5rem; border-radius: var(--r-full); }
.sk-stack { display: flex; flex-direction: column; gap: .375rem; }
.sk-row { display: flex; align-items: center; gap: .625rem; }

.skeleton-card {
  padding: .875rem .9375rem; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-sm);
  display: flex; flex-direction: column; gap: .625rem;
}

/* Fades content while a background fetch is in flight */
.is-loading-region { position: relative; }
.is-loading-region[aria-busy="true"] > .region-content { opacity: .4; pointer-events: none; transition: opacity .15s var(--ease); }
.region-skeleton { display: none; }
.is-loading-region[aria-busy="true"] > .region-skeleton { display: block; }
.is-loading-region[aria-busy="true"] > .region-content { display: none; }

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .main-scroll { scroll-behavior: auto; }
}


/* ============================================================
   13. Route progress bar
   ============================================================ */
#route-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  z-index: 300;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
  box-shadow: 0 0 8px rgba(184,71,47,.6);
  opacity: 0; transition: width .2s var(--ease), opacity .25s var(--ease);
  pointer-events: none;
}
#route-progress.active { opacity: 1; }

/* ============================================================
   14. Toasts
   ============================================================ */
#toast-region {
  position: fixed; z-index: 280;
  bottom: 1rem; right: 1rem;
  display: flex; flex-direction: column-reverse; gap: .5rem;
  width: min(23rem, calc(100vw - 2rem));
  pointer-events: none;
}
@media (min-width: 640px) { #toast-region { bottom: 1.25rem; right: 1.25rem; } }

.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: .625rem;
  padding: .75rem .875rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  animation: toast-in .28s var(--ease-out) both;
}
.toast.leaving { animation: toast-out .2s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.75rem) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(1rem) scale(.98); } }

.toast-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 1.375rem; height: 1.375rem; border-radius: 50%; margin-top: .0625rem;
}
.toast-icon .icon, .toast-icon .icon-sm { width: .875rem; height: .875rem; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { margin: 0; font-size: .8125rem; font-weight: 700; color: var(--ink); }
.toast-text { margin: .0625rem 0 0; font-size: .75rem; color: var(--muted); line-height: 1.45; word-break: break-word; }
.toast-close {
  flex-shrink: 0; display: grid; place-items: center;
  width: 1.375rem; height: 1.375rem; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--muted-2);
}
.toast-close:hover { background: var(--surface-3); color: var(--ink); }
.toast-close .icon, .toast-close .icon-xs { width: .75rem; height: .75rem; }
.toast::before {
  content: ""; position: absolute; left: 0; top: .625rem; bottom: .625rem;
  width: 3px; border-radius: var(--r-full);
}
.toast { position: relative; padding-left: 1rem; }
.toast-success::before { background: #12B76A; }
.toast-success .toast-icon { background: var(--ok-50); color: var(--ok-600); }
.toast-error::before { background: #F04438; }
.toast-error .toast-icon { background: var(--danger-50); color: var(--danger-600); }
.toast-warning::before { background: #F79009; }
.toast-warning .toast-icon { background: var(--warn-50); color: var(--warn-600); }
.toast-info::before { background: #2E90FA; }
.toast-info .toast-icon { background: var(--info-50); color: var(--info-600); }

/* ============================================================
   15. Alerts (inline, non-transient)
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: .625rem;
  border-radius: var(--r-md); padding: .75rem .875rem; margin: 0;
  font-size: .8125rem; line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}
.alert .icon, .alert .icon-sm { width: 1rem; height: 1rem; margin-top: .125rem; flex-shrink: 0; }
.alert-body { min-width: 0; flex: 1; }
.alert-title { margin: 0 0 .0625rem; font-weight: 700; color: inherit; font-size: .8125rem; }
.alert-error { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.alert-success { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.alert-info { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }
.alert-warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }

/* ============================================================
   16. Modals & drawers
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 250;
  display: none;
  background: rgba(23,33,42,.45);
  backdrop-filter: blur(3px);
}
.overlay.open { display: grid; place-items: center; padding: 1rem; }
.overlay.open { animation: fade-in .16s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } }

.modal {
  width: 100%; max-width: 30rem;
  max-height: calc(100dvh - 2rem);
  display: flex; flex-direction: column;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-xl);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: modal-in .24s var(--ease-out) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(1rem) scale(.97); } }
.modal-lg { max-width: 40rem; }
.modal-header {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1.125rem 1.25rem .875rem;
  border-bottom: 1px solid var(--line-2);
}
.modal-header-body { flex: 1; min-width: 0; }
.modal-title { margin: 0; font-size: .9375rem; font-weight: 700; color: var(--ink); }
.modal-sub { margin: .125rem 0 0; font-size: .75rem; color: var(--muted); line-height: 1.5; }
.modal-body { padding: 1.125rem 1.25rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-body > .field + .field { margin-top: 1rem; }
.modal-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}
.modal-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 2.25rem; height: 2.25rem; border-radius: var(--r-md);
  background: var(--surface-3); color: var(--muted);
}
.modal-icon.danger { background: var(--danger-50); color: var(--danger-600); }
.modal-icon.brand { background: var(--brand-50); color: var(--brand-600); }
.modal-icon .icon { width: 1.125rem; height: 1.125rem; }

/* Right-hand drawer (filters, quick panels) */
.overlay.drawer-overlay.open { place-items: stretch; justify-content: flex-end; padding: 0; }
.drawer {
  width: min(24rem, 100vw);
  height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--sh-xl);
  animation: drawer-in .26s var(--ease-out) both;
}
@keyframes drawer-in { from { transform: translateX(100%); } }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.125rem 1.25rem; }
.drawer-body .field + .field { margin-top: 1rem; }
.drawer-section {
  padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line-2);
}
.drawer-section:first-child { padding-top: 0; margin-top: 0; border-top: 0; }

/* ============================================================
   17. Command palette
   ============================================================ */
.overlay.palette-overlay.open { place-items: start center; padding-top: 6rem; }
.palette {
  width: min(34rem, calc(100vw - 2rem));
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-xl);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: modal-in .2s var(--ease-out) both;
}
.palette-input-wrap {
  display: flex; align-items: center; gap: .625rem;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--line-2);
}
.palette-input-wrap .icon { color: var(--muted-2); }
.palette-input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: .9375rem; color: var(--ink); padding: 0;
}
.palette-input::placeholder { color: var(--muted-2); }
.palette-list { max-height: 20rem; overflow-y: auto; padding: .375rem; }
.palette-group {
  padding: .5rem .625rem .25rem;
  font-size: .5625rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted-2);
}
.palette-item {
  display: flex; align-items: center; gap: .625rem;
  width: 100%; text-align: left;
  padding: .5rem .625rem; border: 0; border-radius: var(--r-sm);
  background: transparent; font-size: .8125rem; color: var(--ink-2);
}
.palette-item .icon, .palette-item .icon-sm { width: 1rem; height: 1rem; color: var(--muted-2); }
.palette-item:hover, .palette-item.active { background: var(--brand-50); color: var(--brand-800); }
.palette-item.active .icon { color: var(--brand-600); }
.palette-item-meta { margin-left: auto; font-size: .6875rem; color: var(--muted-2); }
.palette-empty { padding: 1.5rem 1rem; text-align: center; font-size: .8125rem; color: var(--muted); }
.palette-foot {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .875rem; border-top: 1px solid var(--line-2);
  background: var(--surface-2); font-size: .625rem; color: var(--muted-2);
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; padding: .0625rem .25rem;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--r-xs);
  background: var(--surface);
  font-family: inherit; font-size: .625rem; font-weight: 700; color: var(--muted);
}
.kbd-hint { display: none; }
@media (min-width: 900px) { .kbd-hint { display: inline-flex; } }

.palette-trigger {
  display: none; align-items: center; gap: .5rem;
  height: 2.125rem; padding: 0 .5rem 0 .6875rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted-2);
  font-size: .75rem; font-weight: 500; min-width: 12rem;
}
@media (min-width: 900px) { .palette-trigger { display: inline-flex; } }
.palette-trigger:hover { background: var(--surface); border-color: var(--line-strong); color: var(--muted); }
.palette-trigger .icon, .palette-trigger .icon-sm { width: .9375rem; height: .9375rem; }
.palette-trigger kbd { margin-left: auto; }

/* ============================================================
   18. Timeline
   ============================================================ */
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.timeline::before {
  content: ""; position: absolute; left: .8125rem; top: .5rem; bottom: .5rem;
  width: 1px; background: var(--line);
}
.timeline-item { position: relative; display: flex; gap: .75rem; padding: .5rem 0; }
.timeline-dot {
  position: relative; z-index: 1; flex-shrink: 0;
  display: grid; place-items: center;
  width: 1.625rem; height: 1.625rem; margin-top: .0625rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  box-shadow: 0 0 0 3px var(--surface);
}
.timeline-dot .icon, .timeline-dot .icon-xs { width: .8125rem; height: .8125rem; }
.timeline-dot.brand { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-600); }
.timeline-dot.ok { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-600); }
.timeline-dot.warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-600); }
.timeline-dot.danger { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-600); }
.timeline-dot.info { background: var(--info-50); border-color: var(--info-200); color: var(--info-600); }
.timeline-body { flex: 1; min-width: 0; padding-bottom: .25rem; }
.timeline-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem;
}
.timeline-title { font-size: .8125rem; font-weight: 600; color: var(--ink); }
.timeline-time { font-size: .6875rem; color: var(--muted-2); white-space: nowrap; }
.timeline-note {
  margin: .3125rem 0 0;
  padding: .5rem .6875rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: .8125rem; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; line-height: 1.55;
}
.timeline-meta { margin: .1875rem 0 0; font-size: .6875rem; color: var(--muted); }

/* Legacy comment blocks reuse the new surface treatment */
.comment-list { display: flex; flex-direction: column; gap: .625rem; margin-bottom: 1rem; }
.comment-item { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: .75rem .875rem; background: var(--surface-2); }
.comment-meta { font-size: .6875rem; color: var(--muted); margin-bottom: .25rem; }
.comment-body { white-space: pre-wrap; word-break: break-word; font-size: .8125rem; color: var(--ink-2); }

/* ============================================================
   19. Kanban pipeline board
   ============================================================ */
.board-scroll { overflow-x: auto; padding: .875rem 1.125rem 1.125rem; overscroll-behavior-x: contain; }
.board { display: flex; gap: .75rem; min-height: 24rem; align-items: flex-start; }
.board-col {
  flex: 0 0 17.5rem; width: 17.5rem;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
  max-height: calc(100dvh - 17rem);
}
.board-col-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--line-2);
}
.board-col-dot { width: .5rem; height: .5rem; border-radius: 50%; flex-shrink: 0; }
.board-col-title { margin: 0; font-size: .75rem; font-weight: 700; color: var(--ink); }
.board-col-count {
  margin-left: auto;
  min-width: 1.375rem; height: 1.25rem; padding: 0 .375rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-full); background: var(--surface-3);
  font-size: .625rem; font-weight: 700; color: var(--muted);
}
.board-col-body {
  flex: 1; min-height: 4rem; overflow-y: auto;
  padding: .5rem; display: flex; flex-direction: column; gap: .5rem;
  transition: background .15s var(--ease), box-shadow .15s var(--ease);
}
.board-col-body.drop-target {
  background: var(--brand-50);
  box-shadow: inset 0 0 0 2px var(--brand-300);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.board-empty {
  padding: 1.25rem .5rem; text-align: center;
  font-size: .6875rem; color: var(--muted-2);
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
}

.board-card {
  display: block;
  padding: .625rem .6875rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-xs);
  cursor: grab;
  transition: box-shadow .14s var(--ease), transform .14s var(--ease), border-color .14s var(--ease), opacity .14s var(--ease);
}
.board-card:hover { box-shadow: var(--sh-md); border-color: var(--line-strong); }
.board-card:active { cursor: grabbing; }
.board-card.dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); }
.board-card.is-saving { opacity: .55; pointer-events: none; }
.board-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.board-card-name { font-size: .8125rem; font-weight: 600; color: var(--ink); }
.board-card-req {
  margin: .25rem 0 0; font-size: .6875rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.board-card-foot {
  display: flex; align-items: center; gap: .375rem; flex-wrap: wrap;
  margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line-2);
  font-size: .625rem; color: var(--muted-2);
}
.board-card-foot .icon, .board-card-foot .icon-xs { width: .75rem; height: .75rem; }

/* ============================================================
   20. Pagination
   ============================================================ */
.pagination {
  display: flex; flex-wrap: wrap; align-items: center; gap: .625rem;
  padding: .75rem 1.125rem;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}
.pagination-info { font-size: .75rem; color: var(--muted); }
.pagination-info strong { color: var(--ink); font-weight: 700; }
.pagination-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  min-width: 2rem; height: 2rem; padding: 0 .5rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2);
  font-size: .75rem; font-weight: 600;
  box-shadow: var(--sh-xs);
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.page-btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.page-btn.active {
  background: var(--brand-600); border-color: var(--brand-700); color: #fff;
  box-shadow: 0 1px 2px rgba(120,50,32,.28);
}
.page-btn.disabled { opacity: .45; pointer-events: none; }
.page-btn .icon, .page-btn .icon-xs { width: .875rem; height: .875rem; }
.page-gap { padding: 0 .25rem; color: var(--muted-2); font-size: .75rem; }
.page-size { display: flex; align-items: center; gap: .375rem; font-size: .75rem; color: var(--muted); }

/* ============================================================
   21. Charts
   ============================================================ */
.funnel { display: flex; flex-direction: column; gap: .875rem; }
.funnel-row { display: flex; flex-direction: column; gap: .3125rem; }
.funnel-line { display: flex; align-items: center; gap: .875rem; }
.funnel-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .375rem; }
.funnel-meta { display: flex; align-items: baseline; gap: .625rem; }
.funnel-stage {
  font-size: .8125rem; font-weight: 600; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.funnel-count {
  margin-left: auto; flex: none;
  font-size: .8125rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.funnel-bar-track {
  height: .625rem; border-radius: var(--r-full);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%; border-radius: var(--r-full);
  transition: width .5s var(--ease-out);
}
/* Fixed gutter, so the number never sits over the fill and stays aligned down the column. */
.funnel-percent {
  flex: none; width: 2.75rem; text-align: right;
  font-size: .8125rem; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.funnel-drop {
  display: flex; align-items: center; gap: .25rem;
  margin: 0; font-size: .625rem; color: var(--muted-2); font-weight: 600;
}
.funnel-tone-1 .funnel-bar-fill { background: linear-gradient(90deg,#1F6FEB,#4A90F0); }
.funnel-tone-2 .funnel-bar-fill { background: linear-gradient(90deg,#3538CD,#6172F3); }
.funnel-tone-3 .funnel-bar-fill { background: linear-gradient(90deg,#5925DC,#875BF7); }
.funnel-tone-4 .funnel-bar-fill { background: linear-gradient(90deg,#C11574,#EE46BC); }
.funnel-tone-5 .funnel-bar-fill { background: linear-gradient(90deg,#B54708,#F79009); }
.funnel-tone-6 .funnel-bar-fill { background: linear-gradient(90deg,#087443,#12B76A); }

.donut-layout { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 480px) { .donut-layout { flex-direction: row; align-items: center; } }
.donut-wrap { position: relative; flex-shrink: 0; width: 8.5rem; height: 8.5rem; }
.donut {
  width: 100%; height: 100%; border-radius: 50%;
  mask: radial-gradient(circle, transparent 54%, #000 55%);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55%);
}
.donut-center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.donut-center-value { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.donut-center-label {
  margin: 0; font-size: .5625rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted-2);
}
.donut-empty {
  display: grid; place-items: center; background: var(--surface-3);
  color: var(--muted-2); font-size: .75rem; font-weight: 600;
}
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; width: 100%; display: flex; flex-direction: column; gap: .4375rem; }
.legend li { display: flex; align-items: center; gap: .5rem; font-size: .75rem; }
.legend-swatch { width: .625rem; height: .625rem; border-radius: 3px; flex-shrink: 0; }
.legend-label { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

.bars { display: flex; align-items: flex-end; gap: .375rem; height: 8rem; padding-top: .5rem; }
.bars-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .375rem; height: 100%; justify-content: flex-end; }
.bars-bar {
  width: 100%; max-width: 2.25rem; border-radius: var(--r-xs) var(--r-xs) 0 0;
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  min-height: 2px;
  transition: height .5s var(--ease-out), opacity .14s var(--ease);
  position: relative;
}
.bars-col:hover .bars-bar { opacity: .82; }
.bars-label { font-size: .5625rem; font-weight: 600; color: var(--muted-2); white-space: nowrap; }
.bars-value { font-size: .625rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ============================================================
   22. Login
   ============================================================ */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--canvas);
}
@media (min-width: 960px) { .auth-shell { grid-template-columns: 1fr 1fr; } }
.auth-aside {
  display: none;
  position: relative;
  padding: 3rem;
  flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1000px 500px at 15% 10%, rgba(184,71,47,.28), transparent 60%),
    linear-gradient(160deg, var(--navy-800), var(--navy-950));
  color: #fff;
  overflow: hidden;
}
@media (min-width: 960px) { .auth-aside { display: flex; } }
.auth-aside::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 3.5rem 3.5rem;
  mask-image: radial-gradient(circle at 30% 30%, #000, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 72%);
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-quote { max-width: 26rem; }
.auth-quote h2 {
  margin: 0 0 .875rem; font-size: 1.875rem; line-height: 1.22;
  font-weight: 700; letter-spacing: -.03em;
}
.auth-quote p { margin: 0; font-size: .9375rem; color: rgba(255,255,255,.68); line-height: 1.65; }
.auth-points { list-style: none; margin: 1.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .625rem; }
.auth-points li { display: flex; align-items: center; gap: .625rem; font-size: .8125rem; color: rgba(255,255,255,.8); }
.auth-points .icon { width: 1rem; height: 1rem; color: var(--brand-300); }
.auth-foot { font-size: .6875rem; color: rgba(255,255,255,.4); }

.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 24rem; }
.auth-brand { display: flex; align-items: center; gap: .625rem; margin-bottom: 1.75rem; }
.auth-card h1 { margin: 0 0 .375rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -.028em; color: var(--ink); }
.auth-card > p { margin: 0 0 1.5rem; font-size: .8125rem; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--canvas); }
.login-card { width: 100%; max-width: 24rem; }

/* ============================================================
   23. Utilities
   ============================================================ */
.hstack { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.vstack { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger-600); }
.text-ok { color: var(--ok-600); }
.text-warn { color: var(--warn-700); }
.text-xs { font-size: .6875rem; }
.text-sm { font-size: .75rem; }
.font-bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-2); border: 0; margin: 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline-flex; } }
.only-sm { display: inline-flex; }
@media (min-width: 640px) { .only-sm { display: none; } }

.tip { position: relative; }
.tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + .375rem); left: 50%;
  transform: translateX(-50%) translateY(.25rem);
  padding: .25rem .5rem; border-radius: var(--r-xs);
  background: var(--navy-900); color: #fff;
  font-size: .625rem; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .14s var(--ease), transform .14s var(--ease);
  z-index: 50;
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

@media print {
  .sidebar, .top-header, #toast-region, .panel-toolbar, .pagination, .row-actions { display: none !important; }
  .app-shell, .main-scroll { display: block; height: auto; overflow: visible; }
  .panel, .card, .stat { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
