:root {
    --color-primary: #C99A2E;
    --color-primary-dark: #A97F20;
    --color-primary-light: #F2C230;
    --color-accent: #F2C230;
    --color-sidebar-bg: #1C1B1F;
    --color-sidebar-bg-alt: #26242B;
    --color-sidebar-text: #B9B6C3;
    --color-sidebar-text-muted: #726F7C;
    --color-bg: #F6F5F2;
    --color-surface: #ffffff;
    --color-border: #E6E2DA;
    --color-text: #2A2730;
    --color-muted: #7A7686;
    --color-danger: #C0392B;
    --color-danger-bg: #FBEAE8;
    --color-success: #2F8F4E;
    --color-success-bg: #E8F5EC;
    --radius: 10px;
    --radius-sm: 7px;
    --spacing: 18px;
    --sidebar-width: 252px;
    --topbar-height: 62px;
    --shadow-sm: 0 1px 2px rgba(30, 25, 10, 0.06);
    --shadow-md: 0 8px 24px rgba(30, 25, 10, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary-dark);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}
.icon-sm {
    width: 14px;
    height: 14px;
}

/* ---------- App shell / sidebar ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.22s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    overflow: hidden;
}
.brand-name {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
}
.brand-sub {
    font-size: 11px;
    color: var(--color-primary-light);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.sidebar-close {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-sidebar-text);
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-sidebar-text);
    font-size: 14px;
    font-weight: 500;
}
.nav-item:hover {
    background: var(--color-sidebar-bg-alt);
    color: #fff;
    text-decoration: none;
}
.nav-item.active {
    background: var(--color-primary-light);
    color: #24211a;
}
.nav-item.active .icon {
    color: #24211a;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 12px;
}
.sidebar-footer .nav-item {
    margin-bottom: 6px;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-sidebar-bg-alt);
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: #24211a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    line-height: 1.3;
}
.sidebar-user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    color: var(--color-sidebar-text-muted);
    font-size: 11.5px;
    text-transform: capitalize;
}
.icon-button {
    background: none;
    border: none;
    color: var(--color-sidebar-text);
    cursor: pointer;
    padding: 4px;
    display: flex;
    border-radius: 6px;
}
.icon-button:hover {
    color: var(--color-danger);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 5, 0.45);
    z-index: 35;
}

/* ---------- Main content ---------- */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 4px;
}

.page-container {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 26px 26px 50px;
}

body.no-sidebar {
    background: var(--color-bg);
}

.site-footer {
    text-align: center;
    padding: 14px 26px;
    font-size: 12.5px;
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
}
.site-footer a {
    color: var(--color-muted);
    text-decoration: underline;
}
.site-footer a:hover {
    color: var(--color-text);
}
body.no-sidebar .site-footer {
    border-top: none;
    margin-top: 10px;
}

/* ---------- Alerts ---------- */

.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid transparent;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-color: #cdeadb; }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border-color: #f3d3ce; }
.alert-info { background: #EAF2FB; color: #2c5d8f; border-color: #c7dcf3; }

/* ---------- Cards, headers ---------- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}
.page-header h1 {
    margin: 0 auto 0 0;
    font-size: 20px;
    font-weight: 700;
}
.page-header .page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 1px 2px rgba(30, 25, 10, 0.1);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--color-primary-dark); text-decoration: none; color: #fff; box-shadow: 0 4px 12px rgba(30, 25, 10, 0.16); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(30, 25, 10, 0.1); }
.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); box-shadow: none; }
.btn-secondary:hover { background: #f9f7f2; color: var(--color-text); border-color: #d9d3c4; box-shadow: 0 2px 8px rgba(30, 25, 10, 0.08); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #9d3025; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Forms (Material-style floating-label fields) ---------- */

.form-group {
    position: relative;
    margin-bottom: 24px;
}

/* Label sits inside the field until the control has focus or a value,
   then floats above the border. Requires the label to be the DOM sibling
   right after the control (visual order is handled by absolute position),
   and text inputs/textareas to carry placeholder=" " for :placeholder-shown. */
.form-group > label {
    position: absolute;
    left: 13px;
    top: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
    background: #fff;
    padding: 0 5px;
    margin: 0;
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, color 0.15s ease, font-weight 0.15s ease;
    text-transform: none;
    letter-spacing: 0;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
}

.form-control {
    width: 100%;
    padding: 21px 14px 9px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 14.5px;
    background: #fff;
    color: var(--color-text);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control::placeholder {
    color: transparent;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(201, 154, 46, 0.14);
}
.form-control:hover:not(:focus) {
    border-color: #cfc9ba;
}

.form-group .form-control:focus + label,
.form-group .form-control:not(:placeholder-shown) + label,
.form-group select.form-control + label {
    top: -9px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}
.form-group .form-control:focus + label {
    color: var(--color-primary-dark);
}
.form-group .field-error ~ label,
.form-group.has-error > label {
    color: var(--color-danger);
}
.form-group.has-error .form-control {
    border-color: var(--color-danger);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A7686' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 17px;
    padding-right: 38px;
    cursor: pointer;
}

.form-hint {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 5px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row .form-group {
    flex: 1;
    min-width: 200px;
}
.bundle-row {
    align-items: center;
    margin-bottom: 12px;
}
.bundle-row .remove-bundle-row {
    flex: 0 0 auto;
    align-self: flex-start;
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}
.field-error {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 5px;
}

/* ---------- Segmented toggle (radio group styled as pill buttons) ---------- */

.segmented {
    display: inline-flex;
    background: #F1EEE6;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 16px;
}
.segmented input[type="radio"],
.segmented input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.segmented label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}
.segmented label .icon { width: 16px; height: 16px; }
.segmented input[type="radio"]:checked + label,
.segmented input[type="checkbox"]:checked + label {
    background: #fff;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}
.segmented input[type="radio"]:focus-visible + label,
.segmented input[type="checkbox"]:focus-visible + label {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* ---------- Period toggle (link-based segmented control) ---------- */

.period-toggle {
    display: inline-flex;
    background: #F1EEE6;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.period-toggle a {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-muted);
}
.period-toggle a:hover {
    text-decoration: none;
    color: var(--color-text);
}
.period-toggle a.active {
    background: #fff;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

/* ---------- Searchable select (type-to-filter combobox) ---------- */

.searchable-select {
    position: relative;
}
.searchable-select .form-control {
    cursor: text;
}
.searchable-select-arrow {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    pointer-events: none;
    width: 17px;
    height: 17px;
}
.searchable-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
.searchable-dropdown.open {
    display: block;
}
.searchable-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #F3F1EB;
}
.searchable-option:last-child {
    border-bottom: none;
}
.searchable-option:hover,
.searchable-option.highlighted {
    background: #FAF3DE;
}
.searchable-option .opt-title {
    font-weight: 600;
    color: var(--color-text);
}
.searchable-option .opt-meta {
    color: var(--color-muted);
    font-size: 12px;
    white-space: nowrap;
}
.searchable-empty {
    padding: 14px;
    color: var(--color-muted);
    font-size: 13px;
    text-align: center;
}

/* ---------- Date picker (themed calendar popup) ---------- */

.date-field .form-control {
    cursor: pointer;
}

.datepicker-popup {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 14px;
    width: 272px;
    display: none;
}
.datepicker-popup.open {
    display: block;
}
.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.datepicker-title {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--color-text);
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
}
.datepicker-title:not(.datepicker-title-static):hover {
    background: #F3F1EB;
}
.datepicker-title-static {
    cursor: default;
}
.datepicker-nav {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 5px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.datepicker-nav .icon {
    width: 16px;
    height: 16px;
}
.datepicker-nav:hover {
    background: #F3F1EB;
    color: var(--color-text);
}
.datepicker-weekdays,
.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.datepicker-weekdays {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-muted);
    margin-bottom: 4px;
}
.datepicker-weekdays span {
    padding: 4px 0;
}
.datepicker-days {
    gap: 2px;
}
.datepicker-day {
    border: none;
    background: none;
    padding: 7px 0;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--color-text);
    transition: background 0.12s ease, color 0.12s ease;
}
.datepicker-day:hover {
    background: #FAF3DE;
}
.datepicker-day.is-outside {
    color: #CFC9BA;
}
.datepicker-day.is-today {
    font-weight: 700;
    color: var(--color-primary-dark);
}
.datepicker-day.is-selected {
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
}
.datepicker-day.is-selected:hover {
    background: var(--color-primary-dark);
}
.datepicker-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
.datepicker-cell {
    border: none;
    background: none;
    padding: 12px 0;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text);
    transition: background 0.12s ease, color 0.12s ease;
}
.datepicker-cell:hover {
    background: #FAF3DE;
}
.datepicker-cell.is-today {
    color: var(--color-primary-dark);
}
.datepicker-cell.is-selected {
    background: var(--color-primary);
    color: #fff;
}
.datepicker-cell.is-selected:hover {
    background: var(--color-primary-dark);
}
.datepicker-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}
.datepicker-footer button {
    background: none;
    border: none;
    color: var(--color-primary-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.datepicker-footer button:hover {
    background: #FAF3DE;
}
.datepicker-footer button.datepicker-clear {
    color: var(--color-muted);
}

/* ---------- Stat cards ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing);
    margin-bottom: 24px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #FBF1DC;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon .icon { width: 22px; height: 22px; }
.stat-body { min-width: 0; }
.stat-card .stat-label {
    font-size: 12.5px;
    color: var(--color-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.stat-card .stat-value {
    font-size: 25px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

/* ---------- Hero stat (the headline number) ---------- */

.hero-stat {
    background: linear-gradient(135deg, #211f26 0%, #2b2833 100%);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-bottom: var(--spacing);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-md);
}
.hero-stat-label {
    font-size: 12.5px;
    color: var(--color-primary-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 6px;
}
.hero-stat-value {
    font-size: 40px;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
}
.hero-stat-sub {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 4px;
}
.hero-stat-spark {
    flex-shrink: 0;
    width: 180px;
    max-width: 40%;
}
.hero-stat-spark svg {
    display: block;
    width: 100%;
    height: 52px;
}

/* ---------- Charts ---------- */

.chart-period {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.chart-period h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.charts-row {
    display: flex;
    gap: var(--spacing);
    flex-wrap: wrap;
    margin-bottom: var(--spacing);
    align-items: stretch;
}
.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    flex: 2 1 420px;
    min-width: 0;
}
.chart-card.chart-card-secondary {
    flex: 1 1 300px;
}
.chart-card h2 {
    font-size: 14.5px;
    margin: 0 0 4px;
}
.chart-card .chart-subtitle {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 14px;
}

.chart-wrap {
    position: relative;
}
.chart-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}
.chart-empty {
    padding: 30px 0;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

.chart-gridline {
    stroke: var(--color-border);
    stroke-width: 1;
}
.chart-axis-label {
    fill: var(--color-muted);
    font-size: 10.5px;
}
.chart-area {
    fill: rgba(201, 154, 46, 0.12);
}
.chart-line {
    fill: none;
    stroke: var(--color-primary-dark);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chart-end-dot {
    fill: var(--color-primary-dark);
    stroke: #fff;
    stroke-width: 2;
}
.chart-end-label {
    fill: var(--color-text);
    font-size: 12px;
    font-weight: 700;
}
.chart-crosshair {
    stroke: var(--color-muted);
    stroke-width: 1;
    stroke-dasharray: 2 2;
}
.chart-crosshair-dot {
    fill: var(--color-primary-dark);
    stroke: #fff;
    stroke-width: 2;
}
.chart-hit-band {
    fill: transparent;
    cursor: crosshair;
}
.chart-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -100%);
    background: #211f26;
    color: #fff;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 5;
    box-shadow: var(--shadow-md);
}
.chart-tooltip.visible {
    opacity: 1;
}
.chart-tooltip strong {
    display: block;
    font-size: 13px;
}
.chart-tooltip span {
    color: rgba(255, 255, 255, 0.6);
}

.chart-svg-bars .chart-bar-label {
    fill: var(--color-text);
    font-size: 12px;
    font-weight: 600;
}
.chart-svg-bars .chart-bar-track {
    fill: #F1EEE6;
}
.chart-svg-bars .chart-bar-value {
    fill: var(--color-muted);
    font-size: 11.5px;
}
.chart-svg-bars .chart-bar-hit {
    fill: transparent;
    cursor: pointer;
}
.chart-bar-group .chart-bar-fill {
    transition: filter 0.1s ease;
}
.chart-bar-group:hover .chart-bar-fill {
    filter: brightness(0.9);
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
}
th, td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13.5px;
}
th {
    background: #FAF8F4;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    font-weight: 700;
}
tbody tr:hover td {
    background: #FBFAF7;
}
tbody tr:last-child td {
    border-bottom: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.table-wrap table {
    border: none;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.badge-active { background: var(--color-success-bg); color: var(--color-success); }
.badge-inactive { background: var(--color-danger-bg); color: var(--color-danger); }

/* ---------- Filters / pagination ---------- */

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    align-items: flex-end;
}
.filters-bar .form-group {
    margin-bottom: 0;
    min-width: 170px;
}
/* Filter bars use compact static labels above the field rather than the
   floating-label treatment — better suited to short, always-visible filters. */
.filters-bar .form-group > label {
    position: static;
    display: block;
    background: none;
    padding: 0;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
}
.filters-bar .form-control {
    padding: 9px 12px;
}
.filters-bar select.form-control {
    padding-right: 34px;
}

.pagination {
    display: flex;
    gap: 6px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 13px;
    background: #fff;
}
.pagination a:hover { text-decoration: none; background: #f3f1ec; }
.pagination .current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ---------- Login page ---------- */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, #262229 0%, #17151a 70%);
}
.login-card {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.login-logo {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: block;
}
.login-card h1 {
    font-size: 19px;
    margin: 0 0 2px;
}
.login-card .subtitle {
    color: var(--color-muted);
    font-size: 12.5px;
    margin-bottom: 22px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.login-card .form-group { text-align: left; }
.login-hint {
    margin-top: 18px;
    font-size: 12px;
    color: var(--color-muted);
}

/* ---------- Misc ---------- */

.muted { color: var(--color-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
/* Deliberately NOT display:flex here -- overriding a <td>'s display away
   from table-cell makes the browser wrap it in an anonymous table-cell and
   render this box as a plain top-aligned block inside it, so it stops
   sharing the row's normal (vertically centered) cell alignment on any row
   that another column has wrapped onto multiple lines. */
.actions-cell { white-space: nowrap; vertical-align: middle; }
.actions-cell > * + * { margin-left: 6px; }
.inline-form { display: inline; }
.link-button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.steps {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.step {
    padding: 6px 12px;
    border-radius: 999px;
    background: #FAF8F4;
    font-size: 12px;
    color: var(--color-muted);
}
.step.active {
    background: var(--color-primary);
    color: #fff;
}

/* ---------- Receipt ---------- */

.receipt {
    max-width: 340px;
    margin: 0 auto;
    background: #fff;
    padding: 16px;
    font-family: "Courier New", monospace;
    font-size: 13px;
}
.receipt h2 {
    text-align: center;
    font-size: 16px;
    margin: 0 0 4px;
}
.receipt .center { text-align: center; }
.receipt hr {
    border: none;
    border-top: 1px dashed #999;
    margin: 8px 0;
}
.receipt table {
    width: 100%;
    font-size: 12px;
}
.receipt table td {
    padding: 3px 0;
    border: none;
}
.receipt .receipt-actions {
    text-align: center;
    margin-top: 16px;
}

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .receipt { max-width: 100%; }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
    .sidebar-close {
        display: inline-flex;
    }
    .sidebar-toggle {
        display: inline-flex;
    }
    .main-content {
        margin-left: 0;
    }
    .page-container {
        padding: 20px 16px 40px;
    }
    .topbar {
        padding: 0 16px;
    }
}

@media (max-width: 640px) {
    .stat-grid { grid-template-columns: 1fr; }
    .hero-stat { flex-direction: column; align-items: flex-start; }
    .hero-stat-spark { width: 100%; max-width: 100%; }
    .hero-stat-value { font-size: 32px; }
}
