/* =========================================================
   Arshinet - Tema UI
   ========================================================= */
:root {
    --brand:        #2563eb;
    --brand-dark:   #1e40af;
    --brand-light:  #dbeafe;
    --accent:       #0ea5e9;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;
    --info:         #0891b2;

    --bg:           #f1f5f9;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --border:       #e2e8f0;
    --text:         #0f172a;
    --text-soft:    #64748b;
    --text-mute:    #94a3b8;

    --sidebar-bg:   #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;

    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-lg:    0 10px 25px rgba(15,23,42,.10);
    --sidebar-w:    248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transition: transform .25s ease;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    display: grid; place-items: center;
    font-weight: 800; color: #fff; font-size: 18px;
    box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.sidebar__title { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.sidebar__title small { display:block; font-size:11px; font-weight:500; color:var(--text-mute); letter-spacing:.5px; }

.sidebar__session {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__session label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-mute); }
.sidebar__session select {
    width: 100%; margin-top: 6px; padding: 8px 10px;
    background: rgba(255,255,255,.06); color: #fff;
    border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-sm);
    font-size: 13px;
}
.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar__group { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-mute); padding: 14px 12px 6px; }
.sidebar__link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500;
    margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar__link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar__link.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.4); }
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar__footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: var(--text-mute); }
.sidebar__logoimg { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background:#fff; }

/* Submenu bertingkat */
.sidebar__toggle { width: 100%; background: none; border: none; cursor: pointer; font: inherit; justify-content: flex-start; }
.sidebar__toggle .chev { width: 16px; height: 16px; margin-left: auto; transition: transform .2s; }
.sidebar__parent.open > .sidebar__toggle .chev { transform: rotate(180deg); }
.sidebar__sub { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sidebar__parent.open > .sidebar__sub { max-height: 500px; }
.sidebar__sublink {
    display: block; padding: 8px 12px 8px 46px; color: var(--text-mute);
    font-size: 13px; border-radius: var(--radius-sm); margin: 1px 0; transition: background .15s, color .15s;
}
.sidebar__sublink:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar__sublink.active { color: #fff; background: rgba(37,99,235,.35); font-weight: 600; }

.content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 24px 28px 48px;
    max-width: 100%;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .subtitle { color: var(--text-soft); font-size: 13px; margin-top: 2px; }
.topbar__user { display: flex; align-items: center; gap: 12px; }
.topbar__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.menu-toggle { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card__head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__head h2 { font-size: 15px; font-weight: 650; }
.card__body { padding: 20px; }
.card__body.tight { padding: 0; }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat__icon {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
}
.stat__icon svg { width: 22px; height: 22px; }
.stat__icon.blue   { background: #dbeafe; color: #2563eb; }
.stat__icon.green  { background: #dcfce7; color: #16a34a; }
.stat__icon.amber  { background: #fef3c7; color: #d97706; }
.stat__icon.cyan   { background: #cffafe; color: #0891b2; }
.stat__icon.purple { background: #ede9fe; color: #7c3aed; }
.stat__icon.red    { background: #fee2e2; color: #dc2626; }
.stat__label { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .4px; }
.stat__value { font-size: 24px; font-weight: 750; line-height: 1.15; margin-top: 2px; }
.stat__sub { font-size: 12px; color: var(--text-mute); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { background: var(--surface-2); font-weight: 600; color: var(--text-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tfoot td { font-weight: 700; background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: var(--radius-sm);
    border: 1px solid transparent; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .15s; background: var(--surface); color: var(--text);
    border-color: var(--border); line-height: 1;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn--primary:hover { background: var(--brand-dark); }
.btn--success { background: var(--success); color: #fff; border-color: var(--success); }
.btn--danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn--ghost   { background: transparent; }
.btn--sm { padding: 6px 11px; font-size: 12px; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
label.lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
label.lbl .req { color: var(--danger); }
.hint { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge--green { background: #dcfce7; color: #15803d; }
.badge--red   { background: #fee2e2; color: #b91c1c; }
.badge--gray  { background: #e2e8f0; color: #475569; }
.badge--blue  { background: #dbeafe; color: #1d4ed8; }
.badge--amber { background: #fef3c7; color: #b45309; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--green { background: #22c55e; } .dot--red { background: #ef4444; } .dot--gray { background: #94a3b8; }

/* ---------- Alerts / flash ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert--success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert--info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert--warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
    background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a, transparent), linear-gradient(135deg, #0f172a, #1e293b); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 32px; }
.auth-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.auth-logo .sidebar__logo { width: 44px; height: 44px; font-size: 20px; }
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .muted { text-align: center; color: var(--text-soft); margin-bottom: 24px; font-size: 13px; }

/* ---------- Utilities ---------- */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}
.text-soft { color: var(--text-soft); } .text-mute { color: var(--text-mute); }
.text-right { text-align: right; } .text-center { text-align: center; }
.fw-700 { font-weight: 700; } .fs-sm { font-size: 12px; } .fs-lg { font-size: 18px; }
.w-full { width: 100%; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-mute); }
.empty svg { width: 48px; height: 48px; opacity: .4; margin-bottom: 12px; }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; max-width: 280px; flex: 1; }
.search-box input { padding-left: 34px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-mute); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-backdrop.open { display: grid; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal__head h3 { font-size: 16px; } .modal__body { padding: 20px; } .modal__foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal__close { background: none; border: none; cursor: pointer; font-size: 22px; color: var(--text-mute); line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; padding: 18px 16px 40px; }
    .menu-toggle { display: inline-flex; }
}
