/* BMS theme - modeled on reference SmartAdmin app (localhost/dms) */
:root {
    /* Modern palette 2024 */
    --bg-body: #f8fafc;
    --navy: #1e293b;
    --navy-2: #334155;
    --navy-3: #475569;
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --secondary: #10b981;
    --secondary-light: #34d399;
    --accent: #0ea5e9;
    --accent-2: #38bdf8;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --success: #10b981;
    --success-light: #34d399;
    --text: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --white: #ffffff;
    
    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    height: 100%;
    font-family: "Open Sans", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg-body);
    color: var(--text);
    font-size: 14px;
}
a { text-decoration: none; color: inherit; }
button, input, select { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }

/* ============ SIDEBAR ============ */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--navy) 0%, #0f172a 100%);
    color: #c8ccd1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 30;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}
.sidebar.collapsed { margin-left: -280px; }

.sidebar-header {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
}
.logo-mini {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 10px;
    font-size: 22px; font-weight: 800; line-height: 1;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}
.logo-text { font-size: 20px; font-weight: 300; color: #fff; letter-spacing: 1px; }
.logo-text small { display: block; font-size: 10px; color: #a9c6e8; letter-spacing: 0; font-weight: 400; }

.sidebar-search-wrap { padding: 10px 12px; }
.sidebar-search {
    width: 100%;
    padding: 7px 10px;
    border-radius: 3px;
    border: 1px solid #3a4553;
    background: #1a2029;
    color: #e5e7eb;
    outline: none;
    font-size: 13px;
}
.sidebar-search::placeholder { color: #93b4d9; }
.sidebar-search:focus { border-color: var(--accent); }

.sidebar-nav { padding: 0 0 20px; flex: 1; overflow-y: auto; }

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: var(--navy-2);
    font-size: 11.5px;
    color: #a9c6e8;
}
.sidebar-user { color: #c8ccd1; margin-bottom: 6px; }
.sidebar-user i { color: var(--accent); margin-right: 4px; }
.sidebar-user strong { color: #fff; font-weight: 600; }
.sidebar-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sidebar-links a { color: var(--accent); text-decoration: none; }
.sidebar-links a:hover { text-decoration: underline; }
.sidebar-links span { color: #4a5563; }
.sidebar-ver { color: #93b4d9; letter-spacing: 0.3px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: none; }
.sidebar-nav ul.open { display: block; }
.sidebar-nav > ul.menu-root { display: block; }

.menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    color: #d1d5db;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid transparent;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
}
.menu-header:hover { 
    background: rgba(79, 70, 229, 0.12); 
    color: white; 
    border-left-color: var(--primary);
}
.menu-header > span { flex: 1; }
.menu-header .module-icon { 
    color: white; 
    font-size: 16px; 
    width: 24px; 
    height: 24px;
    text-align: center;
    line-height: 24px;
    border-radius: 8px;
}
.menu-header .chevron { 
    font-size: 12px; 
    transition: transform 0.2s ease; 
    color: var(--accent-2);
}
.menu-header.open .chevron { transform: rotate(180deg); }
.menu-header.open { 
    background: rgba(79, 70, 229, 0.15); 
    color: white; 
    border-left-color: var(--primary);
    font-weight: 500;
}

/* depth 1 = section headers */
.sidebar-nav ul ul > li > .menu-header { padding-left: 44px; font-size: 13px; }
/* depth 2 = sub-group headers (e.g. Transaction > Service) */
.sidebar-nav ul ul ul > li > .menu-header { padding-left: 58px; font-size: 12.5px; }
/* depth 3 = sub-group headers (rare) */
.sidebar-nav ul ul ul ul > li > .menu-header { padding-left: 72px; font-size: 12px; }
/* leaf items per depth */
.sidebar-nav ul ul > li > .menu-item { padding-left: 44px; }
.sidebar-nav ul ul ul > li > .menu-item { padding-left: 58px; }
.sidebar-nav ul ul ul ul > li > .menu-item { padding-left: 72px; font-size: 12.5px; }
.sidebar-nav ul ul ul ul ul > li > .menu-item { padding-left: 86px; font-size: 12px; }

.menu-item {
    display: block;
    padding: 10px 18px 10px 48px;
    color: #a7b0ba;
    font-size: 13.5px;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}
.menu-item:hover { 
    background: rgba(255, 255, 255, 0.06); 
    color: white; 
    padding-left: 52px;
}
.menu-item.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.15), rgba(79, 70, 229, 0.05));
    color: white;
    border-left-color: var(--primary);
    font-weight: 500;
    box-shadow: inset 4px 0 8px rgba(79, 70, 229, 0.1);
}

/* ============ MAIN ============ */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 280px;
    transition: margin-left 0.25s ease;
    min-width: 0;
}
.sidebar.collapsed ~ .main-panel { margin-left: 0; }

.topbar {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.toggle-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    color: white;
    align-self: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}
.toggle-btn:hover { 
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.brand-mini { font-size: 22px; font-weight: 300; color: var(--text); letter-spacing: 1px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-meta { color: var(--muted); font-size: 12px; }
.topbar-meta a { color: var(--accent); }
.topbar-meta a:hover { text-decoration: underline; }
/* User + tombol Keluar di topbar. Wajib terlihat di HP karena sidebar
   (tempat link logout lama) tersembunyi sebagai drawer. */
.topbar-user { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.topbar-user i { color: var(--accent); }
.topbar-logout {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 9px;
    background: #fee2e2; color: #b91c1c;
    font-size: 12px; font-weight: 700; text-decoration: none;
    border: 1px solid #fecaca;
    -webkit-tap-highlight-color: transparent;
}
.topbar-logout:hover { background: #fecaca; color: #991b1b; }
.topbar-logout i { font-size: 14px; }
.company-badge {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    color: white;
    font-size: 13px;
    border-radius: 8px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.content { padding: 16px; }

/* ============ PAGE HEADER (breadcrumb bar) ============ */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.page-title-row h3 { margin: 0; font-weight: 300; font-size: 22px; color: var(--text); }

/* ============ WIDGETS (jarvish style) ============ */
.jarvish-widget {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    margin-bottom: 14px;
}
.widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f8f8;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.widget-title { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.widget-title i { color: var(--accent); }
.widget-body { padding: 12px; }

/* keep old .card markup working */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    margin-bottom: 18px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}
.card-header {
    border-bottom: 1px solid var(--glass-border);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 600;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.3);
}
.card-body { padding: 12px; }

/* ============ DASHBOARD ============ */
.dash-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 14px;
}
.btn-sm-widget {
    background: #f4f4f4;
    border: 1px solid #c5c5c5;
    border-radius: 3px;
    padding: 5px 12px;
    font-size: 12.5px;
    color: #333;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-sm-widget:hover { background: #e8e8e8; }

.tile-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stat-tile {
    border-radius: 12px;
    padding: 16px 20px;
    color: white;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.stat-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    z-index: 0;
}
.tile-blue { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
.tile-green { background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%); }
.tile-orange { background: linear-gradient(135deg, var(--warning) 0%, var(--warning-light) 100%); }
.tile-red { background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%); }
.tile-top { display: flex; align-items: baseline; justify-content: space-between; }
.tile-label { font-size: 11px; letter-spacing: 1px; opacity: 0.85; }
.tile-big { font-size: 28px; font-weight: 600; margin-top: 4px; }
.tile-bottom { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.tile-sub { font-size: 13px; opacity: 0.95; }
.tile-icon { font-size: 24px; opacity: 0.8; }
.tile-icon::before {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* ============ FORMS / TABLES ============ */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #c5c5c5;
    border-radius: 3px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    background: #f4f4f4;
    color: #333;
    transition: 0.15s ease;
}
.btn:hover { background: #e8e8e8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #4a7688; }
.btn-secondary { background: #f4f4f4; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-warning { background: var(--orange); border-color: var(--orange); color: #fff; }

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.field input, .field select, .field textarea {
    border: 1px solid #cccccc;
    border-radius: 3px;
    padding: 7px 9px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(87,136,156,0.2); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 3px; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid #edf2f7; text-align: left; vertical-align: top; font-size: 13px; }
.table thead th {
    background: #f8f8f8;
    color: #555;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--line);
}
.table tbody tr:hover { background: rgba(87,136,156,0.06); }

.badge { display: inline-flex; align-items: center; border-radius: 3px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.badge.ok { background: rgba(108,199,135,0.15); color: #2e7d44; }
.badge.warn { background: rgba(226,139,51,0.15); color: #9a5b17; }
.badge.danger { background: rgba(168,109,109,0.15); color: #8c4a4a; }

.report-panel { border: 1px solid var(--line); border-radius: 3px; background: #fff; overflow: hidden; margin-bottom: 12px; }
.report-header { background: #f8f8f8; border-bottom: 1px solid var(--line); padding: 8px 12px; font-weight: 600; }
.report-body { padding: 12px; }

/* ============ LOGIN ============ */
.login-body {
    background: linear-gradient(160deg, var(--navy) 0%, #0ea5e9 100%);
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.login-wrap {
    display: flex;
    gap: 0;
    width: min(860px, 94vw);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(15,23,42,0.28);
}
.login-hero {
    flex: 1.2;
    background: var(--navy-2);
    color: #cfd6dd;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.login-hero-logo { font-size: 44px; font-weight: 200; color: #fff; letter-spacing: 3px; }
.login-hero-sub { color: var(--accent-2); font-size: 13px; letter-spacing: 2px; }
.login-hero-name { font-size: 15px; margin-top: 2px; }
.login-hero-ver { font-size: 11px; color: #93b4d9; }
.login-hero-news { margin-top: 28px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 18px; }
.login-hero-news h4 { margin: 0 0 8px; font-size: 14px; color: #fff; font-weight: 600; }
.login-hero-news p { margin: 0; font-size: 12.5px; color: #a9c6e8; }

.login-card { flex: 1; background: #fff; padding: 40px 32px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.login-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}
.login-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(87,136,156,0.2); }
.login-error { background: rgba(168,109,109,0.12); color: #8c4a4a; border-radius: 3px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 12px; }
.login-btn {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 3px;
    padding: 11px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    letter-spacing: 0.5px;
}
.login-btn:hover { background: #4a7688; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
    .main-panel { margin-left: 0; }
    .sidebar { margin-left: -280px; }
    .sidebar.collapsed { margin-left: 0; }
    .login-wrap { flex-direction: column; }
}

/* ============================================================
   THEME v2 — Modern navy & gold (ref: localhost:8080)
   ============================================================ */
:root {
    --bg-body: #eef2f7;
    --navy: #1e40af;
    --navy-2: #1d4ed8;
    --navy-3: #2563eb;
    --accent: #0ea5e9;
    --accent-2: #38bdf8;
    --gold-grad: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    --navy-grad: linear-gradient(160deg, #172554 0%, #1e40af 52%, #0369a1 100%);
    --text: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --radius: 16px;
    --shadow: 0 8px 24px rgba(15, 23, 42, .07);
    --blue: #3b82f6;
    --green: #10b981;
    --orange: #f59e0b;
    --red: #ef4444;
    --violet: #8b5cf6;
    --cyan: #06b6d4;
}

body {
    font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
    background:
        radial-gradient(1100px 500px at 100% -10%, rgba(14, 165, 233, .09), transparent 60%),
        var(--bg-body);
}

/* ---- sidebar ---- */
.sidebar { background: var(--navy-grad); border-right: 1px solid rgba(255, 255, 255, .05); }
.sidebar::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb, .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 99px; }
.sidebar-header { padding: 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.logo-mini { background: var(--gold-grad); color: #1a1a1a; border-radius: 11px; box-shadow: 0 4px 14px rgba(14, 165, 233, .35); }
.logo-text { font-weight: 800; letter-spacing: .5px; font-size: 19px; }
.logo-text small { color: #bfdbfe; font-weight: 500; }
.sidebar-search { border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .06); }
.sidebar-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14, 165, 233, .15); }

.sidebar-nav .menu-header, .sidebar-nav .menu-item { border-left: 0; border-radius: 10px; margin: 2px 10px; }
.sidebar-nav > ul.menu-root > li > .menu-item { padding-left: 16px; }
.sidebar-nav ul ul > li > .menu-header,
.sidebar-nav ul ul > li > .menu-item { padding-left: 16px; font-size: 13px; }
.sidebar-nav ul ul ul > li > .menu-header,
.sidebar-nav ul ul ul > li > .menu-item { padding-left: 28px; font-size: 12.5px; }
.sidebar-nav ul ul ul ul > li > .menu-header,
.sidebar-nav ul ul ul ul > li > .menu-item { padding-left: 40px; font-size: 12.5px; }
.sidebar-nav ul ul ul ul ul > li > .menu-item { padding-left: 52px; font-size: 12px; }
.menu-header { color: #eff6ff; font-weight: 600; }
/* Sub menu (depth >= 2) diberi chevron kecil + area klik penuh supaya jelas
   bisa dibuka. Sebelumnya header sub menu tampak seperti label biasa
   sehingga terasa "tidak bisa diklik". */
.sidebar-nav ul ul > li > .menu-header { color: #cbd5e1; font-weight: 600; }
.sidebar-nav ul ul > li > .menu-header > span { font-weight: 600; }
.sidebar-nav ul ul > li > .menu-header .chevron { font-size: 10px; opacity: .75; }
.sidebar-nav ul ul > li > .menu-header:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.sidebar-nav ul ul > li > .menu-header:hover .chevron { opacity: 1; }
.menu-header:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-header.open { background: rgba(255, 255, 255, .07); color: #fff; border-left-color: transparent; }
.menu-header .module-icon { color: var(--accent-2); }
.menu-item { color: #dbeafe; }
.menu-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.menu-item.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, .28), rgba(14, 165, 233, .07));
    color: #e0f2fe;
    border-left-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .28);
}

.sidebar-footer { background: rgba(0, 0, 0, .25); border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user i { color: var(--accent-2); }
.sidebar-links a { color: var(--accent-2); }

/* ---- topbar ---- */
.topbar {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
    padding: 12px 22px;
}
.toggle-btn { background: var(--navy-2); border-radius: 10px; }
.toggle-btn:hover { background: var(--navy-3); }
.brand-mini { font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.brand-sub { font-weight: 500; }
.topbar-crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.topbar-crumb i { font-size: 10px; color: #cbd5e1; }
.topbar-crumb strong { color: var(--text); font-weight: 700; font-size: 14.5px; }
.content { padding: 22px; }

/* ---- cards / widgets ---- */
.card, .jarvish-widget, .report-panel {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header, .widget-head, .report-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14.5px;
}
.card-header i, .widget-title i { color: var(--accent); }
.card-body, .widget-body, .report-body { padding: 16px 18px; }

/* ---- buttons ---- */
.btn, .btn-sm-widget {
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    padding: 7px 14px;
    font-weight: 600;
}
.btn:hover, .btn-sm-widget:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary { background: var(--gold-grad); border: 0; color: #083344; font-weight: 700; box-shadow: 0 4px 14px rgba(14, 165, 233, .3); }
.btn-primary:hover { background: var(--gold-grad); filter: brightness(1.07); }
.btn-success { background: linear-gradient(135deg, #34d399, #0ea371); border: 0; color: #fff; }
.btn-warning { background: linear-gradient(135deg, #fbbf24, #d97706); border: 0; color: #fff; }

/* ---- forms / tables ---- */
.field input, .field select, .field textarea { border-radius: 10px; border: 1px solid var(--line); padding: 9px 12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14, 165, 233, .15); }
.field label { color: var(--muted); }
.table-wrap { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.table thead th { background: #f8fafc; color: var(--muted); border-bottom: 1px solid var(--line); }
.table tbody tr:hover { background: rgba(14, 165, 233, .06); }
.badge { border-radius: 999px; }

/* ---- dashboard v2 ---- */
.dash-hero {
    position: relative;
    overflow: hidden;
    background: var(--navy-grad);
    border-radius: 20px;
    padding: 28px 30px;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: 0 16px 40px rgba(30, 58, 138, .35);
}
.dash-hero::after {
    content: "";
    position: absolute;
    right: -70px; top: -80px;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, .4), transparent 70%);
}
.dash-hero-kicker { font-size: 11.5px; letter-spacing: 2px; color: var(--accent-2); font-weight: 700; margin-bottom: 8px; }
.dash-hero-kicker i { margin-right: 4px; }
.dash-hero h2 { margin: 0 0 6px; font-size: 27px; font-weight: 800; }
.dash-hero p { margin: 0; color: #cfe6fb; font-size: 13.5px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    padding: 6px 13px; border-radius: 999px;
    font-size: 12px; color: #cbd5e1;
}
.chip i { color: var(--accent-2); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card {
    background: #fff; border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px; display: flex; gap: 14px; align-items: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15, 23, 42, .13); }
.kpi-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; color: #fff; flex: none; box-shadow: 0 6px 16px rgba(15, 23, 42, .18); }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--green); font-weight: 600; }
.kpi-sub i { font-size: 11px; }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.mini-row:last-child { border-bottom: 0; }
.mini-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mini-text { flex: 1; color: var(--text); }
.mini-time { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Aktivitas Terbaru (dashboard) */
.act-card { margin-bottom: 20px; }
.act-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Filter jenis transaksi di header Aktivitas Terbaru */
.act-search { display: flex; align-items: center; flex: 0 0 auto; }
.act-filter { height: 31px; min-width: 190px; padding: 5px 30px 5px 10px; border: 1px solid #dbe2ea; border-radius: 8px; font-size: 12px; font-weight: 600; background: #fff; color: var(--text); cursor: pointer; }
.act-filter:focus { outline: none; border-color: var(--navy-2, #1e3a8a); box-shadow: 0 0 0 3px rgba(30, 58, 138, .1); }
/* Kotak cari bebas di samping filter jenis transaksi */
.act-qsearch { position: relative; display: flex; align-items: center; flex: 1 1 200px; max-width: 260px; }
.act-qsearch > i { position: absolute; left: 9px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.act-qsearch input { width: 100%; height: 31px; padding: 5px 26px 5px 27px; border: 1px solid #dbe2ea; border-radius: 8px; font-size: 12px; background: #fff; color: var(--text); }
.act-qsearch input:focus { outline: none; border-color: var(--navy-2, #1e3a8a); box-shadow: 0 0 0 3px rgba(30, 58, 138, .1); }
.act-qsearch .act-qx { position: absolute; right: 4px; border: 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 5px; cursor: pointer; border-radius: 6px; }
.act-qsearch .act-qx:hover { background: #f1f5f9; color: var(--text); }
.act-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.act-count { font-size: 11.5px; font-weight: 700; color: var(--muted); background: #f1f5f9; border-radius: 999px; padding: 3px 10px; letter-spacing: .02em; white-space: nowrap; }
.act-body { padding: 0 !important; }
.act-list { display: flex; flex-direction: column; max-height: 430px; overflow-y: auto; padding: 6px 8px; }
.act-list::-webkit-scrollbar { width: 8px; }
.act-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.act-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
/* Pager sheet Aktivitas Terbaru — 25 baris per halaman. */
.act-pager { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 9px 12px; border-top: 1px solid var(--line); background: #f8fafc; }
.act-pg { min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border-radius: 8px; border: 1px solid #dbe2ea; background: #fff; color: var(--navy-2, #1e3a8a); font-size: 12px; font-weight: 700; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.act-pg:hover { background: #eef2ff; border-color: #c7d2fe; }
.act-pg.is-active { background: var(--navy-2, #1e3a8a); border-color: var(--navy-2, #1e3a8a); color: #fff; }
.act-pg.is-off { opacity: .4; pointer-events: none; }
.act-pg-dot { padding: 0 3px; color: var(--muted); font-size: 12px; }
.act-pg-info { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Pager aktivitas memuat data via fetch (tanpa reload dashboard). Saat menunggu,
   daftar dibuat pudar + baris placeholder supaya terasa langsung merespons. */
.act-list { transition: opacity .18s ease; }
.act-pager { transition: opacity .18s ease; }
.act-list.is-loading { opacity: .45; }
.act-skeleton { display: flex; align-items: center; gap: 11px; padding: 10px 9px; border-bottom: 1px solid var(--line); }
.act-skeleton .sk-dot { width: 32px; height: 32px; border-radius: 9px; flex: none; background: #e2e8f0; animation: actPulse 1.2s ease-in-out infinite; }
.act-skeleton .sk-lines { flex: 1; min-width: 0; }
.act-skeleton .sk-line { height: 9px; border-radius: 4px; background: #e2e8f0; animation: actPulse 1.2s ease-in-out infinite; }
.act-skeleton .sk-line + .sk-line { margin-top: 6px; width: 55%; }
@keyframes actPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .act-skeleton .sk-dot, .act-skeleton .sk-line { animation: none; }
}
/* Tap feedback cepat di HP (sebelumnya terasa "tidak merespons"). */
.act-pg { transition: background .12s ease, transform .08s ease; }
.act-pg:active { transform: scale(.94); }
.act-row { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: 10px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.act-row:last-child { border-bottom: 0; }
.act-link { cursor: pointer; }
.act-link:hover { background: #f8fafc; }
.act-ico { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 14px; color: var(--ico, var(--accent)); background: color-mix(in srgb, var(--ico, var(--accent)) 13%, #fff); }
.act-main { flex: 1; min-width: 0; }
.act-line1 { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; line-height: 1.35; }
.act-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.act-doc { font-size: 12.5px; font-weight: 700; color: var(--text); }
.act-notes { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; font-style: italic; }
.act-notes i { font-size: 10px; }
.act-line2 { font-size: 11.5px; color: var(--muted); margin-top: 1px; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-line2 i { font-size: 10.5px; opacity: .8; flex: none; }
.act-time { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; display: flex; align-items: center; gap: 4px; }
.act-time i { font-size: 10.5px; opacity: .75; }
@media (max-width: 640px) {
    .act-row { flex-wrap: wrap; }
    .act-time { width: 100%; padding-left: 43px; }
}
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.quick-card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 16px 10px; text-align: center; color: var(--text);
    font-weight: 700; font-size: 12.5px;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    transition: transform .15s ease, border-color .15s ease;
}
.quick-card i { font-size: 22px; color: var(--accent); }
.quick-card:hover { transform: translateY(-2px); border-color: var(--accent); }

/* ---- login v2 ---- */
html { overflow-x: hidden; }
.login-body {
    background: var(--navy-grad);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    overflow-x: hidden;
    max-width: 100vw;
}
.login-body::before, .login-body::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
}
.login-body::before { width: 480px; height: 480px; right: -140px; top: -140px; background: radial-gradient(circle, rgba(14, 165, 233, .22), transparent 70%); }
.login-body::after { width: 420px; height: 420px; left: -160px; bottom: -160px; background: radial-gradient(circle, rgba(59, 130, 246, .16), transparent 70%); }
.login-stage {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 34px;
    align-items: stretch;
    /* 100% (bukan 96vw): 96vw masih ditambah padding 24px body sehingga
       melebar melewati layar HP dan halaman bisa di-scroll horizontal. */
    width: 100%;
    max-width: 1080px;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.login-hero {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .13);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 22px;
    padding: 34px 38px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.login-hero-title { font-size: clamp(28px, 3.6vw, 42px); font-weight: 800; color: #fff; line-height: 1.15; margin: 0 0 14px; letter-spacing: -.5px; }
.login-hero-title em { font-style: normal; background: linear-gradient(135deg,#ffffff 0%,#38bdf8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero-desc { color: #cfe6fb; font-size: 15px; line-height: 1.65; margin: 0 0 10px; max-width: 480px; }
.login-feat { display: flex; align-items: center; gap: 13px; color: #cbd5e1; margin-top: 18px; font-size: 14px; }
.login-feat i {
    width: 40px; height: 40px; border-radius: 12px; flex: none;
    background: rgba(14, 165, 233, .13);
    border: 1px solid rgba(14, 165, 233, .28);
    color: var(--accent-2);
    display: grid; place-items: center; font-size: 17px;
}
.login-panel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    display: flex; 
    flex-direction: column; 
    justify-content: center;
    border-radius: 24px;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand-logo {
    width: 60px; height: 60px; border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: grid; place-items: center;
    font-size: 30px; font-weight: 800; line-height: 1;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.5);
}
.login-brand h4 { margin: 0; color: #fff; font-size: 17px; font-weight: 800; }
.login-brand p { margin: 0; color: #bfdbfe; font-size: 12.5px; }
.login-input-wrap { position: relative; margin-bottom: 14px; }
.login-input-wrap i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #bfdbfe; font-size: 15px; }
.login-input-wrap input {
    width: 100%;
    padding: 15px 16px 15px 50px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    outline: none;
    font-size: 15px;
    transition: all 0.3s ease;
}
.login-input-wrap input::placeholder { color: rgba(255, 255, 255, 0.6); }
.login-input-wrap input:focus { 
    border-color: var(--primary-light); 
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2); 
    background: rgba(255, 255, 255, 0.12);
}
.login-error {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #fca5a5;
    padding: 10px 13px; border-radius: 10px;
    margin-bottom: 14px; font-size: 13px;
}
.login-submit {
    width: 100%; 
    border: 0; 
    border-radius: 14px;
    padding: 16px; 
    margin-top: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 700; 
    font-size: 16px; 
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
    transition: all 0.3s ease;
}
.login-submit:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
}
.login-foot { text-align: center; color: #a5c8ea; font-size: 12px; margin-top: 22px; }
.login-install { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 14px; padding: 9px 12px; border-radius: 9px; border: 1px dashed rgba(255,255,255,.42); color: #dbeafe; font-size: 12.5px; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s; }
.login-install:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.7); color: #fff; }
.login-install i { font-size: 15px; }

@media (max-width: 900px) {
    .login-stage { grid-template-columns: 1fr; gap: 22px; }
    .login-hero, .login-panel { padding: 24px 20px; border-radius: 18px; }
    .login-hero-desc { font-size: 14px; }
    .login-feat { margin-top: 12px; font-size: 13px; }
    .login-brand-logo { width: 48px; height: 48px; font-size: 24px; border-radius: 13px; }
    .dash-cols { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .login-body { padding: 14px; }
    /* Dekorasi lingkaran 480/420px meluber keluar body dan membuat body.scrollWidth
       > viewport (walau html sudah overflow-x:hidden). Kecilkan di layar sempit. */
    .login-body::before { width: 260px; height: 260px; right: -90px; top: -90px; }
    .login-body::after  { width: 240px; height: 240px; left: -100px; bottom: -100px; }
    .login-hero { padding: 20px 16px; }
    .login-hero-title { font-size: 24px; }
    .login-hero-desc { font-size: 13px; line-height: 1.55; }
    .login-panel { padding: 22px 16px; }
    .login-brand { margin-bottom: 18px; gap: 11px; }
    .login-brand h4 { font-size: 15px; }
    .login-input-wrap input { padding: 13px 14px 13px 44px; font-size: 16px; }
    .login-submit { padding: 14px; font-size: 15px; }
    .login-foot { margin-top: 16px; font-size: 11px; }
}

/* ============================================================
   THEME v3 — Colour-coded modules, motion, richer dashboard
   ============================================================ */
:root {
    --c-general: #60a5fa;
    --c-sparepart: #a78bfa;
    --c-service: #22d3ee;
    --c-finance: #34d399;
    --c-dashboard: #38bdf8;
}

/* ---- module colours in sidebar ---- */
.menu-group.mod-general    { --mc: var(--c-general); }
.menu-group.mod-sparepart  { --mc: var(--c-sparepart); }
.menu-group.mod-service    { --mc: var(--c-service); }
.menu-group.mod-finance    { --mc: var(--c-finance); }
.menu-leaf.mod-dashboard   { --mc: var(--c-dashboard); }

.sidebar-nav ul.menu-root > li > .menu-header .module-icon {
    background: color-mix(in srgb, var(--mc, var(--primary)) 24%, transparent);
    border-radius: 10px;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.sidebar-nav ul.menu-root > li > .menu-header.open .module-icon,
.sidebar-nav ul.menu-root > li > .menu-header:hover .module-icon {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mc, var(--primary)) 25%, transparent);
    transform: scale(1.05);
}
.sidebar-nav ul.menu-root > li > .menu-header.open {
    background: linear-gradient(90deg, color-mix(in srgb, var(--mc, var(--accent)) 14%, transparent), transparent 85%);
    color: #fff;
}
.sidebar-nav ul.menu-root > li .menu-item.active {
    background: linear-gradient(90deg, color-mix(in srgb, var(--mc, var(--accent)) 26%, transparent), color-mix(in srgb, var(--mc, var(--accent)) 6%, transparent));
    color: color-mix(in srgb, var(--mc, var(--accent-2)) 75%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mc, var(--accent)) 30%, transparent);
}
.sidebar-nav ul.menu-root > li .menu-item:hover { color: #fff; }
.sidebar-nav ul.menu-root > li > .menu-leaf > .menu-item { padding-left: 16px; }
.menu-leaf.mod-dashboard > .menu-item.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, .26), rgba(56, 189, 248, .06));
    color: #e0f2fe;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .3);
}
/* submenu bullet dots */
.sidebar-nav li.menu-leaf > .menu-item { position: relative; }
.sidebar-nav ul ul li.menu-leaf > .menu-item::before {
    content: "";
    position: absolute;
    left: 10px; top: 50%;
    width: 5px; height: 5px;
    margin-top: -2.5px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--mc, #64748b) 60%, #475569);
    transition: transform .15s ease;
}
.sidebar-nav ul ul ul li.menu-leaf > .menu-item::before { left: 22px; }
.sidebar-nav ul ul ul ul li.menu-leaf > .menu-item::before { left: 34px; }
.sidebar-nav ul ul ul ul ul li.menu-leaf > .menu-item::before { left: 46px; }
.sidebar-nav li.menu-leaf > .menu-item:hover::before,
.sidebar-nav li.menu-leaf > .menu-item.active::before { transform: scale(1.5); background: var(--mc, var(--accent-2)); }

/* ---- motion ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.content > * { animation: fadeUp .45s ease both; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .18s; }
.kpi-card, .quick-card, .chart-card { will-change: transform; }
.kpi-card:hover .kpi-icon { transform: scale(1.1) rotate(-4deg); }
.kpi-icon { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }

/* ---- dashboard v3 ---- */
.dash-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.dash-hero-clock { text-align: right; position: relative; z-index: 1; }
.dash-hero-clock .big-time { font-size: 30px; font-weight: 800; color: #fff; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.dash-hero-clock .big-date { font-size: 12.5px; color: #cfe6fb; }

.progress-card .p-row { margin-bottom: 16px; }
.progress-card .p-row:last-child { margin-bottom: 0; }
.progress-card .p-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.progress-card .p-top span { color: var(--muted); font-weight: 600; }
.progress-card .p-top strong { color: var(--text); }
.p-bar { height: 8px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
/* .p-fill: TANPA transition width. Dulu memakai `transition: width 1s`, tetapi
   pada Chrome/WebView HP elemen di luar viewport tidak memulai transisi sehingga
   bar selalu tampak kosong (0px). Lebar kini diset langsung oleh script. */
.p-fill { height: 100%; border-radius: 99px; width: 0; }

.dash-grid-3 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card { background: #fff; border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.chart-card h6 { margin: 0 0 2px; font-size: 14px; font-weight: 800; color: var(--text); }
.chart-card .chart-sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.chart-box { position: relative; height: 240px; }
.chart-box-sm { height: 210px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.quick-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.quick-card i {
    width: 44px; height: 44px; border-radius: 13px;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--qc, var(--accent)) 13%, #fff);
    color: var(--qc, var(--accent));
    font-size: 20px;
    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.quick-card:hover { box-shadow: 0 10px 26px rgba(15, 23, 42, .1); }
.quick-card:hover i { transform: scale(1.12) rotate(-5deg); }
.quick-card.q-blue { --qc: var(--blue); }
.quick-card.q-violet { --qc: var(--violet); }
.quick-card.q-green { --qc: var(--green); }
.quick-card.q-orange { --qc: var(--orange); }

/* toast */
.toast-pop {
    position: fixed;
    right: 22px; bottom: 22px;
    background: var(--navy-2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .12);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 13px;
    box-shadow: 0 16px 40px rgba(30, 58, 138, .4);
    display: flex; align-items: center; gap: 10px;
    animation: fadeUp .4s ease both;
    z-index: 60;
}
.toast-pop i { color: var(--accent-2); font-size: 17px; }
.toast-pop button { background: none; border: 0; color: #a5c8ea; cursor: pointer; margin-left: 4px; font-size: 15px; }

@media (max-width: 1100px) { .dash-grid-3 { grid-template-columns: 1fr; } }

/* Grid item default `min-width:auto` membuat kolom tidak bisa menyusut di bawah
   min-content anaknya (canvas Chart.js 300px) -> dashboard melebar ~5px di HP
   dan memicu scroll horizontal. min-width:0 + canvas max-width:100% membetulkan. */
.dash-grid-3 > *, .dash-grid > * { min-width: 0; }
.chart-box canvas { max-width: 100% !important; height: auto !important; }

/* ============================================================
   SMARTADMIN FORM REPLICA — matches localhost/dms reference
   ============================================================ */
:root {
    --sa-blue: #005b99;
    --sa-line: #d6dde5;
    --sa-cyan1: #5bc0de;
    --sa-cyan2: #2aabd2;
    --sa-cyan-bd: #28a4c9;
}

.sa-form { max-width: 1400px; }

/* page header */
.sa-pagehead {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px;
    border-bottom: 2px solid var(--sa-blue);
    padding-bottom: 10px;
}
.sa-pagehead h3 { margin: 0; font-size: 22px; font-weight: 400; color: var(--sa-blue); font-family: Verdana, "Segoe UI", sans-serif; }
.sa-pagehead h3 i { margin-right: 8px; }
.sa-modbadge { background: var(--sa-blue); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 3px; text-transform: uppercase; letter-spacing: .5px; }

/* toolbar */
.sa-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sa-toolbar-group { display: flex; flex-wrap: wrap; gap: 6px; }
.sa-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--sa-cyan-bd);
    background: linear-gradient(var(--sa-cyan1), var(--sa-cyan2));
    color: #fff; font-size: 13px; font-weight: 600;
    padding: 6px 12px; border-radius: 2px; cursor: pointer;
    box-shadow: 0 1px 1px rgba(0,0,0,.12);
    transition: filter .12s ease, transform .05s ease;
}
.sa-btn:hover { filter: brightness(1.06); }
.sa-btn:active { transform: translateY(1px); }
.sa-btn i { font-size: 14px; }
.sa-btn-save { background: linear-gradient(#6cc787, #4ca568); border-color: #46a05f; }
.sa-btn-print { background: linear-gradient(#f0b25a, #e28b33); border-color: #d17f28; }
.sa-btn-del { background: linear-gradient(#e08a8a, #c05b5b); border-color: #b85050; }
.sa-btn-new { background: linear-gradient(#6db3e8, #3f8fd0); border-color: #3a86c4; }
.sa-btn-edit { background: linear-gradient(#b79ce0, #8e6bc7); border-color: #825fb8; }

/* Read-only form lock (desktop parity: open = view, Edit unlocks fields) */
.sa-locked input, .sa-locked textarea, .sa-locked select { pointer-events: none; }
/* custom buttons stay clickable in view mode so JS can show the "press Edit" hint */
.sa-locked .sa-lk-btn, .sa-locked .sa-select-btn { cursor: not-allowed; }
/* kotak cari di modal Browse harus tetap bisa diketik walau form terkunci (Mode Lihat) */
.sa-modal .sa-lk-search, .sa-modal .sa-lk-searchwrap, .sa-modal .sa-lk-tblwrap { pointer-events: auto; }
.sa-locked .sa-modal input, .sa-locked .sa-modal button { pointer-events: auto; }
.sa-locked .sa-modal #browseSearch { pointer-events: auto !important; }
.sa-locked input:not([readonly]):not([type=hidden]):not([type=checkbox]), .sa-locked textarea { background: #f4f6f8; color: #64748b; }
.sa-locked .sa-select-btn { opacity: .6; }
#saToast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1f2d3d; color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 4px 16px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: all .25s; z-index: 9999; }
#saToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sa-locked .sa-btn-save, .sa-locked [type=submit][form="mForm"], .sa-locked [type=submit][form="tForm"], .sa-locked [type=submit][form="cForm"] { opacity: .45; pointer-events: none; }
.sa-locked .sa-child-toolbar { pointer-events: none; }
.sa-btn-cancel { background: linear-gradient(#f0c36d, #dfa32e); border-color: #cf9426; color: #4a3608; }
.sa-btn-browse { background: linear-gradient(#6db3e8, #3f8fd0); border-color: #3a86c4; }
.sa-btn-std { background: linear-gradient(#f4f6f8, #dde3e9); border-color: #c6cfd8; color: #33414f; }

/* panel + subtitle */
.sa-panel {
    background: #fff; border: 1px solid var(--sa-line);
    border-radius: 4px; margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
    overflow: hidden;
}
.sa-subtitle {
    display: flex; align-items: center; gap: 8px;
    color: var(--sa-blue); font-size: 15px; font-weight: 600;
    padding: 10px 14px; border-bottom: 1px solid var(--sa-line);
    background: linear-gradient(#fbfcfd, #f2f5f8);
    cursor: pointer; user-select: none;
}
.sa-subtitle > i { font-size: 13px; color: #7c8a99; transition: transform .2s ease; }
.sa-subtitle .sa-count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: #7c8a99; background: #eef2f6; border-radius: 999px; padding: 2px 10px; }
.sa-panel.collapsed .sa-subtitle > i { transform: rotate(-90deg); }
.sa-panel.collapsed .sa-panel-body, .sa-panel.collapsed .sa-bottombar { display: none; }
.sa-panel-body { padding: 16px; }
.sa-panel-body-flush { padding: 0; }

/* span grid */
.sa-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.sa-field { grid-column: span 4; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sa-span1 { grid-column: span 1; } .sa-span2 { grid-column: span 2; } .sa-span3 { grid-column: span 3; }
.sa-span4 { grid-column: span 4; } .sa-span5 { grid-column: span 5; } .sa-span6 { grid-column: span 6; }
.sa-span7 { grid-column: span 7; } .sa-span8 { grid-column: span 8; } .sa-span9 { grid-column: span 9; }
.sa-span10 { grid-column: span 10; } .sa-span11 { grid-column: span 11; } .sa-span12 { grid-column: span 12; }
.sa-field > label { font-size: 12.5px; color: #4d4d4d; font-weight: 600; }
.sa-req { color: #d9534f; }
.sa-control { display: flex; align-items: center; gap: 6px; }
.sa-control input, .sa-control textarea, .sa-control select {
    width: 100%; border: 1px solid #c6cfd8; border-radius: 3px;
    padding: 8px 10px; font-size: 13.5px; color: #222; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.sa-control input:focus, .sa-control textarea:focus { border-color: var(--sa-cyan2); outline: none; box-shadow: 0 0 0 3px rgba(42,171,210,.15); }
.sa-control input[readonly] { background: #f4f6f8; color: #64748b; }
.sa-date { position: relative; width: 100%; }
.sa-date input { width: 100%; padding-right: 30px; }
.sa-date i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #7c8a99; pointer-events: none; }
.sa-browse { border: 1px solid var(--sa-cyan-bd); background: linear-gradient(var(--sa-cyan1), var(--sa-cyan2)); color: #fff; border-radius: 3px; padding: 8px 9px; cursor: pointer; flex: none; }

/* Generic XLookup field: code input + name input + "..." button opening search modal */
.sa-lk { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.sa-lk-row { display: flex; align-items: stretch; gap: 6px; width: 100%; }
.sa-lk-row .sa-lk-code { flex: 1; min-width: 0; }
.sa-lk-btn { border: 1px solid var(--sa-cyan-bd); background: linear-gradient(var(--sa-cyan1), var(--sa-cyan2)); color: #fff; border-radius: 3px; padding: 0 12px; font-weight: 700; cursor: pointer; flex: none; }
.sa-lk-btn:hover { filter: brightness(1.05); }
.sa-lk-name { width: 100%; border: 1px solid #c6cfd8; border-radius: 3px; padding: 8px 10px; font-size: 13.5px; color: #222; background: #f4f6f8; }
.sa-lk-searchwrap { position: relative; margin-bottom: 10px; }
.sa-lk-searchwrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #7c8a99; }
.sa-lk-search { width: 100%; padding: 8px 10px 8px 32px; border: 1px solid #c6cfd8; border-radius: 3px; font-size: 13.5px; }
.sa-lk-tblwrap { max-height: 52vh; overflow: auto; }
.sa-lk-modal .sa-modal-box { width: min(680px, 100%); }
.sa-lk-modal tbody tr { cursor: pointer; }
.sa-lk-modal tbody tr:hover { background: #eef6fb; }
/* Baris yang tampil tapi tidak boleh dipilih (stok kosong / harga belum ada / HPP kosong) */
.sa-lk-modal tbody tr.sa-lk-blocked { cursor: not-allowed; background: #fdf3f3; color: #8a4a47; }
.sa-lk-modal tbody tr.sa-lk-blocked:hover { background: #fbe9e9; }
.sa-lk-modal tbody tr.sa-lk-blocked td:first-child { text-decoration: line-through; text-decoration-color: rgba(176,65,62,.45); }
.sa-lk-modal .sa-lk-status { font-size: 11.5px; color: #b0413e; white-space: nowrap; }
.sa-lk-modal .sa-lk-status .sa-lk-ok { color: #2e7d44; font-weight: 600; }
.sa-lk-toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%) translateY(8px); background: #b0413e; color: #fff; font-size: 12.5px; padding: 8px 14px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: 88%; text-align: center; z-index: 5; }
.sa-lk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sa-lk-modal .sa-modal-box { position: relative; }
.sa-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: #33414f; }
.sa-check input { width: 16px; height: 16px; }

/* lookup code+name pair (legacy model) */
.sa-lookup-name { width: 100%; margin-top: 6px; border: 1px solid #c6cfd8; border-radius: 3px; padding: 8px 10px; font-size: 13.5px; color: #222; background: #fff; }
.sa-lookup-name:focus { border-color: var(--sa-cyan2); outline: none; box-shadow: 0 0 0 3px rgba(42,171,210,.15); }

/* Ya/Tidak toggle (legacy radio pills) */
.sa-yatidak { display: inline-flex; border: 1px solid #c6cfd8; border-radius: 3px; overflow: hidden; width: 100%; }
/* position:relative wajib — input radio di dalamnya position:absolute. Tanpa
   containing block, input meluber ke kanan dokumen dan membuat halaman bisa
   di-scroll horizontal di HP (mis. halaman Open Job Number). */
.sa-yatidak .sa-yt { flex: 1; text-align: center; cursor: pointer; position: relative; overflow: hidden; }
.sa-yatidak .sa-yt input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; left: 0; top: 0; }
.sa-yatidak .sa-yt span { display: block; padding: 8px 10px; font-size: 13.5px; color: #475569; background: #fff; transition: background .12s; }
.sa-yatidak .sa-yt + .sa-yt { border-left: 1px solid #c6cfd8; }
.sa-yatidak .sa-yt.on span { background: var(--sa-cyan2); color: #fff; font-weight: 600; }

/* child grid inside detail form */
.sa-subtitle-grid { border-top: 1px solid var(--sa-line); }
.sa-child-toolbar { padding: 10px 14px 0; }

/* select2-like dropdown */
.sa-select { position: relative; width: 100%; }
.sa-select-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    border: 1px solid #c6cfd8; border-radius: 3px; background: #fff;
    padding: 8px 10px; font-size: 13.5px; color: #222; cursor: pointer; text-align: left;
}
.sa-select-btn:hover { border-color: var(--sa-cyan2); }
.sa-select-btn i { color: #7c8a99; font-size: 12px; }
.sa-select-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-select-pop {
    position: absolute; z-index: 40; top: calc(100% + 3px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--sa-line); border-radius: 4px;
    box-shadow: 0 8px 24px rgba(15,23,42,.18); display: none; overflow: hidden;
}
.sa-select.open .sa-select-pop, .sa-select-pop.sa-pop-open { display: block; }
.sa-select-search-wrap { position: relative; padding: 6px; border-bottom: 1px solid var(--sa-line); }
.sa-select-search-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9aa7b4; font-size: 12px; }
.sa-select-search { width: 100%; border: 1px solid #c6cfd8; border-radius: 3px; padding: 6px 8px 6px 28px; font-size: 13px; }
.sa-select-list { list-style: none; margin: 0; padding: 4px 0; max-height: 220px; overflow-y: auto; }
.sa-select-list li { padding: 7px 12px; font-size: 13.5px; cursor: pointer; color: #33414f; }
.sa-select-list li:hover { background: #eaf6fb; color: var(--sa-blue); }
.sa-select-list li.sel { background: var(--sa-cyan2); color: #fff; }
.sa-select-list li.hide { display: none; }
.sa-select-sm { width: 74px; }
.sa-select-sm .sa-select-btn { padding: 4px 8px; font-size: 12.5px; }

/* data table */
.sa-table-wrap { overflow-x: auto; }
.sa-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.sa-table thead th {
    background: linear-gradient(#f7f9fb, #eaeff4);
    color: var(--sa-blue); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--sa-cyan2); white-space: nowrap;
}
.sa-table tbody td { padding: 9px 12px; border-bottom: 1px solid #eef2f6; font-size: 13px; color: #33414f; }
.sa-table tbody tr:nth-child(even) { background: #fafcfe; }
.sa-table tbody tr:hover { background: #eaf6fb; }
.sa-table tbody tr.sel { background: #d6eef8; }
.sa-col-check { width: 34px; text-align: center; }
.sa-col-no { width: 44px; text-align: center; color: #7c8a99; }
.sa-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sa-empty td { text-align: center; color: #9aa7b4; padding: 26px !important; }
.sa-empty i { font-size: 20px; display: block; margin-bottom: 4px; }
.sa-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--sa-cyan2); cursor: pointer; }

/* status pills */
.sa-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.sa-pill-ok { background: rgba(76,165,104,.14); color: #2e7d44; }
.sa-pill-warn { background: rgba(226,139,51,.16); color: #9a5b17; }
.sa-pill-danger { background: rgba(192,91,91,.15); color: #b0413e; }
.sa-pill-info { background: rgba(42,171,210,.15); color: #1c7a99; }
.sa-pill-muted { background: #eef2f6; color: #7c8a99; }

/* bottom bar */
.sa-bottombar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 9px 14px; border-top: 1px solid var(--sa-line); background: #f7f9fb; font-size: 12.5px; color: #64748b;
}
.sa-bb-left { display: flex; align-items: center; gap: 8px; }
.sa-bb-left strong { color: var(--sa-blue); }
.sa-bb-status { display: inline-flex; align-items: center; gap: 5px; color: #2e7d44; font-weight: 600; }
.sa-bb-status i { color: #4ca568; }
.sa-bb-right { display: flex; align-items: center; gap: 12px; }
.sa-bb-label { color: #7c8a99; }
.sa-pager { display: flex; align-items: center; gap: 3px; }
.sa-page { border: 1px solid var(--sa-line); background: #fff; border-radius: 3px; padding: 4px 8px; cursor: pointer; color: #475569; }
.sa-page:hover:not([disabled]) { background: #eaf6fb; border-color: var(--sa-cyan2); }
.sa-page[disabled] { opacity: .45; cursor: default; }
.sa-page-cur { padding: 0 10px; font-weight: 700; color: var(--sa-blue); }

@media (max-width: 900px) {
    .sa-grid { grid-template-columns: repeat(6, 1fr); }
    .sa-field, .sa-span4, .sa-span5, .sa-span6, .sa-span7, .sa-span8 { grid-column: span 6; }
}

/* ===== tabs (desktop-style tabbed panels) ===== */
.sa-tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--sa-line); background: #f2f5f8; }
.sa-tab { border: 1px solid transparent; border-bottom: none; background: transparent; padding: 8px 16px; font-size: 12.5px; font-weight: 600; color: #64748b; cursor: pointer; border-radius: 6px 6px 0 0; margin-bottom: -1px; }
.sa-tab:hover { color: var(--sa-blue); background: #e8eef4; }
.sa-tab.active { background: #fff; color: var(--sa-blue); border-color: var(--sa-line); border-bottom-color: #fff; }
.sa-tabpane { display: none; padding: 16px; }
.sa-tabpane.active { display: block; }
.sa-toolkit-table { display: table; width: 100%; min-width: 640px; visibility: visible; }
.sa-toolkit-table thead, .sa-toolkit-table tbody { display: table-header-group; }
.sa-toolkit-table tbody { display: table-row-group; }
.sa-toolkit-table tr { display: table-row; }
.sa-toolkit-table th, .sa-toolkit-table td { display: table-cell; }
.sa-toolkit-table input { min-width: 0; }
.sa-divider { border: none; border-top: 1px solid var(--sa-line); margin: 4px 0; width: 100%; }

/* ===== alerts ===== */
.sa-alert { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 12px; border: 1px solid transparent; }
.sa-alert-danger { background: rgba(192,91,91,.1); color: #b0413e; border-color: rgba(192,91,91,.3); }
.sa-alert-success { background: rgba(46,125,68,.1); color: #2e7d44; border-color: rgba(46,125,68,.3); }

/* ===== modal (browse/lookup) ===== */
.sa-modal { display: none; position: fixed; inset: 0; z-index: 1200; background: rgba(15,23,42,.55); align-items: flex-start; justify-content: center; padding: 60px 16px; }
.sa-modal.open { display: flex; }
.sa-modal-box { background: #fff; border-radius: 12px; width: min(760px, 100%); max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; }
.sa-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--sa-blue, #1e3a5f); color: #fff; font-weight: 700; font-size: 14px; }
.sa-modal-x { background: none; border: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.sa-modal-body { padding: 12px 16px; overflow: auto; }
.sa-modal-foot { padding: 10px 16px; border-top: 1px solid #e5e5e5; text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

/* ===== printable document view (doc_engine mode=print) ===== */
.td-print { padding: 12px 0; }
.td-print-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.td-print-doc { background: #fff; color: #111; max-width: 800px; margin: 0 auto; padding: 28px 34px; border: 1px solid #d7dde5; display: flex; flex-direction: column; min-height: 266mm; }
.td-print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 12px; }
.td-print-co span { font-size: 11.5px; color: #444; }
.td-print-title { text-align: right; }
.td-print-title h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: .5px; text-transform: uppercase; }
.td-print-no { font-size: 13px; }
.td-print-meta { width: 100%; font-size: 12.5px; margin-bottom: 12px; border-collapse: collapse; }
.td-print-meta td { padding: 1px 4px; vertical-align: top; }
.td-print-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.td-print-tbl th, .td-print-tbl td { border: 1px solid #999; padding: 4px 6px; }
.td-print-tbl thead th { background: #eef2f6; text-align: left; }
.td-print-tbl tfoot td { border: none; }
.td-print-grand td { border-top: 2px solid #111 !important; font-size: 13px; }
.td-print-sign { width: 100%; margin-top: auto; padding-top: 34px; font-size: 12.5px; text-align: center; border-collapse: collapse; }
.td-print-sign td { width: 50%; }
.td-print-foot { margin-top: 18px; font-size: 10.5px; color: #666; text-align: center; border-top: 1px dashed #bbb; padding-top: 6px; }
.td-print-size { display: inline-flex; gap: 6px; align-items: center; margin: 0 6px; font-size: 12.5px; color: #444; }
.td-print-size label { font-weight: 600; }
.td-print-size .sa-btn.active { outline: 2px solid #1e88e5; }
/* Mode setengah halaman: kertas TETAP A4; dokumen dibatasi ½ tinggi halaman
   (≈ 136mm dari 273mm area cetak), isi tetap skala penuh. Bila isi lebih
   pendek dari ½ halaman, area ½ bawah dibiarkan kosong + garis potong; BILA isi
   lebih panjang, dokumen TIDAK dipotong/ dipaksa setengah tampilan layar. */
.td-print-half .td-print-doc { position: relative; padding-bottom: 22px; }
.td-print-half .td-print-doc::after {
    content: "\2702  potong di sini (½ halaman)"; position: absolute; left: 0; right: 0; bottom: 0;
    border-top: 1.5px dashed #98a4b3; color: #6b7787; font-size: 11px; padding-top: 4px; text-align: center;
}

@media print {
    .sidebar, .topbar, .no-print, .td-print-toolbar { display: none !important; }
    .app-shell, .main-panel, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
    body { background: #fff !important; }
    .td-print { padding: 0; }
    .td-print-doc { border: none; max-width: none; padding: 0; margin: 0; }
    @page { margin: 12mm; }
}

/* ============================================================
   MOBILE — form Working Sheet / Inspection dari HP mekanik.
   Halaman utama sudah cukup responsive; blok ini menambah
   kenyamanan sentuh: input & tombol tinggi, font lebih besar,
   tabel detail jadi kartu per baris agar tidak perlu scroll
   horizontal.
   ============================================================ */
@media (max-width: 640px) {
    .content { padding: 12px 10px 90px; }
    .topbar { padding: 10px 12px; }
    .sa-form { max-width: 100%; }
    .sa-toolbar { gap: 5px; }
    .sa-btn { min-height: 44px; font-size: 14px; padding: 8px 14px; }
    .sa-panel-body { padding: 12px 10px; }
    .sa-grid { gap: 10px 10px; }
    .sa-field label, .sa-label { font-size: 12px; }
    .sa-field input, .sa-field select, .sa-field textarea, .sa-native,
    .sa-field input[type="date"], .sa-field input[type="time"] {
        min-height: 46px; font-size: 16px;
    }
    .sa-field input[readonly] { background: #f1f5f9; }
    /* Tabel detail perjalanan: ubah tiap baris jadi blok kartu */
    .sa-table-wrap { overflow-x: auto; }
    /* Working Sheet punya 7 kolom (Tanggal, Mulai, Selesai, Location, Mekanik,
       Description, Hapus); Inspection 4 kolom. `.sa-table` punya min-width:720px
       (dan header th punya lebar kolom tetap) sehingga Location & Mekanik berada
       di luar layar HP. Paksa tabel ikut lebar layar, buang min-width & thead. */
    #svDetailBody { display: block; }
    #svDetailBody tr { display: block; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; background: #fff; }
    #svDetailBody tr td { display: block; width: 100% !important; border: none; padding: 4px 6px; }
    #svDetailBody tr td::before { font-size: 11px; font-weight: 700; color: #64748b; display: block; margin-bottom: 2px; }
    .sv-field-doc .sa-table { table-layout: auto !important; width: 100% !important; min-width: 0 !important; }
    .sv-field-doc .sa-table thead { display: none; }
    .sv-field-doc .sa-table td input, .sv-field-doc .sa-table td > div { max-width: 100% !important; min-width: 0 !important; }
    #svDetailBody tr td:nth-child(1)::before { content: "Tanggal"; }
    #svDetailBody tr td:nth-child(2)::before { content: "Mulai"; }
    #svDetailBody tr td:nth-child(3)::before { content: "Selesai"; }
    #svDetailBody tr td:nth-child(4)::before { content: "Location / Lokasi"; }
    #svDetailBody tr td:nth-child(5)::before { content: "Technician"; }
    #svDetailBody tr td:nth-child(6)::before { content: "Description / Keterangan"; }
    #svDetailBody tr td:last-child { text-align: right; }
    #svDetailBody tr td:last-child::before { content: none; }
    #svDetailBody .sa-btn-del { min-height: 40px; width: 100%; }
    /* Inspection: 4 kolom (Description, Result, Comment, Hapus) */
    .sv-field-doc.sv-insp #svDetailBody tr td:nth-child(1)::before { content: "Description"; }
    .sv-field-doc.sv-insp #svDetailBody tr td:nth-child(2)::before { content: "Result"; }
    .sv-field-doc.sv-insp #svDetailBody tr td:nth-child(3)::before { content: "Comment"; }
    .sv-field-doc.sv-insp #svDetailBody tr td:nth-child(4)::before { content: none; }
    /* Panel Keluhan dan Penyebab: textarea full width */
    .sa-field textarea { width: 100%; }
    .sa-bottombar { position: sticky; bottom: 0; z-index: 30; background: #fff; box-shadow: 0 -2px 10px rgba(15,23,42,.08); }
    .sa-bottombar .sa-btn-save { width: 100%; min-height: 50px; font-size: 15.5px; }
}

/* ============================================================
   MOBILE APP SHELL (Android / HP) — ditambahkan untuk akses mekanik
   Sidebar desktop diganti bottom-nav; konten diberi ruang bawah.
   ============================================================ */
.sa-bottom-nav { display: none; }

@media (max-width: 900px) {
    /* Sidebar jadi drawer penuh. Konvensi app: `.collapsed` = TERTUTUP di desktop,
       tetapi di mobile media-query lama membaliknya (collapsed = terbuka).
       Karena itu lebar drawer dan offset harus memakai satuan yang sama (vw)
       supaya saat tertutup benar-benar keluar layar. */
    /* Drawer pakai transform (GPU) — margin-left bertransisi membuat posisi
       tidak stabil saat diukur/di-scroll di HP.
       Konvensi app: class .collapsed DITAMBAHKAN saat tombol toggle ditekan. */
    .sidebar {
        width: 84vw; max-width: 320px;
        margin-left: 0 !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
        will-change: transform;
    }
    .sidebar.collapsed {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,.45);
    }
    .main-panel { margin-left: 0 !important; }

    /* Topbar lebih ringkas + aman dari notch. */
    .topbar {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        gap: .5rem;
    }
    .topbar-crumb { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .toggle-btn { padding: 9px 12px; border-radius: 10px; }

    /* Topbar HP: sembunyikan nama user (crumb sudah panjang), tampilkan tombol
       Keluar sebagai ikon saja supaya hemat ruang. */
    .topbar { justify-content: space-between; }
    .topbar-left { min-width: 0; flex: 1 1 auto; }
    .topbar-user { display: none; }
    .topbar-logout { padding: 8px 10px; gap: 0; }
    .topbar-logout span { display: none; }
    .topbar-logout i { font-size: 17px; }

    .content {
        padding: 12px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }

    /* ---- Bottom navigation ---- */
    .sa-bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 40;
        background: rgba(255,255,255,.97);
        border-top: 1px solid var(--line);
        box-shadow: 0 -4px 18px rgba(15,23,42,.08);
        padding-bottom: env(safe-area-inset-bottom);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    .sa-bottom-nav a {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 9px 4px 8px;
        color: var(--muted);
        text-decoration: none;
        font-size: 10.5px;
        font-weight: 600;
        line-height: 1.15;
        -webkit-tap-highlight-color: transparent;
    }
    .sa-bottom-nav a i { font-size: 20px; line-height: 1; }
    .sa-bottom-nav a.active { color: var(--navy-2); }
    .sa-bottom-nav a.active i { color: var(--navy-2); }
    .sa-bottom-nav a:active { background: rgba(37,99,235,.08); }
    /* Tombol Keluar di bottom nav — selalu terlihat, warna merah muda. */
    .sa-bottom-nav a.sa-bnav-logout { color: #b91c1c; }
    .sa-bottom-nav a.sa-bnav-logout i { color: #dc2626; }
    .sa-bottom-nav a.sa-bnav-logout:active { background: rgba(220,38,38,.10); }

    /* Target sentuh lebih besar untuk form mekanik. */
    .sa-native, .sa-select, select, input[type="text"], input[type="date"],
    input[type="time"], input[type="number"], textarea { font-size: 16px !important; }
    .sa-btn { min-height: 40px; }
    .sa-table-wrap { -webkit-overflow-scrolling: touch; }

    /* Modal lookup di HP: pakai hampir seluruh layar agar daftar pilihan terbaca
       dan tombol baris mudah disentuh. Sebelumnya padding 60px atas + box 680px
       membuat modal terasa sempit dan sebagian pilihan tidak terlihat. */
    .sa-modal { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); align-items: stretch; }
    .sa-modal-box, .sa-lk-modal .sa-modal-box { width: 100%; max-height: calc(100dvh - 16px); border-radius: 14px; }
    .sa-lk-modal .sa-modal-body { padding: 10px 10px 14px; }
    .sa-lk-searchwrap { margin-bottom: 8px; }
    .sa-lk-search { font-size: 16px !important; padding: 11px 12px 11px 34px; }
    .sa-lk-tblwrap { max-height: calc(100dvh - 170px); }
    .sa-lk-modal tbody td { padding: 10px 8px; font-size: 13px; }
    .sa-lk-modal thead th { padding: 8px; font-size: 11.5px; position: sticky; top: 0; background: #f1f5f9; z-index: 1; }
    /* Tombol cari di dalam field lookup diperbesar agar mudah ditekan di HP. */
    .sa-lk-btn { min-width: 42px; min-height: 42px; }
}

/* Tablet/HP lanskap: bottom-nav tetap, sidebar drawer lebih lebar. */
@media (min-width: 641px) and (max-width: 900px) {
    .content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}