/* =========================================================
   Arsip Surat — Design System
   Palet: navy arsip (#1e3a5f) + kertas hangat (#f6f3ec) + amber stempel (#c47f17)
   Tipografi: Source Serif 4 (judul) + Inter (isi/UI)
   ========================================================= */

:root{
  --brand: #1e3a5f;
  --brand-dark: #142943;
  --amber: #c47f17;
  --amber-soft: #f5ecd8;
  --paper: #f6f3ec;
  --paper-card: #ffffff;
  --ink: #22293a;
  --ink-soft: #5c6478;
  --line: #e6e1d4;
  --danger: #b3261e;
  --success: #1c6b34;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(30,41,59,.06);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, sans-serif;
  font-size:15px;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,.serif{ font-family:'Source Serif 4', Georgia, serif; letter-spacing:-.01em; }
a{ text-decoration:none; }
code{ background:#f1efe6; padding:1px 6px; border-radius:5px; }

/* ---------- App Shell ---------- */
.app-shell{ display:flex; min-height:100vh; }

.sidebar{
  width:264px; flex-shrink:0;
  background: linear-gradient(180deg, var(--brand-dark), var(--brand));
  color:#eaf0f7;
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh; overflow-y:auto;
}
.sidebar-brand{ display:flex; align-items:center; gap:12px; padding:24px 20px 18px; border-bottom:1px solid rgba(255,255,255,.12); }
.sidebar-brand img{ width:42px; height:42px; border-radius:10px; object-fit:cover; background:#fff; }
.brand-fallback{ width:42px; height:42px; border-radius:10px; background:var(--amber); color:#fff; display:flex; align-items:center; justify-content:center; font-family:'Source Serif 4',serif; font-weight:700; font-size:18px; flex-shrink:0; }
.sidebar-brand-title{ font-family:'Source Serif 4',serif; font-weight:700; font-size:16px; line-height:1.2; }
.sidebar-brand-sub{ font-size:11.5px; color:#b9c8dc; margin-top:2px; max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.sidebar-nav{ padding:16px 12px 24px; display:flex; flex-direction:column; gap:2px; }
.nav-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:#8fa3bd; margin:16px 10px 6px; font-weight:600; }
.sidebar-nav a{
  display:flex; align-items:center; gap:11px; color:#dbe6f2; padding:10px 12px; border-radius:9px; font-size:14px; font-weight:500;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a i{ font-size:16px; width:18px; text-align:center; opacity:.9; }
.sidebar-nav a:hover{ background:rgba(255,255,255,.08); color:#fff; }
.sidebar-nav a.active{ background: var(--amber); color:#fff; box-shadow: 0 4px 14px rgba(196,127,23,.35); }

.app-main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  display:flex; align-items:center; gap:16px;
  padding:16px 28px; background: var(--paper-card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:20;
}
.burger{ display:none; background:none; border:none; font-size:22px; color:var(--brand); }
.topbar-title{ font-size:19px; margin:0; flex:1; font-weight:700; }
.topbar-user-name{ font-size:13.5px; font-weight:600; text-align:right; }
.topbar-user-role{ font-size:11.5px; color:var(--ink-soft); text-align:right; text-transform:uppercase; letter-spacing:.04em; }

.content{ padding:26px 28px 10px; flex:1; }
.app-footer{ padding:16px 28px; font-size:12.5px; color:var(--ink-soft); text-align:center; }

/* ---------- Cards ---------- */
.card{ border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--paper-card); }
.card-header{ background:transparent; border-bottom:1px solid var(--line); font-weight:600; padding:16px 20px; }
.card-body{ padding:20px; }

/* Stat cards */
.stat-card{
  border-radius: var(--radius); padding:20px 22px; background: var(--paper-card);
  border:1px solid var(--line); box-shadow: var(--shadow); position:relative; overflow:hidden;
}
.stat-card::before{ content:''; position:absolute; right:-18px; top:-18px; width:90px; height:90px; border-radius:50%; background: var(--stat-color, var(--amber)); opacity:.08; }
.stat-card .stat-icon{ width:44px; height:44px; border-radius:11px; display:flex; align-items:center; justify-content:center; background: var(--stat-color, var(--amber)); color:#fff; font-size:19px; margin-bottom:14px; }
.stat-card .stat-value{ font-family:'Source Serif 4',serif; font-size:30px; font-weight:700; line-height:1; }
.stat-card .stat-label{ color:var(--ink-soft); font-size:13px; margin-top:6px; }

/* ---------- Buttons ---------- */
.btn-primary{ background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus{ background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-amber{ background: var(--amber); border-color: var(--amber); color:#fff; }
.btn-amber:hover{ background:#a8690e; border-color:#a8690e; color:#fff; }
.btn-outline-brand{ border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover{ background: var(--brand); color:#fff; }
.btn{ border-radius:9px; font-weight:500; font-size:14px; }

/* ---------- Tables (ledger style) ---------- */
.table-ledger{ background: var(--paper-card); border-radius: var(--radius); overflow:hidden; border:1px solid var(--line); }
.table-ledger thead th{
  background: var(--amber-soft); color:#6b4a10; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em;
  border-bottom:2px solid #e8d4a8; font-weight:700; padding:12px 14px; white-space:nowrap;
}
.table-ledger tbody td{ padding:12px 14px; vertical-align:middle; border-bottom:1px solid var(--line); font-size:14px; }
.table-ledger tbody tr:last-child td{ border-bottom:none; }
.table-ledger tbody tr:hover{ background:#faf8f2; }
.no-agenda{ font-family:'Source Serif 4',serif; font-weight:700; color:var(--brand); }

/* Sifat surat badges */
.badge-sifat{ font-size:11px; padding:5px 10px; border-radius:20px; font-weight:600; letter-spacing:.02em; }
.badge-biasa{ background:#eef0f4; color:#4a5266; }
.badge-penting{ background:#fdecec; color:#b3261e; }
.badge-segera{ background:#fff1e0; color:#a8590e; }
.badge-rahasia{ background:#f1e9f8; color:#6a3aab; }

/* ---------- Forms ---------- */
.form-label{ font-weight:600; font-size:13.5px; color:var(--ink); }
.form-control, .form-select{ border-radius:9px; border-color:#d9d4c5; font-size:14.5px; padding:9px 12px; }
.form-control:focus, .form-select:focus{ border-color: var(--brand); box-shadow:0 0 0 .2rem rgba(30,58,95,.12); }
.form-section-title{ font-family:'Source Serif 4',serif; font-weight:700; font-size:16px; color:var(--brand); margin-bottom:14px; padding-bottom:8px; border-bottom:1px dashed var(--line); }

/* Filter bar */
.filter-bar{ background: var(--paper-card); border:1px solid var(--line); border-radius: var(--radius); padding:16px 18px; margin-bottom:18px; box-shadow: var(--shadow); }

/* Search box */
.search-wrap{ position:relative; }
.search-wrap i{ position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--ink-soft); }
.search-wrap input{ padding-left:36px; }

/* Empty state */
.empty-state{ text-align:center; padding:60px 20px; color:var(--ink-soft); }
.empty-state i{ font-size:44px; color:var(--line); margin-bottom:14px; display:block; }

/* Detail sheet (surat detail view) */
.doc-sheet{ background: var(--paper-card); border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding:30px 34px; }
.doc-sheet-header{ display:flex; justify-content:space-between; align-items:flex-start; border-bottom:2px solid var(--brand); padding-bottom:16px; margin-bottom:20px; }
.doc-field{ margin-bottom:14px; }
.doc-field-label{ font-size:11.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-soft); font-weight:600; }
.doc-field-value{ font-size:15px; margin-top:2px; }

/* ---------- Auth page ---------- */
.auth-body{ background: radial-gradient(circle at 20% 20%, #24466f, var(--brand-dark) 60%); min-height:100vh; display:flex; align-items:center; justify-content:center; margin:0; font-family:'Inter',sans-serif; }
.auth-wrap{ width:100%; padding:20px; }
.auth-card{ max-width:420px; margin:0 auto; background: var(--paper-card); border-radius:18px; padding:38px 36px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.auth-brand{ display:flex; align-items:center; gap:12px; margin-bottom:22px; }
.auth-brand img{ width:46px; height:46px; border-radius:10px; object-fit:cover; }
.auth-brand-fallback{ width:46px; height:46px; border-radius:10px; background:var(--amber); color:#fff; display:flex; align-items:center; justify-content:center; font-family:'Source Serif 4',serif; font-weight:700; font-size:19px; }
.auth-brand-title{ font-family:'Source Serif 4',serif; font-weight:700; font-size:15px; color:var(--brand); }
.auth-brand-sub{ font-size:12px; color:var(--ink-soft); }
.auth-heading{ font-size:23px; margin:0 0 4px; }
.auth-desc{ color:var(--ink-soft); font-size:13.5px; margin-bottom:20px; }
.auth-footnote{ text-align:center; font-size:12px; color:var(--ink-soft); margin-top:18px; margin-bottom:0; }

/* ---------- Responsive ---------- */
@media (max-width: 991px){
  .sidebar{ position:fixed; left:0; top:0; z-index:1000; transform:translateX(-100%); transition:transform .2s ease; box-shadow:0 0 40px rgba(0,0,0,.3); }
  .sidebar.open{ transform:translateX(0); }
  .burger{ display:block; }
}

/* ---------- Print ---------- */
@media print{
  .sidebar, .topbar, .app-footer, .no-print{ display:none !important; }
  .app-main{ padding:0; }
  .content{ padding:0; }
  body{ background:#fff; }
  .doc-sheet{ box-shadow:none; border:none; }
}
