@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    --pln-blue: #0066b3;
    --pln-blue-light: #008deb;
    --pln-blue-dark: #004680;
    --pln-yellow: #f8c919;
    --pln-yellow-light: #fbe06d;
    --pln-cyan: #0aa6e9;

    --bg-main: #f0f4f8;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-solid: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: rgba(226, 232, 240, 0.8);
    --border-light: rgba(241, 245, 249, 0.6);

    --success-bg: rgba(209, 250, 229, 0.8);
    --success-text: #059669;
    --success-border: rgba(167, 243, 208, 0.6);

    --warning-bg: rgba(254, 243, 199, 0.8);
    --warning-text: #d97706;
    --warning-border: rgba(253, 230, 138, 0.6);

    --danger-bg: rgba(254, 226, 226, 0.8);
    --danger-text: #dc2626;
    --danger-border: rgba(254, 202, 202, 0.6);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 50px;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-glow: 0 10px 30px -10px rgba(0, 102, 179, 0.4);
    --shadow-glow-alert: 0 10px 20px -5px rgba(220, 38, 38, 0.3);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    background-image:
        radial-gradient(circle at 100% 0%, rgba(0, 90, 156, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(248, 201, 25, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
.brand-title,
.stat-val,
.stok-num,
.card-nama {
    font-family: 'Outfit', sans-serif;
}

/* ---- Sidebar Glassmorphism ---- */
.sidebar {
    width: 270px;
    height: 100vh;
    max-height: 100vh;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px -3px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 1000;
    flex-shrink: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .sidebar {
    margin-left: -270px;
}

.menu-open-btn {
    position: fixed;
    top: 24px;
    left: -100px;
    /* hidden state */
    z-index: 998;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s, background 0.2s;
}

.menu-open-btn:hover {
    background: var(--bg-main);
    color: var(--pln-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

body.sidebar-collapsed .menu-open-btn {
    left: 24px;
    /* slides in */
}

.menu-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: var(--transition);
}

.menu-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--pln-blue);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--pln-blue) 0%, var(--pln-cyan) 50%, var(--pln-yellow) 100%);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-brand .logo-icon {
    font-size: 32px;
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    filter: drop-shadow(0 2px 4px rgba(248, 201, 25, 0.3));
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.sidebar-brand .brand-title {
    color: var(--pln-blue);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.sidebar-brand .brand-sub {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 102, 179, 0.3) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 179, 0.3);
    border-radius: 4px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link:hover {
    background: var(--bg-main);
    color: var(--pln-blue);
}

.nav-link.active {
    background: var(--pln-blue);
    color: white;
    box-shadow: var(--shadow-glow);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    background: rgba(248, 250, 252, 0.5);
    flex-shrink: 0;
}


.user-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.user-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

.footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px dashed rgba(226, 232, 240, 0.8);
}

.clock-display {
    font-size: 13px;
    font-weight: 700;
    color: var(--pln-blue);
    font-variant-numeric: tabular-nums;
}

.logout-btn {
    color: var(--danger-text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    color: #b91c1c;
}

/* ---- Main layout ---- */
.main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 40px;
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .main {
    padding-left: 80px;
    /* leaves room for the hamburger toggle button */
}

/* ---- Page header Premium ---- */
.page-header {
    background: linear-gradient(135deg, var(--pln-blue) 0%, var(--pln-blue-light) 100%);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(248, 201, 25, 0.15) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

.page-header h1 {
    color: white;
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 2;
}

.page-header p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    margin: 0;
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.page-header .btn {
    position: relative;
    z-index: 2;
}

/* ---- Summary stats ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stat-pill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-pill:nth-child(1)::after {
    background: var(--pln-blue);
}

.stat-pill:nth-child(2)::after {
    background: var(--pln-cyan);
}

.stat-pill:nth-child(3)::after {
    background: var(--success-text);
}

.stat-pill:nth-child(4)::after {
    background: var(--warning-text);
}

.stat-pill:nth-child(5)::after {
    background: var(--danger-text);
}

.stat-pill:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 12px;
    background: var(--bg-main);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-val {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-lbl {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* ---- Filter bar ---- */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-bar input,
.filter-bar select {
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-main);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--pln-blue);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

.filter-bar input {
    flex: 1;
    min-width: 250px;
}

.filter-count {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    margin-left: auto;
    padding: 0 8px;
}

/* ---- Papan Stok Grid ---- */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

@media (max-width: 1400px) {
    .stock-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .stock-grid {
        grid-template-columns: 1fr;
    }
}

.sch-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sch-card,
.stock-card,
#hariIniGrid>div {
    overflow: hidden !important;
}

.sch-nama,
.card-nama,
.card-spec {
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

.sch-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.sch-kiri {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding-right: 15px;
}

.sch-nama {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Outfit', sans-serif;
}

.sch-barcode {
    font-family: monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--pln-blue);
    letter-spacing: 0.5px;
}

.sch-kanan {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 2px dashed var(--border-light);
    padding-left: 15px;
    min-width: 90px;
}

.sch-stok {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
    font-family: 'Outfit', sans-serif;
}

.sch-satuan {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.8;
    margin-top: 4px;
}

/* Status themes for .stock-card & .sch-card */
.aman.stock-card,
.aman.sch-card {
    border: 1.5px solid rgba(16, 185, 129, 0.35);
    border-top: 5px solid #10b981;
    background: linear-gradient(180deg, rgba(209, 250, 229, 0.25) 0%, #ffffff 100%);
}

.aman .stok-num,
.aman .sch-stok {
    color: #059669;
}

.aman .stok-unit,
.aman .sch-satuan {
    color: #047857;
}

.aman .card-head {
    background: rgba(209, 250, 229, 0.45);
}

.aman .card-stok {
    background: rgba(209, 250, 229, 0.35);
    border-top: 1px solid rgba(167, 243, 208, 0.6);
    border-bottom: 1px solid rgba(167, 243, 208, 0.6);
}

.terbatas.stock-card,
.terbatas.sch-card {
    border: 1.5px solid rgba(245, 158, 11, 0.4);
    border-top: 5px solid #f59e0b;
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.35) 0%, #ffffff 100%);
}

.terbatas .stok-num,
.terbatas .sch-stok {
    color: #d97706;
}

.terbatas .stok-unit,
.terbatas .sch-satuan {
    color: #b45309;
}

.terbatas .card-head {
    background: rgba(254, 243, 199, 0.5);
}

.terbatas .card-stok {
    background: rgba(254, 243, 199, 0.4);
    border-top: 1px solid rgba(253, 230, 138, 0.6);
    border-bottom: 1px solid rgba(253, 230, 138, 0.6);
}

.kritis.stock-card,
.kritis.sch-card {
    border: 1.5px solid rgba(249, 115, 22, 0.45);
    border-top: 5px solid #f97316;
    background: linear-gradient(180deg, rgba(254, 215, 170, 0.35) 0%, #ffffff 100%);
}

.kritis .stok-num,
.kritis .sch-stok {
    color: #ea580c;
}

.kritis .stok-unit,
.kritis .sch-satuan {
    color: #c2410c;
}

.kritis .card-head {
    background: rgba(255, 237, 213, 0.55);
}

.kritis .card-stok {
    background: rgba(255, 237, 213, 0.45);
    border-top: 1px solid rgba(253, 186, 116, 0.6);
    border-bottom: 1px solid rgba(253, 186, 116, 0.6);
}

.kritis.stock-card:hover,
.kritis.sch-card:hover {
    box-shadow: 0 10px 20px -5px rgba(249, 115, 22, 0.3), var(--shadow-md);
}

.kritis-mutlak.stock-card,
.kritis-mutlak.sch-card {
    border: 1.5px solid rgba(239, 68, 68, 0.5);
    border-top: 5px solid #ef4444;
    background: linear-gradient(180deg, rgba(254, 226, 226, 0.4) 0%, #ffffff 100%);
}

.kritis-mutlak .stok-num,
.kritis-mutlak .sch-stok {
    color: #dc2626;
}

.kritis-mutlak .stok-unit,
.kritis-mutlak .sch-satuan {
    color: #b91c1c;
}

.kritis-mutlak .card-head {
    background: rgba(254, 226, 226, 0.6);
}

.kritis-mutlak .card-stok {
    background: rgba(254, 226, 226, 0.5);
    border-top: 1px solid rgba(252, 165, 165, 0.7);
    border-bottom: 1px solid rgba(252, 165, 165, 0.7);
}

.kritis-mutlak.stock-card:hover,
.kritis-mutlak.sch-card:hover {
    box-shadow: var(--shadow-glow-alert), var(--shadow-md);
}

/* ---- Cards / Panels ---- */
.panel {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 32px;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 18px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---- Form elements ---- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-full {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-main);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--pln-blue);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--pln-blue);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 90, 156, 0.3);
}

.btn-primary:hover {
    background: var(--pln-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 90, 156, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success-text);
    color: white;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-text);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-main);
    color: var(--pln-blue);
    border-color: var(--pln-blue);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ---- Tables ---- */
.cart-table,
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    line-height: 1.4;
}

.cart-table th,
.data-table th {
    background: var(--bg-main);
    padding: 12px 10px;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    line-height: 1.4;
    white-space: nowrap;
}

.cart-table th:first-child,
.data-table th:first-child {
    border-top-left-radius: var(--radius-sm);
}

.cart-table th:last-child,
.data-table th:last-child {
    border-top-right-radius: var(--radius-sm);
}

.cart-table td,
.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.4;
}

.cart-table tr:hover td,
.data-table tr:hover td {
    background: var(--bg-main);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-safe {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.badge-blue {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ---- Alerts ---- */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ---- Barcode input ---- */
.scan-input-wrap {
    position: relative;
    margin-bottom: 24px;
}

.scan-input {
    width: 100%;
    padding: 20px 24px;
    font-size: 24px;
    font-family: 'Outfit', monospace;
    font-weight: 700;
    letter-spacing: 2px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    background: var(--bg-main);
    color: var(--pln-blue);
    transition: var(--transition);
    text-align: center;
}

.scan-input:focus {
    border-color: var(--pln-blue);
    background: var(--bg-surface);
    box-shadow: 0 10px 30px -10px rgba(0, 90, 156, 0.2);
    transform: translateY(-2px);
}

.scan-input::placeholder {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0;
}

/* ---- Two-col layout ---- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
}

@media (max-width: 1024px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

/* ---- Surat Jalan expander ---- */
.sj-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sj-item:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 90, 156, 0.3);
}

.sj-header {
    padding: 20px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.sj-header:hover {
    background: var(--bg-main);
}

.sj-header.open {
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.sj-body {
    display: none;
    padding: 24px;
    background: var(--bg-surface);
}

.sj-body.open {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Toast notification ---- */
.toast-container {
    position: fixed;
    top: 90px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(40px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.toast-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.toast-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ---- Utils ---- */
.text-center {
    text-align: center;
}

.divider {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 24px 0;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modal-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--pln-blue);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

/* ---- Scroll ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.8);
}

/* ---- Print Styles ---- */
@media print {

    .topbar,
    .filter-bar,
    .toast-container,
    .page-header button {
        display: none !important;
    }

    .main {
        padding: 0 !important;
        margin: 0 !important;
    }

    .panel {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .page-header {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 10px 0 !important;
        background: none !important;
    }

    .page-header h1 {
        color: black !important;
    }

    .page-header p {
        color: #333 !important;
    }
}

/* ---- Mobile Responsiveness ---- */
@media (max-width: 768px) {
    .topbar {
        position: relative;
        /* Fallback for sticky on older phones */
    }

    .topbar-inner {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
        align-items: stretch;
    }

    .topbar-brand {
        justify-content: center;
        margin-bottom: 4px;
    }

    .topbar-nav {
        overflow-x: auto;
        padding-bottom: 8px;
        width: 100%;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        white-space: nowrap;
        font-size: 13px;
        padding: 8px 12px;
    }

    .topbar-clock {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .main {
        padding: 20px 16px;
    }

    .page-header {
        padding: 24px 20px;
        text-align: center;
        flex-direction: column;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-pill {
        padding: 16px;
    }

    .stat-pill:nth-child(1) {
        grid-column: 1 / -1;
        /* Make first one span full width */
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 10px;
    }

    .filter-bar input,
    .filter-bar select {
        width: 100%;
        min-width: 0;
        height: 42px;
    }

    .panel {
        padding: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sj-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sj-header>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-box {
        padding: 24px;
    }

    .cart-table th,
    .data-table th,
    .cart-table td,
    .data-table td {
        padding: 10px;
        white-space: nowrap;
    }
}

/* ---- Tablet & iPad Specific Optimization (768px - 1024px) ---- */
@media (min-width: 768px) and (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 14px !important;
    }

    .stat-pill:nth-child(1) {
        grid-column: span 1 !important;
    }

    .filter-bar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }

    .filter-bar input,
    .filter-bar select {
        flex: 1 1 200px !important;
    }

    .stock-grid-dashboard {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
    }

    .modal-box {
        max-width: 720px !important;
        width: 90% !important;
    }
}

/* ---- Legacy Papan Stok Grid (For Dashboard) ---- */
.stock-grid-dashboard {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

@media (max-width: 1300px) {
    .stock-grid-dashboard {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .stock-grid-dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stock-grid-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .stock-grid-dashboard {
        grid-template-columns: 1fr;
    }
}

.stock-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
}

.stock-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.card-head {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 42px;
    box-sizing: border-box;
}

.card-kode {
    font-size: 12px;
    font-weight: 800;
    color: var(--pln-blue);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
    white-space: nowrap !important;
    word-break: normal !important;
    flex-shrink: 0;
}

.card-kategori {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--pln-blue);
    border: 1px solid rgba(0, 90, 156, 0.2);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-stok {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    position: relative;
    overflow: hidden;
}

.stok-num {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2px;
    position: relative;
    z-index: 2;
}

.stok-unit {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 4px;
    z-index: 2;
}

.card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-nama {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.card-spec {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    flex: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    margin-top: auto;
}

.card-merk {
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-main);
    padding: 3px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.card-rak {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---- Responsive Scaling Optimization for 13" - 14" Laptop Screens & DPI Scaling ---- */
@media (max-width: 1440px) {
    .sidebar-header {
        padding: 14px 18px;
    }

    .sidebar-nav {
        padding: 12px;
        gap: 4px;
    }

    .nav-link {
        padding: 9px 12px;
        font-size: 13px;
    }

    .sidebar-footer {
        padding: 12px 16px;
    }

    .main {
        padding: 20px 24px;
    }

    .page-header {
        padding: 20px 28px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-header p {
        font-size: 13.5px;
    }

    .stats-row {
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-pill {
        padding: 14px 16px;
    }

    .stat-val {
        font-size: 26px;
    }

    .stat-icon {
        font-size: 22px;
        width: 38px;
        height: 38px;
        margin-bottom: 8px;
    }

    .stat-lbl {
        font-size: 11px;
    }

    .panel {
        padding: 20px;
    }

    .sch-card {
        padding: 12px 16px;
    }

    .sch-nama {
        font-size: 14.5px;
    }

    .sch-stok {
        font-size: 26px;
    }
}


@media (max-width: 1280px) {
    .sidebar {
        width: 230px;
    }

    body.sidebar-collapsed .sidebar {
        margin-left: -230px;
    }

    .main {
        padding: 16px 20px;
    }

    .stock-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}