/* ============================================
   INFRATRACK REVAMP
   PulaSpace-Inspired Premium Enterprise UI
   ============================================ */

/* ─────────────────────────────────────────────
   1. UPSCALE FONT SIZES + SPACING TOKENS
   ───────────────────────────────────────────── */
:root {
    --font-size-xs:   13px;
    --font-size-sm:   14px;
    --font-size-base: 16px;
    --font-size-lg:   18px;
    --font-size-xl:   20px;
    --font-size-2xl:  22px;
    --font-size-3xl:  26px;
    --font-size-4xl:  34px;

    /* Semantic spacing system */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;
}

/* ─────────────────────────────────────────────
   2. BODY & FONT ENFORCEMENT
   ───────────────────────────────────────────── */
body, input, textarea, select, button {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-weight: 500;
    font-size: var(--font-size-base);
}

/* ─────────────────────────────────────────────
   3. BRAND LOCKUP (logo area in sidebar)
   ───────────────────────────────────────────── */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0;
    text-decoration: none;
}

.brand-lockup svg { width: 36px; height: 36px; flex: 0 0 auto; }

.brand-name {
    font-size: 20px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* Logo image — always white on dark sidebar */
.brand-logo-img {
    width: auto;
    height: 52px;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
    transition: opacity 0.2s;
}

@media (max-width: 768px) {
    .brand-logo-img { height: 38px; }
}

/* ─────────────────────────────────────────────
   4. SIDEBAR — ALWAYS DARK (light AND dark mode)
   ───────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.28) !important;
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    padding-right: 16px;
}

[data-theme="dark"] .sidebar {
    background: var(--sidebar-bg) !important;
    border-right-color: rgba(255, 255, 255, 0.04) !important;
    box-shadow: 4px 0 36px rgba(0, 0, 0, 0.45) !important;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding-bottom: 22px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .sidebar-header {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* ─────────────────────────────────────────────
   5. NAVIGATION ITEMS
   ───────────────────────────────────────────── */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55) !important;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.16s, color 0.16s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item svg,
.nav-item .icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.88) !important;
    transform: none;
}

.nav-item.active {
    background: rgba(30, 91, 255, 0.2) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 var(--blue) !important;
    font-weight: 700;
}

.nav-item.active svg,
.nav-item.active .icon { opacity: 1; }

/* Nav section labels */
.nav-section-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.25);
    padding: 18px 14px 7px;
    display: block;
}

/* Sidebar user area at bottom */
.sidebar-user {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─────────────────────────────────────────────
   6. MAIN CONTENT
   ───────────────────────────────────────────── */
.main-content {
    background: var(--bg) !important;
    padding: 24px !important;
    padding-bottom: max(32px, env(safe-area-inset-bottom, 32px));
}

[data-theme="dark"] .main-content {
    background: var(--bg) !important;
}

/* ─────────────────────────────────────────────
   7. PAGE / DASHBOARD HEADER HERO
   ───────────────────────────────────────────── */
.page-hero,
.dashboard-header {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-hero h1,
.dashboard-header h1 {
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.4px;
}

[data-theme="dark"] .page-hero,
[data-theme="dark"] .dashboard-header {
    background: var(--card);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .page-hero h1,
[data-theme="dark"] .dashboard-header h1 { color: var(--ink); }

/* ─────────────────────────────────────────────
   8. CARDS
   ───────────────────────────────────────────── */
.card,
.stat-card,
.modal-content {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: rgba(30, 91, 255, 0.2);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1.5px solid var(--line);
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.card-body {}

.card-footer {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1.5px solid var(--line);
    margin-top: 4px;
}

/* Cards grid spacing */
.card { margin-bottom: 16px; }
.grid-2, .grid-3, .grid-4 { gap: 16px; }

[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .modal-content {
    background: var(--card);
    border-color: var(--line);
}

[data-theme="dark"] .card-header { border-color: var(--line); }
[data-theme="dark"] .card-footer { border-color: var(--line); }

/* ─────────────────────────────────────────────
   9. STAT CARDS
   ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    transition: box-shadow 0.22s, border-color 0.22s, transform 0.18s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--blue);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -22px;
    top: -22px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(30, 91, 255, 0.07);
}

.stat-card h4 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--ink);
    margin: 0 0 4px;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--ink-3);
    font-weight: 500;
}

[data-theme="dark"] .stat-card h4  { color: var(--ink-3); }
[data-theme="dark"] .stat-value    { color: var(--ink); }
[data-theme="dark"] .stat-label    { color: var(--ink-3); }

/* ─────────────────────────────────────────────
   10. BUTTONS (override global)
   ───────────────────────────────────────────── */
.btn {
    font-weight: 700;
    letter-spacing: 0.15px;
    border-radius: var(--radius-md);
    height: 40px;
    padding: 0 18px;
    font-size: 13px;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.14s;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--blue-shadow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-d);
    border-color: var(--blue-d);
    box-shadow: 0 4px 18px var(--blue-shadow);
    transform: translateY(-1px);
    filter: none;
}

.btn-secondary {
    background: var(--card);
    color: var(--ink-2);
    border: 1.5px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--blue);
    color: var(--blue);
}

[data-theme="dark"] .btn-secondary {
    background: var(--bg-secondary);
    color: var(--ink-2);
    border-color: var(--line);
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
    border-color: var(--blue);
    color: var(--blue);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    box-shadow: 0 2px 10px rgba(220,38,38,0.22);
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(220,38,38,0.3);
}

.btn-icon {
    width: 40px;
    height: 40px;
    min-width: unset;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ─────────────────────────────────────────────
   11. FORM INPUTS
   ───────────────────────────────────────────── */
.input-clean,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
    border-color: var(--line);
    border-radius: var(--radius-md);
    background: var(--card);
    height: 40px;
    font-weight: 500;
    color: var(--ink);
    border-width: 1.5px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

/* Specific Search Input Padding Override */
#dashSearch,
#dashSearch:not([type="checkbox"]),
.search-wrap input:not([type="checkbox"]),
.search-inline input:not([type="checkbox"]),
.workspace-search input:not([type="checkbox"]) {
    padding-left: 52px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
    text-indent: 0 !important;
}

textarea { height: auto; min-height: 96px; padding: 12px 14px; }

input:focus:not([type="checkbox"]):not([type="radio"]),
textarea:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-l);
    outline: none;
}

select {
    /* keep the default chevron SVG from global.css; only hide for .select-wrap which has its own positioned arrow */
    padding-right: 40px;
}

/* Wrapped selects use positioned chevron, so hide the background one */
.select-wrap select {
    background-image: none !important;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--bg-secondary);
    border-color: var(--line);
    color: var(--ink);
}

/* Select wrapper */
.select-wrap { position: relative; }
.select-wrap select { padding-right: 44px; min-width: 140px; }

.select-wrap .select-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    pointer-events: none;
}

/* Input with icon wrapper */
.input-wrapper { position: relative; }
.input-wrapper input { padding-right: 48px; }

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--ink-3);
    display: grid;
    place-items: center;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.18s, background 0.18s;
}

.password-toggle:hover { color: var(--blue); background: var(--blue-l); }

/* ─────────────────────────────────────────────
   12. CHARTS
   ───────────────────────────────────────────── */
.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 20px;
    margin-bottom: 24px;
}

.bar-chart { display: flex; flex-direction: column; gap: 0; }

.budget-bar-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.budget-bar-item:last-child { border-bottom: none; }

.bbi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.bbi-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.bbi-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--blue);
    white-space: nowrap;
    flex-shrink: 0;
}

.bbi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
}

.bbi-sub { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.bbi-pct { font-size: 12px; font-weight: 800; color: var(--blue); }

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr auto;
    gap: 12px;
    align-items: center;
}

.bar-track,
.progress-track {
    height: 8px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill,
.progress-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .bar-track,
[data-theme="dark"] .progress-track { background: var(--bg-tertiary); }

/* Donut chart */
.donut {
    --pct: 50;
    width: 180px;
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 12px auto;
    background: conic-gradient(var(--blue) calc(var(--pct) * 1%), var(--line) 0);
    display: grid;
    place-items: center;
}

.donut::after {
    content: attr(data-label);
    width: 108px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--card);
    display: grid;
    place-items: center;
    color: var(--ink);
    font-weight: 800;
    font-size: 18px;
}

[data-theme="dark"] .donut {
    background: conic-gradient(var(--blue) calc(var(--pct) * 1%), var(--bg-tertiary) 0);
}
[data-theme="dark"] .donut::after { background: var(--card); color: var(--ink); }

/* ─────────────────────────────────────────────
   13. PROJECT CARDS
   ───────────────────────────────────────────── */
.project-card {
    display: flex;
    flex-direction: column;
    min-height: 240px;
}

.project-card .card-footer { margin-top: auto; justify-content: flex-end; }

.project-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.metric-box {
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--bg);
    transition: border-color 0.18s;
}

.metric-box:hover { border-color: rgba(30,91,255,0.22); }

.metric-box span {
    display: block;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-box strong {
    display: block;
    margin-top: 5px;
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
}

[data-theme="dark"] .metric-box           { background: var(--bg-secondary); border-color: var(--line); }
[data-theme="dark"] .metric-box span      { color: var(--ink-3); }
[data-theme="dark"] .metric-box strong    { color: var(--ink); }

/* ─────────────────────────────────────────────
   14. TABS
   ───────────────────────────────────────────── */
.tab-list {
    display: inline-flex;
    gap: 4px;
    background: var(--bg);
    border: 1.5px solid var(--line);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-list::-webkit-scrollbar { display: none; }

.tab-button {
    border: none;
    background: transparent;
    color: var(--ink-3);
    padding: 9px 16px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.tab-button:hover:not(.active) {
    background: rgba(30,91,255,0.07);
    color: var(--ink-2);
}

.tab-button.active {
    background: var(--blue);
    color: #ffffff !important;
    box-shadow: 0 2px 8px var(--blue-shadow);
    font-weight: 700;
}

.tab-button:not(.active) { color: var(--ink-3); background: transparent; }

[data-theme="dark"] .tab-list             { background: var(--bg-secondary); border-color: var(--line); }
[data-theme="dark"] .tab-button:not(.active) { color: var(--ink-3); }
[data-theme="dark"] .tab-button.active    { background: var(--blue); color: #fff !important; }

/* ─────────────────────────────────────────────
   15. FILE DROP ZONE
   ───────────────────────────────────────────── */
.file-drop {
    border: 2px dashed var(--line);
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.file-drop:hover {
    border-color: var(--blue);
    background: var(--blue-l);
}

/* ─────────────────────────────────────────────
   16. PERMISSION PILLS
   ───────────────────────────────────────────── */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }

.permission-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    transition: border-color 0.18s, color 0.18s;
}

.permission-pill:hover { border-color: var(--blue); color: var(--blue); }

[data-theme="dark"] .permission-pill {
    background: var(--bg-secondary);
    border-color: var(--line);
    color: var(--ink-2);
}

/* ─────────────────────────────────────────────
   17. SETTINGS LAYOUT
   ───────────────────────────────────────────── */
.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
    gap: 24px;
}

/* ─────────────────────────────────────────────
   18. PLAN CARDS (upgrade page)
   ───────────────────────────────────────────── */
.plan-card {
    position: relative;
    overflow: hidden;
}

.plan-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--blue);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.plan-card .plan-price,
.plan-card .card-body > p:first-child {
    font-size: 2rem !important;
    font-weight: 800 !important;
    color: var(--blue) !important;
    margin-bottom: 16px;
}

[data-theme="dark"] .plan-card .plan-price,
[data-theme="dark"] .plan-card .card-body > p:first-child {
    color: var(--blue) !important;
}

.plan-feature {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    color: var(--ink-2);
}
.plan-feature:last-child { border-bottom: 0; }

[data-theme="dark"] .plan-feature { color: var(--ink-2); border-color: var(--line); }

/* ─────────────────────────────────────────────
   19. PREFERENCE ROWS (settings toggles)
   ───────────────────────────────────────────── */
.preference-list { display: grid; gap: 12px; }

.preference-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--bg);
    transition: border-color 0.18s;
}

.preference-row:hover { border-color: rgba(30,91,255,0.2); }
.preference-row label { margin: 0; font-weight: 700; color: var(--ink); font-size: 14px; }
.preference-row p     { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }

[data-theme="dark"] .preference-row { background: var(--bg-secondary); border-color: var(--line); }

/* ─────────────────────────────────────────────
   20. SWITCH TOGGLE
   ───────────────────────────────────────────── */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex: 0 0 auto;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--line);
    cursor: pointer;
    transition: 0.2s;
}

.switch span::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(10,15,30,0.2);
}

.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::before { transform: translateX(20px); }

/* ─────────────────────────────────────────────
   21. BACK BUTTON
   ───────────────────────────────────────────── */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1.5px solid var(--line);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all 0.18s;
    cursor: pointer;
}

.back-btn:hover {
    background: var(--blue);
    color: #ffffff;
    border-color: var(--blue);
}

[data-theme="dark"] .back-btn {
    background: var(--bg-secondary);
    border-color: var(--line);
    color: var(--ink-2);
}

[data-theme="dark"] .back-btn:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ─────────────────────────────────────────────
   22. BADGES (override)
   ───────────────────────────────────────────── */
.badge {
    border-radius: 999px;
    font-size: 11px;
    padding: 3px 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────
   23. ICON SIZING
   ───────────────────────────────────────────── */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn .icon     { width: 16px; height: 16px; }
.btn-icon .icon { width: 18px; height: 18px; }

/* ─────────────────────────────────────────────
   24. MOBILE MENU BUTTON (desktop: hidden)
   ───────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 16px));
    left: max(16px, env(safe-area-inset-left, 16px));
    z-index: 1100;
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--sidebar-bg);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: background 0.18s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active { transform: scale(0.93); }
.mobile-menu-btn .icon { width: 24px; height: 24px; stroke: #fff; }

/* ─────────────────────────────────────────────
   25. SIDEBAR BACKDROP
   ───────────────────────────────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ─────────────────────────────────────────────
   26. MOBILE BOTTOM NAV (hidden desktop)
   ───────────────────────────────────────────── */
.bottom-nav { display: none; }

/* ─────────────────────────────────────────────
   27. PROJECT INFO ROWS
   ───────────────────────────────────────────── */
.project-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.project-info-row:last-of-type { border-bottom: none; }

.proj-info-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-3);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.proj-info-label .icon { width: 13px; height: 13px; opacity: 0.7; }

.proj-info-value {
    font-weight: 700;
    color: var(--ink);
    font-size: 14px;
    text-align: right;
    word-break: break-word;
}

/* Project action buttons */
.project-card-actions { display: flex; gap: 10px; }

.proj-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-md);
}
.proj-action-btn .icon { width: 16px; height: 16px; }

/* ─────────────────────────────────────────────
   28. DASHBOARD PROJECT CARDS (mobile)
   ───────────────────────────────────────────── */
.dash-project-card {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: box-shadow 0.18s, border-color 0.18s;
}

.dash-project-card:hover {
    border-color: rgba(30,91,255,0.2);
    box-shadow: var(--shadow-md);
}

.dash-project-card:active { transform: scale(0.98); }

.dash-project-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.dash-project-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.3;
    word-break: break-word;
    flex: 1;
}

.dash-project-loc {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--ink-3);
    font-weight: 600;
    margin-bottom: 12px;
}
.dash-project-loc .icon { width: 13px; height: 13px; }

.dash-project-prog { margin-bottom: 12px; }

.dash-project-budget {
    display: flex;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.dash-project-budget span {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-project-budget span:last-child { text-align: right; }
.dash-project-budget strong { font-size: 15px; font-weight: 800; color: var(--ink); }
.dash-project-budget small {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ink-3);
    letter-spacing: 0.4px;
}

.dash-project-empty {
    text-align: center;
    padding: 32px 0;
    color: var(--ink-3);
    font-size: 15px;
}

.mobile-top-bar { display: none; }

/* ─────────────────────────────────────────────
   29. TABLE POLISH
   ───────────────────────────────────────────── */
th {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--ink-3);
}

td { font-weight: 500; }

[data-theme="dark"] .bbi-value { color: var(--blue); }
[data-theme="dark"] .bbi-pct   { color: var(--blue); }
[data-theme="dark"] .bbi-sub   { color: var(--ink-3); }
[data-theme="dark"] .dash-project-card { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .card-body p,
[data-theme="dark"] .card-body strong  { color: var(--ink); }
[data-theme="dark"] .text-muted,
[data-theme="dark"] p.text-muted       { color: var(--ink-3); }

/* ─────────────────────────────────────────────
   30. SMOOTH TRANSITIONS
   ───────────────────────────────────────────── */
.card, .stat-card, .nav-item, .btn, .modal-content,
input, textarea, select, .badge, .tab-button, .sidebar, .main-content {
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: 0.22s;
    transition-timing-function: ease;
}

/* ─────────────────────────────────────────────
   31. CONFIRM MODAL
   ───────────────────────────────────────────── */
.confirm-modal .modal-content { max-width: 440px; }

/* ─────────────────────────────────────────────
   32. DASHBOARD HEADER (flex override)
   ───────────────────────────────────────────── */
.dashboard-header,
.page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─────────────────────────────────────────────
   RESPONSIVE — 900px breakpoint
   ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .chart-grid, .settings-layout {
        grid-template-columns: 1fr;
    }
    .bar-row { grid-template-columns: 1fr; }
    .flex-between, .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }
    .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — 768px mobile breakpoint
   ───────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Show hamburger */
    .mobile-menu-btn { display: flex; }

    /* Content top padding for top bar */
    .main-content {
        padding-top: max(76px, calc(env(safe-area-inset-top, 0px) + 70px));
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Page headers: stack on mobile */
    .dashboard-header, .page-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px 18px;
        margin-bottom: 16px;
    }

    .dashboard-header h1,
    .page-hero h1 { font-size: 22px; }

    .dashboard-header > .btn,
    .page-hero > .btn,
    .dashboard-header button,
    .page-hero button {
        width: 100% !important;
        justify-content: center;
        padding: 0 20px;
    }

    /* Stats: 2 columns */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card    { padding: 14px 12px; border-radius: 12px; }
    .stat-value   { font-size: 1.4rem; }
    .stat-card h4 { font-size: 9px; margin-bottom: 6px; }
    .stat-label   { font-size: 11px; }

    /* Grids: single column */
    .grid-2 { grid-template-columns: 1fr; }
    #projectsGrid.grid-2    { grid-template-columns: 1fr; }
    #suppliersGrid.grid-2   { grid-template-columns: 1fr; }

    /* Card headers: wrap */
    .card-header { flex-wrap: wrap; gap: 10px; }
    .card-header input[type="text"],
    .projects-filters input,
    .projects-filters select { width: 100%; }

    /* Table: scroll */
    .card-body, .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table { min-width: 560px; font-size: 13px; }
    th, td { padding: 10px 12px; white-space: nowrap; }

    /* Bottom nav */
    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--sidebar-bg);
        border-top: 1px solid rgba(255,255,255,0.07);
        z-index: 1000;
        box-shadow: 0 -6px 24px rgba(0,0,0,0.22);
        align-items: stretch;
    }

    [data-theme="dark"] .bottom-nav {
        background: #080c16;
        border-top-color: rgba(255,255,255,0.05);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: rgba(255,255,255,0.42);
        text-decoration: none;
        font-family: 'Raleway', sans-serif;
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        padding: 6px 2px;
        transition: color 0.18s;
        -webkit-tap-highlight-color: transparent;
        background: none;
        border: none;
        cursor: pointer;
    }

    .bottom-nav-item .icon { width: 22px; height: 22px; stroke-width: 1.8; }
    .bottom-nav-item.active { color: var(--blue) !important; }
    .bottom-nav-item:active { transform: scale(0.88); }

    /* Modal: slide up from bottom */
    .modal { align-items: flex-end; padding: 0; }
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 92vh;
        max-height: 92dvh;
        animation: slideUpModal 0.3s cubic-bezier(0.22,1,0.36,1);
    }

    @keyframes slideUpModal {
        from { transform: translateY(40px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .modal-header { border-radius: 20px 20px 0 0; }

    /* Tabs: horizontal scroll */
    .tab-list {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        border-radius: 10px;
        scrollbar-width: none;
        margin-bottom: 16px;
    }
    .tab-button { flex-shrink: 0; padding: 9px 14px; font-size: 12px; }

    /* Charts / settings: single column */
    .chart-grid, .settings-layout { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; gap: 5px; }

    /* Button & input sizes  */
    .btn       { height: 52px; padding: 0 20px; font-size: 15px; }
    .btn-small { height: 40px; padding: 0 14px; font-size: 13px; }
    .btn-icon  { width: 48px; height: 48px; }

    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select { height: 52px; }

    /* Metric boxes */
    .project-meta { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Filters: stack vertically */
    .projects-filters { flex-direction: column; }

    /* Pills */
    .pill-list { gap: 6px; }
    .permission-pill { font-size: 13px; padding: 7px 10px; }

    /* Sidebar hidden drawer */
    .sidebar {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1050 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.22,1,0.36,1) !important;
        overflow-y: auto !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 48px rgba(0,0,0,0.4) !important;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.3rem; }
    h1 { font-size: var(--font-size-3xl); }
    h2 { font-size: var(--font-size-2xl); }
    h3 { font-size: var(--font-size-xl); }
}

/* ─────────────────────────────────────────────
   STATUS SELECT fixes
   ───────────────────────────────────────────── */
#filterStatus, select#filterStatus { min-width: 160px; padding-right: 44px; }
.select-wrap select                 { min-width: 140px; padding-right: 44px; }

/* ─────────────────────────────────────────────
   NOTIFICATION CARD HEADERS
   ───────────────────────────────────────────── */
#notificationsList .card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

#notificationsList .card-header > div:last-child {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   DARK MODE TABLE ROWS
   ───────────────────────────────────────────── */
[data-theme="dark"] th { background: var(--bg-secondary); color: var(--ink-3); }
[data-theme="dark"] tr:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] tr:hover td { background: rgba(255,255,255,0.03); }

/* ─────────────────────────────────────────────
   DARK MODE STAT CARD ACCENT
   ───────────────────────────────────────────── */
[data-theme="dark"] .stat-card::after { background: rgba(30,91,255,0.1); }
