/* ============================================
   SISTEM SURAT DESA - MAIN STYLESHEET
   Design: Refined Government Administrative
   ============================================ */

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

:root {
    /* Color Palette - Deep Navy & Gold Government Theme */
    --primary: #0f2d5e;
    --primary-light: #1a4080;
    --primary-dark: #081d3f;
    --accent: #c8971a;
    --accent-light: #e8b52a;
    --accent-dark: #9d7314;
    --success: #1a7a4a;
    --danger: #c0392b;
    --warning: #d68910;
    --info: #1a6fa0;
    
    /* Neutrals */
    --white: #ffffff;
    --gray-50: #f8f9fc;
    --gray-100: #f0f2f7;
    --gray-200: #e2e7f0;
    --gray-300: #c8d0e0;
    --gray-400: #9ba8be;
    --gray-500: #6b7a99;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a2035;
    --gray-900: #0d1117;
    
    /* Typography */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Playfair Display', serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15,45,94,.08), 0 1px 2px rgba(15,45,94,.06);
    --shadow-md: 0 4px 16px rgba(15,45,94,.10), 0 2px 6px rgba(15,45,94,.07);
    --shadow-lg: 0 10px 40px rgba(15,45,94,.14), 0 4px 12px rgba(15,45,94,.08);
    --shadow-xl: 0 20px 60px rgba(15,45,94,.18);
    
    /* Spacing */
    --sidebar-width: 265px;
    --header-height: 68px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--primary-dark);
    overflow: hidden;
    position: relative;
}

.login-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 80% at 70% 50%, rgba(200,151,26,.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 60% at 20% 80%, rgba(26,64,128,.4) 0%, transparent 60%),
        linear-gradient(135deg, #081d3f 0%, #0f2d5e 50%, #1a3a6e 100%);
}

.login-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(255,255,255,.02) 60px,
            rgba(255,255,255,.02) 61px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(255,255,255,.02) 60px,
            rgba(255,255,255,.02) 61px
        );
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    position: relative;
    z-index: 1;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 60px;
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 8px 24px rgba(200,151,26,.4);
}

.login-brand-text h1 {
    font-family: var(--font-display);
    font-size: 28px;
    color: white;
    font-weight: 700;
    line-height: 1.1;
}

.login-brand-text span {
    font-size: 13px;
    color: rgba(255,255,255,.5);
    font-weight: 400;
}

.login-headline {
    font-family: var(--font-display);
    font-size: clamp(32px, 4vw, 52px);
    color: white;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 20px;
}

.login-headline em {
    font-style: normal;
    color: var(--accent-light);
}

.login-sub {
    font-size: 16px;
    color: rgba(255,255,255,.55);
    max-width: 420px;
    line-height: 1.7;
    margin-bottom: 48px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,.7);
    font-size: 14px;
}

.login-feature-item::before {
    content: '✓';
    width: 28px;
    height: 28px;
    background: rgba(200,151,26,.2);
    border: 1px solid rgba(200,151,26,.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--accent-light);
    flex-shrink: 0;
    line-height: 28px;
    text-align: center;
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

.login-card-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-card-header h2 {
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card-header p {
    color: var(--gray-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(15,45,94,.08);
}

.form-control::placeholder { color: var(--gray-400); }

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .form-control {
    padding-left: 44px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
    pointer-events: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    box-shadow: 0 4px 14px rgba(15,45,94,.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 6px 20px rgba(15,45,94,.4);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: white;
    box-shadow: 0 4px 14px rgba(200,151,26,.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(15,45,94,.04);
}

.btn-success {
    background: linear-gradient(135deg, #22a86a, var(--success));
    color: white;
    box-shadow: 0 4px 14px rgba(26,122,74,.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, var(--danger));
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, var(--warning));
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #2980b9, var(--info));
    color: white;
}

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================
   MAIN LAYOUT
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(200,151,26,.4);
}

.sidebar-brand-text h2 {
    font-family: var(--font-display);
    font-size: 18px;
    color: white;
    font-weight: 700;
    line-height: 1.1;
}

.sidebar-brand-text span {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    font-weight: 400;
    line-height: 1;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 20px 6px;
}

.nav-item {
    padding: 0 12px;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,.08);
}

.nav-link.active {
    color: white;
    background: rgba(200,151,26,.2);
    border: 1px solid rgba(200,151,26,.25);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.06);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,.4);
}

.sidebar-logout {
    color: rgba(255,255,255,.4);
    text-decoration: none;
    font-size: 15px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-logout:hover { color: #e74c3c; }

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER */
.main-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-800);
    flex: 1;
}

.header-title span {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(15,45,94,.06);
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

/* PAGE CONTENT */
.page-content {
    padding: 28px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray-500);
    font-size: 14px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--gray-300); }

/* ============================================
   CARDS & STATS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transform: translate(30px, -30px);
    opacity: 0.06;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.accent { border-left: 4px solid var(--accent); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.info { border-left: 4px solid var(--info); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(15,45,94,.1); }
.stat-icon.accent { background: rgba(200,151,26,.1); }
.stat-icon.success { background: rgba(26,122,74,.1); }
.stat-icon.info { background: rgba(26,111,160,.1); }

.stat-content { flex: 1; }
.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1;
    margin-bottom: 6px;
    font-family: var(--font-display);
}

.stat-desc {
    font-size: 12px;
    color: var(--gray-400);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:hover td { background: rgba(15,45,94,.02); }
.table tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-primary { background: rgba(15,45,94,.1); color: var(--primary); }
.badge-accent { background: rgba(200,151,26,.12); color: var(--accent-dark); }
.badge-success { background: rgba(26,122,74,.1); color: var(--success); }
.badge-danger { background: rgba(192,57,43,.1); color: var(--danger); }
.badge-warning { background: rgba(214,137,16,.1); color: var(--warning); }
.badge-info { background: rgba(26,111,160,.1); color: var(--info); }

/* ============================================
   FORMS
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    transition: var(--transition);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a99' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.form-select:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(15,45,94,.08);
}

.form-textarea {
    resize: vertical;
    min-height: 90px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 5px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    margin-bottom: 20px;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: rgba(26,122,74,.08);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(192,57,43,.08);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-info {
    background: rgba(26,111,160,.08);
    border-color: var(--info);
    color: var(--info);
}

/* ============================================
   SURAT GRID (34 SURAT)
   ============================================ */
.surat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.surat-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--gray-200);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.surat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.surat-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.surat-card:hover::before { opacity: 1; }

.surat-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    font-family: var(--font-display);
}

.surat-info { flex: 1; min-width: 0; }
.surat-kode {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.surat-nama {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.4;
    margin-bottom: 6px;
}

.surat-meta {
    font-size: 11px;
    color: var(--gray-400);
}

.surat-arrow {
    color: var(--gray-300);
    font-size: 16px;
    flex-shrink: 0;
    transition: var(--transition);
    align-self: center;
}

.surat-card:hover .surat-arrow { color: var(--primary); transform: translateX(3px); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,29,63,.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 18px;
    flex-shrink: 0;
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger); color: white; }

.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 28px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ============================================
   PRINT STYLES (LETTER/SURAT)
   ============================================ */
.print-btn-bar {
    background: var(--primary-dark);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.print-btn-bar span {
    color: rgba(255,255,255,.7);
    font-size: 13px;
}

.surat-preview {
    background: white;
    padding: 40px 50px;
    max-width: 800px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.8;
    color: #000;
    border: 1px solid var(--gray-200);
}

.surat-kop {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 4px solid #000;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.kop-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    text-align: center;
    font-weight: bold;
    flex-shrink: 0;
}

.kop-text { flex: 1; text-align: center; }
.kop-text h2 {
    font-size: 15pt;
    font-weight: 700;
    margin-bottom: 2px;
    font-family: 'Times New Roman', serif;
    text-transform: uppercase;
}

.kop-text h3 {
    font-size: 13pt;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.kop-text p { font-size: 10pt; }

.surat-title {
    text-align: center;
    margin: 20px 0 16px;
}

.surat-title h3 {
    font-size: 13pt;
    font-weight: 700;
    text-decoration: underline;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.surat-title p { font-size: 10pt; margin-top: 4px; }

.surat-body { margin: 16px 0; }

.data-row {
    display: flex;
    gap: 0;
    margin-bottom: 4px;
    line-height: 1.7;
}

.data-label {
    width: 200px;
    flex-shrink: 0;
}

.data-colon {
    width: 20px;
    flex-shrink: 0;
}

.data-value { flex: 1; }

.surat-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

.ttd-block { text-align: center; min-width: 200px; }
.ttd-kota-tgl { margin-bottom: 6px; font-size: 11pt; }
.ttd-jabatan { font-weight: 600; }
.ttd-space { height: 70px; }
.ttd-nama { font-weight: 700; text-decoration: underline; font-size: 12pt; }
.ttd-nip { font-size: 10pt; }

/* ============================================
   SEARCH & FILTERS
   ============================================ */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 15px;
}

.search-input {
    width: 100%;
    padding: 11px 16px 11px 40px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--gray-700);
    background: white;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,45,94,.08);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding-top: 20px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    font-family: var(--font-main);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-400); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

.divider {
    height: 1px;
    background: var(--gray-100);
    margin: 20px 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-desc { font-size: 13px; }

/* Loading */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   RESPONSIVE - TABLET & MOBILE
   ============================================ */

/* ── Hamburger toggle button (hanya muncul di mobile) ── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-size: 20px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--gray-100); }

/* ── Overlay gelap saat sidebar terbuka di HP ── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,29,63,.55);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ─── TABLET (≤ 1024px) ─────────────────────── */
@media (max-width: 1024px) {
    .surat-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ─── TABLET KECIL (≤ 768px) ────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    /* Sidebar tersembunyi, slide-in saat .open */
    .sidebar {
        transform: translateX(-100%);
        width: 265px;
        z-index: 101;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    /* Tombol hamburger muncul */
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

    /* Layout & konten */
    .page-content { padding: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Login: sembunyikan panel kiri */
    .login-left { display: none; }
    .login-right { width: 100%; padding: 20px; }
    .login-card { padding: 32px 24px; }

    /* Header */
    .main-header { padding: 0 14px; height: 56px; gap: 10px; }
    .header-title { font-size: 15px; }
    .header-title span { display: none; }
    .header-badge { display: none; }

    /* Modal full-width di HP */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    .modal-header { padding: 18px 20px 14px; }
    .modal-body { padding: 16px 20px; }
    .modal-footer { padding: 12px 20px 20px; }

    /* Surat grid 1 kolom */
    .surat-grid { grid-template-columns: 1fr; }

    /* Form actions stack */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
}

/* ─── MOBILE (≤ 600px) ───────────────────────── */
@media (max-width: 600px) {
    .page-content { padding: 10px; }

    /* Stat cards 2 kolom */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .stat-value { font-size: 24px; }
    .stat-label { font-size: 10px; }

    /* Tabel scroll horizontal */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 12px; }
    .table thead th, .table tbody td { padding: 8px 10px; }

    /* Sembunyikan kolom sekunder di tabel */
    .hide-mobile { display: none !important; }

    /* Search bar stack */
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-input-wrap { min-width: unset; }

    /* Buttons lebih kecil */
    .btn { font-size: 13px; padding: 9px 16px; }
    .btn-sm { font-size: 11px; padding: 6px 10px; }

    /* Card header wrap */
    .card-header { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
    .card-body { padding: 14px 16px; }
    .card-title { font-size: 13px; }

    /* Form grid kolom tunggal */
    .form-grid, .form-grid-3, .form-grid-2 { grid-template-columns: 1fr !important; }

    /* Print btn bar stack */
    .print-btn-bar { flex-direction: column; gap: 10px; padding: 14px 16px; }

    /* Surat preview lebih compact */
    .surat-preview { padding: 20px 18px; font-size: 11pt; }
    .kop-logo { width: 56px; height: 56px; }
    .kop-text h2 { font-size: 12pt; }
    .kop-text h3 { font-size: 11pt; }
    .data-label { width: 130px; font-size: 10pt; }

    /* Alert compact */
    .alert { padding: 10px 14px; font-size: 13px; }
}

/* ─── VERY SMALL (≤ 380px) ───────────────────── */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .stat-value { font-size: 20px; }
    .header-title { font-size: 13px; }
    .page-content { padding: 8px; }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .sidebar, .main-header, .print-btn-bar, .btn, .breadcrumb { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .surat-preview {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    body { background: white !important; }
}

/* ============================================
   UPGRADE FITUR BARU
   ============================================ */

/* Alert */
.alert { padding: 12px 18px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.alert i { font-size: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Stat cards responsive */
@media(max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr) !important; }
}

/* Admin mini avatar */
.admin-mini-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
}

/* Row active highlight */
.row-active td { background: rgba(15,45,94,.03); }

/* form-grid-3 */
.form-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media(max-width:768px) { .form-grid-3 { grid-template-columns: 1fr; } }

/* form-actions */
.form-actions { display: flex; gap: 10px; }
.mt-16 { margin-top: 16px; }
.mb-20 { margin-bottom: 20px; }
.p-0 { padding: 0; }

/* font-semibold text-primary */
.font-semibold { font-weight: 600; }
.text-primary { color: var(--primary); }

/* Badge secondary */
.badge-secondary { background: var(--gray-300); color: var(--gray-700); }

/* btn-block */
.btn-block { width: 100%; justify-content: center; }

/* form-label */
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }

/* Notif dot animation */
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.2);opacity:.7;} }

/* ── Mobile Bottom Navigation ── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    z-index: 98;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15,45,94,.10);
}
.mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.mobile-bottom-nav .nav-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-main);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 52px;
}
.mobile-bottom-nav .nav-item-btn i {
    font-size: 18px;
    display: block;
}
.mobile-bottom-nav .nav-item-btn.active { color: var(--primary); }
.mobile-bottom-nav .nav-item-btn:hover { color: var(--primary); }
.mobile-bottom-nav .nav-badge-dot {
    position: absolute;
    top: 2px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}
.mobile-bottom-nav .nav-item-btn-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media(max-width: 768px) {
    .mobile-bottom-nav { display: block; }
    /* Push page content up so it doesn't hide behind bottom nav */
    .page-content { padding-bottom: 72px !important; }
}

/* ── Header responsive ── */
@media(max-width:768px){
  .header-actions{gap:6px;}
  .header-actions .btn-sm{padding:6px 10px;font-size:11px;}
  /* Hide text on small button if icon present */
  .header-actions .btn-sm .btn-text{display:none;}
}
@media(max-width:480px){
  .main-header{padding:0 10px;height:52px;}
  .header-title{font-size:14px;}
}
