    :root {
      --bg: #f0f4f3;
      --surface: #ffffff;
      --primary: #0d6e5f;
      --primary-light: #e8f5f2;
      --accent: #f59e0b;
      --danger: #dc2626;
      --text: #1a2e2a;
      --muted: #5c726c;
      --border: #d4e4df;
      --shadow: 0 4px 20px rgba(13, 110, 95, 0.08);
      --radius: 12px;
      --sidebar-w: 240px;
    }

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

    html {
      overflow-x: hidden;
    }

    body {
      font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      overflow-x: hidden;
    }

    body.login-mode { display: block; }

    body:not(.login-mode) {
      display: block;
    }

    #app-shell {
      display: block;
      width: 100%;
      min-height: 100vh;
      overflow-x: hidden;
    }
    #app-shell[hidden] { display: none !important; }

    .login-screen {
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: linear-gradient(145deg, #0a5a4e 0%, #0d6e5f 40%, #148f7a 100%);
    }

    .login-screen[hidden] { display: none !important; }

    .login-card {
      width: 100%;
      max-width: 400px;
      background: var(--surface);
      border-radius: var(--radius);
      padding: 32px 28px;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    }

    .login-brand {
      font-size: 1.5rem;
      font-weight: 700;
      color: var(--primary);
      text-align: center;
    }

    .login-sub {
      text-align: center;
      color: var(--muted);
      font-size: 0.9rem;
      margin: 6px 0 24px;
    }

    .login-card .form-group { margin-bottom: 16px; }

    .login-card .form-group label {
      display: block;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .login-card .form-group input {
      width: 100%;
      padding: 11px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 0.95rem;
    }

    .login-card .form-group input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(13, 110, 95, 0.15);
    }

    .btn-login {
      width: 100%;
      margin-top: 8px;
      padding: 12px;
      font-size: 1rem;
    }

    .login-error {
      color: var(--danger);
      font-size: 0.85rem;
      margin-bottom: 8px;
      text-align: center;
    }

    .role-badge {
      display: inline-block;
      margin-top: 6px;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.7rem;
      font-weight: 600;
      background: rgba(255, 255, 255, 0.15);
    }

    .role-badge.role-super { background: #f59e0b; color: #1a2e2a; }
    .role-badge.role-admin { background: #93c5fd; color: #1e3a5f; }
    .role-badge.role-sales { background: #a7f3d0; color: #065f46; }
    .role-badge.role-branch { background: #fde68a; color: #92400e; }

    .btn-logout {
      margin-top: 10px;
      width: 100%;
      padding: 8px;
      border: 1px solid rgba(255, 255, 255, 0.35);
      background: transparent;
      color: #fff;
      border-radius: 8px;
      font-size: 0.8rem;
      cursor: pointer;
    }

    .btn-logout:hover { background: rgba(255, 255, 255, 0.1); }

    .readonly-badge {
      display: inline-block;
      font-size: 0.75rem;
      color: var(--muted);
      background: #f1f5f4;
      padding: 4px 10px;
      border-radius: 6px;
      margin-left: 8px;
    }

    select:disabled, input:disabled, .card.no-drag { opacity: 0.85; cursor: not-allowed; }
    .card.no-drag { cursor: default; }
    .card.card-view-only { opacity: 0.92; border: 1px dashed var(--border); }
    .card .view-only-tag {
      font-size: 0.65rem;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }

    .col-actions { white-space: nowrap; width: 1%; }
    .lead-actions { display: flex; gap: 6px; flex-wrap: wrap; }

    .demo-banner {
      position: fixed;
      top: 0;
      left: var(--sidebar-w);
      right: 0;
      z-index: 100;
      background: linear-gradient(90deg, #0d6e5f, #148f7a);
      color: #fff;
      text-align: center;
      padding: 6px 12px;
      font-size: 0.8rem;
      letter-spacing: 0.02em;
    }

    aside {
      width: var(--sidebar-w);
      background: var(--primary);
      color: #fff;
      min-height: 100vh;
      padding: 24px 16px;
      flex-shrink: 0;
      position: fixed;
      left: 0;
      top: 0;
      display: flex;
      flex-direction: column;
    }

    .logo {
      font-weight: 700;
      font-size: 1.1rem;
      margin-bottom: 4px;
      line-height: 1.3;
    }

    .logo span { opacity: 0.75; font-size: 0.75rem; font-weight: 400; display: block; }

    .logo-datetime {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-top: 14px;
      padding: 10px 14px;
      border-radius: 12px;
      background: rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.14);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
      font-variant-numeric: tabular-nums;
      line-height: 1.2;
      white-space: nowrap;
    }

    .logo-datetime .sidebar-date {
      display: block;
      font-size: 0.82rem;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.78);
      letter-spacing: 0.02em;
    }

    .logo-datetime .sidebar-time {
      display: block;
      font-size: 0.9rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      color: #7ec8ff;
      text-shadow: 0 0 12px rgba(126, 200, 255, 0.35);
    }

    nav { margin-top: 32px; }

    nav a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 8px;
      color: rgba(255,255,255,0.85);
      text-decoration: none;
      font-size: 0.9rem;
      margin-bottom: 4px;
      cursor: pointer;
      transition: background 0.15s;
    }

    nav a:hover, nav a.active { background: rgba(255,255,255,0.15); color: #fff; }

    nav a .icon { width: 20px; text-align: center; }

    .user-box {
      margin-top: auto;
      padding-top: 24px;
      border-top: 1px solid rgba(255,255,255,0.2);
      font-size: 0.8rem;
      opacity: 0.9;
    }

    main {
      margin-left: var(--sidebar-w);
      width: calc(100vw - var(--sidebar-w));
      max-width: calc(100vw - var(--sidebar-w));
      padding: 48px 16px 24px;
      min-height: 100vh;
      overflow: visible;
    }

    .view { display: none; }
    .view.active { display: block; }

    .page-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      flex-wrap: wrap;
      gap: 16px;
      margin-bottom: 24px;
    }

    .page-header h1 { font-size: 1.5rem; font-weight: 600; }
    .page-header p { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 18px;
      border: none;
      border-radius: 8px;
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      transition: transform 0.1s, box-shadow 0.15s;
    }

    .btn-primary {
      background: var(--primary);
      color: #fff;
      box-shadow: 0 2px 8px rgba(13, 110, 95, 0.35);
    }

    .btn-primary:hover { transform: translateY(-1px); }

    .btn-ghost {
      background: var(--surface);
      color: var(--primary);
      border: 1px solid var(--border);
    }

    .btn-danger { background: var(--danger); color: #fff; }
    .btn-sm { padding: 6px 12px; font-size: 0.8rem; }

    .action-btns {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }

    .btn-delete {
      background: transparent;
      color: var(--danger);
      border: 1px solid #fecaca;
    }

    .btn-delete:hover { background: #fef2f2; }

    .btn-icon {
      width: 30px;
      height: 30px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      flex-shrink: 0;
    }

    .btn-icon svg {
      width: 16px;
      height: 16px;
      pointer-events: none;
    }

    .btn-icon.btn-ghost {
      color: var(--primary);
      border: 1px solid var(--border);
      background: var(--surface);
    }

    .btn-icon.btn-ghost:hover {
      background: var(--primary-light);
    }

    .btn-icon.btn-delete {
      color: var(--danger);
      border: 1px solid #fecaca;
    }

    .stats-row {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .stat-card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 18px;
      box-shadow: var(--shadow);
      border: 1px solid var(--border);
    }

    .stat-card.stat-card-iconed {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
    }

    .stat-card-body { flex: 1; min-width: 0; }

    .stat-card .label {
      font-size: 0.72rem;
      color: var(--muted);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      line-height: 1.35;
    }

    .stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-top: 4px; }
    .stat-card.alert .value { color: var(--danger); }

    .stat-card-icon {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .stat-card-icon svg { width: 22px; height: 22px; }

    .stat-card-icon.icon-blue { background: #dbeafe; color: #2563eb; }
    .stat-card-icon.icon-green { background: #d1fae5; color: #059669; }
    .stat-card-icon.icon-purple { background: #ede9fe; color: #7c3aed; }
    .stat-card-icon.icon-red { background: #fee2e2; color: #dc2626; }
    .stat-card-icon.icon-teal { background: #ccfbf1; color: #0d9488; }

    .dashboard-bottom-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 20px;
    }

    .dashboard-bottom-grid .panel { margin-bottom: 0; }

    .activity-timeline {
      display: flex;
      flex-direction: column;
      max-height: 360px;
      overflow-y: auto;
      padding-right: 4px;
    }

    .activity-timeline::-webkit-scrollbar { width: 5px; }
    .activity-timeline::-webkit-scrollbar-thumb { background: #c5d9d3; border-radius: 4px; }

    .timeline-item {
      display: flex;
      gap: 12px;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      align-items: flex-start;
    }

    .timeline-item:last-child { border-bottom: none; }

    .timeline-dot {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 0.95rem;
    }

    .timeline-dot.tl-new { background: #dbeafe; color: #2563eb; }
    .timeline-dot.tl-contact { background: #fef3c7; color: #d97706; }
    .timeline-dot.tl-quote { background: #ede9fe; color: #7c3aed; }
    .timeline-dot.tl-won { background: #d1fae5; color: #059669; }
    .timeline-dot.tl-lost { background: #fee2e2; color: #dc2626; }
    .timeline-dot.tl-sla { background: #fee2e2; color: #dc2626; }

    .timeline-content { flex: 1; min-width: 0; }

    .timeline-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px;
    }

    .timeline-title { font-weight: 600; font-size: 0.85rem; color: var(--text); }
    .timeline-time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
    .timeline-desc { font-size: 0.8rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }
    .timeline-extra { font-size: 0.78rem; font-weight: 600; color: var(--primary); margin-top: 4px; }

    .pipeline-head-main {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      min-width: 0;
    }

    .pipeline-head-main .status-pill {
      font-size: 0.68rem;
      padding: 2px 8px;
    }

    .pipeline-meta {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 4px 10px;
      margin-top: 8px;
      font-size: 0.76rem;
      color: var(--muted);
      line-height: 1.35;
    }

    .pipeline-meta strong {
      color: var(--text);
      font-weight: 600;
    }

    .pipeline-note,
    .pipeline-lost {
      margin-top: 6px;
      font-size: 0.76rem;
      color: var(--muted);
      line-height: 1.4;
      padding: 6px 8px;
      background: #f8faf9;
      border-radius: 6px;
      border-left: 3px solid var(--border);
    }

    .pipeline-lost {
      border-left-color: #fca5a5;
      background: #fff5f5;
    }

    .pipeline-sla {
      margin-top: 6px;
      font-size: 0.74rem;
      font-weight: 600;
      color: #92400e;
      background: #fffbeb;
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
    }

    .pipeline-sla.is-violation {
      color: #b91c1c;
      background: #fee2e2;
    }

    .timeline-empty {
      color: var(--muted);
      font-size: 0.9rem;
      padding: 8px 0;
    }

    .panel-sub {
      font-size: 0.82rem;
      color: var(--muted);
      margin: -8px 0 14px;
      line-height: 1.4;
    }

    .panel-audit {
      margin-bottom: 20px;
    }

    .audit-timeline {
      display: flex;
      flex-direction: column;
      max-height: 320px;
      overflow-y: auto;
      padding-right: 4px;
    }

    .audit-timeline::-webkit-scrollbar { width: 5px; }
    .audit-timeline::-webkit-scrollbar-thumb { background: #c5d9d3; border-radius: 4px; }

    .audit-item {
      display: flex;
      gap: 12px;
      padding: 11px 0;
      border-bottom: 1px solid var(--border);
      align-items: flex-start;
    }

    .audit-item:last-child { border-bottom: none; }

    .audit-dot {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 0.9rem;
    }

    .audit-dot.audit-login { background: #dbeafe; color: #2563eb; }
    .audit-dot.audit-logout { background: #e2e8f0; color: #475569; }
    .audit-dot.audit-customer { background: #d1fae5; color: #059669; }
    .audit-dot.audit-status { background: #ede9fe; color: #7c3aed; }
    .audit-dot.audit-export { background: #fef3c7; color: #d97706; }
    .audit-dot.audit-staff { background: #e0f2fe; color: #0369a1; }
    .audit-dot.audit-service { background: #ccfbf1; color: #0d9488; }
    .audit-dot.audit-security { background: #fee2e2; color: #dc2626; }
    .audit-dot.audit-default { background: #f1f5f4; color: var(--muted); }

    .audit-content { flex: 1; min-width: 0; }

    .audit-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px;
    }

    .audit-filters {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 12px;
    }

    .audit-filter-btn {
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 999px;
      cursor: pointer;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .audit-filter-btn:hover {
      border-color: var(--primary);
      color: var(--primary);
    }

    .audit-filter-btn.active {
      background: var(--primary);
      border-color: var(--primary);
      color: #fff;
    }

    .audit-head-main {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      min-width: 0;
    }

    .audit-operator {
      font-weight: 700;
      font-size: 0.82rem;
      color: var(--text);
    }

    .audit-category {
      font-size: 0.68rem;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 999px;
      white-space: nowrap;
    }

    .audit-category.cat-auth { background: #dbeafe; color: #1d4ed8; }
    .audit-category.cat-customer { background: #d1fae5; color: #047857; }
    .audit-category.cat-export { background: #fef3c7; color: #b45309; }
    .audit-category.cat-admin { background: #e0e7ff; color: #4338ca; }
    .audit-category.cat-other { background: #f1f5f4; color: var(--muted); }

    .audit-action {
      font-weight: 600;
      font-size: 0.82rem;
      color: var(--text);
      margin-top: 4px;
    }

    .audit-time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
    .audit-desc { font-size: 0.78rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }

    .audit-role {
      display: inline-block;
      margin-top: 5px;
      font-size: 0.7rem;
      font-weight: 600;
      color: var(--primary);
      background: var(--primary-light);
      padding: 2px 8px;
      border-radius: 999px;
    }

    .filters {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 20px;
    }

    .filters select, .filters input {
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 0.9rem;
      background: var(--surface);
    }

    .filters-bar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 20px;
    }

    .filters-bar .filters { margin-bottom: 0; }

    .filter-item {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .filter-item span {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--muted);
    }

    .filter-search input[type="search"] {
      min-width: 160px;
    }

    .filter-search input[type="search"]::-webkit-search-cancel-button {
      cursor: pointer;
    }

    .view-toggle {
      display: inline-flex;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 3px;
      gap: 2px;
    }

    .view-toggle button {
      padding: 8px 16px;
      border: none;
      background: transparent;
      border-radius: 6px;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }

    .view-toggle button.active {
      background: var(--primary);
      color: #fff;
    }

    .lead-view { display: none; }
    .lead-view.active { display: block; }

    .lead-records-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px 20px;
      flex-wrap: wrap;
      padding: 12px 16px;
      margin-bottom: 14px;
      background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
      border: 1px solid #bbf7d0;
      border-radius: 10px;
    }

    .lead-records-summary {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }

    .lead-records-count {
      font-size: 0.95rem;
      color: var(--text);
      line-height: 1.3;
    }

    .lead-records-count strong {
      font-size: 1.15rem;
      color: #15803d;
    }

    .lead-records-hint {
      font-size: 0.78rem;
      color: var(--muted);
    }

    .lead-pagination {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .lead-page-range {
      font-size: 0.85rem;
      color: var(--muted);
      white-space: nowrap;
    }

    .lead-page-range strong {
      color: var(--text);
    }

    .lead-page-btns {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .lead-page-indicator {
      font-size: 0.82rem;
      font-weight: 600;
      color: #166534;
      padding: 0 6px;
      white-space: nowrap;
    }

    .lead-page-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .lead-records-bar-bottom {
      margin-top: 14px;
      margin-bottom: 0;
      justify-content: center;
      background: #f8fafc;
      border-color: var(--border);
    }

    .lead-list-empty {
      text-align: center;
      color: var(--muted);
      padding: 28px 16px !important;
      font-size: 0.9rem;
    }

    .list-panel {
      background: var(--surface);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      border: 1px solid var(--border);
      overflow: visible;
    }

    .h-scroll-zone {
      overflow-x: visible;
      overflow-y: visible;
      border-radius: inherit;
    }

    .list-panel table { font-size: 0.85rem; }

    .list-panel table.lead-table {
      table-layout: fixed;
      width: 100%;
      min-width: 0;
      font-size: 0.78rem;
    }

    .list-panel table.lead-table th,
    .list-panel table.lead-table td {
      vertical-align: middle;
      padding: 7px 5px;
      line-height: 1.4;
    }

    .list-panel table.lead-table tbody td {
      min-height: 3.25em;
    }

    .list-panel table.lead-table .col-stt { width: 3%; }
    .list-panel table.lead-table .col-company { width: 10%; }
    .list-panel table.lead-table .col-name { width: 8%; }
    .list-panel table.lead-table .col-position { width: 4%; }
    .list-panel table.lead-table .col-phone { width: 7%; }
    .list-panel table.lead-table .col-address { width: 9%; }
    .list-panel table.lead-table .col-note { width: 7%; }
    .list-panel table.lead-table .col-service { width: 4%; }
    .list-panel table.lead-table .col-sale { width: 7%; }
    .list-panel table.lead-table .col-branch { width: 5%; }
    .list-panel table.lead-table .col-received { width: 6%; }
    .list-panel table.lead-table .col-status { width: 10%; }
    .list-panel table.lead-table .col-value { width: 7%; }
    .list-panel table.lead-table .col-sla { width: 6%; }
    .list-panel table.lead-table .col-actions { width: 5%; }

    .list-panel table.lead-table .cell-clip {
      -webkit-line-clamp: 2;
      max-height: 2.8em;
      line-height: 1.4;
    }

    .list-panel table.lead-table .badge {
      font-size: 0.68rem;
      padding: 2px 5px;
    }

    .list-panel table.lead-table .lead-actions {
      gap: 4px;
    }

    .list-panel table.lead-table .lead-actions .btn-icon {
      width: 28px;
      height: 28px;
    }

    .list-panel table.lead-table .lead-actions .btn-icon svg {
      width: 15px;
      height: 15px;
    }

    .list-panel table.lead-table .value-input {
      width: 100%;
      max-width: 88px;
      padding: 4px 5px;
      font-size: 0.72rem;
    }

    .cell-clip {
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
      text-overflow: ellipsis;
      word-break: break-word;
      line-height: 1.35;
      max-height: 2.75em;
    }

    .cell-clip.has-full-text {
      cursor: help;
    }

    .cell-clip.has-full-text:hover {
      color: var(--primary);
    }

    .list-panel table.lead-table .col-phone,
    .list-panel table.lead-table .col-received,
    .list-panel table.lead-table .col-sla,
    .list-panel table.lead-table .col-service,
    .list-panel table.lead-table .col-stt,
    .list-panel table.lead-table .col-value,
    .list-panel table.lead-table .col-actions {
      white-space: normal;
      word-break: break-word;
    }

    .list-panel table.lead-table .col-stt {
      white-space: nowrap;
    }

    .list-panel table.lead-table .cell-clip-center {
      display: flex;
      align-items: center;
      min-height: 2.8em;
      line-height: 1.4;
    }

    .list-panel table.lead-table .col-status .status-cell-wrap,
    .list-panel table.lead-table .col-value .value-cell-wrap,
    .list-panel table.lead-table .col-actions .lead-actions {
      min-height: 2.8em;
      display: flex;
      align-items: center;
    }

    .list-panel table.lead-table .col-actions .lead-actions {
      flex-wrap: nowrap;
      gap: 5px;
      justify-content: center;
    }

    .list-panel th.col-status,
    .list-panel td.col-status {
      min-width: 0;
      white-space: nowrap;
      vertical-align: middle;
    }

    .status-cell-wrap {
      display: block;
      min-width: 0;
      width: 100%;
      max-width: 100%;
    }

    .list-panel select.status-select {
      padding: 5px 22px 5px 7px;
      border: 1px solid transparent;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      min-width: 0;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
      cursor: pointer;
      transition: background-color 0.15s, border-color 0.15s, color 0.15s;
      -webkit-appearance: none;
      appearance: none;
      background-repeat: no-repeat;
      background-position: right 8px center;
      background-size: 12px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c726c' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    }

    /* Màu trạng thái — class/data-status (app.js) hoặc :has (fallback khi chưa upload JS mới) */
    .list-panel select.status-select.st-new,
    .list-panel select.status-select[data-status="new"],
    .list-panel select.status-select:has(option[value="new"]:checked) {
      background-color: #fef9c3;
      color: #854d0e;
      border-color: #fde047;
    }

    .list-panel select.status-select.st-contact,
    .list-panel select.status-select[data-status="contact"],
    .list-panel select.status-select:has(option[value="contact"]:checked) {
      background-color: #e0f2fe;
      color: #0369a1;
      border-color: #7dd3fc;
    }

    .list-panel select.status-select.st-quote,
    .list-panel select.status-select[data-status="quote"],
    .list-panel select.status-select:has(option[value="quote"]:checked) {
      background-color: #ede9fe;
      color: #5b21b6;
      border-color: #c4b5fd;
    }

    .list-panel select.status-select.st-won,
    .list-panel select.status-select[data-status="won"],
    .list-panel select.status-select:has(option[value="won"]:checked) {
      background-color: #bbf7d0;
      color: #166534;
      border-color: #4ade80;
    }

    .list-panel select.status-select.st-lost,
    .list-panel select.status-select[data-status="lost"],
    .list-panel select.status-select:has(option[value="lost"]:checked) {
      background-color: #fecaca;
      color: #991b1b;
      border-color: #f87171;
    }

    .list-panel select.status-select:disabled {
      opacity: 0.88;
      cursor: not-allowed;
    }

    .list-panel select.status-select:focus {
      outline: 2px solid rgba(13, 92, 74, 0.35);
      outline-offset: 1px;
    }

    .status-cell-wrap.has-lost-reason {
      cursor: help;
      border-bottom: 1px dotted var(--muted);
    }

    .card-lost-reason {
      color: #991b1b;
      background: #fef2f2;
      border-radius: 6px;
      padding: 6px 8px;
      font-size: 0.78rem;
      line-height: 1.35;
    }

    #modal-lost-reason textarea {
      width: 100%;
      min-height: 96px;
      resize: vertical;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-family: inherit;
      font-size: 0.9rem;
    }

    tr.row-sla td:first-child { border-left: 3px solid var(--danger); }
    tr.row-sla td.col-stt { border-left: 3px solid var(--danger); }

    td.col-stt, th.col-stt {
      width: 48px;
      text-align: center;
      color: var(--muted);
      font-weight: 600;
    }
    tr.row-sla { background: #fffbfb; }

    .sla-badge {
      color: var(--danger);
      font-size: 0.75rem;
      font-weight: 600;
      white-space: nowrap;
    }

    .list-panel table.lead-table .col-sla {
      text-align: center;
    }

    .list-panel table.lead-table .sla-badge-table {
      display: inline-block;
      white-space: normal;
      text-align: center;
      line-height: 1.25;
      font-size: 0.68rem;
      font-weight: 700;
      word-break: keep-all;
    }

    .list-panel table.lead-table .col-actions {
      text-align: center;
    }

    .status-pill {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 0.75rem;
      font-weight: 600;
    }

    .status-pill.st-new { background: #dbeafe; color: #1e40af; }
    .status-pill.st-contact { background: #fef3c7; color: #92400e; }
    .status-pill.st-quote { background: #e0e7ff; color: #3730a3; }
    .status-pill.st-won { background: #d1fae5; color: #065f46; }
    .status-pill.st-lost { background: #fee2e2; color: #991b1b; }

    /* Kanban */
    .kanban {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 14px;
      overflow: visible;
      padding-bottom: 8px;
      min-width: 0;
    }

    .kanban-scroll {
      overflow-x: visible;
      overflow-y: visible;
      padding-bottom: 4px;
    }

    .column {
      background: #e8efec;
      border-radius: var(--radius);
      min-height: 420px;
      display: flex;
      flex-direction: column;
    }

    .column-header {
      padding: 12px 14px;
      font-weight: 600;
      font-size: 0.85rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      border-radius: var(--radius) var(--radius) 0 0;
    }

    .column-header-label {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      min-width: 0;
    }

    .column-header-text {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .column-header-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      flex-shrink: 0;
      opacity: 0.92;
    }

    .column-header-icon svg {
      width: 17px;
      height: 17px;
    }

    .column-header .count {
      background: rgba(0,0,0,0.08);
      padding: 2px 8px;
      border-radius: 20px;
      font-size: 0.75rem;
    }

    .col-new .column-header { background: #dbeafe; color: #1e40af; }
    .col-contact .column-header { background: #fef3c7; color: #92400e; }
    .col-quote .column-header { background: #e0e7ff; color: #3730a3; }
    .col-won .column-header { background: #d1fae5; color: #065f46; }
    .col-lost .column-header { background: #fee2e2; color: #991b1b; }

    .column-body {
      padding: 10px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 80px;
    }

    .column-body.drag-over { background: rgba(13, 110, 95, 0.08); outline: 2px dashed var(--primary); outline-offset: -4px; border-radius: 0 0 var(--radius) var(--radius); }

    .card {
      background: var(--surface);
      border-radius: 10px;
      padding: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.06);
      border: 1px solid var(--border);
      cursor: grab;
      transition: box-shadow 0.15s;
    }

    .card:active { cursor: grabbing; }
    .card.dragging { opacity: 0.5; }

    .card.sla-violation {
      border-color: var(--danger);
      animation: pulse-red 1.2s ease-in-out infinite;
    }

    @keyframes pulse-red {
      0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); background: #fff; }
      50% { box-shadow: 0 0 12px 4px rgba(220, 38, 38, 0.35); background: #fef2f2; }
    }

    .card.lead-highlight-flash,
    tr.lead-highlight-flash {
      animation: lead-highlight-flash 0.8s ease-in-out 3;
    }

    @keyframes lead-highlight-flash {
      0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
      50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35); background: #eff6ff; }
    }

    .card h4 { font-size: 0.9rem; margin-bottom: 6px; }
    .card .meta { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
    .card .badge {
      display: inline-block;
      margin-top: 8px;
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 0.7rem;
      font-weight: 600;
      background: var(--primary-light);
      color: var(--primary);
    }

    .card .sla-tag {
      display: block;
      margin-top: 6px;
      font-size: 0.7rem;
      color: var(--danger);
      font-weight: 600;
    }

    .card .value-hd { color: var(--primary); font-weight: 700; font-size: 0.85rem; margin-top: 6px; }

    /* Dashboard alerts */
    .alert-list { display: flex; flex-direction: column; gap: 10px; }

    .alert-item {
      background: #fef2f2;
      border: 1px solid #fecaca;
      border-left: 4px solid var(--danger);
      padding: 14px 16px;
      border-radius: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }

    .panel {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 20px;
      box-shadow: var(--shadow);
      border: 1px solid var(--border);
      margin-bottom: 20px;
    }

    .panel h2 { font-size: 1rem; margin-bottom: 16px; }

    /* Reports */
    .charts-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 20px;
    }

    .chart-box h3 {
      font-size: 0.9rem;
      color: var(--muted);
      margin-bottom: 6px;
      font-weight: 600;
    }

    .chart-subtitle {
      font-size: 0.75rem;
      color: var(--muted);
      margin-bottom: 12px;
      line-height: 1.4;
    }

    .chart-empty {
      color: var(--muted);
      font-size: 0.85rem;
      padding: 12px 0;
    }

    .charts-grid .chart-box-revenue {
      grid-column: 1 / -1;
    }

    .charts-grid .chart-box-funnel {
      grid-column: 1 / -1;
    }

    @media (min-width: 900px) {
      .charts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (min-width: 1100px) {
      .charts-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
    }

    /* Doanh thu theo KD — cột ngang, cuộn khi nhiều nhân sự */
    .revenue-h-chart {
      width: 100%;
    }

    .revenue-h-chart-scroll {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-height: min(420px, 55vh);
      overflow-y: auto;
      overflow-x: hidden;
      padding-right: 4px;
      scrollbar-gutter: stable;
    }

    .revenue-h-chart-scroll::-webkit-scrollbar {
      width: 6px;
    }

    .revenue-h-chart-scroll::-webkit-scrollbar-thumb {
      background: #c5d9d3;
      border-radius: 4px;
    }

    .revenue-h-row {
      display: grid;
      grid-template-columns: minmax(88px, 28%) 1fr minmax(76px, 22%);
      align-items: center;
      gap: 10px 12px;
      font-size: 0.8rem;
      min-height: 32px;
    }

    .revenue-h-name {
      color: var(--text);
      font-weight: 500;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 1.3;
    }

    .revenue-h-track {
      background: #e8efec;
      border-radius: 5px;
      height: 24px;
      overflow: hidden;
      min-width: 0;
    }

    .revenue-h-fill {
      height: 100%;
      min-width: 0;
      border-radius: 5px;
      background: linear-gradient(90deg, #148f7a, #0d6e5f);
      transition: width 0.35s ease;
    }

    .revenue-h-amount {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--primary);
      text-align: right;
      white-space: nowrap;
    }

    .revenue-h-hint {
      margin-top: 10px;
      font-size: 0.72rem;
      color: var(--muted);
      text-align: center;
    }

    .pie-wrap {
      display: flex;
      align-items: center;
      gap: 24px;
      flex-wrap: wrap;
    }

    .pie-chart {
      width: 160px;
      height: 160px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .pie-legend { display: flex; flex-direction: column; gap: 8px; font-size: 0.8rem; padding: 0; margin: 0; }
    .pie-legend li { display: flex; align-items: center; gap: 8px; list-style: none; }
    .pie-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .pie-legend li span:not(.dot) { min-width: 0; }
    .charts-grid .chart-box .pie-legend li {
      line-height: 1.35;
    }

    .h-bar-chart { display: flex; flex-direction: column; gap: 10px; }
    .h-bar-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; font-size: 0.8rem; }
    .h-bar-track { background: #e8efec; border-radius: 4px; height: 22px; overflow: hidden; }
    .h-bar-fill { height: 100%; border-radius: 4px; transition: width 0.35s ease; }

    /* Báo cáo KPI — danh sách KH trong báo cáo */
    .report-table-hint {
      display: none;
      font-size: 0.75rem;
      color: var(--muted);
      margin: -6px 0 12px;
      line-height: 1.4;
    }

    table.report-detail-table {
      table-layout: fixed;
      width: 100%;
      min-width: 0;
      font-size: 0.82rem;
    }

    table.report-detail-table th,
    table.report-detail-table td {
      vertical-align: middle;
      padding: 9px 10px;
      line-height: 1.4;
      word-break: break-word;
    }

    table.report-detail-table tbody td {
      min-height: 2.8em;
    }

    table.report-detail-table .col-rpt-name { width: 14%; }
    table.report-detail-table .col-rpt-branch { width: 10%; }
    table.report-detail-table .col-rpt-sale { width: 11%; }
    table.report-detail-table .col-rpt-status { width: 12%; }
    table.report-detail-table .col-rpt-lost { width: 22%; }
    table.report-detail-table .col-rpt-service { width: 9%; }
    table.report-detail-table .col-rpt-value { width: 12%; }
    table.report-detail-table .col-rpt-period { width: 10%; white-space: nowrap; }

    table.report-detail-table .col-rpt-status .status-pill {
      white-space: nowrap;
    }

    table.report-detail-table .cell-clip {
      -webkit-line-clamp: 2;
      max-height: 2.8em;
      line-height: 1.4;
    }

    /* Quản lý nhân sự KD */
    table.staff-table {
      table-layout: fixed;
      width: 100%;
      min-width: 0;
      font-size: 0.82rem;
    }

    table.staff-table th,
    table.staff-table td {
      vertical-align: middle;
      padding: 9px 10px;
      line-height: 1.4;
      word-break: break-word;
    }

    table.staff-table tbody td {
      min-height: 2.8em;
    }

    table.staff-table .col-staff-name { width: 14%; }
    table.staff-table .col-staff-branch { width: 10%; }
    table.staff-table .col-staff-group { width: 12%; }
    table.staff-table .col-staff-login { width: 14%; }
    table.staff-table .col-staff-role { width: 11%; white-space: nowrap; }
    table.staff-table .col-staff-leads { width: 8%; text-align: center; }
    table.staff-table .col-staff-status { width: 10%; white-space: nowrap; }
    table.staff-table .col-staff-actions { width: 29%; }

    table.staff-table .col-staff-login code {
      font-size: 0.78rem;
      word-break: break-all;
    }

    table.staff-table .cell-clip {
      -webkit-line-clamp: 2;
      max-height: 2.8em;
      line-height: 1.4;
    }

    table.staff-table .col-staff-actions .action-btns {
      flex-wrap: nowrap;
      gap: 5px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
    }

    th, td {
      padding: 10px 12px;
      text-align: left;
      border-bottom: 1px solid var(--border);
    }

    th { background: var(--primary-light); color: var(--primary); font-weight: 600; }

    tr:hover td { background: #f8fcfb; }

    .status-active { color: #059669; font-weight: 600; }
    .status-locked { color: var(--muted); }

    /* Modal */
    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 200;
      align-items: center;
      justify-content: center;
      padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
      overflow-y: auto;
    }

    .overlay.open { display: flex; z-index: 500; }

    .modal {
      background: var(--surface);
      border-radius: var(--radius);
      width: 100%;
      max-width: 440px;
      padding: 24px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.2);
      max-height: min(90vh, calc(100dvh - 40px));
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      margin: auto;
      flex-shrink: 0;
    }

    .modal h3 { margin-bottom: 16px; font-size: 1.15rem; }

    .form-group { margin-bottom: 14px; }
    .label-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }
    .label-row label { margin-bottom: 0; }
    .modal-header-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 8px;
    }
    .modal-header-row h3 { margin-bottom: 0; }
    .sources-panel { padding: 0; overflow: hidden; }
    .sources-table { width: 100%; border-collapse: collapse; }
    .sources-table th,
    .sources-table td {
      padding: 10px 12px;
      text-align: left;
      border-bottom: 1px solid var(--border);
      font-size: 0.88rem;
    }
    .sources-table th { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
    .sources-table tr:last-child td { border-bottom: none; }
    .form-hint,
    .field-hint { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; line-height: 1.4; }
    .form-group input.input-linked {
      background: #f1f5f9;
      color: var(--text);
      cursor: default;
    }
    .form-group input.input-linked:focus {
      outline: none;
      border-color: var(--border);
      box-shadow: none;
    }
    .form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
    .form-group input, .form-group select, .form-group textarea {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 0.9rem;
      font-family: inherit;
    }

    .form-group textarea {
      resize: vertical;
      min-height: 72px;
      line-height: 1.4;
    }

    .card-note {
      font-size: 0.78rem;
      color: var(--text);
      margin-top: 8px;
      padding: 6px 8px;
      background: var(--primary-light);
      border-radius: 6px;
      line-height: 1.35;
      border-left: 3px solid var(--primary);
    }

    .col-note .cell-clip,
    .cell-clip-muted {
      color: var(--muted);
      font-size: 0.82rem;
    }

    .value-cell-wrap {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
    }

    .value-input {
      width: 128px;
      padding: 5px 8px;
      border: 1px solid var(--primary);
      border-radius: 6px;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--primary);
      background: #fff;
    }

    .value-input:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(13, 110, 95, 0.2);
    }

    .value-input::placeholder {
      font-weight: 400;
      color: #94a3b8;
    }

    .card .value-edit {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed var(--border);
    }

    .card .value-edit-label {
      display: block;
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--muted);
      margin-bottom: 4px;
    }

    .card .card-value-input {
      width: 100%;
      max-width: 120px;
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 20px;
      position: sticky;
      bottom: 0;
      z-index: 2;
      background: var(--surface);
      padding-top: 16px;
      border-top: 1px solid var(--border);
      box-shadow: 0 -10px 20px rgba(255, 255, 255, 0.92);
    }

    .toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      background: var(--text);
      color: #fff;
      padding: 12px 20px;
      border-radius: 8px;
      font-size: 0.85rem;
      z-index: 300;
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.3s, transform 0.3s;
      max-width: 320px;
    }

    .toast.show { opacity: 1; transform: translateY(0); }

    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

    /* Mobile shell */
    .mobile-topbar,
    .sidebar-overlay { display: none; }

    .mobile-menu-btn {
      width: 44px;
      height: 44px;
      border: none;
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      border-radius: 8px;
      font-size: 1.35rem;
      line-height: 1;
      cursor: pointer;
      flex-shrink: 0;
    }

    .mobile-menu-btn:active { background: rgba(255, 255, 255, 0.22); }

    @media (max-width: 1100px) {
      .kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .grid-2 { grid-template-columns: 1fr; }
      .dashboard-bottom-grid { grid-template-columns: 1fr; }
    }

    @media (max-width: 768px) {
      .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        padding: 0 12px;
        padding-top: env(safe-area-inset-top);
        background: var(--primary);
        color: #fff;
        z-index: 120;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
      }

      .mobile-topbar-title {
        font-weight: 700;
        font-size: 0.95rem;
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
      }

      body.nav-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
      }

      .demo-banner { display: none; }

      aside {
        width: min(280px, 88vw);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 160;
        padding: 20px 16px;
        padding-top: calc(16px + env(safe-area-inset-top));
      }

      body.nav-open aside { transform: translateX(0); }

      nav a { justify-content: flex-start; }

      #app-shell { width: 100%; }

      main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: calc(60px + env(safe-area-inset-top)) 12px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
      }

      .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
      }

      .page-header h1 { font-size: 1.2rem; }
      .page-header p { font-size: 0.82rem; }

      .page-header > .btn,
      .page-header > .btn-primary,
      .page-header .action-btns { width: 100%; }

      .page-header .btn { justify-content: center; }

      .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
      }

      .filters,
      .report-filters {
        flex-direction: column;
        width: 100%;
        gap: 10px;
      }

      .filters-bar .filters { margin-bottom: 0; }

      .filter-item { width: 100%; }

      .filter-item select,
      .filter-item input,
      .filters select,
      .filters input {
        width: 100%;
      }

      .view-toggle { width: 100%; }

      .view-toggle button {
        flex: 1;
        padding: 10px 8px;
        font-size: 0.8rem;
      }

      .kanban {
        display: flex;
        flex-direction: column;
        gap: 14px;
        overflow-x: visible;
        padding-bottom: 0;
      }

      .column { min-height: auto; }

      .column-body { min-height: 48px; }

      .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
      }

      .stat-card { padding: 14px; }
      .stat-card .value { font-size: 1.25rem; }
      .stat-card-icon { width: 40px; height: 40px; }
      .stat-card-icon svg { width: 18px; height: 18px; }
      .activity-timeline { max-height: 280px; }
      .pipeline-meta { grid-template-columns: 1fr; }
      .audit-filters { gap: 6px; }
      .audit-filter-btn { font-size: 0.72rem; padding: 4px 10px; }

      .charts-grid { grid-template-columns: 1fr; }

      .revenue-h-row {
        grid-template-columns: minmax(72px, 34%) 1fr minmax(64px, 26%);
        gap: 8px;
        font-size: 0.72rem;
      }

      .revenue-h-chart-scroll {
        max-height: min(360px, 50vh);
      }

      .h-bar-row {
        grid-template-columns: 82px 1fr 28px;
        gap: 8px;
        font-size: 0.72rem;
      }

      .pie-wrap {
        flex-direction: column;
        align-items: center;
      }

      .alert-item {
        flex-direction: column;
        align-items: stretch;
      }

      .alert-item .btn { width: 100%; justify-content: center; }

      .overlay {
        align-items: flex-end;
        padding: 0;
      }

      .modal {
        max-width: 100%;
        max-height: min(92vh, calc(100dvh - env(safe-area-inset-top)));
        overflow-y: auto;
        border-radius: var(--radius) var(--radius) 0 0;
        padding: 20px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
      }

      .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
        margin-top: 16px;
        padding-top: 14px;
        box-shadow: 0 -12px 24px rgba(255, 255, 255, 0.95);
      }

      .modal-actions .btn {
        width: 100%;
        justify-content: center;
      }

      .toast {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        max-width: none;
      }

      .list-panel {
        border-radius: 8px;
      }

      .h-scroll-zone {
        overflow-x: auto;
        overflow-y: clip;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
      }

      .h-scroll-zone::-webkit-scrollbar {
        height: 8px;
      }

      .h-scroll-zone::-webkit-scrollbar-thumb {
        background: #c5d9d3;
        border-radius: 4px;
      }

      .report-table-hint {
        display: block;
      }

      table.report-detail-table {
        min-width: 920px;
        font-size: 0.8rem;
      }

      table.report-detail-table th,
      table.report-detail-table td {
        padding: 8px 10px;
      }

      table.report-detail-table .col-rpt-name { width: 120px; min-width: 120px; }
      table.report-detail-table .col-rpt-branch { width: 88px; min-width: 88px; }
      table.report-detail-table .col-rpt-sale { width: 100px; min-width: 100px; }
      table.report-detail-table .col-rpt-status { width: 108px; min-width: 108px; }
      table.report-detail-table .col-rpt-lost { width: 200px; min-width: 200px; }
      table.report-detail-table .col-rpt-service { width: 80px; min-width: 80px; }
      table.report-detail-table .col-rpt-value { width: 108px; min-width: 108px; }
      table.report-detail-table .col-rpt-period { width: 84px; min-width: 84px; }

      table.staff-table {
        min-width: 900px;
        font-size: 0.8rem;
      }

      table.staff-table th,
      table.staff-table td {
        padding: 8px 10px;
      }

      table.staff-table .col-staff-name { width: 120px; min-width: 120px; }
      table.staff-table .col-staff-branch { width: 88px; min-width: 88px; }
      table.staff-table .col-staff-group { width: 100px; min-width: 100px; }
      table.staff-table .col-staff-login { width: 120px; min-width: 120px; }
      table.staff-table .col-staff-role { width: 88px; min-width: 88px; }
      table.staff-table .col-staff-leads { width: 68px; min-width: 68px; }
      table.staff-table .col-staff-status { width: 92px; min-width: 92px; }
      table.staff-table .col-staff-actions { width: 180px; min-width: 180px; }

      table.staff-table .col-staff-actions .action-btns {
        flex-direction: column;
        align-items: stretch;
      }

      table.staff-table .col-staff-actions .action-btns .btn {
        justify-content: center;
        white-space: nowrap;
        font-size: 0.75rem;
        padding: 7px 8px;
      }

      .kanban-scroll {
        overflow-x: auto;
        overflow-y: clip;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
      }

      .kanban-scroll::-webkit-scrollbar {
        height: 8px;
      }

      .kanban-scroll::-webkit-scrollbar-thumb {
        background: #c5d9d3;
        border-radius: 4px;
      }

      .list-panel table.lead-table {
        min-width: 1180px;
        font-size: 0.8rem;
      }

      .list-panel table.lead-table .cell-clip {
        -webkit-line-clamp: 2;
        max-height: 2.75em;
      }

      .list-panel th.col-status,
      .list-panel td.col-status {
        min-width: 138px;
        width: 138px;
      }

      .status-cell-wrap { min-width: 128px; }

      .list-panel select.status-select {
        min-width: 128px;
        max-width: 138px;
        width: auto;
        font-size: 0.75rem;
        padding: 6px 26px 6px 8px;
      }

      th, td { padding: 8px 10px; }

      .value-input { width: 96px; }

      .card .card-value-input { max-width: none; width: 100%; }

      .lead-actions { flex-direction: column; }

      /* Bảng danh sách KH — mobile: tách cột, không đè Trạng thái / Giá trị HĐ */
      .list-panel table.lead-table {
        min-width: 1240px;
      }

      .list-panel table.lead-table th.col-status,
      .list-panel table.lead-table td.col-status {
        width: 152px;
        min-width: 152px;
        max-width: 152px;
        white-space: normal;
        overflow: hidden;
      }

      .list-panel table.lead-table .col-status .status-cell-wrap {
        display: block;
        min-width: 0;
        min-height: 0;
        width: 100%;
        max-width: 100%;
      }

      .list-panel table.lead-table select.status-select {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        font-size: 0.72rem;
        padding: 6px 24px 6px 8px;
        box-sizing: border-box;
      }

      .list-panel table.lead-table th.col-value,
      .list-panel table.lead-table td.col-value {
        width: 112px;
        min-width: 112px;
        max-width: 112px;
        overflow: hidden;
      }

      .list-panel table.lead-table .col-value .value-cell-wrap {
        display: block;
        width: 100%;
        max-width: 100%;
        white-space: normal;
        min-width: 0;
        min-height: 0;
      }

      .list-panel table.lead-table .value-input {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 0.72rem;
        padding: 5px 6px;
      }

      .list-panel table.lead-table th.col-sla,
      .list-panel table.lead-table td.col-sla {
        width: 58px;
        min-width: 58px;
        max-width: 58px;
      }

      .list-panel table.lead-table th.col-actions,
      .list-panel table.lead-table td.col-actions {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        padding-left: 2px;
        padding-right: 2px;
      }

      .list-panel table.lead-table .col-actions .lead-actions {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 4px;
        justify-content: center;
        align-items: center;
        min-height: 0;
        padding: 2px 0;
      }

      .list-panel table.lead-table .lead-actions .btn-icon {
        width: 30px;
        height: 30px;
        border-width: 1px;
        border-radius: 6px;
        box-shadow: none;
      }

      .list-panel table.lead-table .lead-actions .btn-icon svg {
        width: 15px;
        height: 15px;
        stroke-width: 2;
      }

      .list-panel table.lead-table .lead-actions .btn-icon.btn-ghost {
        background: var(--primary-light);
        border-color: rgba(13, 110, 95, 0.35);
        color: var(--primary);
      }

      .list-panel table.lead-table .lead-actions .btn-icon.btn-delete {
        background: #fef2f2;
        border-color: #f87171;
        color: #dc2626;
      }

      .action-btns {
        flex-direction: column;
        align-items: stretch;
      }

      .action-btns .btn { justify-content: center; }

      .btn-sm { padding: 9px 12px; }

      .panel { padding: 16px; }
    }

    @media (max-width: 480px) {
      .stats-row { grid-template-columns: 1fr; }

      .list-panel table.lead-table .lead-actions .btn-icon {
        width: 32px;
        height: 32px;
      }

      .list-panel table.lead-table .lead-actions .btn-icon svg {
        width: 16px;
        height: 16px;
      }

      .login-card {
        padding: 24px 18px;
        margin: 0 4px;
      }

      .login-screen { padding: 16px; }
    }
