@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Corporate Blue Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    
    --bg: #f4f7f6;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: var(--primary);
    border-radius: var(--radius);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; color: white;
    margin-bottom: 16px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.login-logo p { color: var(--text-muted); font-size: 13px; }

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-weight: 500; margin-bottom: 6px;
    color: var(--text-main); font-size: 13px;
}
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    transition: all 0.2s ease;
    background: #fff; color: var(--text-main);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
select.form-control {
    cursor: pointer; appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 14px center #fff;
    padding-right: 36px;
}

/* ============================================
   BUTTONS (Solid Colors, No Gradients)
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s ease;
    text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #475569; color: white; }
.btn-secondary:hover { background: #334155; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--text-main); border-color: var(--border); }
.btn-outline:hover { background: #f1f5f9; border-color: #cbd5e1; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================
   LAYOUT (Sidebar & Main)
   ============================================ */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; background: var(--sidebar-bg); color: white;
    position: fixed; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    border-right: 1px solid #1e293b;
}
.sidebar-brand {
    padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-brand h2 { font-size: 16px; font-weight: 600; color: white; display: flex; align-items: center; gap: 8px; }
.sidebar-brand small { display: block; font-size: 11px; color: var(--sidebar-text); margin-top: 2px; }

.sidebar-menu { list-style: none; padding: 16px 12px; flex: 1; }
.sidebar-menu li { margin-bottom: 4px; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; color: var(--sidebar-text);
    text-decoration: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; transition: all 0.2s;
}
.sidebar-menu a:hover { background: var(--sidebar-hover); color: white; }
.sidebar-menu a.active { background: var(--primary); color: white; }
.sidebar-menu .menu-icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
    margin-left: 250px; flex: 1; padding: 24px 32px;
    min-height: 100vh; background: var(--bg);
}
.topbar {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 16px 24px; margin-bottom: 24px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { font-size: 18px; font-weight: 600; color: var(--text-main); }
.user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

/* ============================================
   CARDS & PANELS
   ============================================ */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    padding: 24px; margin-bottom: 24px;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text-main); }

/* ============================================
   TABLES
   ============================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    background: #f8fafc; color: var(--text-muted);
    font-weight: 600; font-size: 12px; text-transform: uppercase;
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.2s; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody td { padding: 12px 16px; vertical-align: middle; color: var(--text-main); }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-draft { background: #fef3c7; color: #b45309; }
.badge-printed { background: #d1fae5; color: #047857; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 24px; max-width: 500px; width: 100%;
    box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar-brand h2 span:not(.brand-icon) { display: none; }
    .sidebar-menu a span:not(.menu-icon) { display: none; }
    .main-content { margin-left: 70px; padding: 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================
   LABEL PRINT 4x3 INCH (TIDAK BERUBAH, TETAP HITAM PUTIH)
   ============================================ */
.label-page { width: 100mm; height: 76mm; padding: 2.5mm 3mm; box-sizing: border-box; background: #fff; color: #000; font-family: Arial, Helvetica, sans-serif; border: 1px dashed #ccc; margin: 10px auto; overflow: hidden; position: relative; line-height: 1.25; }
.label-shipping { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 2mm 3mm; height: 100%; }
.label-shipping .header-text { grid-column: 1; grid-row: 1; align-self: start; font-size: 16px; font-weight: bold; line-height: 1.2; }
.label-shipping .vendor-box { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; text-align: right; font-size: 22px; font-weight: bold; border: 2px solid #000; padding: 1mm 3mm; white-space: nowrap; }
.label-shipping .content-col { grid-column: 1 / -1; grid-row: 2; display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.label-shipping .content-top { display: flex; flex-direction: column; gap: 1mm; }
.label-shipping .po-label { font-size: 16px; font-weight: bold; margin-bottom: 0; }
.label-shipping .po-value { font-size: 20px; font-weight: bold; margin-bottom: 3mm; word-break: break-all; }
.label-shipping .detail-line { font-size: 16px; line-height: 1.4; font-weight: 500; }
.label-shipping .made-in { font-size: 16px; font-weight: bold; text-align: left; margin-top: auto; }
.label-shipping .branch-factory { font-size: 13px; font-weight: 600; text-align: left; margin-top: 1mm; }
.label-shipping .wonogiri { font-size: 15px; font-weight: bold; text-align: left; margin-top: 0.5mm; }
.label-packing { display: flex; flex-direction: column; height: 100%; }
.label-packing .item-code { font-size: 22px; font-weight: bold; margin-bottom: 1mm; line-height: 1.1; }
.label-packing .item-qty { font-size: 24px; font-weight: bold; margin-bottom: 1mm; line-height: 1.1; }
.label-packing .set-code { font-size: 18px; font-weight: 600; margin-bottom: 2mm; line-height: 1.1; }
.label-packing .item-name { font-size: 16px; margin-bottom: 2mm; line-height: 1.25; }
.label-packing .size-table { width: 100%; border-collapse: collapse; font-size: 16px; margin-top: auto; table-layout: fixed; }
.label-packing .size-table th, .label-packing .size-table td { border: 1.5px solid #000; padding: 2mm 1mm; text-align: center; vertical-align: middle; }
.label-packing .size-table th { font-weight: bold; background: #f0f0f0; font-size: 16px; }
.label-packing .size-table td:first-child { text-align: left; font-weight: bold; font-size: 16px; width: 30%; }
.label-packing.solid-layout .item-code { font-size: 26px; margin-bottom: 2mm; }
.label-packing.solid-layout .item-qty { font-size: 28px; margin-bottom: 2mm; }
.label-packing.solid-layout .set-code { font-size: 20px; margin-bottom: 4mm; }
.label-packing.solid-layout .item-name { font-size: 18px; margin-bottom: auto; }

@media print {
    @page { size: 100mm 76mm; margin: 0; }
    body { margin: 0; padding: 0; background: #fff; }
    .no-print { display: none !important; }
    .label-page { border: none; margin: 0; page-break-after: always; page-break-inside: avoid; }
    .label-page:last-child { page-break-after: auto; }
}