:root {
  --navy: #0b1526;
  --navy-2: #101f38;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue-bg: #dbeafe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
.icon { flex: none; vertical-align: middle; }

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

.sidebar {
  width: 272px;
  flex: none;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #cbd5e1;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  z-index: 40;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: .5px; color: #fff; font-size: 15px;
  background: linear-gradient(135deg, #3b82f6, #22d3ee);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .45);
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { color: #fff; font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 10.5px; color: #94a3b8; line-height: 1.35; max-width: 160px; }

.nav { flex: 1; overflow-y: auto; padding-right: 2px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 6px; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .9px;
  color: #64748b; padding: 18px 12px 8px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 3px;
  border-radius: 10px; color: #cbd5e1; font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(148, 163, 184, .1); color: #fff; }
.nav-item.active {
  background: rgba(59, 130, 246, .18);
  color: #fff; border-left-color: #60a5fa;
}
.nav-item .icon { color: #93c5fd; }
.nav-item.active .icon { color: #93c5fd; }

.sidebar-footer {
  display: flex; flex-direction: column; gap: 1px;
  padding: 14px 12px 4px; margin-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, .14);
  font-size: 10.5px; color: #64748b;
}

.main-area { flex: 1; margin-left: 272px; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 74px; padding: 0 26px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-heading h1 { font-size: 19px; font-weight: 700; }
.page-heading p { font-size: 12.5px; color: var(--muted); }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--muted); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  flex: none;
}
.avatar-lg { width: 54px; height: 54px; font-size: 20px; border-radius: 16px; }

.menu-btn {
  display: none; border: 1px solid var(--line); background: #fff;
  font-size: 20px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
}

.content { padding: 24px 26px 40px; max-width: 1460px; }
.overlay { display: none; }

/* ---------------------------------------------------------------- Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head .link { font-size: 12.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; flex: none;
}
.stat-icon.blue { background: var(--blue-bg); color: var(--primary); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-label { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { display: block; font-size: 25px; font-weight: 800; line-height: 1.15; }
.stat-note { font-size: 11px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 0; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; padding: 9px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .right { text-align: right; white-space: nowrap; }
.table .empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.table .wrap { max-width: 260px; white-space: normal; }
.name-link { font-weight: 600; color: var(--text); }
.name-link:hover { color: var(--primary); }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: #15803d; }
.badge-amber { background: var(--amber-bg); color: #b45309; }
.badge-red { background: var(--red-bg); color: #b91c1c; }
.badge-blue { background: var(--blue-bg); color: var(--primary-600); }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; background: #f1f5f9; color: #475569;
}
.tag-blue { background: var(--blue-bg); color: var(--primary-600); }
.tag-green { background: var(--green-bg); color: #15803d; }
.tag-amber { background: var(--amber-bg); color: #b45309; }
.tag-red { background: var(--red-bg); color: #b91c1c; }

/* ---------------------------------------------------------------- Progress */
.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-lg { height: 14px; }
.bar { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.bar-green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.big-pct { font-size: 26px; font-weight: 800; color: var(--primary); }
.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.mini-progress { height: 6px; width: 110px; background: #e2e8f0; border-radius: 999px; overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-progress span { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 999px; }

.mini-stats { display: flex; gap: 22px; margin: 4px 0 16px; flex-wrap: wrap; }
.mini-stats > div { display: flex; flex-direction: column; }
.mini-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.mini-stats strong { font-size: 22px; font-weight: 800; }
.big-number { font-size: 34px; font-weight: 800; line-height: 1.1; }

/* ---------------------------------------------------------------- Forms */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.spacer { flex: 1; }
.search-input {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  background: #fff; color: var(--muted); min-width: 240px;
}
.search-input input { border: none; outline: none; padding: 9px 0; width: 100%; background: transparent; font-size: 13px; }

input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input[type="file"] { padding: 7px; background: #f8fafc; }
textarea { resize: vertical; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.form-section h3 { font-size: 13px; color: var(--primary-600); text-transform: uppercase; letter-spacing: .5px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: #334155; }
.field.full { grid-column: 1 / -1; }
.req { color: var(--red); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.inline { display: inline; }
.inline-form { flex-direction: row; align-items: center; margin-top: 14px; }

.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { display: none; }
.segmented span {
  display: block; text-align: center; padding: 9px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fff;
}
.segmented input:checked + span { background: var(--primary-50); border-color: #93c5fd; color: var(--primary-600); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  background: #fff; color: var(--text); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: #fff; border-color: var(--line); color: #334155; }
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 9px; font-size: 11.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- Details */
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 14px 0 0; }
.detail-list > div { border-bottom: 1px dashed #eef2f7; padding-bottom: 7px; }
.detail-list dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 2px 0 0; font-weight: 600; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.profile-head strong { display: block; font-size: 17px; }
.profile-head span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.profile-head .badge { margin-top: 6px; }
.note { background: #f8fafc; border-left: 3px solid var(--primary); padding: 10px 12px; border-radius: 6px; margin-top: 14px; color: #334155; }

/* ---------------------------------------------------------------- Misc */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--green-bg); color: #166534; border-color: #bbf7d0; }
.flash-danger { background: var(--red-bg); color: #991b1b; border-color: #fecaca; }
.flash-info { background: var(--blue-bg); color: #1e40af; border-color: #bfdbfe; }
.flash-warning { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }

.muted { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.right { text-align: right; }
.block { display: block; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-blue { color: var(--primary); }
.mb { margin-bottom: 12px; }

.upload-panel { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 14px; margin: 14px 0; }
.upload-panel h3 { font-size: 12.5px; margin-bottom: 10px; color: #334155; }
.upload-panel .filter-bar { margin-bottom: 0; }

.checklist { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fff; }
.checklist input { margin-top: 2px; }
.checklist input:checked + span { color: var(--green); font-weight: 600; }
.checklist input:disabled + span { color: var(--muted); }

.service-item { border: 1px solid var(--line); border-radius: 11px; padding: 4px 16px; margin-bottom: 10px; background: #fff; }
.service-item summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; padding: 12px 0; }
.service-item summary strong { font-size: 13.5px; }
.req-list { margin: 4px 0 16px; padding-left: 22px; color: #334155; }
.req-list li { margin-bottom: 4px; }

.faq { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 13px; }
.faq p { padding: 0 0 12px; color: var(--muted); font-size: 12.5px; }

.steps { margin: 0; padding-left: 20px; color: #334155; }
.steps li { margin-bottom: 7px; font-size: 12.5px; }
.result-box { margin-top: 18px; padding: 14px; background: var(--primary-50); border-radius: 11px; }
.result-box h3 { font-size: 13px; margin-bottom: 8px; color: var(--primary-600); }

.center-card { text-align: center; max-width: 520px; margin: 40px auto; }
.error-code { font-size: 56px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 10px; }
.center-card p { margin-bottom: 18px; color: var(--muted); }

/* ---------------------------------------------------------------- Login */
.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 10% 10%, #1e3a8a 0%, #0b1526 45%, #060c17 100%);
  padding: 24px;
}
.login-wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; width: 100%; max-width: 980px; align-items: center; }
.login-hero { color: #e2e8f0; padding: 10px 8px; }
.hero-badge {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: rgba(59, 130, 246, .2); color: #93c5fd; font-weight: 700;
  letter-spacing: 1px; font-size: 11px; margin-bottom: 16px;
}
.login-hero h1 { font-size: 32px; line-height: 1.15; color: #fff; margin-bottom: 14px; }
.login-hero p { color: #94a3b8; max-width: 440px; }
.hero-list { margin: 22px 0 0; padding-left: 20px; color: #cbd5e1; font-size: 13px; }
.hero-list li { margin-bottom: 7px; }
.login-card { background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 30px 60px rgba(2, 6, 23, .45); }
.login-card h2 { font-size: 21px; margin-bottom: 4px; }
.login-card .muted { margin-bottom: 18px; font-size: 12.5px; }
.demo-accounts { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.demo-accounts strong { display: block; margin-bottom: 8px; color: #334155; }
.demo-accounts > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.demo-accounts code { color: var(--primary-600); background: var(--primary-50); padding: 2px 7px; border-radius: 6px; }
.demo-accounts span { color: var(--muted); }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .overlay.show { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 35; }
  .login-wrap { grid-template-columns: 1fr; max-width: 520px; }
  .login-hero { display: none; }
  .user-meta { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 16px 14px 30px; }
  .topbar { padding: 0 14px; height: 66px; }
  .page-heading p { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
  .search-input { min-width: 0; flex: 1 1 100%; }
  .filter-bar > select, .filter-bar > input { flex: 1 1 45%; }
}
