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

:root {
  --sidebar-w: 268px;
  --navy: #081529;
  --navy-2: #102445;
  --ink: #122033;
  --muted: #5b6b7c;
  --line: #e4e8ee;
  --paper: #f3f1ec;
  --card: #ffffff;
  --gold: #b8893a;
  --teal: #0f766e;
  --blue: #1d4f91;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(8, 21, 41, .07);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body.app-body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
h1, h2, h3, .brand-serif { font-family: 'IBM Plex Serif', serif; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1030;
  box-shadow: 8px 0 30px rgba(8, 21, 41, .18);
}
.sidebar .brand {
  padding: 1.35rem 1.2rem 1.15rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #e2c48a);
  color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.sidebar .brand small { display: block; color: #9aa8b8; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; margin-top: .2rem; }
.sidebar .nav-link {
  color: #b7c3d3;
  border-radius: 10px;
  margin: .12rem .7rem;
  padding: .52rem .8rem;
  font-size: .9rem;
  font-weight: 500;
}
.sidebar .nav-link i { width: 1.25rem; display: inline-block; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(184,137,58,.28), rgba(184,137,58,.08));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar .nav-section {
  color: #7d8c9e;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: 1rem 1.2rem .25rem;
}
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: .7rem 1.5rem;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.15rem; font-weight: 600; margin: 0; }
.search-box {
  background: #f4f6f8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .9rem;
  min-width: 280px;
  display: flex; align-items: center; gap: .45rem;
}
.search-box input { border: 0; background: transparent; outline: none; width: 100%; font-size: .9rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 600;
}
.page { padding: 1.4rem 1.6rem 2.4rem; }
.page-hero {
  background: linear-gradient(120deg, var(--navy) 0%, #16345f 55%, #1b5c58 140%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute; right: -40px; top: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(184,137,58,.18);
}
.page-hero h2 { font-size: 1.45rem; margin: 0 0 .2rem; }
.page-hero p { margin: 0; color: #c9d4e3; font-size: .92rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-top: 1rem; position: relative; z-index: 1; }
.quick-link {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff; text-decoration: none;
  border-radius: 12px; padding: .7rem .8rem;
  font-size: .85rem; font-weight: 500;
}
.quick-link:hover { background: rgba(255,255,255,.18); color: #fff; }
.quick-link span { display: block; font-size: .72rem; color: #d5deea; font-weight: 400; }
.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--gold);
}
.kpi.teal::before { background: var(--teal); }
.kpi.blue::before { background: var(--blue); }
.kpi.alert::before { background: var(--danger); }
.kpi .ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: #f4efe6; color: var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.kpi .label { color: var(--muted); font-size: .78rem; font-weight: 500; letter-spacing: .02em; }
.kpi .value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.card-soft {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card-soft .card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1.1rem .2rem;
  font-weight: 600;
}
.table { font-size: .92rem; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; background: #faf9f6;
  border-bottom: 1px solid var(--line) !important;
}
.table td, .table th { vertical-align: middle; padding: .7rem .85rem; }
.table tbody tr:hover { background: #fbfaf7; }
.badge { font-weight: 500; letter-spacing: .02em; text-transform: capitalize; border-radius: 999px; padding: .35em .7em; }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover { background: #0d2344; border-color: #0d2344; }
.btn-outline-secondary { border-color: #cfd6de; color: var(--ink); }
.form-control, .form-select {
  border-color: #d5dce4; border-radius: 10px; padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(184,137,58,.18);
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.nav-pills .nav-link {
  color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: .35rem .85rem; font-size: .82rem; font-weight: 500;
}
.nav-pills .nav-link.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.alert { border-radius: 12px; border: 0; }
.login-wrap {
  min-height: 100vh;
  background: var(--navy);
  font-family: 'IBM Plex Sans', sans-serif;
}
.login-split { min-height: 100vh; }
.login-brand {
  background: linear-gradient(160deg, #081529 0%, #123056 50%, #0f4a46 120%);
  color: #fff; padding: 3.5rem;
  display: flex; flex-direction: column; justify-content: center;
}
.login-brand h1 { font-family: 'IBM Plex Serif', serif; font-size: 2.4rem; }
.login-facts { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.login-facts li { padding: .45rem 0; color: #c5d0de; }
.login-facts i { color: var(--gold); margin-right: .5rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.link-quiet { color: var(--blue); text-decoration: none; font-weight: 500; font-size: .85rem; }
.link-quiet:hover { text-decoration: underline; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .65rem 1.2rem; }
.detail-grid .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.detail-grid .v { font-weight: 600; }
.wizard-steps {
  display: flex; gap: .5rem; flex-wrap: wrap;
}
.wizard-step {
  display: flex; align-items: center; gap: .45rem;
  padding: .45rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}
.wizard-step .num {
  width: 1.4rem; height: 1.4rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e8eef5; color: var(--navy); font-size: .75rem; font-weight: 700;
}
.wizard-step.active {
  border-color: var(--navy); color: var(--navy); background: #eef3f9;
}
.wizard-step.active .num { background: var(--navy); color: #fff; }
.wizard-step.done {
  border-color: #0f766e; color: #0f766e;
}
.wizard-step.done .num { background: #0f766e; color: #fff; }
button.wizard-step-btn {
  cursor: pointer;
  font: inherit;
  font-size: .82rem;
  font-weight: 500;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}
button.wizard-step-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: #f3f6fb;
}
button.wizard-step-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.password-field {
  position: relative;
}
.password-field .form-control {
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: .4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.password-toggle:hover { color: var(--navy); background: #eef2f7; }
.password-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.report-actions .btn {
  min-width: 6.5rem;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}
.report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.report-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.report-table th.sortable .sort-ico {
  opacity: .35;
  font-size: .75rem;
  margin-left: .25rem;
}
.report-table th.sortable.sort-asc .sort-ico,
.report-table th.sortable.sort-desc .sort-ico { opacity: 1; color: var(--navy); }
.report-table .filter-row th {
  background: #f7f9fc;
  font-weight: 400;
  vertical-align: middle;
  padding-top: .35rem;
  padding-bottom: .35rem;
}
.report-table .filter-row .form-control {
  min-width: 4.5rem;
  font-size: .78rem;
}
.print-only { display: none; }
.print-masthead {
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid #ccc;
}

.wizard-errors {
  background: #fef3f2;
  border: 1px solid #f5c2c0;
  border-left: 4px solid #b42318;
  border-radius: .5rem;
  padding: .85rem 1rem;
  color: #b42318;
}
.wizard-errors-title {
  font-weight: 650;
  margin-bottom: .35rem;
}
.wizard-errors ul {
  margin: 0;
  padding-left: 1.15rem;
}
.wizard-errors li { margin: .15rem 0; }
.wizard-missing {
  color: #b42318 !important;
}
.wizard-missing .text-muted { color: #b42318 !important; opacity: .85; }
@media print {
  .sidebar, .topbar, .no-print, .page-hero .quick-grid { display: none !important; }
  .main { margin: 0 !important; width: 100% !important; }
  .page { padding: 0 !important; overflow: visible !important; }
  body, html, .app-body, .main, .page, .report-sheet, .report-table-wrap, .card, .card-soft {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }
  .report-table-wrap {
    overflow: visible !important;
    width: 100% !important;
  }
  .report-sheet {
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .print-only, .print-masthead { display: flex !important; }
  .report-table {
    width: 100% !important;
    table-layout: auto;
    font-size: 11px;
  }
  .report-table th, .report-table td {
    white-space: normal !important;
    word-break: break-word;
    padding: .25rem .35rem !important;
    border-color: #999 !important;
  }
  a[href]::after { content: none !important; }
}
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.show { transform: none; }
  .main { margin-left: 0; }
  .search-box { min-width: 0; width: 100%; }
}
