@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --primary: #1a3a5c;
    --secondary: #c9a84c;
    --accent: #e8f4f8;
    --primary-light: #2d5986;
    --primary-dark: #0d2338;
    --secondary-light: #e2c97e;
    --secondary-dark: #9e7d2e;
    --bg: #f4f7fa;
    --white: #ffffff;
    --text: #1e2d3d;
    --text-muted: #6b7f94;
    --border: #dce6ef;
    --danger: #c0392b;
    --success: #1e7e5a;
    --warning: #d4851a;
    --shadow: 0 2px 20px rgba(26,58,92,0.10);
    --shadow-lg: 0 8px 40px rgba(26,58,92,0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
}

/* TOPBAR */
.topbar {
    background: var(--primary-dark);
    padding: 6px 0;
    text-align: center;
    font-size: 11px;
    color: var(--secondary-light);
    letter-spacing: 1.5px;
    font-weight: 500;
}

/* NAVBAR */
.navbar {
    background: var(--primary);
    box-shadow: 0 2px 16px rgba(26,58,92,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-icon {
    width: 42px; height: 42px;
    background: var(--secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
}
.brand-text { color: var(--white); }
.brand-text .app-name {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    display: block;
}
.brand-text .app-sub {
    font-size: 10px;
    color: var(--secondary-light);
    letter-spacing: 0.5px;
    display: block;
    margin-top: -2px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}
.navbar-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.navbar-nav a:hover, .navbar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
}
.navbar-nav a.active { background: rgba(201,168,76,0.25); color: var(--secondary-light); }
.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.08);
    padding: 6px 14px 6px 8px;
    border-radius: 30px;
    color: var(--white);
    font-size: 13px;
}
.user-avatar {
    width: 30px; height: 30px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--primary-dark);
}
.badge-role {
    background: var(--secondary);
    color: var(--primary-dark);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

/* LAYOUT */
.page-wrapper { max-width: 1400px; margin: 0 auto; padding: 30px 24px; }

/* HERO DASHBOARD */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    border-radius: 20px;
    padding: 40px;
    color: var(--white);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.dashboard-hero::before {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 280px; height: 280px;
    background: rgba(201,168,76,0.1);
    border-radius: 50%;
}
.dashboard-hero::after {
    content: '';
    position: absolute;
    right: 80px; top: 80px;
    width: 160px; height: 160px;
    background: rgba(201,168,76,0.08);
    border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; }
.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}
.hero-sub {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    margin-bottom: 24px;
}
.hero-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--secondary-light);
}

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--secondary);
}
.stat-icon {
    width: 46px; height: 46px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
    color: var(--primary);
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; }

/* CARDS */
.card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, var(--accent), var(--white));
}
.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-body { padding: 24px; }

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    transition: all 0.2s;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.10);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: var(--primary-dark); }
.btn-secondary:hover { background: var(--secondary-dark); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #922b21; }
.btn-success { background: var(--success); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.tbl thead th {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}
table.tbl tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
table.tbl tbody tr:hover { background: var(--accent); }
table.tbl tbody td { padding: 12px 16px; color: var(--text); vertical-align: middle; }
.nomor-badge {
    font-family: 'Courier New', monospace;
    background: var(--primary);
    color: var(--secondary-light);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    display: inline-block;
}
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.badge-admin { background: rgba(201,168,76,0.2); color: var(--secondary-dark); }
.badge-user { background: var(--accent); color: var(--primary); }
.badge-manual { background: rgba(212,133,26,0.15); color: var(--warning); }
.badge-auto { background: rgba(30,126,90,0.12); color: var(--success); }

/* LOGIN PAGE */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 30px;
}
.login-logo-icon {
    width: 72px; height: 72px;
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    position: relative;
}
.login-logo-icon::after {
    content: '';
    position: absolute;
    bottom: -4px; right: -4px;
    width: 28px; height: 28px;
    background: var(--secondary);
    border-radius: 8px;
}
.login-logo-icon span {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    position: relative;
    z-index: 1;
}
.login-logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 4px;
}
.login-logo p { font-size: 12px; color: var(--text-muted); }
.login-divider {
    text-align: center;
    color: var(--secondary);
    font-size: 18px;
    margin: 6px 0 24px;
}

/* ALERT */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger { background: #fdf0ef; color: var(--danger); border: 1px solid #f5c6c3; }
.alert-success { background: #edf7f3; color: var(--success); border: 1px solid #c0e6d3; }
.alert-warning { background: #fdf5e8; color: var(--warning); border: 1px solid #f5dba0; }
.alert-info { background: var(--accent); color: var(--primary); border: 1px solid var(--border); }

/* SIDEBAR ADMIN */
.admin-layout { display: flex; min-height: calc(100vh - 128px); gap: 0; }
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--primary-dark);
    border-right: 1px solid rgba(255,255,255,0.08);
}
.sidebar-menu { padding: 16px 0; }
.sidebar-section {
    padding: 8px 20px 4px;
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    font-weight: 600;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--white);
    border-left-color: var(--secondary);
}
.sidebar-menu a.active {
    background: rgba(201,168,76,0.12);
    color: var(--secondary-light);
    border-left-color: var(--secondary);
}
.main-content { flex: 1; padding: 28px; overflow-x: auto; }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,35,56,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white);
    border-radius: 20px;
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: 20px 20px 0 0;
}
.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--white);
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-body { padding: 28px; }
.modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* SMART INPUT */
.smart-input-wrap { position: relative; }
.smart-suggestions {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--white);
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-lg);
}
.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--accent); }
.suggestion-kode { font-family: 'Courier New', monospace; font-size: 10px; color: var(--primary); font-weight: 700; margin-bottom: 2px; }
.suggestion-nama { font-size: 13px; color: var(--text); }
.suggestion-match { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* FORM ROW */
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header-title {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.page-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* SEARCH BAR */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.search-bar .form-control { max-width: 280px; }

/* PAGINATION */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: var(--primary);
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.pagination a:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); font-weight: 700; }

/* NOMOR DISPLAY */
.nomor-display-box {
    background: var(--primary-dark);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 16px 0;
}
.nomor-display-label { font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.nomor-display-value {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary-light);
    letter-spacing: 1px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar-nav { display: none; }
    .dashboard-hero { padding: 24px; }
}

/* UTILS */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.fw-bold { font-weight: 700; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Copy button */
.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 6px;
  opacity: 0.6;
  transition: opacity .2s, background .2s;
  vertical-align: middle;
}
.btn-copy:hover { opacity: 1; background: var(--light); }
.btn-copy.copied { border-color: var(--success, #28a745); opacity: 1; }
