/* ============================================================
   ARISE TRACKER — Master Stylesheet
   Dark theme only. No gradients. No decorations. Data is hero.
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    /* Background layers */
    --bg:         #0a0a0f;
    --surface:    #111118;
    --surface-2:  #16161f;

    /* Borders */
    --border:     rgba(255, 255, 255, 0.06);
    --border-2:   rgba(255, 255, 255, 0.10);

    /* Text */
    --ink:        #ffffff;
    --ink-2:      rgba(255, 255, 255, 0.55);
    --ink-3:      rgba(255, 255, 255, 0.28);

    /* Semantic colours */
    --green:      #22c55e;
    --green-dim:  rgba(34, 197, 94, 0.10);

    --red:        #ef4444;
    --red-dim:    rgba(239, 68, 68, 0.10);

    --amber:      #f59e0b;
    --amber-dim:  rgba(245, 158, 11, 0.10);

    --blue:       #3b82f6;
    --blue-dim:   rgba(59, 130, 246, 0.10);

    --purple:     #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.10);

    --accent:     #6366f1;
    --accent-dim: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);

    /* Spacing (4px base) */
    --sp-xs:  4px;
    --sp-sm:  8px;
    --sp-md:  12px;
    --sp-lg:  16px;
    --sp-xl:  20px;
    --sp-2xl: 24px;
    --sp-3xl: 32px;

    /* Border radius */
    --radius:    8px;
    --radius-lg: 12px;

    /* Fonts */
    --font-display: 'Bricolage Grotesque', sans-serif;
    --font-body:    'DM Sans', sans-serif;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg);
    color: var(--ink-2);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--ink);
}

img, svg {
    display: block;
    max-width: 100%;
}

/* ---- Scrollbars (WebKit + Firefox) ---- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    overflow: auto;
}

.login-card {
    width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-3xl);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--sp-3xl);
}

.login-logo-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.login-logo-sub {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-top: 4px;
}

/* Login notice (session expired) */
.login-notice {
    background: var(--amber-dim);
    color: var(--amber);
    font-size: 12px;
    font-weight: 400;
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, 0.15);
    margin-bottom: var(--sp-lg);
    text-align: center;
}

/* Login error */
.login-error {
    background: var(--red-dim);
    color: var(--red);
    font-size: 12px;
    font-weight: 400;
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius);
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin-bottom: var(--sp-lg);
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.login-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-3);
    display: block;
    margin-bottom: 6px;
}

.login-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-2);
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.login-input:focus {
    border-color: var(--accent);
}

.login-input::placeholder {
    color: var(--ink-3);
}

.login-submit {
    background: var(--accent);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.login-submit:hover {
    background: #5558e8;
}


/* ============================================================
   SHELL LAYOUT
   ============================================================ */

/* Full-screen grid: sidebar | main */
.shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 56px auto;
    height: 100vh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    grid-row: 1 / 3;
    grid-column: 1;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Sidebar logo block */
.sidebar-logo {
    padding: var(--sp-lg) var(--sp-xl);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1;
}

.sidebar-logo-sub {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-top: 2px;
}

/* Sidebar nav sections */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-lg) 0;
}

.sidebar-section-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--sp-sm) var(--sp-xl);
    cursor: default;
    user-select: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: 7px var(--sp-xl);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-2);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}

.sidebar-link.active {
    background: var(--accent-dim);
    color: var(--ink);
    border-left-color: var(--accent);
}

.sidebar-link-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Phase status pill at sidebar bottom */
.sidebar-phase {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: var(--sp-md) var(--sp-xl);
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
}

.sidebar-phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Phase dot colours */
.phase-dot-amber {
    background: var(--amber);
    animation: pulse 2s ease infinite;
}
.phase-dot-green {
    background: var(--green);
}
.phase-dot-accent {
    background: var(--accent);
    animation: pulse 2s ease infinite;
}
.phase-dot-muted {
    background: var(--ink-3);
}

.phase-label-amber { color: var(--amber); }
.phase-label-green { color: var(--green); }
.phase-label-accent { color: var(--accent); }
.phase-label-muted { color: var(--ink-3); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ---- Topbar ---- */
.topbar {
    grid-row: 1;
    grid-column: 2;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-3xl);
    height: 56px;
}

.topbar-left {
    display: flex;
    flex-direction: column;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.topbar-subtitle {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-top: -1px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

/* ---- Main Content ---- */
.main-content {
    grid-row: 2;
    grid-column: 2;
    overflow-y: auto;
    padding: var(--sp-3xl);
}

.main-content.fade-in {
    animation: fadeInUp 0.4s ease;
}

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


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Primary */
.btn-primary {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: #5558e8;
    border-color: #5558e8;
    color: var(--ink);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    border-color: var(--border-2);
    color: var(--ink-2);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}

/* Danger */
.btn-danger {
    background: transparent;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red);
}
.btn-danger:hover {
    background: var(--red-dim);
}

/* Small */
.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* Link-style button */
.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
    padding: 0;
}
.btn-link:hover {
    color: var(--ink);
    background: transparent;
}


/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-sm {
    font-size: 10px;
    padding: 3px 8px;
}

/* Semantic badge colours */
.badge-green {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.15);
}
.badge-red {
    background: var(--red-dim);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.15);
}
.badge-amber {
    background: var(--amber-dim);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.15);
}
.badge-accent {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.15);
}
.badge-purple {
    background: var(--purple-dim);
    color: var(--purple);
    border-color: rgba(168, 85, 247, 0.15);
}
.badge-blue {
    background: var(--blue-dim);
    color: var(--blue);
    border-color: rgba(59, 130, 246, 0.15);
}
.badge-muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink-3);
    border-color: var(--border);
}

/* Status dot badge */
.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-dot-green  { background: var(--green); }
.badge-dot-amber  { background: var(--amber); }
.badge-dot-muted  { background: var(--ink-3); }


/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-xl) var(--sp-xl) 0;
}

.card-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.card-body {
    padding: var(--sp-xl);
}

/* Card with top accent border */
.card-accent-amber {
    border-top: 2px solid var(--amber);
}
.card-accent-accent {
    border-top: 2px solid var(--accent);
}

/* ---- Milestone Cards ---- */
.milestone-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-lg);
    margin-bottom: var(--sp-2xl);
}

.milestone-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-2xl);
}

.milestone-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.milestone-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.milestone-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 2px;
    letter-spacing: -0.03em;
}

.milestone-value span {
    font-size: 16px;
    color: var(--ink-3);
    font-weight: 400;
}

/* Progress bar */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--sp-md);
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.22, 0.68, 0, 1.2);
    width: 0%; /* Set via inline style */
}

.progress-fill-amber  { background: var(--amber); }
.progress-fill-accent { background: var(--accent); }
.progress-fill-green  { background: var(--green); }
.progress-fill-muted  { background: var(--ink-3); }

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
    font-size: 12px;
}

.progress-meta-item {
    color: var(--ink-3);
}

/* Milestone locked state */
.milestone-locked {
    opacity: 0.5;
}

.milestone-locked-text {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--ink-3);
    font-style: italic;
}

/* ---- KPI Cards ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-lg);
    margin-bottom: var(--sp-2xl);
}

/* 5-column variant for per-product views */
.kpi-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-xl);
    transition: border-color 0.2s, transform 0.2s;
    cursor: default;
}

.kpi-card:hover {
    border-color: var(--border-2);
    transform: translateY(-1px);
}

.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--sp-md);
}

.kpi-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-3);
}

.kpi-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 14px;
    flex-shrink: 0;
}

.kpi-icon-green  { background: var(--green-dim); color: var(--green); }
.kpi-icon-red    { background: var(--red-dim);   color: var(--red); }
.kpi-icon-blue   { background: var(--blue-dim);  color: var(--blue); }
.kpi-icon-purple { background: var(--purple-dim); color: var(--purple); }

.kpi-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.kpi-delta {
    font-family: var(--font-body);
    font-size: 11px;
    margin-top: var(--sp-xs);
    color: var(--ink-3);
}


/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--sp-md) var(--sp-xl);
    text-align: left;
    border-bottom: 1px solid var(--border);
    cursor: default;
    user-select: none;
    white-space: nowrap;
}

thead th.sortable {
    cursor: pointer;
}

thead th.sortable:hover {
    color: var(--ink-2);
}

tbody td {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-2);
    padding: var(--sp-md) var(--sp-xl);
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--surface-2);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Amount column uses display font */
td.tx-amount {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
}

td.tx-amount.amount-income {
    color: var(--green);
}

td.tx-amount.amount-expense {
    color: var(--red);
}

/* Note truncation */
.tx-note {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Table card wrapper */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table-card .card-header {
    padding: var(--sp-xl);
    border-bottom: 1px solid var(--border);
}


/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-group {
    margin-bottom: var(--sp-lg);
}

.form-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-3);
    display: block;
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-2);
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--ink-3);
}

.form-select {
    appearance: none;
    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='rgba(255,255,255,0.28)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-select option {
    background: var(--surface);
    color: var(--ink-2);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-help {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 4px;
}

.form-error {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-lg);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin-top: var(--sp-2xl);
}


/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInUp 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-xl) var(--sp-2xl);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.modal-close {
    background: none;
    border: none;
    color: var(--ink-3);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--ink);
}

.modal-body {
    padding: var(--sp-2xl);
}


/* ============================================================
   RIGHT PANEL (Dashboard sidebar content)
   ============================================================ */
.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--sp-lg);
    margin-bottom: var(--sp-2xl);
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: var(--sp-lg);
}

/* CPP Monitor card */
.cpp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-xl);
}

.cpp-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-md);
}

.cpp-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cpp-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--sp-lg);
    letter-spacing: -0.03em;
}

.cpp-bar-track {
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    position: relative;
    margin-bottom: var(--sp-sm);
}

.cpp-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.cpp-bar-target {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--amber);
    border-radius: 1px;
    z-index: 2;
}

.cpp-bar-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--ink-3);
    margin-bottom: var(--sp-md);
}

.cpp-delta {
    font-family: var(--font-body);
    font-size: 12px;
}

/* Stat row cards (right panel) */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-xl);
}

.stat-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-bottom: var(--sp-xs);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.stat-subnote {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-top: var(--sp-xs);
}


/* ============================================================
   PRODUCT CARDS (Products page grid)
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-lg);
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-2xl);
    transition: border-color 0.2s;
}

.product-card:hover {
    border-color: var(--border-2);
}

.product-card-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--sp-sm);
    letter-spacing: -0.02em;
}

.product-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
    margin: var(--sp-lg) 0;
}

.product-card-stat-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.product-card-stat-value {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 2px;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--sp-lg);
    padding-top: var(--sp-lg);
    border-top: 1px solid var(--border);
}


/* ============================================================
   CAMPAIGN CARDS (Campaigns page grid)
   ============================================================ */
.campaign-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-lg);
}

.campaign-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-2xl);
    transition: border-color 0.2s;
}

.campaign-card:hover {
    border-color: var(--border-2);
}

.campaign-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.campaign-card-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.campaign-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md) var(--sp-lg);
}

.campaign-card-stat-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.campaign-card-stat-value {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    margin-top: 2px;
}


/* ============================================================
   PAGE HEADER & FILTER BAR
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-2xl);
}

.page-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-2xl);
}

.filter-bar .form-select {
    width: auto;
    min-width: 160px;
}


/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-3xl) var(--sp-xl);
    text-align: center;
}

.empty-state-icon {
    font-size: 32px;
    color: var(--ink-3);
    margin-bottom: var(--sp-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: var(--sp-xs);
}

.empty-state-subtitle {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 300;
    color: var(--ink-3);
    margin-bottom: var(--sp-xl);
}

/* ============================================================
   SECTION SPACING
   ============================================================ */
.section-gap {
    margin-bottom: var(--sp-2xl);
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-accent { color: var(--accent); }
.text-blue   { color: var(--blue); }
.text-purple { color: var(--purple); }
.text-muted  { color: var(--ink-3); }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.08em; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.mt-sm  { margin-top: var(--sp-sm); }
.mt-md  { margin-top: var(--sp-md); }
.mt-lg  { margin-top: var(--sp-lg); }
.mt-xl  { margin-top: var(--sp-xl); }
.mb-sm  { margin-bottom: var(--sp-sm); }
.mb-md  { margin-bottom: var(--sp-md); }
.mb-lg  { margin-bottom: var(--sp-lg); }
.mb-xl  { margin-bottom: var(--sp-xl); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }

.hidden { display: none !important; }


/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.hamburger {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--ink-2);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
}

/* Sidebar backdrop overlay (mobile only) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.6);
    z-index: 98;
}

.sidebar-backdrop.visible {
    display: block;
}

/* Sidebar close button (tablet/mobile only) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--ink-2);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius);
    z-index: 2;
    transition: color 0.15s;
}
.sidebar-close:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
}


/* ============================================================
   TABLET (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    /* Show hamburger, hide sidebar by default */
    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Show sidebar close button */
    .sidebar-close {
        display: block;
    }

    /* Topbar left: hamburger and title on the same row */
    .topbar-left {
        flex-direction: row;
        align-items: center;
        gap: var(--sp-sm);
    }

    /* Sidebar becomes a fixed overlay */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 99;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    /* Shell becomes single column */
    .shell {
        grid-template-columns: 1fr;
        grid-template-rows: 56px auto;
    }

    /* Topbar spans full width */
    .topbar {
        grid-row: 1;
        grid-column: 1;
        padding: 0 var(--sp-xl);
    }

    /* Main content spans full width */
    .main-content {
        grid-row: 2;
        grid-column: 1;
        padding: var(--sp-xl);
    }

    /* KPI grid: 2 columns */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .kpi-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Dashboard panels: stack */
    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    /* Right panel becomes horizontal grid */
    .right-panel {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp-lg);
    }

    /* Product grid: 2 columns */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Campaign grid stays 2 columns (already 2) */

    /* Milestone grid: still 2 columns on tablet */
}

/* ============================================================
   MOBILE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Topbar adjustments */
    .topbar {
        padding: 0 var(--sp-md);
        height: 52px;
        gap: var(--sp-sm);
    }

    .topbar-title {
        font-size: 13px;
    }

    .topbar-subtitle {
        font-size: 10px;
        display: none; /* Hide subtitle on small screens to save space */
    }

    .topbar-right {
        gap: 6px;
    }

    .topbar-right .btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Main content */
    .main-content {
        padding: var(--sp-md);
    }

    /* Milestone grid: single column */
    .milestone-grid {
        grid-template-columns: 1fr;
    }

    .milestone-value {
        font-size: 22px;
    }

    .milestone-value span {
        font-size: 13px;
    }

    /* KPI grid: 2 columns */
    .kpi-grid,
    .kpi-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp-sm);
    }

    .kpi-card {
        padding: var(--sp-md);
    }

    .kpi-value {
        font-size: 20px;
    }

    .kpi-label {
        font-size: 11px;
    }

    /* Dashboard panels */
    .dashboard-panels {
        grid-template-columns: 1fr;
        gap: var(--sp-lg);
    }

    .right-panel {
        display: flex;
        flex-direction: column;
        gap: var(--sp-md);
    }

    .cpp-value {
        font-size: 22px;
    }

    .stat-value {
        font-size: 18px;
    }

    /* Product grid: 1 column */
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        padding: var(--sp-lg);
    }

    .product-card-name {
        font-size: 15px;
    }

    /* Campaign grid: 1 column */
    .campaign-grid {
        grid-template-columns: 1fr;
    }

    .campaign-card {
        padding: var(--sp-lg);
    }

    .campaign-card-name {
        font-size: 14px;
    }

    /* Page header: stack on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-sm);
        margin-bottom: var(--sp-lg);
    }

    .page-title {
        font-size: 13px;
    }

    /* Filter bar: wrap */
    .filter-bar {
        flex-wrap: wrap;
        gap: var(--sp-sm);
        margin-bottom: var(--sp-lg);
    }

    .filter-bar form {
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-bar .form-select {
        min-width: auto;
        width: 100%;
    }

    .filter-bar .form-input {
        width: 100%;
    }

    /* Tables: compact on mobile */
    thead th {
        padding: var(--sp-sm) var(--sp-md);
        font-size: 9px;
    }

    tbody td {
        padding: var(--sp-sm) var(--sp-md);
        font-size: 12px;
    }

    td.tx-amount {
        font-size: 12px;
    }

    /* Hide non-essential columns on mobile */
    .tx-note {
        max-width: 120px;
    }

    /* Form rows: single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Modal: fit mobile */
    .modal {
        width: calc(100vw - 32px);
        max-width: 480px;
        margin: 0 var(--sp-lg);
        max-height: 85vh;
    }

    .modal-header {
        padding: var(--sp-md) var(--sp-lg);
    }

    .modal-body {
        padding: var(--sp-lg);
    }

    /* Login card: fit mobile */
    .login-card {
        width: calc(100vw - 32px);
        max-width: 380px;
        padding: var(--sp-2xl);
    }

    /* Buttons: tighter on mobile */
    .btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .btn-primary,
    .btn-ghost,
    .btn-danger {
        font-size: 11px;
    }

    /* Pagination: compact */
    .table-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-sm);
    }

    /* Progress meta: stack on small */
    .progress-meta {
        flex-direction: column;
        gap: 2px;
    }
}

/* ============================================================
   VERY SMALL SCREENS (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    /* KPI grid: single column if very narrow */
    .kpi-grid,
    .kpi-grid-5 {
        grid-template-columns: 1fr;
    }

    /* Sidebar: narrower */
    .sidebar {
        width: 260px;
        left: -260px;
    }

    .sidebar.open {
        left: 0;
    }

    /* Topbar buttons hide text, show icons only */
    .topbar-right .btn {
        padding: 5px 8px;
        gap: 3px;
    }

    /* Reduce card padding */
    .milestone-card {
        padding: var(--sp-lg);
    }

    .milestone-value {
        font-size: 20px;
    }
}

