/*
 * RestockPilot - Main Application Styles
 */

/* ─── Variables ────────────────────────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg-app:       #f5f7fb;
    --bg-surface:   #ffffff;
    --bg-primary:   #ffffff;
    --bg-secondary: #f2f4f7;
    --bg-sidebar:   #fcfcfd;
    --bg-muted:     #f9fafb;
    --bg-hover:     #f9fafb;
    --bg-active:    #f2f4f7;

    /* Text */
    --text-primary:    #101828;
    --text-secondary:  #475467;
    --text-tertiary:   #667085;
    --text-quaternary: #98a2b3;

    /* Borders */
    --border-color:  #eaecf0;
    --border-light:  #f2f4f7;
    --border-strong: #d0d5dd;

    /* Accent */
    --accent:       #111111;
    --accent-hover: #000000;
    --accent-light: rgba(17, 17, 17, 0.05);
    --focus-ring:   rgba(17, 17, 17, 0.14);

    /* Layout */
    --sidebar-width:     272px;
    --sidebar-collapsed: 64px;
    --header-height:     72px;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    /* Shadows */
    --shadow-sm:  none;
    --shadow-md:  none;
    --shadow-lg:  none;

    /* Motion */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.1s;
    --duration-base: 0.2s;
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width var(--duration-base) var(--ease);
    overflow: hidden;
    box-shadow: none;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

/* Header */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: var(--radius-md);
    padding: 6px;
    color: white;
    box-shadow: none;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    white-space: nowrap;
    overflow: hidden;
    transition:
        opacity var(--duration-fast) var(--ease),
        max-width var(--duration-base) var(--ease);
    max-width: 180px;
}

.sidebar-collapsed .logo-text {
    opacity: 0;
    max-width: 0;
}

/* Collapse toggle */
.collapse-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.collapse-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-quaternary);
    padding: 0 12px 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--duration-fast) var(--ease), height var(--duration-fast) var(--ease);
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease);
    margin-bottom: 2px;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-light);
    color: var(--accent);
    box-shadow: none;
}

.nav-item.active svg {
    color: var(--accent);
}

.nav-item-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 1.9;
}

.nav-item-text {
    overflow: hidden;
    transition:
        opacity var(--duration-fast) var(--ease),
        max-width var(--duration-base) var(--ease);
    max-width: 160px;
}

.sidebar-collapsed .nav-item-text {
    opacity: 0;
    max-width: 0;
}

/* Footer / User */
.sidebar-footer {
    padding: 12px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-light);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: background-color var(--duration-fast) var(--ease);
    overflow: hidden;
    background: var(--bg-muted);
    border: 1px solid var(--border-light);
}

.user-menu:hover {
    background-color: var(--bg-hover);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition:
        opacity var(--duration-fast) var(--ease),
        max-width var(--duration-base) var(--ease);
    max-width: 120px;
}

.sidebar-collapsed .user-info {
    opacity: 0;
    max-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-email {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.logout-form {
    flex-shrink: 0;
    transition: opacity var(--duration-fast) var(--ease);
}

.sidebar-collapsed .logout-form {
    opacity: 0;
    pointer-events: none;
}

.logout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
        background-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease);
}

.logout-button:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.logout-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ─── Main Wrapper ───────────────────────────────────────────────────────────── */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--duration-base) var(--ease);
}

.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed);
}

/* Mobile Content Header */
.mobile-content-header {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

@media (min-width: 769px) {
    .mobile-content-header,
    .page-title {
        display: none;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1440px;
    width: 100%;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease),
        outline-color var(--duration-fast) var(--ease);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: -0.01em;
    box-shadow: none;
}

.btn:focus-visible {
    outline: none;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: none;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-strong);
    box-shadow: none;
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-quaternary);
}

.btn-danger {
    background-color: #fff;
    color: #d92d20;
    border-color: #fecdca;
}

.btn-danger:hover {
    background-color: #fef3f2;
    border-color: #fda29b;
}

.icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease);
}

.icon-button:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    transition:
        border-color var(--duration-fast) var(--ease),
        outline-color var(--duration-fast) var(--ease);
    line-height: 1.4;
    box-shadow: none;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.input::placeholder {
    color: var(--text-tertiary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, outline-color 0.2s;
    box-shadow: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.form-control.input-validation-error {
    border-color: #dc2626;
    box-shadow: none;
}

.field-validation-message,
.field-validation-error {
    font-size: 13px;
    color: #b91c1c;
}

.validation-summary {
    display: none;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(220, 38, 38, 0.2);
    background-color: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    font-size: 14px;
}

.validation-summary.validation-summary-errors {
    display: block;
}

.validation-summary ul {
    margin: 0;
    padding-left: 18px;
}

.form-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 8px;
}

/* ─── Shared Components ──────────────────────────────────────────────────────── */

/* Content cards */
.content-card,
.table-card,
.prediction-card,
.settings-section,
.account-section,
.subscription-panel,
.replenishment-table-card,
.integration-module,
.onboarding-card,
.details-empty-state {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: none;
}

.content-card,
.table-card,
.prediction-card,
.settings-section,
.account-section,
.subscription-panel,
.integration-module {
    overflow: hidden;
}

.content-card-header,
.settings-section-header,
.account-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.content-card-title,
.settings-section-title,
.account-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.content-card-description,
.settings-section-description,
.account-section-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.content-card-body,
.settings-section-body,
.account-section-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Buttons */
.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-primary-outline {
    background-color: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-outline:hover:not(:disabled) {
    background-color: var(--accent);
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px dashed var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

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

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background-color 0.2s;
}

.btn-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* Tables */
.data-table,
.prediction-table,
.purchase-history-table,
.replenishment-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.prediction-table th,
.purchase-history-table th,
.replenishment-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    background-color: var(--bg-muted);
}

.data-table td,
.prediction-table td,
.purchase-history-table td,
.replenishment-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr:hover td,
.prediction-table tbody tr:hover td,
.purchase-history-table tbody tr:hover td,
.replenishment-table tbody tr:hover td {
    background-color: var(--bg-hover);
}

.data-table tbody tr:last-child td,
.prediction-table tbody tr:last-child td,
.purchase-history-table tbody tr:last-child td,
.replenishment-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td a,
.replenishment-table td a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.data-table td a:hover,
.replenishment-table td a:hover {
    color: var(--accent);
}

/* Badges */
.badge,
.risk-pill,
.status-pill,
.subscription-badge,
.purchase-history-status {
    display: inline-flex;
    align-items: center;
}

.badge,
.risk-pill {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    padding: 4px 10px;
}

.status-pill {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
}

.subscription-badge,
.purchase-history-status {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge--ordernow,
.risk-ordernow,
.status-out,
.status-critical {
    color: #b42318;
    background-color: #fef3f2;
}

.badge--ordered,
.risk-ordered,
.status-ordered {
    color: #175cd3;
    background-color: #eff8ff;
}

.badge--watch,
.risk-watch,
.status-warning,
.subscription-badge-readonly,
.purchase-history-status-ended {
    color: #b54708;
    background-color: #fffaeb;
}

.badge--healthy,
.risk-healthy,
.status-healthy,
.subscription-badge-full,
.purchase-history-status-active {
    color: #027a48;
    background-color: #ecfdf3;
}

.status-unknown {
    color: var(--text-secondary);
    background-color: var(--bg-muted);
}

.purchase-history-status-recorded {
    color: #344054;
    background-color: #f2f4f7;
}

.subscription-badge-blocked {
    color: #b42318;
    background-color: #fef3f2;
}

/* Modals */
.modal-overlay,
.account-modal-backdrop,
.replenishment-modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
}

.modal-content,
.account-modal,
.replenishment-modal {
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
}

.modal-actions,
.account-modal-actions,
.replenishment-modal-actions {
    display: flex;
    justify-content: flex-end;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-success {
    background-color: #ecfdf3;
    color: #027a48;
    border: 1px solid #abefc6;
}

.alert-error {
    background-color: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

.alert-warning {
    background-color: #fffaeb;
    color: #b54708;
    border: 1px solid #fedf89;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.toast .alert {
    margin: 0;
    box-shadow: none;
    background-clip: padding-box;
}

/* Utilities */
[x-cloak] {
    display: none !important;
}

.mono,
.td-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.td-mono {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
}

/* ─── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-heading {
    font-size: 30px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.15;
}

.page-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    max-width: 720px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: none;
}

.card-header {
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.metric-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.metric-card--striped::before {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    top: 0;
    height: 3px;
    border-radius: 999px;
    background-color: var(--accent);
}

.metric-card--accent::before {
    background-color: var(--accent);
}

.metric-card--critical::before {
    background-color: #f04438;
}

.metric-card--warning::before {
    background-color: #f79009;
}

.metric-card--neutral::before {
    background-color: #667085;
}

.metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric-value {
    color: var(--text-primary);
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
}

.metric-value--secondary {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding-top: 8px;
}

/* ─── HTMX loading states ────────────────────────────────────────────────────── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-flex;
}

.htmx-request .htmx-not-indicator {
    display: none;
}

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-muted {
    color: var(--text-tertiary);
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition:
            transform var(--duration-base) var(--ease),
            width var(--duration-base) var(--ease);
        width: var(--sidebar-width) !important;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: none;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        width: calc(100vw - 24px);
    }

    .mobile-content-header {
        display: flex;
    }

    .main-content {
        padding: 24px 16px;
    }
}

@media (max-width: 640px) {
    .metric-value {
        font-size: 24px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .data-table th,
    .prediction-table th,
    .purchase-history-table th,
    .replenishment-table th,
    .data-table td,
    .prediction-table td,
    .purchase-history-table td,
    .replenishment-table td {
        padding: 8px 12px;
    }
}

/* ─── Stock Alerts ───────────────────────────────────────────────────────────── */
.stock-alert-critical {
    color: #b42318;
    font-weight: 600;
}

.stock-alert-warning {
    color: #b54708;
    font-weight: 600;
}

.stock-alert-ok {
    color: #027a48;
}

.subscription-expired-card {
    max-width: 720px;
}

.subscription-expired-lead {
    margin-bottom: 16px;
}

.subscription-expired-body {
    margin-bottom: 20px;
}

.subscription-expired-activation-form {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
