/* ============================================================
   SIAKPSEKDIS — Main Stylesheet
   ============================================================ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary:        #2563EB;
    --primary-dark:   #1E40AF;
    --primary-mid:    #1D4ED8;
    --primary-light:  #3B82F6;
    --primary-pale:   #DBEAFE;
    --primary-xpale:  #EFF6FF;

    --accent:         #F59E0B;
    --accent-light:   #FCD34D;
    --accent-pale:    #FEF3C7;

    --sidebar-bg:     #1E3A8A;
    --white:          #FFFFFF;
    --bg:             #F0F4FF;
    --surface2:       #F8FAFF;
    --text:           #1E293B;
    --text-muted:     #64748B;
    --text-dim:       #94A3B8;
    --border:         #CBD5E1;
    --border-light:   #E2E8F0;

    --red:            #EF4444;
    --green:          #10B981;
    --amber:          #F59E0B;
    --purple:         #7C3AED;
    --purple-pale:    #EDE9FE;

    --radius-sm:  8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 3px rgba(37,99,235,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 4px 20px rgba(37,99,235,.12);
    --shadow-lg: 0 8px 40px rgba(37,99,235,.18);

    --transition: .22s cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 265px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    box-shadow: 2px 0 16px rgba(30,58,138,.18);
}

.sidebar-brand {
    padding: 26px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: 13px;
}

.sidebar-brand img {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: white;
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.brand-abbr {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--accent-light);
    letter-spacing: .04em;
    line-height: 1.1;
}

.brand-full {
    font-size: 10px;
    color: rgba(255,255,255,.5);
    line-height: 1.3;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sidebar-user {
    margin: 14px 14px 4px;
    padding: 13px 15px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius-md);
}

.sidebar-user-role {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--accent-light);
    font-weight: 700;
    margin-bottom: 3px;
}

.sidebar-user-name { font-size: 14px; font-weight: 600; color: #fff; }

.sidebar-nav { padding: 8px 10px; flex: 1; }

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255,255,255,.35);
    font-weight: 700;
    padding: 14px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.65);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover          { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active         { background: rgba(255,255,255,.15); color: #fff; }
.nav-icon                { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.3);
    color: #FCA5A5;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-logout:hover { background: rgba(239,68,68,.28); color: #FEE2E2; }

/* ── Main content ────────────────────────────────────────── */
.main { margin-left: 265px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title { font-family: 'DM Serif Display', serif; font-size: 21px; color: var(--primary-dark); }
.topbar-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.topbar-date {
    font-size: 12.5px;
    color: var(--primary);
    background: var(--primary-pale);
    border: 1px solid #BFDBFE;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 500;
}

.content { padding: 28px 32px; flex: 1; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown .3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #D1FAE5; border: 1px solid #6EE7B7; color: #065F46; }
.alert-error   { background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B; }
.alert-icon    { font-size: 17px; }

/* ── Alur banner ─────────────────────────────────────────── */
.alur-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--primary-xpale);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--primary-dark);
    flex-wrap: wrap;
}

.alur-step  { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.alur-arrow { color: var(--primary-light); font-size: 16px; }

/* ── Stats cards ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px 2px 0 0;
}

.stat-card.stat-purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-value { font-family: 'DM Serif Display', serif; font-size: 36px; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.stat-icon  { position: absolute; right: 18px; top: 18px; font-size: 26px; opacity: .12; }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    margin-top: 10px;
}

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 19px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px; height: 20px;
    background: linear-gradient(to bottom, var(--primary), var(--primary-light));
    border-radius: 2px;
    display: inline-block;
}

.divider { border: none; border-top: 1px solid var(--border-light); margin: 28px 0; }

/* ── Forms ───────────────────────────────────────────────── */
.form-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.form-group        { display: flex; flex-direction: column; gap: 6px; }
.form-group.full   { grid-column: 1 / -1; }

.form-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
    height: 44px;
}

textarea.form-control { height: auto; min-height: 88px; resize: vertical; }

.form-control::placeholder { color: var(--text-dim); }
.form-control:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-pale);
}

select.form-control option { background: #fff; color: var(--text); }

.form-actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.filter-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-pale);
    border: 1px solid #BFDBFE;
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
}

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: .02em;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.btn-primary:hover { background: var(--primary-mid); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.3); }

.btn-secondary {
    background: var(--surface-raised);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--border-light); transform: translateY(-1px); }

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 6px; }

.btn-approve    { background: #D1FAE5; border: 1px solid #6EE7B7; color: #065F46; }
.btn-approve:hover { background: #A7F3D0; }

.btn-reject     { background: #FEF3C7; border: 1px solid #FCD34D; color: #92400E; }
.btn-reject:hover  { background: #FDE68A; }

.btn-edit       { background: var(--primary-pale); border: 1px solid #BFDBFE; color: var(--primary-dark); }
.btn-edit:hover    { background: #BFDBFE; }

.btn-delete     { background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B; }
.btn-delete:hover  { background: #FECACA; }

.btn-ghost      { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover   { background: var(--surface2); color: var(--text); }

.btn-disposisi  { background: var(--purple-pale); border: 1px solid #C4B5FD; color: var(--purple); }
.btn-disposisi:hover { background: #DDD6FE; }

.btn-selesai    { background: #D1FAE5; border: 1px solid #6EE7B7; color: #065F46; }
.btn-selesai:hover   { background: #A7F3D0; }

.btn-kembalikan { background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B; }
.btn-kembalikan:hover { background: #FECACA; }

.btn-filter     { background: var(--primary); color: #fff; height: 44px; }
.btn-filter:hover  { background: var(--primary-mid); }

.btn-reset      { background: var(--surface2); border: 1.5px solid var(--border); color: var(--text-muted); height: 44px; }
.btn-reset:hover   { background: var(--border-light); color: var(--text); }

/* ── Tables ──────────────────────────────────────────────── */
.table-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface2);
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--primary-xpale); }

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--primary);
    white-space: nowrap;
    border-bottom: 1.5px solid var(--primary-pale);
}

td {
    padding: 13px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:hover          { background: var(--primary-xpale); }
tbody tr:last-child td  { border-bottom: none; }

.td-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.td-id      { font-family: monospace; font-size: 12px; color: var(--text-dim); }
.td-num     { font-weight: 600; color: var(--primary-dark); font-size: 13px; }

.empty-row td { text-align: center; padding: 38px; color: var(--text-dim); font-style: italic; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

.badge-waiting   { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.badge-waiting::before { background: var(--amber); }

.badge-done      { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.badge-done::before    { background: var(--green); }

.badge-reject    { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.badge-reject::before  { background: var(--red); }

.badge-disposisi { background: var(--purple-pale); color: var(--purple); border: 1px solid #C4B5FD; }
.badge-disposisi::before { background: var(--purple); }

.badge-kembali   { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.badge-kembali::before { background: #F97316; }

/* ── Search highlight ────────────────────────────────────── */
.highlight { background: #FEF08A; border-radius: 3px; padding: 0 2px; }

/* ── Auth page ───────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 50%, #EDE9FE 100%);
    padding: 24px;
}

.auth-panel { width: 100%; max-width: 440px; }

.auth-header { text-align: center; margin-bottom: 30px; }

.auth-header img {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: white;
    padding: 8px;
    object-fit: contain;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(37,99,235,.2);
}

.auth-header h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 26px;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.auth-header p { color: var(--text-muted); font-size: 13px; }

.auth-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 34px 34px 28px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 { font-size: 17px; font-weight: 700; margin-bottom: 22px; color: var(--text); }

.auth-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.auth-toggle { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-muted); }

.auth-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    font-size: 13px;
}

.auth-link:hover { color: var(--primary-mid); text-decoration: underline; }

.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

.lockout-info {
    font-size: 12px;
    color: #92400E;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    text-align: center;
}

/* ── Footer ──────────────────────────────────────────────── */
.page-footer {
    padding: 18px 32px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--white);
}

.primary-text { color: var(--primary); font-weight: 600; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar { width: 220px; }
    .main    { margin-left: 220px; }
    .content { padding: 22px 18px; }
    .topbar  { padding: 14px 18px; }
}

@media (max-width: 640px) {
    .sidebar     { display: none; }
    .main        { margin-left: 0; }
    .stats-grid  { grid-template-columns: 1fr 1fr; }
    .form-grid   { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
}
