/* ==========================================================================
   POS Pro — Modern Professional Stylesheet
   Font: DM Sans · Primary: Facebook Blue #1877F2 · Light/Dark via data-theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   Theme Variables — shared di :root, warna per tema
   -------------------------------------------------------------------------- */
:root {
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;
    --font: 'DM Sans', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --transition: 0.18s ease;
    color-scheme: light;

    /* Spacing — skala konsisten */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-page: 20px;
    --space-card: 16px;
    --space-card-header-y: 12px;
    --space-card-header-x: 16px;

    /* Form controls */
    --input-height: 38px;
    --input-height-sm: 32px;
    --input-height-lg: 44px;
    --input-padding-x: 12px;
    --input-font-size: 14px;
    --input-font-size-sm: 13px;
    --label-gap: 5px;
    --form-group-gap: 14px;
    --form-row-gap: 12px;

    /* Buttons — ringkas, terpisah dari tinggi input */
    --btn-height: 36px;
    --btn-height-sm: 30px;
    --btn-height-lg: 40px;
    --btn-padding-x: 12px;
    --btn-padding-x-lg: 16px;
    --btn-font-weight: 500;

    /* Typography */
    --heading-weight: 600;
    --heading-size-page: 1.375rem;

    /* Tables */
    --table-cell-x: 14px;
    --table-cell-y: 10px;
    --table-head-y: 8px;
}

[data-theme="light"] {
    --primary: #1877F2;
    --primary-dark: #166FE5;
    --primary-light: #4599FF;
    --primary-subtle: #E7F3FF;
    --primary-ring: rgba(24, 119, 242, 0.2);

    --success: #31A24C;
    --success-subtle: #E7F3EF;
    --danger: #FA383E;
    --danger-subtle: #FEE2E2;
    --warning: #F7B928;
    --warning-subtle: #FFF8E6;

    --bg: #F0F2F5;
    --bg-elevated: #FFFFFF;
    --surface: #FFFFFF;
    --surface-hover: #F2F3F5;
    --border: #CED0D4;
    --border-strong: #BCC0C4;

    --text: #050505;
    --text-secondary: #1C1E21;
    --text-muted: #65676B;
    --text-inverse: #FFFFFF;

    --sidebar-from: #FFFFFF;
    --sidebar-to: #FFFFFF;
    --sidebar-text: #050505;
    --sidebar-muted: #65676B;
    --sidebar-border: #CED0D4;
    --sidebar-hover: #F0F2F5;
    --sidebar-active: #E7F3FF;

    --topbar-bg: rgba(255, 255, 255, 0.92);
    --topbar-border: #CED0D4;
    --overlay: rgba(0, 0, 0, 0.45);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    color-scheme: dark;
    --primary: #4599FF;
    --primary-dark: #1877F2;
    --primary-light: #6CB0FF;
    --primary-subtle: rgba(24, 119, 242, 0.18);
    --primary-ring: rgba(69, 153, 255, 0.28);

    --success: #45BD62;
    --success-subtle: rgba(69, 189, 98, 0.14);
    --danger: #FA383E;
    --danger-subtle: rgba(250, 56, 62, 0.14);
    --warning: #F7B928;
    --warning-subtle: rgba(247, 185, 40, 0.14);

    --bg: #18191A;
    --bg-elevated: #242526;
    --surface: #242526;
    --surface-hover: #3A3B3C;
    --border: #3A3B3C;
    --border-strong: #4E4F50;

    --text: #E4E6EB;
    --text-secondary: #B0B3B8;
    --text-muted: #B0B3B8;
    --text-inverse: #FFFFFF;

    --sidebar-from: #242526;
    --sidebar-to: #242526;
    --sidebar-text: #E4E6EB;
    --sidebar-muted: #B0B3B8;
    --sidebar-border: #3A3B3C;
    --sidebar-hover: #3A3B3C;
    --sidebar-active: rgba(24, 119, 242, 0.22);

    --topbar-bg: rgba(36, 37, 38, 0.92);
    --topbar-border: #3A3B3C;
    --overlay: rgba(0, 0, 0, 0.65);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.45);
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
    max-width: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    overflow-x: clip;
    max-width: 100%;
}

img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color-scheme: dark;
}

[data-theme="dark"] select option {
    background: var(--surface);
    color: var(--text);
}

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

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

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

::selection {
    background: var(--primary-subtle);
    color: var(--primary-dark);
}

/* --------------------------------------------------------------------------
   Auth — Split Login Page
   -------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: stretch;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

.auth-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 56px;
    background: linear-gradient(145deg, #1877F2 0%, #166FE5 50%, #0D65D9 100%);
    overflow: hidden;
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 85% 15%, rgba(255, 255, 255, 0.1) 0%, transparent 55%);
    pointer-events: none;
}

.auth-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.auth-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 480px;
    color: #fff;
}

.auth-logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 32px;
}

.auth-logo span {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.auth-hero-inner h1 {
    font-size: clamp(28px, 3.5vw, 38px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.auth-hero-inner > p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.65;
    margin-bottom: 28px;
}

.auth-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.auth-features li::before {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.auth-panel {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 32px;
    background: var(--bg);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-y: auto;
}

[data-theme="dark"] .auth-panel {
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow-sm);
}

.auth-card-head {
    margin-bottom: 28px;
}

.auth-card-head h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.auth-card-head p {
    color: var(--text-muted);
    font-size: 14px;
}

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

.auth-roles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.role-chip {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 12px;
}

.role-chip strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text);
}

.role-chip code {
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
}

.role-chip.admin {
    border-color: rgba(24, 119, 242, 0.3);
    background: var(--primary-subtle);
}

.role-chip.admin strong {
    color: var(--primary-dark);
}

[data-theme="dark"] .role-chip.admin strong {
    color: var(--primary-light);
}

.role-chip.cashier {
    border-color: rgba(5, 150, 105, 0.25);
    background: var(--success-subtle);
}

.role-chip.cashier strong {
    color: var(--success);
}

/* Legacy login (migrate.php) */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0c0a1d 0%, #312e81 100%);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

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

.login-header .logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(24, 119, 242, 0.25);
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
}

.login-hint {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.login-hint code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: clip;
}

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

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    border-right: 1px solid var(--sidebar-border);
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.brand-text {
    font-weight: 600;
    color: var(--sidebar-text);
    font-size: 14px;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.brand-sub {
    font-size: 11px;
    color: var(--sidebar-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.shift-badge {
    margin: 12px 16px 4px;
    padding: 8px 12px;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: #6ee7b7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    50% { opacity: 0.85; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
}

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

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary);
    font-weight: 500;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-icon .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-divider {
    padding: 18px 14px 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-card strong {
    display: block;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.user-card small {
    display: block;
    color: var(--sidebar-muted);
    font-size: 11px;
    text-transform: capitalize;
}

.user-info {
    margin-bottom: 10px;
}

.user-info strong {
    display: block;
    color: var(--sidebar-text);
    font-size: 14px;
}

.user-info small {
    text-transform: capitalize;
    color: var(--sidebar-text);
}

.sidebar-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.icon-btn .bi {
    font-size: 1rem;
    line-height: 1;
}

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

.icon-btn:hover {
    background: #E4E6EB;
    color: var(--text);
}

[data-theme="dark"] .icon-btn:hover {
    background: #4E4F50;
    color: var(--text);
}

.icon-btn.danger:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--topbar-border);
    gap: 16px;
    min-width: 0;
    max-width: 100%;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
}

.topbar-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mobile-menu {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--surface-hover);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.mobile-menu .bi {
    font-size: 1.35rem;
    line-height: 1;
}

.mobile-menu:hover {
    background: var(--surface-hover);
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */
.main-content {
    flex: 1;
    padding: var(--space-page);
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header h1 {
    font-size: var(--heading-size-page);
    font-weight: var(--heading-weight);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   Cards & Stats
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    max-width: 100%;
    min-width: 0;
}

.card-header {
    padding: var(--space-card-header-y) var(--space-card-header-x);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

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

.card-body.table-wrap,
.card-body:has(.table-wrap) {
    padding: 0;
}

.card-body.table-wrap {
    overflow-x: auto;
}

.card-body .table-wrap {
    overflow-x: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--space-card-header-y) var(--space-card);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-card .label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: calc(var(--form-group-gap) + 4px) 0 var(--form-group-gap);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.01em;
}

.section-title:first-child {
    margin-top: 0;
}

.shift-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 10px;
}

.shift-status.open {
    background: var(--success-subtle);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.shift-status.closed {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Forms — tinggi, jarak & padding konsisten
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--form-group-gap);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: var(--label-gap);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.form-group select,
.form-group textarea,
.auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.auth-form select,
.auth-form textarea,
.filter-bar input,
.filter-bar select,
.filter-field input,
.filter-field select,
.modal-body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.modal-body select,
.modal-body textarea,
.login-card input:not([type="checkbox"]):not([type="radio"]),
.login-card select,
.login-card textarea {
    display: block;
    width: 100%;
    min-height: var(--input-height);
    padding: 0 var(--input-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--input-font-size);
    line-height: 1.4;
    background: var(--bg-elevated);
    color: var(--text);
    box-sizing: border-box;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group select,
.auth-form select,
.filter-bar select,
.filter-field select,
.modal-body select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

[data-theme="dark"] .form-group select,
[data-theme="dark"] .auth-form select,
[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-field select,
[data-theme="dark"] .modal-body select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.form-group textarea,
.auth-form textarea,
.modal-body textarea,
.login-card textarea {
    min-height: calc(var(--input-height) * 2);
    padding: 8px var(--input-padding-x);
    resize: vertical;
    line-height: 1.55;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.filter-field input:focus,
.filter-field select:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus,
.login-card input:focus,
.login-card select:focus,
.login-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-group input.input-money,
input.input-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.form-group input.input-money:focus,
input.input-money:focus {
    letter-spacing: 0.02em;
}

.form-group textarea::placeholder,
.auth-form input::placeholder,
.auth-form textarea::placeholder,
.modal-body input::placeholder,
.modal-body textarea::placeholder,
.login-card input::placeholder,
.login-card textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--form-row-gap);
    margin-bottom: var(--form-group-gap);
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--form-group-gap);
}

.form-stack .form-group {
    margin-bottom: 0;
}

.form-hint,
.form-group small,
.form-group .text-muted {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--input-height-sm);
    font-size: var(--input-font-size);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.filter-bar {
    display: flex;
    gap: var(--form-row-gap);
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-bar .form-group,
.filter-field {
    margin-bottom: 0;
}

.filter-field label {
    display: block;
    margin-bottom: var(--label-gap);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

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

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--btn-height);
    padding: 0 var(--btn-padding-x);
    border-radius: var(--radius-sm);
    border: none;
    font-size: var(--input-font-size);
    font-weight: var(--btn-font-weight);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), filter var(--transition), transform 0.1s;
    background: #E4E6EB;
    color: #050505;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none;
}

[data-theme="dark"] .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-outline) {
    background: #3A3B3C;
    color: #E4E6EB;
}

.btn .bi {
    font-size: 1.05em;
    line-height: 1;
}

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

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    filter: brightness(1.02);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    filter: brightness(0.95);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(0.95);
}

.btn-warning {
    background: var(--warning);
    color: #050505;
}

.btn-warning:hover {
    filter: brightness(0.95);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

[data-theme="light"] .btn-ghost {
    background: transparent;
}

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

[data-theme="dark"] .btn-ghost:hover {
    background: #3A3B3C;
}

.btn-sm {
    min-height: var(--btn-height-sm);
    padding: 0 10px;
    font-size: var(--input-font-size-sm);
}

.btn-lg {
    min-height: var(--btn-height-lg);
    padding: 0 var(--btn-padding-x-lg);
    font-size: var(--input-font-size);
}

.btn-block {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: opacity 0.3s ease;
}

.alert-success {
    background: var(--success-subtle);
    color: #065f46;
    border-color: rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .alert-success {
    color: #6ee7b7;
}

.alert-error {
    background: var(--danger-subtle);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .alert-error {
    color: #fca5a5;
}

.alert-warning {
    background: var(--warning-subtle);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.2);
}

[data-theme="dark"] .alert-warning {
    color: #fcd34d;
}

.alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.alert-action {
    margin: 10px 0 0;
}

/* --------------------------------------------------------------------------
   Tables — minimal, elegant, presisi
   -------------------------------------------------------------------------- */
.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: var(--table-head-y) var(--table-cell-x);
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    white-space: nowrap;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
    vertical-align: middle;
}

table tbody td {
    padding: var(--table-cell-y) var(--table-cell-x);
    text-align: left;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

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

table tbody tr {
    transition: background var(--transition);
}

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

/* Padding flush dengan card */
.card-body.table-wrap table thead th:first-child,
.card-body.table-wrap table tbody td:first-child,
.card-body .table-wrap table thead th:first-child,
.card-body .table-wrap table tbody td:first-child {
    padding-left: var(--space-card);
}

.card-body.table-wrap table thead th:last-child,
.card-body.table-wrap table tbody td:last-child,
.card-body .table-wrap table thead th:last-child,
.card-body .table-wrap table tbody td:last-child {
    padding-right: var(--space-card);
}

.card-body.table-wrap table thead th,
.card-body .table-wrap table thead th {
    background: var(--bg);
}

[data-theme="dark"] .card-body.table-wrap table thead th,
[data-theme="dark"] .card-body .table-wrap table thead th {
    background: var(--bg-elevated);
}

/* Alignment utilities */
table th.num,
table td.num,
table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table th.center,
table td.center {
    text-align: center;
}

table td.muted,
table td .muted {
    color: var(--text-muted);
}

/* SKU / kode di tabel */
table code {
    display: inline-block;
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}

[data-theme="dark"] table code {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

/* Baris kosong */
table tbody tr.table-empty td,
table tbody td.table-empty {
    text-align: center;
    padding: 40px var(--table-cell-x);
    color: var(--text-muted);
    font-size: 14px;
    border-bottom: none;
}

table tbody tr.table-empty:hover td {
    background: transparent;
}

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

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5em;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.3;
    vertical-align: middle;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-subtle);
    color: #065f46;
    border-color: rgba(5, 150, 105, 0.15);
}

[data-theme="dark"] .badge-success {
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.2);
}

.badge-danger {
    background: var(--danger-subtle);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.12);
}

[data-theme="dark"] .badge-danger {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.2);
}

.badge-warning {
    background: var(--warning-subtle);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.15);
}

[data-theme="dark"] .badge-warning {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.2);
}

.badge-primary {
    background: var(--primary-subtle);
    color: var(--primary-dark);
    border-color: rgba(24, 119, 242, 0.15);
}

[data-theme="dark"] .badge-primary {
    color: var(--primary-light);
}

.badge-muted {
    background: var(--surface-2, #F0F2F5);
    color: var(--text-muted);
}

[data-theme="dark"] .badge-muted {
    background: rgba(228, 230, 235, 0.08);
    color: #B0B3B8;
}

/* Grup tombol Edit + Hapus di tabel (bukan pada sel td) */
.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.table-actions form {
    display: inline-flex;
    margin: 0;
}

table td.actions {
    white-space: nowrap;
    text-align: right;
}

table td.actions form {
    display: inline-flex;
    margin: 0;
}

/* Tombol di dalam tabel — compact, palet Facebook */
table .btn {
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    gap: 4px;
    border-radius: 6px;
    line-height: 1.2;
    box-shadow: none;
}

table .btn .bi {
    font-size: 12px;
}

table .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-outline) {
    background: #E4E6EB;
    color: #050505;
}

table .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-outline):hover {
    background: #D8DADF;
    filter: none;
}

[data-theme="dark"] table .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-outline) {
    background: #3A3B3C;
    color: #E4E6EB;
}

[data-theme="dark"] table .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-outline):hover {
    background: #4E4F50;
}

table .btn-primary {
    background: #1877F2;
    color: #fff;
}

table .btn-primary:hover {
    background: #166FE5;
    filter: none;
}

table .btn-success {
    background: #31A24C;
    color: #fff;
}

table .btn-success:hover {
    background: #2b9143;
    filter: none;
}

table .btn-danger {
    background: #FA383E;
    color: #fff;
}

table .btn-danger:hover {
    background: #e73238;
    filter: none;
}

table .btn-warning {
    background: #F7B928;
    color: #050505;
}

table .btn-outline {
    background: transparent;
    border: 1px solid #CCD0D5;
    color: #050505;
}

table .btn-outline:hover {
    background: #F0F2F5;
}

[data-theme="dark"] table .btn-outline {
    border-color: #3E4042;
    color: #E4E6EB;
}

[data-theme="dark"] table .btn-outline:hover {
    background: #3A3B3C;
}

table td strong {
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

table tbody tr.is-muted td {
    opacity: 0.55;
}

table tbody tr.is-muted:hover td {
    opacity: 0.72;
}

.card-header + .card-body.table-wrap table thead th {
    background: var(--bg);
}

[data-theme="dark"] .card-header + .card-body.table-wrap table thead th {
    background: var(--bg-elevated);
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal-header {
    padding: 14px var(--space-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 15px;
}

.modal-body {
    padding: var(--space-card);
}

.modal-footer {
    padding: var(--space-md) var(--space-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}

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

.modal-wide {
    max-width: 720px;
}

.modal-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.supplier-field,
.supplier-notes-field {
    padding: 0 16px;
    margin: 0 0 8px;
}

.supplier-field {
    padding-top: 12px;
}

.supplier-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.supplier-select-row select {
    flex: 1;
    min-width: 0;
    min-height: var(--input-height-sm);
}

.supplier-select-row .btn {
    flex-shrink: 0;
    padding: 0 10px;
}

.supplier-manage-table {
    max-height: 360px;
}

/* --------------------------------------------------------------------------
   POS Layout (v1)
   -------------------------------------------------------------------------- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - var(--topbar-height) - 56px);
}

.pos-products {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pos-search input {
    width: 100%;
    min-height: var(--input-height);
    padding: 0 var(--input-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--input-font-size);
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
    padding-right: 4px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-align: center;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px var(--primary-ring);
    transform: translateY(-2px);
}

.product-card.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-card .name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.product-card .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
}

.product-card .stock {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.pos-cart {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.cart-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 16px;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 200px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-info .name {
    font-weight: 600;
    font-size: 13px;
}

.cart-item-info .price {
    color: var(--text-muted);
    font-size: 12px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-control button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    transition: background var(--transition);
}

.qty-control button:hover {
    background: var(--surface-hover);
}

.qty-control span,
.qty-control .qty-input {
    min-width: 48px;
    width: 56px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 4px 6px;
}

.qty-control .qty-input {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.input-qty {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.cart-summary {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 17px;
    font-weight: 600;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.cart-actions {
    padding: var(--space-md) var(--space-card);
    border-top: 1px solid var(--border);
}

.cart-actions .btn {
    width: 100%;
    min-height: var(--btn-height-lg);
    font-size: 14px;
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    transition: background var(--transition);
}

.btn-remove:hover {
    background: var(--danger-subtle);
}

/* --------------------------------------------------------------------------
   POS v2
   -------------------------------------------------------------------------- */
body.pos-page .main-content {
    padding: 16px 20px;
}

.pos-v2-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pos-v2-topbar h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}

.pos-v2-topbar p {
    color: var(--text-muted);
    font-size: 14px;
}

.pos-shortcuts {
    font-size: 13px;
    color: var(--text-muted);
}

.pos-shortcuts kbd {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: inherit;
}

.pos-v2-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    min-height: calc(100vh - var(--topbar-height) - 100px);
    max-width: 100%;
    min-width: 0;
}

.pos-mobile-tabs {
    display: none;
}

.pos-mobile-cart-fab {
    display: none;
}

.pos-v2-main[hidden],
.pos-v2-cart[hidden] {
    display: none !important;
}

.pos-v2-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
}

.scan-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.scan-box-primary {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.scan-box label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

.scan-box input {
    width: 100%;
    min-height: var(--input-height-lg);
    padding: 0 18px;
    font-size: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    letter-spacing: 0.04em;
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 600;
    box-sizing: border-box;
}

.scan-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.scan-box small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.manual-search {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    flex: 1;
    box-shadow: var(--shadow-sm);
}

.manual-search label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.manual-search > input {
    width: 100%;
    min-height: var(--input-height);
    padding: 0 var(--input-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--input-font-size);
    background: var(--bg-elevated);
    color: var(--text);
    box-sizing: border-box;
}

.manual-search > input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.search-results {
    margin-top: 12px;
    max-height: 360px;
    overflow-y: auto;
}

.search-item {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-bottom: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: border-color var(--transition), background var(--transition);
}

.search-item:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.search-item small {
    display: block;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-item-right {
    text-align: right;
    flex-shrink: 0;
}

.search-item-right small {
    display: block;
}

.search-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 14px;
}

.pos-v2-cart {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    /*max-height: calc(100vh - var(--topbar-height) - 100px);*/
}

.pos-v2-cart .cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-v2-cart .cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    min-height: 180px;
}

.cart-summary.compact {
    padding: 12px 16px;
}

.pay-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--form-row-gap);
    margin: 12px 0;
}

.pay-row .form-group {
    margin-bottom: 0;
}

.pay-row label {
    font-size: 12px;
    margin-bottom: var(--label-gap);
}

.pay-row input {
    min-height: var(--input-height-sm);
    font-size: var(--input-font-size-sm);
    padding: 0 12px;
}

.purchase-item .price-row {
    margin-top: 6px;
}

.purchase-item .price-row label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.purchase-item .price-row input {
    width: 100%;
    max-width: 120px;
    min-height: var(--input-height-sm);
    padding: 0 10px;
    font-size: var(--input-font-size-sm);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--sidebar-to);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 900;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

/* --------------------------------------------------------------------------
   Receipt Preview
   -------------------------------------------------------------------------- */
.receipt-preview {
    width: 280px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
    background: #fff;
    border: 1px dashed var(--border-strong);
    padding: 16px 12px;
    margin: 0 auto;
    color: #000;
}

.receipt-preview.receipt-preview-58 {
    width: 220px;
    font-size: 11px;
}

.receipt-preview.receipt-preview-80 {
    width: 280px;
}

[data-theme="dark"] .receipt-preview {
    background: #f8fafc;
}

.receipt-center {
    text-align: center;
}

.receipt-small {
    font-size: 11px;
    color: var(--text-muted);
}

.receipt-divider {
    border-top: 1px dashed #999;
    margin: 8px 0;
}

/* --------------------------------------------------------------------------
   Reports
   -------------------------------------------------------------------------- */
.report-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.report-tab {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.report-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.report-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.25);
}

.report-filter {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.period-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.period-btn {
    min-height: var(--btn-height-sm);
    padding: 0 12px;
    border: none;
    background: #E4E6EB;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: #050505;
    transition: background var(--transition), color var(--transition), filter var(--transition);
}

[data-theme="dark"] .period-btn:not(.active) {
    background: #3A3B3C;
    color: #E4E6EB;
}

.period-btn:hover {
    filter: brightness(0.97);
    color: var(--primary);
}

.period-btn.active {
    background: var(--primary);
    color: #fff;
}

.filter-inputs {
    display: flex;
    gap: var(--form-row-gap);
    align-items: flex-end;
    flex-wrap: wrap;
    width: 100%;
}

.filter-field label {
    display: block;
    font-size: 12px;
    margin-bottom: var(--label-gap);
    color: var(--text-muted);
    font-weight: 500;
}

.filter-field input {
    min-width: 140px;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.balance-sheet-grid {
    grid-template-columns: 1fr 1fr;
}

.report-table {
    width: 100%;
}

.report-table td,
.report-table th {
    font-size: 14px;
}

.report-table td.num,
.report-table th.num {
    font-variant-numeric: tabular-nums;
}

.financial-statement {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.financial-statement td {
    padding: 11px var(--table-cell-x);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.financial-statement tr:last-child td {
    border-bottom: none;
}

.financial-statement td.amount {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.financial-statement td.negative {
    color: var(--danger);
}

.financial-statement tr.section-head td {
    padding-top: 14px;
    padding-bottom: 6px;
    background: transparent;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-strong);
}

.financial-statement tr.subtotal td {
    font-weight: 600;
    background: var(--surface-hover);
}

.financial-statement tr.grand-total td {
    font-size: 14px;
    font-weight: 600;
    border-top: 1px solid var(--border-strong);
    border-bottom: none;
    background: var(--primary-subtle);
    padding-top: 12px;
    padding-bottom: 12px;
}

.financial-statement tbody tr:hover td {
    background: var(--surface-hover);
}

.financial-statement tr.section-head:hover td,
.financial-statement tr.grand-total:hover td {
    background: inherit;
}

.financial-statement tr.grand-total:hover td {
    background: var(--primary-subtle);
}

.report-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.report-header {
    display: none;
    text-align: center;
    margin-bottom: 24px;
}

.report-header h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.report-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.print-only {
    display: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .report-grid,
    .balance-sheet-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-panel {
        padding: 20px 16px;
    }

    .auth-card,
    .auth-card-wide {
        max-width: 100%;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        z-index: 200;
    }

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

    .app-main {
        margin-left: 0;
    }

    .mobile-menu {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

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

    .pos-layout,
    .pos-v2-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .product-grid {
        max-height: 400px;
    }

    .pos-v2-cart {
        max-height: none;
    }

    .pos-v2-topbar .pos-shortcuts {
        display: none;
    }

    .pos-v2-topbar {
        margin-bottom: 10px;
    }

    .pos-v2-topbar h1 {
        font-size: 20px;
    }

    .pos-v2-topbar p {
        font-size: 13px;
    }

    .pos-mobile-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
        position: sticky;
        top: calc(var(--topbar-height) + 8px);
        z-index: 25;
        background: var(--bg);
        padding-bottom: 4px;
    }

    .pos-tab {
        flex: 1;
        min-height: 44px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface);
        color: var(--text-muted);
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: background var(--transition), border-color var(--transition), color var(--transition);
    }

    .pos-tab.active {
        background: var(--primary-subtle);
        border-color: var(--primary);
        color: var(--primary);
        box-shadow: 0 0 0 2px var(--primary-ring);
    }

    .pos-v2-layout {
        display: block;
        gap: 0;
        min-height: 0;
    }

    .pos-v2-layout.panel-search .pos-v2-main {
        display: flex !important;
    }

    .pos-v2-layout.panel-cart .pos-v2-main {
        display: none !important;
    }

    .pos-v2-layout.panel-search .pos-v2-cart {
        display: none !important;
    }

    .pos-v2-layout.panel-cart .pos-v2-cart {
        display: flex !important;
        flex-direction: column;
        max-height: none;
        min-height: calc(100dvh - var(--topbar-height) - 180px);
    }

    .pos-v2-main {
        gap: 12px;
    }

    .scan-box,
    .manual-search {
        padding: 14px 16px;
    }

    .scan-box input {
        font-size: 16px;
        min-height: 44px;
    }

    .manual-search > input {
        min-height: 44px;
    }

    .search-results {
        max-height: min(40vh, 280px);
    }

    .pos-v2-cart {
        position: static;
        z-index: auto;
        box-shadow: var(--shadow-sm);
        max-height: none;
    }

    .pos-v2-cart .cart-items {
        min-height: 120px;
        max-height: min(38vh, 280px);
    }

    body.pos-page .main-content {
        padding: 12px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }

    body.pos-page .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
    }

    .cart-actions .btn-lg {
        width: 100%;
        min-height: var(--btn-height-lg);
    }

    .quick-pay-row {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .pos-mobile-cart-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 40;
        min-height: 48px;
        padding: 12px 16px;
        border: none;
        border-radius: var(--radius);
        background: var(--primary);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        box-shadow: var(--shadow-lg);
        cursor: pointer;
    }

    .pos-mobile-cart-fab[hidden] {
        display: none !important;
    }

    .auth-roles {
        grid-template-columns: 1fr;
    }
}

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

    .stat-card .value {
        font-size: 1.0625rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

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

    .auth-card {
        padding: 28px 24px;
    }
}

/* Sidebar overlay when open on mobile */
@media (max-width: 900px) {
    .sidebar.open::after {
        content: '';
        position: fixed;
        inset: 0;
        left: var(--sidebar-width);
        background: var(--overlay);
        z-index: -1;
    }
}

/* Collapsed sidebar on medium screens (optional compact mode) */
@media (min-width: 901px) and (max-width: 1100px) {
    .pos-v2-layout {
        grid-template-columns: 1fr 340px;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .sidebar,
    .topbar,
    .no-print,
    .report-nav,
    .report-filter,
    .page-header,
    .alert,
    .toast,
    .modal-overlay {
        display: none !important;
    }

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

    .main-content {
        padding: 0 !important;
    }

    .app-layout {
        display: block;
    }

    .print-only {
        display: block !important;
    }

    .report-header {
        display: block !important;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
        border: 1px solid #ddd;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    [data-theme="dark"] body {
        background: #fff;
        color: #000;
    }

    .financial-statement tr.grand-total td {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a {
        text-decoration: none;
        color: #000;
    }
}

/* --------------------------------------------------------------------------
   Touch & Mobile Enhancements
   -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-item,
    .search-item,
    .qty-control button {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0 12px;
    }

    table .btn,
    table .btn.btn-sm {
        min-height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .page-header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }

    .page-header-actions .toolbar-group {
        display: flex;
        width: 100%;
    }

    .page-header-actions .toolbar-group .btn,
    .page-header-actions .toolbar-group .export-dropdown {
        flex: 1 1 0;
        min-width: 0;
    }

    .page-header-actions .export-dropdown .export-toggle {
        width: 100%;
    }

    .page-header-actions > .btn-primary {
        width: 100%;
    }

    .page-header-actions .filter-bar-inline {
        width: 100%;
        margin-right: 0;
    }

    .page-header-actions .filter-bar-inline .filter-field {
        flex: 1 1 100%;
    }

    .page-header-actions .filter-bar-inline .filter-field input {
        width: 100%;
    }

    .page-header-actions .filter-bar-inline .btn-primary {
        flex: 1 1 auto;
    }

    .page-header .btn,
    .page-header form {
        width: auto;
    }

    .page-header form {
        flex-wrap: wrap;
    }

    .filter-inputs .toolbar-group-actions {
        width: 100%;
        margin-left: 0;
    }

    .filter-inputs .toolbar-group-actions .btn,
    .filter-inputs .toolbar-group-actions .export-dropdown {
        flex: 1 1 calc(50% - 4px);
    }

    .filter-inputs .toolbar-group-actions .export-dropdown .export-toggle {
        width: 100%;
    }

    .filter-bar.filter-bar-inline {
        width: 100%;
    }

    .filter-bar.filter-bar-inline .filter-field {
        flex: 1 1 100%;
    }

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

    .filter-bar.filter-bar-inline .toolbar-group {
        width: 100%;
    }

    .filter-bar.filter-bar-inline .toolbar-group .btn,
    .filter-bar.filter-bar-inline .toolbar-group .export-dropdown {
        flex: 1 1 calc(50% - 4px);
    }

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

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table {
        min-width: 640px;
    }

    table thead th,
    table tbody td {
        padding-left: 14px;
        padding-right: 14px;
    }

    .card-body.table-wrap table thead th:first-child,
    .card-body.table-wrap table tbody td:first-child {
        padding-left: var(--space-md);
    }

    .card-body.table-wrap table thead th:last-child,
    .card-body.table-wrap table tbody td:last-child {
        padding-right: var(--space-md);
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal {
        width: 100% !important;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .filter-bar,
    .filter-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input,
    .filter-bar select,
    .filter-field input,
    .filter-field select {
        width: 100%;
        min-width: 0;
    }

    .page-header .btn {
        white-space: normal;
    }

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

    .toast {
        left: 16px;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        max-width: none;
    }
}

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

    .pay-row {
        grid-template-columns: 1fr !important;
    }

    .pos-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center !important;
    }

    .pos-toolbar .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .pos-v2-cart .cart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* POS extras */
.pos-shift-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    flex-wrap: wrap;
}

.pos-shift-banner.ok {
    background: var(--success-subtle);
    border: 1px solid var(--success);
    color: var(--success);
}

.pos-shift-banner.warn {
    background: var(--warning-subtle);
    border: 1px solid var(--warning);
    color: var(--warning);
}

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

.pos-toolbar .btn {
    flex: 1;
    min-width: 120px;
}

.quick-pay-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
}

.quick-pay-row button {
    min-height: var(--input-height-sm);
    padding: 0 8px;
    font-size: var(--input-font-size-sm);
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    box-sizing: border-box;
}

.quick-pay-row button:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.payment-methods {
    display: flex;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.payment-methods label {
    flex: 1;
    min-width: 70px;
    min-height: var(--input-height-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--input-font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-sizing: border-box;
}

.payment-methods input {
    display: none;
}

.payment-methods input:checked + span {
    color: var(--primary);
}

.payment-methods label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.cart-item .stock-warn {
    color: var(--warning);
    font-size: 11px;
    font-weight: 600;
}

.held-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.held-item small {
    display: block;
    color: var(--text-muted);
    margin-top: 4px;
}

.held-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.held-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--warning-subtle);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
}

/* --------------------------------------------------------------------------
   Dashboard Charts
   -------------------------------------------------------------------------- */
.dashboard-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-charts-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.dashboard-chart-card .card-header small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.dashboard-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-chart-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-chart-title > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-chart-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.dashboard-chart-kpi {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--primary-subtle);
    border: 1px solid rgba(24, 119, 242, 0.12);
}

.dashboard-chart-kpi .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dashboard-chart-kpi strong {
    display: block;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--primary-dark);
    line-height: 1.2;
}

[data-theme="dark"] .dashboard-chart-kpi strong {
    color: var(--primary-light);
}

.chart-period-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.chart-period-btn {
    min-height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.chart-period-btn:hover {
    color: var(--primary);
    background: var(--surface-hover);
}

.chart-period-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.25);
}

.chart-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
}

.chart-wrap-lg {
    height: clamp(260px, 38vw, 360px);
}

.chart-wrap-md {
    height: clamp(220px, 28vw, 280px);
}

.chart-wrap-sm {
    height: clamp(220px, 30vw, 260px);
}

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

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

    .dashboard-chart-header {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-period-tabs {
        width: 100%;
        justify-content: stretch;
    }

    .chart-period-btn {
        flex: 1;
        padding: 0 8px;
    }

    .chart-wrap-lg {
        height: 260px;
    }
}

/* --------------------------------------------------------------------------
   Import / Export — toolbar
   -------------------------------------------------------------------------- */
.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-group-actions {
    margin-left: auto;
}

.filter-bar-inline {
    display: inline-flex;
    align-items: flex-end;
    gap: var(--form-row-gap);
    flex-wrap: wrap;
    margin: 0;
}

.filter-bar-inline .filter-field {
    margin-bottom: 0;
}

.page-header-actions .filter-bar-inline {
    margin-right: 4px;
}

.export-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.export-dropdown .export-toggle {
    min-height: var(--btn-height);
    height: auto;
}

.export-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 120;
}

.export-dropdown.open .export-menu {
    display: block;
}

.export-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.export-menu a:hover {
    background: var(--primary-subtle);
    color: var(--primary);
}

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

.import-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.import-step span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.import-step.active {
    border-color: rgba(24, 119, 242, 0.25);
    background: var(--primary-subtle);
    color: var(--primary-dark);
}

.import-step.active span {
    background: var(--primary);
    color: #fff;
}

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

.import-preview-wrap {
    margin-top: 18px;
}

.import-preview-wrap h4 {
    margin-bottom: 10px;
    font-size: 14px;
}

.form-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.import-error-list {
    margin: 8px 0 0 18px;
}

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

    .import-steps {
        grid-template-columns: 1fr;
    }

    .export-menu {
        left: 0;
        right: auto;
        min-width: 100%;
    }
}

.developer-stats-panel {
    margin-top: 8px;
}

.developer-stats-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.developer-stats-head h2 {
    margin: 0 0 4px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.developer-stats-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.developer-stats-grid .stat-card small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.developer-stat-money {
    font-size: clamp(18px, 2.2vw, 28px);
}

.developer-chart-blocks {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-top: 20px;
}

.developer-chart-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.developer-chart-area-head h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.developer-chart-area-head p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.developer-chart-area-grid {
    display: grid;
    gap: 16px;
    min-width: 0;
}

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

.developer-chart-area .dashboard-chart-card {
    height: 100%;
}

.developer-chart-area .dashboard-chart-card .card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.developer-chart-area .chart-wrap-md,
.developer-chart-area .chart-wrap-sm {
    flex: 1;
    min-height: clamp(200px, 22vw, 260px);
    height: clamp(200px, 22vw, 260px);
}

.developer-chart-area .chart-wrap-lg {
    height: clamp(240px, 30vw, 320px);
}

.developer-chart-note {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--text-muted);
}

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

.developer-stats-table small {
    display: block;
    margin-top: 2px;
}

.developer-settings-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.developer-settings-divider::before,
.developer-settings-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.developer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 24px;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.developer-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.developer-tab:hover {
    color: var(--text);
    background: rgba(79, 70, 229, 0.04);
}

.developer-tab.active {
    color: var(--primary);
    background: var(--card-bg);
    border-color: var(--border);
    border-bottom-color: var(--card-bg);
}

.developer-tab-content {
    min-height: 240px;
}

.developer-form-divider {
    margin: 24px 0;
    border: none;
    border-top: 1px solid var(--border);
}

.developer-users-filter {
    align-items: flex-end;
    margin-bottom: 16px;
}

.developer-users-filter-actions .btn {
    width: 100%;
}

.developer-users-summary {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.developer-users-table small {
    display: block;
    margin-top: 2px;
}

.developer-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.developer-user-actions .inline-form {
    display: inline;
}

.pagination-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination-info {
    padding: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

@media (max-width: 1100px) {
    .developer-table-grid {
        grid-template-columns: 1fr;
    }

    .developer-chart-area-grid-2 {
        grid-template-columns: 1fr;
    }
}

.traktir-ngopi-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.traktir-ngopi-form-card,
.traktir-ngopi-result-card {
    height: 100%;
}

.traktir-ngopi-note {
    margin: 20px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.traktir-ngopi-result-body {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.traktir-ngopi-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
}

.traktir-ngopi-empty-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    opacity: 0.85;
}

.traktir-ngopi-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.traktir-ngopi-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 420px;
}

.traktir-ngopi-meta .label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.traktir-ngopi-meta strong {
    font-size: 16px;
}

.traktir-ngopi-qris-wrap {
    width: min(100%, 320px);
    padding: 16px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.06));
}

.traktir-ngopi-qris {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.traktir-ngopi-scan-hint {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    max-width: 320px;
}

.traktir-ngopi-submit {
    width: 100%;
}

@media (max-width: 900px) {
    .traktir-ngopi-layout {
        grid-template-columns: 1fr;
    }

    .traktir-ngopi-result-body {
        min-height: 280px;
    }

    .traktir-ngopi-meta {
        grid-template-columns: 1fr;
    }
}

.traktir-ngopi-resume-alert {
    margin-bottom: 16px;
}

.traktir-ngopi-thanks-card {
    margin-bottom: 20px;
    padding: 24px 22px;
    border-radius: 16px;
    border: 1px solid rgba(49, 162, 76, 0.28);
    background: linear-gradient(135deg, rgba(49, 162, 76, 0.1), rgba(24, 119, 242, 0.06));
    text-align: center;
}

.traktir-ngopi-thanks-card-live {
    animation: traktirThanksFadeIn 0.45s ease;
}

.traktir-ngopi-thanks-icon {
    font-size: 34px;
    line-height: 1;
    color: #E85D75;
    margin-bottom: 10px;
}

.traktir-ngopi-thanks-title {
    margin: 0 0 10px;
    font-size: 1.25rem;
    color: var(--text, #050505);
}

.traktir-ngopi-thanks-lead,
.traktir-ngopi-thanks-body {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text, #050505);
}

.traktir-ngopi-thanks-amount {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.traktir-ngopi-thanks-prayer {
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px dashed rgba(49, 162, 76, 0.35);
    font-size: 13px;
    line-height: 1.7;
    font-style: italic;
    color: var(--text-muted);
}

.traktir-ngopi-thanks-reload {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

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

.traktir-ngopi-pending-note {
    display: block;
    margin-top: 8px;
}

.traktir-api-debug-card {
    margin-top: 20px;
    border: 1px dashed var(--warning, #F7B928);
    border-radius: 12px;
    background: rgba(247, 185, 40, 0.06);
    overflow: hidden;
}

.traktir-api-debug-head {
    padding: 12px 14px;
    border-bottom: 1px dashed rgba(247, 185, 40, 0.35);
}

.traktir-api-debug-head strong {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.traktir-api-debug-head small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.traktir-api-debug-log {
    margin: 0;
    padding: 14px;
    max-height: 360px;
    overflow: auto;
    font-size: 11px;
    line-height: 1.5;
    background: var(--surface, #fff);
    color: var(--text, #050505);
    white-space: pre-wrap;
    word-break: break-word;
}

.traktir-ngopi-store-total {
    margin-bottom: 16px;
}

.traktir-ngopi-reff {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.traktir-pay-status {
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.traktir-pay-status-pending {
    background: var(--primary-subtle, rgba(24, 119, 242, 0.1));
    color: var(--primary-dark, #166FE5);
}

.traktir-pay-status-success {
    background: rgba(49, 162, 76, 0.12);
    color: var(--success, #31A24C);
}

.traktir-pay-status-warning,
.traktir-pay-status-error {
    background: rgba(247, 185, 40, 0.12);
    color: var(--warning, #F7B928);
}

.traktir-qris-paid {
    opacity: 0.45;
}

.traktir-ngopi-paid-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(49, 162, 76, 0.12);
    color: var(--success, #31A24C);
    font-weight: 600;
}

.traktir-ngopi-leaderboard-card {
    margin-top: 24px;
}

.traktir-ngopi-leaderboard-header .card-header,
.traktir-ngopi-leaderboard-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.traktir-ngopi-leaderboard-header small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.traktir-ngopi-leaderboard-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
}

.traktir-ngopi-leaderboard .text-right {
    text-align: right;
}

.traktir-ngopi-leaderboard td small {
    display: block;
    margin-top: 2px;
}

.traktir-ngopi-rank {
    width: 52px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.traktir-ngopi-address {
    max-width: 280px;
    font-size: 13px;
    color: var(--text-muted);
}

.traktir-ngopi-row-self {
    background: var(--primary-subtle, rgba(24, 119, 242, 0.06));
}

@media (max-width: 768px) {
    .traktir-ngopi-leaderboard thead {
        display: none;
    }

    .traktir-ngopi-leaderboard tbody tr {
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid var(--border);
    }

    .traktir-ngopi-leaderboard tbody td {
        display: block;
        padding: 4px 0;
        border: none;
    }

    .traktir-ngopi-leaderboard tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 2px;
    }

    .traktir-ngopi-rank {
        text-align: left;
        font-size: 18px;
    }

    .traktir-ngopi-address {
        max-width: none;
    }
}

.deploy-status-card {
    margin-top: 20px;
}

.deploy-check-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.deploy-check-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.deploy-check-list li:last-child {
    border-bottom: none;
}

.deploy-check-list small {
    display: block;
    color: var(--text-muted);
    margin-top: 2px;
}

.deploy-check-ok .deploy-check-icon {
    color: var(--success);
}

.deploy-check-warn .deploy-check-icon {
    color: var(--warning);
}

.deploy-check-error .deploy-check-icon {
    color: var(--danger);
}

.deploy-checklist-intro,
.deploy-checklist-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 12px 0 0;
}

.login-page .login-card.setup-card-wide {
    max-width: 640px;
}

body.login-page.setup-page {
    background: #ffffff;
    color: #050505;
}

body.login-page.setup-page .login-card {
    background: #ffffff;
    border: 1px solid #e4e6eb;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

body.login-page.setup-page .login-header h1,
body.login-page.setup-page .login-header p,
body.login-page.setup-page .deploy-checklist-intro,
body.login-page.setup-page .deploy-checklist-hint,
body.login-page.setup-page .deploy-check-list small {
    color: #65676b;
}

body.login-page.setup-page .login-header h1 {
    color: #050505;
}

body.login-page.setup-page .deploy-check-list strong {
    color: #050505;
}
