/* ==========================================================================
   Chemex Dashboard — Glassmorphism Theme
   Coffee · Gold · Dark Luxury
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --coffee-black: #0d0a08;
    --coffee-dark: #1a120b;
    --coffee: #3d2314;
    --coffee-mid: #5c3d2e;
    --coffee-light: #8b6914;
    --gold: #c9a962;
    --gold-soft: #e8d5a3;
    --gold-glow: rgba(201, 169, 98, 0.35);
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-strong: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(201, 169, 98, 0.22);
    --glass-border-hover: rgba(201, 169, 98, 0.45);
    --text: rgba(255, 255, 255, 0.92);
    --text-muted: rgba(255, 255, 255, 0.62);
    --text-faint: rgba(255, 255, 255, 0.45);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --radius: 16px;
    --radius-sm: 12px;
    --sidebar-width: 260px;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
}

/* -------------------------------------------------------------------------- Personal wallet */
.personal-wallet-dashboard { padding-bottom: 72px; }
.personal-wallet-filter { margin-bottom: 18px; }
.dashboard-filter-details > summary { display: none; cursor: pointer; color: var(--gold-soft); font-weight: 800; }
.personal-wallet-nav-label { color: var(--gold-soft); }
.period-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.period-pill {
    border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-muted);
    border-radius: 999px; padding: 8px 15px; font-family: inherit; font-weight: 700; cursor: pointer;
}
.period-pill:hover, .period-pill.is-active { color: var(--coffee-black); background: var(--gold); border-color: var(--gold); }
.personal-wallet-filter small { display: block; margin-top: 12px; color: var(--text-muted); }
.personal-metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.personal-metrics-grid .stat-card { min-height: 135px; }
.personal-metrics-grid .metric-balance { background: linear-gradient(145deg, rgba(201,169,98,.19), rgba(255,255,255,.04)); }
.personal-metrics-grid .metric-name { font-size: 1.2rem; font-weight: 800; margin: 9px 0 3px; color: var(--gold-soft); }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.personal-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.chart-card {
    min-width: 0; padding: 18px; border: 1px solid var(--glass-border); border-radius: var(--radius);
    background: var(--glass-bg); box-shadow: var(--shadow); overflow: hidden;
}
.chart-card h3 { margin: 0 0 8px; color: var(--gold-soft); font-size: 1rem; }
.chart-card canvas { width: 100%; display: block; }
.chart-card-wide { grid-column: 1 / -1; }
.chart-legend { display: flex; gap: 18px; color: var(--text-muted); font-size: .82rem; margin-bottom: 4px; }
.chart-legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 5px; border-radius: 50%; }
.chart-legend .income-dot::before { background: var(--success); }
.chart-legend .expense-dot::before { background: var(--danger); }
.chart-legend .net-dot::before { background: var(--gold); }
.wallet-balance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wallet-balance-card { border-right: 4px solid var(--wallet-color); border-radius: var(--radius-sm); background: rgba(255,255,255,.045); padding: 14px; display: flex; justify-content: space-between; gap: 12px; }
.wallet-balance-card strong { color: var(--gold-soft); }
.personal-wallet-fab {
    position: fixed; z-index: 70; left: 28px; bottom: 28px; width: 58px; height: 58px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 2rem; font-weight: 700;
    color: var(--coffee-black); background: var(--gold); box-shadow: 0 10px 30px rgba(201,169,98,.45); border: 2px solid var(--gold-soft);
}
.personal-wallet-fab:hover { color: var(--coffee-black); transform: translateY(-2px); }

.personal-transaction-form { max-width: 860px; margin-inline: auto; }
.operation-picker { border: 0; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.operation-picker legend { width: 100%; margin-bottom: 9px; color: var(--gold-soft); font-weight: 800; }
.operation-option input { position: absolute; opacity: 0; pointer-events: none; }
.operation-option span { display: flex; min-height: 58px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); background: var(--glass-bg); cursor: pointer; font-weight: 800; transition: .2s; }
.operation-option b { font-size: 1.25rem; }
.operation-option input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.income-option input:checked + span { color: var(--success); border-color: var(--success); background: rgba(74,222,128,.1); }
.expense-option input:checked + span { color: var(--danger); border-color: var(--danger); background: rgba(248,113,113,.1); }
.transfer-option input:checked + span { color: var(--info); border-color: var(--info); background: rgba(96,165,250,.1); }
.quick-amount-field { margin-bottom: 18px; }
.amount-input-wrap { position: relative; }
.amount-input-wrap input { height: 66px; padding-left: 70px; font-size: 2rem; font-weight: 800; color: var(--gold-soft); text-align: center; }
.amount-input-wrap span { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 700; }
.compact-form-grid { align-items: start; }
.compact-form-grid small { display: block; margin-top: 5px; color: var(--text-faint); }
.transaction-filters { margin: 14px 0 18px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 12px; }
.transaction-filters summary { cursor: pointer; color: var(--gold-soft); font-weight: 800; }
.transaction-filters form { margin-top: 14px; }
.personal-transactions-page td { vertical-align: middle; }
.personal-transaction-show { max-width: 900px; margin-inline: auto; }
.transaction-show-amount { font-size: 1.8rem; color: var(--gold); }
.transaction-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.transaction-details-grid > div { background: rgba(255,255,255,.045); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 12px; }
.transaction-details-grid dt { color: var(--text-muted); font-size: .82rem; margin-bottom: 4px; }
.transaction-details-grid dd { margin: 0; font-weight: 700; }
.transaction-details-grid .detail-wide { grid-column: 1 / -1; }

@media (max-width: 1100px) {
    .personal-metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .wallet-balance-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 700px) {
    .personal-wallet-filter { padding: 12px; }
    .dashboard-filter-details > summary { display: list-item; margin-bottom: 12px; }
    .dashboard-filter-details:not([open]) + small { margin-top: 0; }
    .period-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .period-pill { padding: 8px 5px; font-size: .78rem; }
    .personal-metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
    .personal-metrics-grid .stat-card { min-height: 115px; padding: 13px; }
    .personal-metrics-grid .stat-card .value { font-size: 1.15rem; }
    .personal-chart-grid { grid-template-columns: 1fr; }
    .chart-card, .chart-card-wide { grid-column: auto; padding: 12px; }
    .wallet-balance-grid { grid-template-columns: 1fr; }
    .wallet-balance-card { flex-direction: column; gap: 4px; }
    .personal-wallet-fab { left: 18px; bottom: 18px; width: 54px; height: 54px; }
    .operation-picker { gap: 6px; }
    .operation-option span { min-height: 52px; font-size: .9rem; }
    .amount-input-wrap input { font-size: 1.65rem; }
    .transaction-details-grid { grid-template-columns: 1fr; }
    .transaction-details-grid .detail-wide { grid-column: auto; }
    .sticky-form-actions { position: sticky; bottom: 0; z-index: 5; background: rgba(26,18,11,.96); padding: 10px; margin: 16px -10px -10px; border-top: 1px solid var(--glass-border); }
    .personal-transactions-page .table-scroll { overflow: visible; }
    .personal-transactions-page table,
    .personal-transactions-page tbody,
    .personal-transactions-page tr,
    .personal-transactions-page td { display: block; width: 100%; }
    .personal-transactions-page thead { display: none; }
    .personal-transactions-page tbody { display: grid; gap: 12px; }
    .personal-transactions-page tbody tr { padding: 10px 13px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); background: rgba(255,255,255,.035); }
    .personal-transactions-page tbody td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.07); text-align: left; }
    .personal-transactions-page tbody td:last-child { border-bottom: 0; }
    .personal-transactions-page tbody td::before { content: attr(data-label); flex: 0 0 38%; color: var(--text-muted); text-align: right; font-size: .8rem; }
    .personal-transactions-page tbody td.actions { justify-content: flex-start; flex-wrap: wrap; }
    .personal-transactions-page tbody td.actions::before { width: 100%; flex-basis: 100%; }
    .personal-transactions-page tbody td[colspan]::before { content: none; }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', Tahoma, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(ellipse 80% 60% at 15% -10%, rgba(201, 169, 98, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 110%, rgba(92, 61, 46, 0.45), transparent 50%),
        linear-gradient(165deg, var(--coffee-black) 0%, var(--coffee-dark) 35%, #2a1810 70%, #1a120b 100%);
    background-attachment: fixed;
    line-height: 1.6;
}

a { color: var(--gold-soft); transition: color 0.2s; }
a:hover { color: var(--gold); }

code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--gold-soft);
}

/* -------------------------------------------------------------------------- Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 24px 16px 16px;
    background: rgba(13, 10, 8, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sidebar-tagline {
    margin: 0 0 20px;
    font-size: 0.75rem;
    color: var(--text-faint);
    letter-spacing: 2px;
    flex-shrink: 0;
}

.sidebar > form {
    flex-shrink: 0;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0 12px 4px;
    margin: 0 -2px 8px 0;
    scrollbar-color: rgba(201, 169, 98, 0.45) rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 98, 0.42);
    border-radius: 999px;
}

.sidebar-group {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(201, 169, 98, 0.14);
}

.sidebar-group:last-child {
    border-bottom: none;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(201, 169, 98, 0.18);
    background: rgba(255, 255, 255, 0.045);
    color: var(--gold-soft);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.sidebar-group-toggle:hover {
    background: rgba(201, 169, 98, 0.1);
    border-color: var(--glass-border-hover);
    color: var(--gold);
}

.sidebar-group-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    color: var(--gold);
    transition: transform 0.2s ease;
}

.sidebar-group.is-collapsed .sidebar-group-chevron {
    transform: rotate(90deg);
}

.sidebar-group-links {
    padding-top: 8px;
}

.sidebar-group.is-collapsed .sidebar-group-links {
    display: none;
}

.sidebar a,
.sidebar .link-button {
    display: block;
    width: 100%;
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.sidebar a:hover,
.sidebar .link-button:hover {
    background: var(--glass-bg-strong);
    color: var(--gold-soft);
    border-color: var(--glass-border);
}

.sidebar a.active {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.2), rgba(92, 61, 46, 0.3));
    color: var(--gold);
    border-color: var(--glass-border-hover);
}

.sidebar-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 12px 0;
}

.sidebar .link-button {
    text-align: right;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    color: var(--danger);
}

.sidebar .link-button:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: 20px 24px 32px;
    max-width: 1600px;
}

@media (min-width: 901px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        min-height: 100vh;
        max-height: 100vh;
    }

    .main-area {
        width: calc(100% - var(--sidebar-width));
        min-height: 100vh;
        margin-right: var(--sidebar-width);
    }

    .content {
        max-width: none;
    }
}

/* -------------------------------------------------------------------------- Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    margin: 16px 24px 0;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.topbar-user {
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg-strong);
    color: var(--gold);
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.menu-toggle:hover {
    border-color: var(--gold);
    box-shadow: 0 0 16px var(--gold-glow);
}

/* -------------------------------------------------------------------------- Glass panels */
.card,
.table-box,
.form-box,
.topbar,
.form-shell,
.field-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table-box,
.form-box {
    padding: 20px;
    margin-bottom: 20px;
}

.table-box h3,
.form-box h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold-soft);
}

.page-intro {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------------- Cards grid */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    padding: 18px 20px;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

a.card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.metric-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) minmax(90px, auto);
    gap: 12px;
    align-items: center;
    margin: 10px 0;
    color: var(--text);
}

.metric-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.metric-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
}

.spark-bars {
    display: flex;
    align-items: end;
    gap: 4px;
    min-height: 140px;
    padding-top: 34px;
    overflow: visible;
}

.spark-bars span {
    flex: 1;
    min-width: 4px;
    border-radius: 6px 6px 0 0;
    background: var(--gold);
    cursor: default;
    position: relative;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.spark-bars span:hover {
    filter: brightness(1.18);
    transform: translateY(-2px);
    z-index: 2;
}

.spark-bars span::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    min-width: max-content;
    max-width: 150px;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(13, 10, 8, 0.95);
    border: 1px solid var(--glass-border-hover);
    color: var(--gold-soft);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.spark-bars span:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.spark-bars-profit span {
    background: #60a5fa;
}

.partner-charts-lead .table-box {
    min-height: 300px;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg);
}

.card h3 {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.card .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
    word-break: break-word;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* -------------------------------------------------------------------------- Tables */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
    border-radius: var(--radius-sm);
}

.table-box > table,
.table-scroll table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
}

.table-box > table { margin-top: 16px; }

table th,
table td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid rgba(201, 169, 98, 0.12);
    vertical-align: middle;
}

table th {
    background: rgba(0, 0, 0, 0.25);
    color: var(--gold-soft);
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

table tbody tr {
    transition: background 0.15s;
}

table tbody tr:hover {
    background: rgba(201, 169, 98, 0.06);
}

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

/* -------------------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--coffee-mid), var(--coffee));
    color: var(--gold-soft);
    text-decoration: none;
    border: 1px solid var(--glass-border-hover);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    background: linear-gradient(135deg, var(--coffee-light), var(--coffee-mid));
    color: #fff;
    box-shadow: 0 4px 20px var(--gold-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-color: var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--gold-soft);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.8), rgba(127, 29, 29, 0.9));
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
}

.btn-danger:hover {
    box-shadow: 0 4px 20px rgba(248, 113, 113, 0.25);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), #a8863a);
    color: var(--coffee-black);
    border-color: var(--gold);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.actions form { margin: 0; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}

/* -------------------------------------------------------------------------- Forms */
label {
    display: block;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

input,
textarea,
select,
.form-control,
.form-select,
.chemex-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select,
.form-select,
.chemex-select {
    display: block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
}

select:focus,
.form-control:focus,
.form-select:focus,
.chemex-select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

select option {
    background-color: var(--coffee-dark);
    color: var(--text);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
    padding: 8px 12px;
}

.select-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 14px;
}

.select-wrap select {
    margin-bottom: 0;
}

.select-compact {
    font-size: 0.875rem;
    padding: 10px 12px;
}

.select-product,
.product-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

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

.grid-2 > div {
    min-width: 0;
}

.table-box select,
.form-box select,
.toolbar select,
.form-box .select-wrap,
.table-box .select-wrap {
    max-width: 100%;
    min-width: 0;
}

table th.col-product,
table td.col-product {
    width: min(280px, 34vw);
    max-width: 280px;
    min-width: 160px;
}

table td .select-wrap {
    width: 100%;
    margin-bottom: 0;
}

.form-box table .select-wrap {
    margin-bottom: 0;
}

.chemex-select-root {
    position: relative;
}

select.chemex-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.chemex-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 0;
    text-align: right;
    cursor: pointer;
}

.chemex-select-trigger-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chemex-select-trigger-icon::before {
    content: '▾';
    color: var(--gold-soft);
    font-size: 0.85rem;
    line-height: 1;
}

.chemex-select-root.is-open .chemex-select-trigger {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.chemex-select-menu {
    position: fixed;
    z-index: 1200;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: rgba(13, 10, 8, 0.98);
    border: 1px solid var(--glass-border-hover);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    overflow-x: hidden;
    overflow-y: auto;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.chemex-select-menu.is-hidden {
    display: none !important;
}

.chemex-select-option {
    padding: 10px 12px;
    cursor: pointer;
    text-align: right;
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.15s;
}

.chemex-select-option:hover,
.chemex-select-option:focus {
    background: rgba(201, 169, 98, 0.12);
    outline: none;
}

.chemex-select-option.is-selected {
    background: rgba(201, 169, 98, 0.18);
    color: var(--gold-soft);
    font-weight: 700;
}

.chemex-select-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.search-select {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 14px;
}

.search-select-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 0;
}

.search-select-value {
    display: none;
}

.search-select-results,
.search-select-results-floating {
    position: fixed;
    z-index: 1300;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    box-sizing: border-box;
    background: rgba(13, 10, 8, 0.98);
    border: 1px solid var(--glass-border-hover);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 240px;
}

.search-select-results.is-hidden {
    display: none !important;
}

.search-select-option {
    padding: 10px 12px;
    cursor: pointer;
    text-align: right;
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.15s;
}

.search-select-option:hover,
.search-select-option:focus {
    background: rgba(201, 169, 98, 0.12);
    outline: none;
}

.mini-bar {
    position: relative;
    min-width: 140px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 700;
}

.mini-bar::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--bar-width, 0%);
    background: linear-gradient(90deg, rgba(80, 190, 255, 0.35), rgba(201, 169, 98, 0.35));
}

.mini-bar span {
    position: relative;
    z-index: 1;
}

.search-select-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

table td .search-select {
    margin-bottom: 0;
}

.search-select.is-open .search-select-input {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

#items-table,
table.items-table {
    table-layout: fixed;
}

input[list] {
    max-width: 100%;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.checkbox-row input {
    width: auto;
    margin: 0;
}

/* -------------------------------------------------------------------------- Alerts */
.alert {
    background: rgba(74, 222, 128, 0.12);
    color: var(--success);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
    border-color: rgba(251, 191, 36, 0.3);
}

.alert-info {
    background: rgba(56, 189, 248, 0.1);
    color: #bae6fd;
    border-color: rgba(56, 189, 248, 0.25);
}

.settlement-auto-expected-hint {
    font-size: 0.9rem;
}

.alert-danger,
.chemex-alert,
.error-box {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.3);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.chemex-alert ul,
.error-box ul {
    margin: 8px 0 0;
    padding-right: 18px;
}

.alert + .alert { margin-top: 8px; }

/* -------------------------------------------------------------------------- Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-success {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
    border-color: rgba(74, 222, 128, 0.35);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border-color: rgba(251, 191, 36, 0.35);
}

.badge-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.35);
}

.badge-orange {
    background: rgba(251, 146, 60, 0.16);
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.38);
}

.badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: var(--info);
    border-color: rgba(96, 165, 250, 0.35);
}

.badge-muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border-color: var(--glass-border);
}

.badge-gold {
    background: rgba(201, 169, 98, 0.18);
    color: var(--gold);
    border-color: rgba(201, 169, 98, 0.4);
}

.supplier-due-alerts .badge {
    margin: 0 0 8px 8px;
    text-decoration: none;
}

.inventory-age-badge {
    font-size: 0.72rem;
}

.row-age-60 {
    background: rgba(251, 191, 36, 0.08);
}

.row-age-60:hover {
    background: rgba(251, 191, 36, 0.14);
}

.row-age-90 {
    background: rgba(248, 113, 113, 0.1);
}

.row-age-90:hover {
    background: rgba(248, 113, 113, 0.16);
}

.inventory-report .cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.inventory-report .card {
    padding: 12px 14px;
}

.inventory-report .card h3 {
    margin-bottom: 6px;
    font-size: 0.72rem;
}

.inventory-report .card .value {
    font-size: 1.15rem;
}

.inventory-report-table .table-scroll {
    margin-top: 10px;
}

.inventory-report-table table {
    min-width: 980px;
}

.inventory-report-table table th,
.inventory-report-table table td {
    padding: 7px 8px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.inventory-report-table table th {
    font-size: 0.72rem;
    font-weight: 700;
}

.inventory-report-table .col-product-name {
    min-width: 120px;
    max-width: 200px;
    white-space: normal;
    word-break: break-word;
}

.inventory-report-table td:not(.col-product-name):not(.actions) {
    white-space: nowrap;
}

.inventory-report-table .badge {
    padding: 2px 7px;
    font-size: 0.68rem;
}

.inventory-report-table .actions .btn {
    padding: 5px 9px;
    font-size: 0.72rem;
}

.inventory-report-table .toolbar-label,
.inventory-report-table .pagination-summary {
    font-size: 0.8rem;
}

.table-sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

.table-sort-link:hover {
    color: var(--gold);
}

.health-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.health-summary-grid .stat-card {
    min-width: 0;
}

.health-summary-grid-compact {
    margin-bottom: 0;
}

.dashboard-health-toolbar {
    justify-content: space-between;
    margin-bottom: 12px;
}

.dashboard-health-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.dashboard-health-box.is-collapsed .health-summary-grid {
    display: none;
}

.dashboard-health-box.is-collapsed .dashboard-health-toolbar {
    margin-bottom: 0;
}

.dashboard-alerts-body {
    margin-top: 12px;
}

.stat-card {
    display: block;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    backdrop-filter: blur(12px);
}

.stat-card h3 {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card .value,
.health-score-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1.2;
}

.stat-card > span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-card > strong {
    display: block;
    color: var(--gold-soft);
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.health-score-card {
    text-align: center;
}

.health-score-value {
    font-size: 2.6rem;
    margin: 8px 0 12px;
}

.health-score-excellent {
    border-color: rgba(74, 222, 128, 0.35);
}

.health-score-attention {
    border-color: rgba(251, 191, 36, 0.35);
}

.health-score-danger {
    border-color: rgba(248, 113, 113, 0.35);
}

.value-sm {
    font-size: 1rem !important;
    font-weight: 700 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.mt-16 {
    margin-top: 16px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.executive-dashboard-page {
    max-width: 100%;
    overflow: hidden;
}

.executive-dashboard-page .toolbar {
    justify-content: flex-start;
}

.executive-dashboard-page .toolbar form {
    margin: 0;
}

.executive-dashboard-page .stat-card {
    height: 100%;
}

.dashboard-charts-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(0, 3fr);
    gap: 16px;
    margin-bottom: 20px;
    direction: ltr;
}

.dashboard-charts-goals,
.dashboard-charts-sales {
    min-width: 0;
    direction: rtl;
}

.dashboard-charts-row .dashboard-section {
    margin-bottom: 0;
    height: 100%;
}

.dashboard-charts-row .goal-chart-card .dashboard-section-header .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.dashboard-charts-row .goal-chart-card .dashboard-section-header h3 {
    font-size: 0.95rem;
    line-height: 1.4;
}

.dashboard-charts-row .goal-chart-actions .btn {
    width: 100%;
    justify-content: center;
}

.dashboard-charts-row .goal-summary-grid-compact {
    grid-template-columns: 1fr;
    max-width: none;
    gap: 12px;
}

.dashboard-charts-row .goal-progress-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 12px;
    gap: 10px;
}

.dashboard-charts-row .goal-progress-ring {
    width: 78px;
    height: 78px;
}

.dashboard-charts-row .goal-progress-meta {
    font-size: 0.82rem;
}

.dashboard-charts-row .goal-progress-meta div {
    line-height: 1.35;
}

.dashboard-charts-row .goal-chart-empty {
    padding: 20px 10px;
}

@media (max-width: 960px) {
    .dashboard-charts-row {
        grid-template-columns: 1fr;
        direction: rtl;
    }
}

/* -------------------------------------------------------------------------- Dashboard sections */
.dashboard-section {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.dashboard-section-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.dashboard-section-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gold-soft);
}

.dashboard-section-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-section .card {
    margin: 0;
}

.dashboard-section.today-card {
    border-color: rgba(96, 165, 250, 0.35);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), var(--glass-bg));
}

.dashboard-section.sales-chart-card {
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), var(--glass-bg));
}

.dashboard-section.sales-chart-card .dashboard-section-header h3 {
    color: #7dd3fc;
}

.platform-year-charts {
    scroll-margin-top: 24px;
}

.platform-chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.platform-chart-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.035);
    padding: 16px;
    min-width: 0;
}

.platform-chart-head,
.platform-chart-values,
.platform-chart-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.platform-chart-head h4 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: var(--text);
}

.platform-chart-values {
    margin: 14px 0 10px;
    color: var(--text-muted);
    font-weight: 700;
}

.platform-chart-values strong {
    color: var(--gold-soft);
    font-size: 1.25rem;
}

.platform-spark-bars {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
    height: 118px;
    padding: 10px 0 4px;
}

.platform-spark-month {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    gap: 6px;
    min-width: 0;
    height: 100%;
}

.platform-spark-month i {
    display: block;
    width: 100%;
    min-height: 8px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, rgba(201, 169, 98, 0.95), rgba(80, 190, 255, 0.45));
    box-shadow: 0 8px 18px rgba(201, 169, 98, 0.12);
}

.platform-spark-month i.is-empty {
    min-height: 4px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.platform-spark-month span {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.platform-chart-foot {
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 12px;
    color: var(--text-muted);
}

.platform-chart-foot strong {
    color: var(--text);
}

.daily-sales-chart-total {
    color: #7dd3fc;
    font-weight: 800;
    font-size: 1rem;
}

.daily-sales-chart-wrap {
    width: 100%;
    direction: ltr;
}

.daily-sales-chart-stage {
    position: relative;
    height: 240px;
}

.daily-sales-chart {
    display: block;
    width: 100%;
    height: 100%;
}

.daily-sales-grid-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.daily-sales-axis-label {
    fill: var(--text-muted);
    font-size: 11px;
}

.daily-sales-area {
    fill: rgba(56, 189, 248, 0.16);
}

.daily-sales-line {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.daily-sales-dot-glow {
    fill: rgba(56, 189, 248, 0.22);
    stroke: rgba(56, 189, 248, 0.45);
    stroke-width: 1;
    pointer-events: none;
}

.daily-sales-dot {
    fill: #bae6fd;
    stroke: #0284c7;
    stroke-width: 1;
    pointer-events: none;
}

.daily-sales-point-tags {
    position: absolute;
    inset: 40px 20px 44px 56px;
    pointer-events: none;
}

.daily-sales-point-tag {
    position: absolute;
    transform: translate(-50%, calc(-100% - 10px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.15;
    white-space: nowrap;
}

.daily-sales-tag-sales,
.daily-sales-tag-profit {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.72);
}

.daily-sales-tag-sales {
    color: #bae6fd;
}

.daily-sales-tag-profit {
    color: #fcd34d;
}

.daily-sales-x-labels {
    display: grid;
    grid-template-columns: repeat(var(--day-count), minmax(0, 1fr));
    gap: 2px;
    margin-top: 8px;
    padding: 0 56px 0 56px;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.dashboard-section.goal-chart-card {
    border-color: rgba(201, 169, 98, 0.45);
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.1), var(--glass-bg));
}

.dashboard-section.goal-chart-card .dashboard-section-header h3 {
    color: var(--gold-soft);
}

.goal-chart-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.goal-chart-empty {
    padding: 28px 16px;
    text-align: center;
}

.goal-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.goal-summary-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    max-width: 640px;
}

.goal-progress-card,
.goal-legend-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.goal-legend-card {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
}

.goal-progress-ring {
    --progress: 0;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background:
        radial-gradient(circle at center, rgba(20, 16, 12, 0.95) 58%, transparent 59%),
        conic-gradient(var(--ring-color, #38bdf8) calc(var(--progress) * 1%), rgba(255, 255, 255, 0.08) 0);
}

.goal-progress-ring-sales {
    --ring-color: #38bdf8;
}

.goal-progress-ring-profit {
    --ring-color: #fbbf24;
}

.goal-progress-ring-inner {
    text-align: center;
    line-height: 1.2;
}

.goal-progress-ring-inner strong {
    display: block;
    font-size: 1.1rem;
    color: var(--gold);
}

.goal-progress-ring-inner span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.goal-progress-meta {
    font-size: 0.9rem;
    font-weight: 700;
}

.goal-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.goal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.goal-legend-sales { background: #38bdf8; }
.goal-legend-profit { background: #fbbf24; }
.goal-legend-pace { background: rgba(255, 255, 255, 0.45); }

.goal-legend-line {
    width: 18px;
    height: 0;
    border-top: 2px dashed rgba(74, 222, 128, 0.9);
    display: inline-block;
}

.goal-chart-wrap {
    margin-top: 4px;
}

.goal-progress-chart {
    display: block;
    width: 100%;
    height: 260px;
}

.goal-target-line {
    stroke: rgba(74, 222, 128, 0.75);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
}

.goal-line-sales {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.goal-line-profit {
    fill: none;
    stroke: #fbbf24;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.goal-line-pace {
    fill: none;
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 2;
    stroke-dasharray: 5 5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.goal-day-label {
    fill: #bae6fd;
    font-size: 8px;
    font-weight: 700;
}

.goal-modal {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0;
    background: transparent;
    color: var(--text);
    max-width: 560px;
    width: calc(100% - 32px);
}

.goal-modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.goal-modal-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    backdrop-filter: blur(16px);
}

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

.goal-modal-header h3 {
    margin: 0;
    color: var(--gold-soft);
}

.goal-modal-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.attachment-preview-modal {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0;
    background: transparent;
    color: var(--text);
    width: min(1040px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
}

.attachment-preview-modal::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.attachment-preview-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    backdrop-filter: blur(16px);
}

.attachment-preview-header,
.attachment-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.attachment-preview-header h3 {
    margin: 0;
    color: var(--gold-soft);
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.attachment-preview-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.attachment-preview-body {
    display: grid;
    place-items: center;
    margin: 16px 0;
    max-height: calc(100vh - 190px);
    overflow: auto;
}

.attachment-preview-body img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 210px);
    object-fit: contain;
    border-radius: var(--radius);
}

.attachment-preview-actions {
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .platform-chart-grid {
        grid-template-columns: 1fr;
    }

    .platform-spark-bars {
        gap: 4px;
    }

    .daily-sales-chart-stage {
        height: 200px;
    }

    .daily-sales-x-labels {
        padding: 0 40px;
        font-size: 0.65rem;
    }

    .daily-sales-x-labels span:nth-child(odd):not(:nth-child(5n+1)) {
        visibility: hidden;
    }
}

.dashboard-section.today-card .dashboard-section-header h3,
.dashboard-section.today-card .card .value {
    color: #93c5fd;
}

.dashboard-section.month-card {
    border-color: rgba(201, 169, 98, 0.4);
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.12), var(--glass-bg));
}

.dashboard-section.month-card .dashboard-section-header h3 {
    color: var(--gold-soft);
}

.dashboard-section.cash-card {
    border-color: rgba(74, 222, 128, 0.35);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), var(--glass-bg));
}

.dashboard-section.cash-card .dashboard-section-header h3,
.dashboard-section.cash-card .card .value {
    color: #86efac;
}

.dashboard-section.inventory-card {
    border-color: rgba(251, 191, 36, 0.35);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), var(--glass-bg));
}

.dashboard-section.inventory-card .dashboard-section-header h3,
.dashboard-section.inventory-card .card .value {
    color: #fcd34d;
}

.dashboard-section.capital-card {
    border-color: rgba(167, 139, 250, 0.35);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), var(--glass-bg));
}

.dashboard-section.capital-card .dashboard-section-header h3,
.dashboard-section.capital-card .card .value {
    color: #c4b5fd;
}

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

.dashboard-metric-note {
    margin: 10px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.dashboard-metric-card-with-note .value {
    font-size: 1.35rem;
}

@media (max-width: 1280px) {
    .dashboard-section-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

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

@media (max-width: 640px) {
    .dashboard-section-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-section {
        padding: 16px;
    }
}

.status-ok { color: var(--success); font-weight: 700; }
.status-bad { color: var(--danger); font-weight: 700; }

/* -------------------------------------------------------------------------- Pagination */
.pagination-wrap {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pagination-summary {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.toolbar-pagination {
    margin-top: 4px;
    margin-bottom: 12px;
}

.toolbar-label {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.pagination-wrap nav {
    display: flex;
    justify-content: center;
}

.pagination-wrap .pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-wrap .page-link,
.pagination-wrap span {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.pagination-wrap .page-link:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.pagination-wrap .active span {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.25), rgba(92, 61, 46, 0.4));
    color: var(--gold);
    border-color: var(--gold);
}

.pagination-wrap .disabled .page-link {
    opacity: 0.55;
    cursor: not-allowed;
}

.pagination-wrap .chemex-pagination {
    direction: rtl;
    align-items: center;
}

/* -------------------------------------------------------------------------- Rich form layout */
.chemex-form-page { padding: 0; }

.form-shell {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px;
}

.form-header { margin-bottom: 24px; }

.form-badge {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 8px;
}

.form-header h1 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
}

.form-header p {
    margin: 0;
    color: var(--text-muted);
}

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

.field-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-full { grid-column: 1 / -1; }

.field-card label {
    margin: 0;
    color: var(--text);
}

.chemex-input,
.chemex-select {
    width: 100%;
    margin: 0;
}

textarea.chemex-input {
    min-height: 110px;
    padding-top: 14px;
    resize: vertical;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.btn-save,
button.btn-save {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), #a8863a);
    color: var(--coffee-black);
    border: 1px solid var(--gold);
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.btn-save:hover {
    box-shadow: 0 8px 24px var(--gold-glow);
    transform: translateY(-1px);
}

.btn-cancel {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.btn-cancel:hover {
    color: var(--text);
    border-color: var(--glass-border-hover);
}

.section-title {
    margin: 24px 0 12px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold-soft);
}

.detail-table th {
    width: 35%;
    color: var(--text-muted);
    font-weight: 600;
}

/* -------------------------------------------------------------------------- Login */
body.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(440px, 100%);
}

.login-box {
    padding: 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand h1 {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gold);
}

.login-brand p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

/* -------------------------------------------------------------------------- Utilities */
.text-muted { color: var(--text-muted); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex-gap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.notes-list {
    margin: 10px 0 0;
    padding-right: 18px;
    line-height: 1.8;
    color: var(--text-muted);
}

table.detail-table th {
    width: 32%;
    color: var(--text-muted);
    font-weight: 600;
    background: transparent;
}

table.detail-table td {
    color: var(--text);
    font-weight: 600;
}

table tfoot th {
    background: rgba(201, 169, 98, 0.12);
    color: var(--gold-soft);
}

input[readonly],
input:read-only,
select:disabled {
    opacity: 0.85;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.45);
}

.form-box .table-box,
.table-box.nested {
    padding: 16px;
    margin-top: 16px;
    margin-bottom: 0;
}

.summary-panel {
    margin-top: 20px;
}

.is-hidden {
    display: none !important;
}

.form-box table input,
.form-box table select {
    margin-bottom: 0;
    min-width: 0;
    max-width: 100%;
}

.link-external {
    color: var(--gold-soft);
    font-weight: 700;
}

.link-external:hover {
    color: var(--gold);
}

.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }

/* -------------------------------------------------------------------------- Attachments / Dropzone */
.attachments-section {
    margin-top: 20px;
    min-height: 120px;
}

.attachments-section > h3 {
    margin-bottom: 16px;
}

.attachment-dropzone-box {
    margin-bottom: 16px;
}

.dropzone {
    border: 2px dashed rgba(201, 169, 98, 0.35);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.dropzone.is-dragover {
    border-color: var(--gold);
    background: rgba(201, 169, 98, 0.08);
    transform: translateY(-1px);
}

.dropzone-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.dropzone-title {
    margin: 0 0 6px;
    font-weight: 800;
    color: var(--gold-soft);
}

.dropzone-hint {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dropzone-input {
    display: none;
}

.dropzone-files h4 {
    margin: 0 0 10px;
    color: var(--gold-soft);
    font-size: 0.95rem;
}

.dropzone-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.dropzone-file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
}

.dropzone-meta {
    margin-top: 16px;
}

.dropzone-progress {
    margin-top: 14px;
}

.dropzone-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.dropzone-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gold), #a8863a);
    transition: width 0.2s ease;
}

.dropzone-progress-text {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.attachments-create-section {
    margin-top: 20px;
}

.attachment-create-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.attachment-create-group label {
    color: var(--gold-soft);
}

.attachment-file-input {
    border: 1px dashed rgba(201, 169, 98, 0.35);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, background 0.2s;
}

.attachment-file-input:hover,
.attachment-file-input:focus-within {
    border-color: var(--gold);
    background: rgba(201, 169, 98, 0.06);
}

.attachment-file-input input[type="file"] {
    margin-bottom: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.attachment-file-input input[type="file"]::file-selector-button {
    margin-left: 12px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border-hover);
    background: linear-gradient(135deg, var(--coffee-mid), var(--coffee));
    color: var(--gold-soft);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.form-box.nested {
    margin-top: 0;
    margin-bottom: 16px;
}

.platform-wallet-banner {
    margin: 16px 0;
    padding: 16px 18px;
    border: 1px solid rgba(201, 169, 98, 0.45);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.12), rgba(255, 255, 255, 0.03));
}

.platform-wallet-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.platform-wallet-balance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold-soft);
    margin-top: 4px;
}

.platform-wallet-hint {
    margin: 10px 0 0;
    font-size: 0.85rem;
}

.field-full {
    grid-column: 1 / -1;
}

/* -------------------------------------------------------------------------- Responsive */
@media (max-width: 1024px) {
    .cards {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card .value {
        font-size: 1.25rem;
    }
}

@media (max-width: 900px) {
    .menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100dvh;
        min-height: 100dvh;
        overflow-y: auto;
        transform: translateX(100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .content {
        padding: 16px;
    }

    .topbar {
        margin: 12px 16px 0;
        padding: 12px 16px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

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

    .field-full {
        grid-column: auto;
    }

    .attachment-create-grid {
        grid-template-columns: 1fr;
    }

    .form-shell {
        padding: 20px;
    }

    .topbar-user {
        font-size: 0.75rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sales-mobile-table {
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .table-scroll:has(.sales-mobile-table) {
        overflow-x: visible;
    }

    .sales-mobile-table thead {
        display: none;
    }

    .sales-mobile-table,
    .sales-mobile-table tbody,
    .sales-mobile-table tr,
    .sales-mobile-table td {
        display: block;
        width: 100%;
    }

    .sales-mobile-table tr {
        padding: 14px;
        border: 1px solid var(--glass-border);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.035);
    }

    .sales-mobile-table td {
        display: grid;
        grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.2fr);
        gap: 12px;
        align-items: center;
        padding: 9px 0;
        border-bottom: 1px solid rgba(201, 169, 98, 0.1);
        text-align: right;
        word-break: break-word;
    }

    .sales-mobile-table td:last-child {
        border-bottom: 0;
    }

    .sales-mobile-table td::before {
        content: attr(data-label);
        color: var(--gold-soft);
        font-weight: 700;
        font-size: 0.78rem;
    }

    .sales-mobile-table td input,
    .sales-mobile-table td .search-select {
        width: 100%;
        min-width: 0;
    }

    .sales-mobile-table .actions,
    .sales-mobile-table .sales-item-actions {
        align-items: stretch;
    }

    .sales-mobile-table .actions .btn,
    .sales-mobile-table .sales-item-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .sales-items-mobile-table .col-product {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sales-items-mobile-table .col-product::before {
        display: block;
    }
}

@media (max-width: 480px) {
    .cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .card {
        padding: 14px;
    }

    .card h3 {
        font-size: 0.75rem;
    }

    .card .value {
        font-size: 1.1rem;
    }

    .stat-card > strong {
        font-size: 1.2rem;
    }

    .btn {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

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

    .actions .btn {
        width: 100%;
    }
}

/* -------------------------------------------------------------------------- Platform performance */
.dashboard-section.platform-card {
    border-color: rgba(167, 139, 250, 0.35);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.08), var(--glass-bg));
}

.platform-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.platform-stat-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.platform-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.45);
}

.platform-mini-stats {
    display: grid;
    gap: 8px;
}

.platform-mini-stats div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
}

.platform-mini-stats span {
    color: var(--text-muted);
}

.platform-mini-stats strong {
    color: var(--gold);
    font-weight: 700;
}

.platform-highlight-grid,
.platform-charts-grid,
.platform-indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.platform-highlight-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 12px;
}

.platform-chart-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}

.platform-chart-box h4 {
    margin: 0 0 16px;
    font-size: 0.95rem;
    color: var(--gold-soft);
}

.platform-bar-row + .platform-bar-row {
    margin-top: 14px;
}

.platform-bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.platform-bar-value {
    color: var(--gold);
    font-weight: 700;
}

.platform-bar-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.platform-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.65), rgba(212, 175, 55, 0.95));
}

.platform-bar-salla { background: linear-gradient(90deg, rgba(74, 222, 128, 0.65), rgba(74, 222, 128, 0.95)); }
.platform-bar-trendyol { background: linear-gradient(90deg, rgba(96, 165, 250, 0.65), rgba(96, 165, 250, 0.95)); }
.platform-bar-noon { background: linear-gradient(90deg, rgba(251, 191, 36, 0.65), rgba(251, 191, 36, 0.95)); }
.platform-bar-amazon { background: linear-gradient(90deg, rgba(248, 113, 113, 0.65), rgba(248, 113, 113, 0.95)); }
.platform-bar-other { background: linear-gradient(90deg, rgba(167, 139, 250, 0.65), rgba(167, 139, 250, 0.95)); }

/* ------------------------------------------------------- Monthly performance */
.monthly-plan-target-grid,
.monthly-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.monthly-plan-target-field,
.monthly-goal-card {
    border: 1px solid rgba(201, 169, 98, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    padding: 16px;
}

.monthly-plan-target-field small {
    color: var(--muted);
}

.monthly-plan-target-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.monthly-plan-target-heading label {
    margin: 0;
}

.monthly-current-value {
    display: inline-grid;
    gap: 2px;
    min-width: 104px;
    padding: 8px 10px;
    border: 1px solid rgba(201, 169, 98, 0.24);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
    text-align: center;
}

.monthly-current-value small {
    font-size: 0.74rem;
}

.monthly-current-value strong {
    color: var(--gold);
    font-size: 1.05rem;
    line-height: 1.2;
}

.monthly-current-value em {
    color: var(--muted);
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 700;
}

.monthly-plan-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.monthly-plan-input-row span,
.monthly-goal-values span {
    color: var(--muted);
    font-weight: 700;
}

.monthly-plan-helper-note {
    margin: 14px 0 18px;
    color: var(--muted);
    font-weight: 700;
}

.monthly-goal-card {
    border-inline-start-width: 5px;
}

.monthly-goal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.monthly-goal-card-header h4 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}

.monthly-goal-card-header span {
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.monthly-goal-values {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.monthly-goal-values strong {
    font-size: 1.35rem;
    color: var(--gold);
}

.monthly-progress-track {
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 12px;
}

.monthly-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
}

.monthly-goal-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.monthly-status-achieved {
    border-inline-start-color: #4ade80;
}

.monthly-status-achieved .monthly-progress-track span {
    background: #4ade80;
}

.monthly-status-near {
    border-inline-start-color: #facc15;
}

.monthly-status-near .monthly-progress-track span {
    background: #facc15;
}

.monthly-status-delayed {
    border-inline-start-color: #f87171;
}

.monthly-status-delayed .monthly-progress-track span {
    background: #f87171;
}

.strategic-initiative-overdue {
    background: rgba(248, 113, 113, 0.08);
}

.strategic-initiative-overdue td {
    border-color: rgba(248, 113, 113, 0.24);
}

.strategic-initiative-completed {
    background: rgba(74, 222, 128, 0.06);
}

.strategic-initiative-completed td {
    border-color: rgba(74, 222, 128, 0.18);
}

.monthly-report-list {
    margin: 0;
    padding: 0 20px 0 0;
    color: var(--text);
    line-height: 2;
}

.platform-contribution-list {
    display: grid;
    gap: 10px;
}

.platform-contribution-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.03);
}

.platform-contribution-item strong {
    color: var(--gold);
    font-size: 1.1rem;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.8);
    opacity: 1;
    cursor: pointer;
}

.company-logo-preview-box {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.03);
    padding: 18px;
}

.company-logo-preview {
    width: min(180px, 80%);
    max-height: 120px;
    object-fit: contain;
}

.company-logo-fallback {
    min-width: 180px;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--gold-soft);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

.rich-text-output {
    color: inherit;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.rich-text-output p,
.rich-text-output div {
    margin: 0 0 8px;
}

.rich-text-output ul,
.rich-text-output ol {
    margin: 6px 0;
    padding-inline-start: 24px;
    padding-inline-end: 24px;
}

.rich-text-output blockquote {
    margin: 8px 0;
    padding: 10px 14px;
    border-inline-start: 3px solid var(--gold);
    background: rgba(214, 176, 84, .08);
}

.rich-text-output input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-inline-end: 8px;
    accent-color: var(--gold);
    vertical-align: middle;
}

.rich-text-output a {
    color: var(--gold-soft);
    text-decoration: underline;
}

.rich-text-preview {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------------------------- Mobile UX hardening */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

.table-box,
.form-box,
.card,
.field-card {
    overflow: visible;
}

.responsive-table {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.chemex-select-menu,
.search-select-results,
.search-select-results-floating {
    z-index: 3000;
    max-width: calc(100vw - 24px);
}

.mobile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.mobile-sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 80;
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    .sidebar-overlay {
        z-index: 2500;
    }

    .sidebar {
        z-index: 2600;
        width: min(86vw, 320px);
        max-width: 100vw;
    }

    .topbar {
        position: sticky;
        top: 8px;
        z-index: 800;
        align-items: flex-start;
        border-radius: 14px;
    }

    .topbar-title {
        font-size: 1rem;
        line-height: 1.4;
    }

    .topbar-user {
        white-space: normal;
        text-align: left;
        line-height: 1.35;
        max-width: 42vw;
    }

    .content {
        padding: 12px;
    }

    .table-box,
    .form-box {
        padding: 14px;
        border-radius: 14px;
    }

    .toolbar,
    .form-actions,
    .dashboard-health-actions {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 10px;
    }

    .toolbar .btn,
    .toolbar form,
    .toolbar button,
    .form-actions .btn,
    .form-actions button {
        width: 100%;
        justify-content: center;
    }

    .cards,
    .inventory-report .cards {
        grid-template-columns: 1fr;
    }

    .card .value,
    .stat-card .value,
    .stat-card > strong {
        font-size: 1.15rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .form-grid,
    .mobile-form-grid,
    .attachment-create-grid {
        grid-template-columns: 1fr;
    }

    input,
    textarea,
    select,
    .form-control,
    .form-select,
    .chemex-select,
    .chemex-select-trigger,
    .search-select-input {
        min-height: 44px;
        font-size: 16px;
    }

    .chemex-select-menu,
    .search-select-results,
    .search-select-results-floating {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none;
        max-height: min(58vh, 360px) !important;
        border-radius: 16px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65);
    }

    .chemex-select-option,
    .search-select-option {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.55;
        padding: 12px 14px;
    }

    .table-scroll:has(.mobile-card-table) {
        overflow-x: visible;
    }

    .mobile-card-table {
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table,
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
        display: block;
        width: 100%;
    }

    .mobile-card-table tr {
        padding: 14px;
        border: 1px solid var(--glass-border);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.035);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    }

    .mobile-card-table td {
        display: grid;
        grid-template-columns: minmax(104px, 0.85fr) minmax(0, 1.15fr);
        gap: 10px;
        align-items: center;
        padding: 9px 0;
        border-bottom: 1px solid rgba(201, 169, 98, 0.1);
        text-align: right;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .mobile-card-table td:last-child {
        border-bottom: 0;
    }

    .mobile-card-table td::before {
        content: attr(data-label);
        color: var(--gold-soft);
        font-weight: 800;
        font-size: 0.78rem;
        line-height: 1.45;
    }

    .mobile-card-table td:not([data-label]) {
        display: block;
    }

    .mobile-card-table td:not([data-label])::before {
        content: none;
    }

    .mobile-card-table .col-product,
    .mobile-card-table .actions,
    .mobile-card-table .sales-item-actions {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .mobile-card-table .col-product::before,
    .mobile-card-table .actions::before,
    .mobile-card-table .sales-item-actions::before {
        display: block;
    }

    .mobile-card-table input,
    .mobile-card-table select,
    .mobile-card-table .search-select,
    .mobile-card-table .select-wrap {
        width: 100%;
        min-width: 0;
        margin-bottom: 0;
    }

    .mobile-card-table .actions,
    .mobile-card-table .sales-item-actions {
        gap: 8px;
    }

    .mobile-card-table .actions .btn,
    .mobile-card-table .sales-item-actions .btn,
    .mobile-card-table .actions form,
    .mobile-card-table .actions button {
        width: 100%;
        justify-content: center;
    }

    .mobile-card-table tfoot {
        display: block;
    }

    .mobile-card-table tfoot tr,
    .mobile-card-table tfoot th,
    .mobile-card-table tfoot td {
        display: block;
        width: 100%;
        text-align: center;
    }

    .mobile-invoice-summary {
        position: sticky;
        bottom: 10px;
        z-index: 60;
        background: rgba(20, 13, 8, 0.96);
    }

    table.detail-table {
        min-width: 0;
    }

    table.detail-table,
    table.detail-table tbody,
    table.detail-table tr,
    table.detail-table th,
    table.detail-table td {
        display: block;
        width: 100%;
    }

    table.detail-table th,
    table.detail-table td {
        padding: 8px 0;
        border-bottom: 0;
    }

    table.detail-table tr {
        padding: 10px 0;
        border-bottom: 1px solid rgba(201, 169, 98, 0.12);
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px;
    }

    .topbar {
        margin: 10px 10px 0;
        padding: 10px 12px;
    }

    .cards,
    .inventory-report .cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn {
        min-height: 42px;
        white-space: normal;
        line-height: 1.35;
    }

    .mobile-card-table td {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .mobile-card-table td::before {
        font-size: 0.75rem;
    }
}
