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

:root {
  --navy: #0f2744;
  --navy-mid: #1a3a5c;
  --blue: #1d5fa8;
  --blue-light: #2e7dd1;
  --sky: #e8f2fc;
  --accent: #e8a020;
  --accent-light: #fef3dc;
  --red: #c0392b;
  --red-light: #fdecea;
  --green: #1a7a4c;
  --green-light: #e6f5ed;
  --gray-bg: #f4f6f9;
  --gray-border: #d1dce8;
  --gray-text: #6b7a8d;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(15,39,68,0.10);
  --shadow-lg: 0 8px 40px rgba(15,39,68,0.16);
}

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

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--gray-bg);
  color: var(--navy);
  min-height: 100vh;
  font-size: 14px;
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
#auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--blue), var(--navy));
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 16px;
}
.auth-logo h1 {
  font-size: 18px; font-weight: 700; color: var(--navy);
  line-height: 1.4;
}
.auth-logo p { font-size: 13px; color: var(--gray-text); margin-top: 4px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 7px; }
.form-group input, .form-group select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-border);
  border-radius: 10px; font-family: inherit; font-size: 14px; color: var(--navy);
  transition: border-color .2s, box-shadow .2s; background: var(--white);
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,95,168,.12);
}
.btn-primary {
  width: 100%; padding: 13px; background: linear-gradient(135deg, var(--blue), var(--navy));
  color: white; border: none; border-radius: 10px; font-family: inherit;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity .2s, transform .1s;
  letter-spacing: .3px;
}
.btn-primary:hover { opacity: .93; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.demo-hint {
  margin-top: 22px; background: var(--sky); border-radius: 10px; padding: 14px 16px;
  font-size: 12px; color: var(--navy-mid);
}
.demo-hint strong { display: block; margin-bottom: 6px; color: var(--blue); }
.demo-hint div { line-height: 1.8; }
.demo-hint code { background: var(--white); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; }

/* ===== LAYOUT ===== */
#app { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
  background: var(--navy);
  display: flex; flex-direction: column; z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,.15);
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .logo-row { display: flex; align-items: center; gap: 12px; }
.sidebar-logo .logo-icon {
  width: 42px; height: 42px; background: var(--blue); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 13px; font-weight: 700; color: white; line-height: 1.35; }
.sidebar-logo .logo-sub { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 2px; }

.sidebar-user {
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue-light);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  color: white; font-weight: 700; flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 600; color: white; }
.user-info .user-role {
  font-size: 11px; color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.1); padding: 2px 8px; border-radius: 20px; display: inline-block; margin-top: 3px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,.35); padding: 8px 8px 4px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.7); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: all .18s; margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: var(--blue); color: white; font-weight: 600; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .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,.1); }

.main-content { margin-left: 260px; min-height: 100vh; }
.topbar {
  background: white; border-bottom: 1px solid var(--gray-border);
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  background: var(--accent-light); color: var(--accent); font-size: 12px;
  font-weight: 600; padding: 5px 12px; border-radius: 20px;
}

.page-content { padding: 28px; }

/* ===== CARDS & STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: white; border-radius: 14px; padding: 22px 20px;
  box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 50px; height: 50px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--sky); }
.stat-icon.green { background: var(--green-light); }
.stat-icon.orange { background: var(--accent-light); }
.stat-icon.red { background: var(--red-light); }
.stat-num { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-text); margin-top: 5px; }

.card {
  background: white; border-radius: 14px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1.5px solid var(--gray-border);
}
.card-title { font-size: 16px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.card-actions { display: flex; gap: 10px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s; white-space: nowrap;
}
.btn-blue { background: var(--blue); color: white; }
.btn-blue:hover { background: var(--navy); }
.btn-outline { background: white; color: var(--navy); border: 1.5px solid var(--gray-border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-success { background: var(--green-light); color: var(--green); }
.btn-success:hover { background: var(--green); color: white; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--gray-bg); padding: 11px 14px; text-align: left;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--gray-text); border-bottom: 2px solid var(--gray-border); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-border); font-size: 13.5px; }
tr:hover td { background: var(--sky); }
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-orange { background: var(--accent-light); color: #c07a00; }
.badge-blue { background: var(--sky); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--gray-text); border: 1px solid var(--gray-border); }

/* ===== FORM ===== */
.form-section {
  background: var(--sky); border-radius: 12px; padding: 18px 20px; margin-bottom: 20px;
  border-left: 4px solid var(--blue);
}
.form-section-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.full { grid-template-columns: 1fr; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-border); border-radius: 8px;
  font-family: inherit; font-size: 13.5px; color: var(--navy); background: white;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,95,168,.1);
}
.field input.error { border-color: var(--red); background: var(--red-light); }
.field input[type=checkbox], .field input[type=radio] { width: auto; padding: 0; flex: 0 0 auto; }
.doc-recip-row span { text-align: left; }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11px; color: var(--gray-text); margin-top: 4px; }

/* ===== REPORT FORM TABLE ===== */
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td {
  border: 1px solid #b8cce0; padding: 9px 12px; vertical-align: middle;
}
.report-table thead th {
  background: #1d5fa8; color: white; font-weight: 700; text-align: center;
  text-transform: none; letter-spacing: 0; font-size: 13px;
}
.report-table .row-group td:first-child { font-weight: 700; background: #e8f2fc; }
.report-table .row-sub td { padding-left: 28px; color: #4a5568; }
.report-table input[type=number], .report-table input[type=text] {
  width: 100%; border: none; background: transparent; font-family: inherit;
  font-size: 13px; color: var(--navy); text-align: right; padding: 2px 4px;
}
.report-table input:focus { outline: 1px solid var(--blue); border-radius: 3px; }
.report-table .total-row td { background: #fff9e6; font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10,20,40,.55);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 18px; width: 100%; max-width: 700px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .22s ease;
}
.modal.wide { max-width: 900px; }
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  padding: 22px 28px 18px; border-bottom: 1.5px solid var(--gray-border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0;
  background: white; z-index: 1; border-radius: 18px 18px 0 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--gray-bg);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--gray-text); transition: background .15s;
}
.modal-close:hover { background: var(--red-light); color: var(--red); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px; border-top: 1.5px solid var(--gray-border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ===== SUMMARY TABLE ===== */
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.summary-cell {
  background: white; border-radius: 12px; padding: 16px;
  border: 1.5px solid var(--gray-border); text-align: center; cursor: pointer; transition: all .18s;
}
.summary-cell:hover { border-color: var(--blue); box-shadow: 0 4px 12px rgba(29,95,168,.12); }
.summary-cell .sc-type { font-size: 11px; font-weight: 700; color: var(--gray-text); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.summary-cell .sc-done { font-size: 28px; font-weight: 800; color: var(--green); }
.summary-cell .sc-pending { font-size: 28px; font-weight: 800; color: var(--red); }
.summary-cell .sc-label { font-size: 11px; color: var(--gray-text); margin-top: 4px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-family: inherit; font-size: 13.5px; font-weight: 600;
  border: none; background: none; cursor: pointer; color: var(--gray-text);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s;
}
.tab-btn:hover { color: var(--blue); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== SEARCH ===== */
.search-bar { position: relative; }
.search-bar input {
  width: 100%; padding: 9px 14px 9px 38px; border: 1.5px solid var(--gray-border);
  border-radius: 10px; font-family: inherit; font-size: 13.5px; background: white;
}
.search-bar input:focus { outline: none; border-color: var(--blue); }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-text); font-size: 15px; }

/* ===== ALERT ===== */
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-info { background: var(--sky); color: var(--blue); border: 1px solid #b8d4f0; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #a8dcc0; }
.alert-warning { background: var(--accent-light); color: #8a5c00; border: 1px solid #f0d090; }
.alert-danger { background: var(--red-light); color: var(--red); border: 1px solid #f0b0a8; }
.alert-blue { background: var(--sky); color: var(--blue); border: 1px solid #b8d4f0; }

/* ===== DEADLINE BANNER ===== */
.deadline-banner {
  background: linear-gradient(135deg, #fff4e0, #ffedc0);
  border: 1.5px solid #f0d090; border-radius: 12px; padding: 14px 18px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 22px;
}
.deadline-banner .icon { font-size: 24px; }
.deadline-banner .text strong { display: block; font-size: 14px; font-weight: 700; color: #7a4f00; }
.deadline-banner .text span { font-size: 13px; color: #a06c00; }

/* ===== RESPONSIVE UTILS ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.link { color: var(--blue); cursor: pointer; text-decoration: underline; font-weight: 600; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b8cce0; border-radius: 10px; }

@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

.btn-green   { background: #16a34a; color: white; border-color: #16a34a; }
.btn-green:hover { background: #15803d; }
.btn-warning { background: #d97706; color: white; border-color: #d97706; }
.btn-warning:hover { background: #b45309; }
.btn-success { background: #059669; color: white; border-color: #059669; }
.btn-success:hover { background: #047857; }
