/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Segoe UI', Arial, Helvetica, sans-serif; font-size: 14px; color: #1e293b; background: #f1f5f9; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img { display: block; }

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    --blue-dark:  #0f172a;
    --blue-main:  #1e3a8a;
    --blue-mid:   #2563eb;
    --blue-light: #eff6ff;
    --green:      #16a34a;
    --green-bg:   #f0fdf4;
    --red:        #dc2626;
    --red-bg:     #fef2f2;
    --amber:      #d97706;
    --amber-bg:   #fef3c7;
    --purple:     #7c3aed;
    --purple-bg:  #f5f3ff;
    --gray-50:    #f8fafc;
    --gray-100:   #f1f5f9;
    --gray-200:   #e2e8f0;
    --gray-300:   #cbd5e1;
    --gray-500:   #64748b;
    --gray-700:   #334155;
    --radius:     10px;
    --radius-lg:  14px;
    --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,.10);
    --sidebar-w:  250px;
    --topbar-h:   62px;
}

/* ── Login Page ─────────────────────────────────────────────── */
body.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #3b82f6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
body.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(59,130,246,.25) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(124,58,237,.20) 0%, transparent 50%);
    pointer-events: none;
}
.login-wrap {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
    color: #fff;
}
.login-brand-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.25);
}
.login-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-brand h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-brand p  { font-size: 13px; opacity: .8; }
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card h2  { font-size: 22px; font-weight: 700; color: var(--blue-dark); margin-bottom: 6px; }
.login-card p   { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.field-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    color: var(--blue-dark);
}
.field-input:focus { border-color: var(--blue-mid); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--blue-main), var(--blue-mid));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity .15s, transform .1s;
}
.btn-login:hover { opacity: .92; }
.btn-login:active { transform: scale(.98); }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--gray-500); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar-app {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: linear-gradient(90deg, var(--blue-dark) 0%, var(--blue-main) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
    box-shadow: 0 2px 16px rgba(0,0,0,.30);
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.2);
    flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text h1  { font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand-text p   { font-size: 11px; opacity: .75; margin-top: 2px; }
.user-top { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-top span { opacity: .9; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px;
    padding: 5px 12px;
}
.user-chip .role-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255,255,255,.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── Layout Shell ──────────────────────────────────────────── */
.main-bg { min-height: 100vh; background: var(--gray-100); }
.layout-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - var(--topbar-h));
    margin-top: var(--topbar-h);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar-app {
    background: var(--blue-dark);
    color: #94a3b8;
    padding: 20px 12px;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-user {
    padding: 12px 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 14px;
}
.sidebar-user .name { font-size: 14px; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { font-size: 11px; margin-top: 3px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #475569; padding: 8px 10px 5px; }
.sidebar-menu { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #94a3b8;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.sidebar-link.active { background: rgba(37,99,235,.25); color: #93c5fd; font-weight: 600; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08); }

/* ── Content Area ──────────────────────────────────────────── */
.content-area { padding: 24px; min-height: calc(100vh - var(--topbar-h)); background: var(--gray-100); }
.page-wrap { max-width: 1100px; }
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--blue-dark);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title::before {
    content: '';
    display: block;
    width: 4px; height: 28px;
    background: linear-gradient(180deg, var(--blue-mid), var(--purple));
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-head h3 { font-size: 15px; font-weight: 600; color: var(--blue-dark); }
.card-body { padding: 20px; }

/* ── Stat Grid ──────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--blue-mid);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-card.green  { border-left-color: var(--green); }
.stat-card.amber  { border-left-color: var(--amber); }
.stat-card.red    { border-left-color: var(--red); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-icon { font-size: 24px; }
.stat-info h4 { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-info .big { font-size: 26px; font-weight: 700; color: var(--blue-dark); line-height: 1; }

/* Legacy compat */
.stat-grid-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-mini {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-top: 3px solid var(--blue-mid);
}
.stat-mini h4  { font-size: 11px; color: var(--gray-500); font-weight: 500; margin-bottom: 6px; }
.stat-mini .big { font-size: 28px; font-weight: 700; color: var(--blue-dark); }

/* ── Menu Cards Grid ─────────────────────────────────────────── */
.menu-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 24px; }
.menu-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: box-shadow .15s, transform .1s;
}
.menu-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.menu-card h3 { font-size: 15px; font-weight: 600; color: var(--blue-dark); margin-bottom: 6px; }
.menu-card p  { font-size: 12px; color: var(--gray-500); margin-bottom: 14px; line-height: 1.5; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-blue, .btn-red, .btn-green, .btn-amber, .btn-purple, .btn-gray {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity .12s, transform .08s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn-blue   { background: var(--blue-mid); color: #fff; }
.btn-red    { background: var(--red);      color: #fff; }
.btn-green  { background: var(--green);    color: #fff; }
.btn-amber  { background: var(--amber);    color: #fff; }
.btn-purple { background: var(--purple);   color: #fff; }
.btn-gray   { background: var(--gray-200); color: var(--gray-700); }
.btn-blue:hover, .btn-red:hover, .btn-green:hover,
.btn-amber:hover, .btn-purple:hover, .btn-gray:hover { opacity: .88; }
.btn-blue:active, .btn-red:active { transform: scale(.97); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Outline variants */
.btn-blue-outline {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 600;
    border: 1.5px solid var(--blue-mid); color: var(--blue-mid);
    background: transparent; cursor: pointer; text-decoration: none;
    transition: background .12s;
}
.btn-blue-outline:hover { background: var(--blue-light); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}
.form-box h3 { font-size: 16px; font-weight: 600; color: var(--blue-dark); margin-bottom: 18px; }
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.form-group input[type=text],
.form-group input[type=number],
.form-group input[type=date],
.form-group input[type=datetime-local],
.form-group input[type=email],
.form-group input[type=password],
.form-group select,
.form-group textarea,
input[type=text].field-input,
input[type=password].field-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 7px;
    font-size: 14px;
    outline: none;
    color: var(--blue-dark);
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-group small { font-size: 11px; color: var(--gray-500); margin-top: 4px; display: block; }

.form-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-box { background: #fff; border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); margin-bottom: 16px; }

/* ── Table ──────────────────────────────────────────────────── */
.simple-table-wrap {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 20px;
}
.table-head-bar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.table-head-bar h3 { font-size: 15px; font-weight: 600; color: var(--blue-dark); }
.simple-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.simple-table th {
    background: var(--gray-50);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.simple-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--blue-dark);
    vertical-align: middle;
}
.simple-table tr:last-child td { border-bottom: none; }
.simple-table tr:hover td { background: var(--gray-50); }
.table-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.table-empty td { text-align: center; color: var(--gray-500); padding: 32px !important; font-size: 13px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-soft {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-700);
}
.badge-blue   { background: var(--blue-light); color: var(--blue-main); }
.badge-green  { background: var(--green-bg);   color: var(--green); }
.badge-red    { background: var(--red-bg);     color: var(--red); }
.badge-amber  { background: var(--amber-bg);   color: var(--amber); }
.badge-purple { background: var(--purple-bg);  color: var(--purple); }

/* Monitor badges */
.monitor-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.monitor-assigned  { background: #eff6ff; color: #1d4ed8; }
.monitor-confirmed { background: #fef3c7; color: #92400e; }
.monitor-started   { background: #f0fdf4; color: #166534; }
.monitor-submitted { background: #ecfdf5; color: #065f46; }

/* ── Alert boxes ─────────────────────────────────────────────── */
.alert-box {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-success::before { content: '✅'; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-error::before { content: '⚠️'; }
.alert-info    { background: var(--blue-light); color: var(--blue-main); border: 1px solid #bfdbfe; }
.alert-info::before { content: 'ℹ️'; }

/* ── Login specific fields ───────────────────────────────────── */
.center-login { display: flex; justify-content: center; align-items: flex-start; padding: 32px 16px; }
.card-panel {
    background: #fff;
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 480px;
}
.card-panel.small { max-width: 420px; }
.card-title { font-size: 20px; font-weight: 700; color: var(--blue-dark); margin-bottom: 6px; }
.card-desc  { font-size: 13px; color: var(--gray-500); margin-bottom: 22px; line-height: 1.5; }
.line-field {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    transition: border-color .12s;
}
.line-field:focus-within { border-color: var(--blue-mid); }
.line-field .icon { padding: 10px 14px; font-size: 16px; background: var(--gray-50); border-right: 1px solid var(--gray-200); }
.line-field input { flex: 1; padding: 10px 14px; border: none; outline: none; font-size: 14px; }
.data-group { margin-bottom: 12px; }
.data-group label { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 4px; }
.line-value { font-size: 14px; color: var(--blue-dark); font-weight: 500; padding: 6px 0; }
.row-3 { display: grid; grid-template-columns: 1fr 2fr 1.5fr; gap: 8px; }
.patterned { background-image: radial-gradient(var(--gray-200) 1px, transparent 1px); background-size: 20px 20px; }

/* ── Konfirmasi page ─────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.left-blank-box {
    background: linear-gradient(135deg, var(--blue-main), var(--blue-mid));
    border-radius: var(--radius-lg);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #fff;
}
.token-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}
.token-line span { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.info-card { background: #fff; border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.info-card h2 { font-size: 18px; font-weight: 700; color: var(--blue-dark); margin-bottom: 18px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-w: 200px; }
}
@media (max-width: 768px) {
    .layout-shell { grid-template-columns: 1fr; }
    .sidebar-app { display: none; }
    .form-grid-2, .form-grid-3, .two-col { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
}

/* ── Loading animation ───────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.loading { animation: pulse 1.5s infinite; }
