:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #101827;
  --muted: #667085;
  --line: #e1dfd6;
  --nav: #050807;
  --brand-blue: #1a2f50;
  --brand-gold: #d6b536;
  --accent: var(--brand-blue);
  --accent-2: var(--brand-gold);
  --success: #27476f;
  --warning: #8a6b14;
  --orange: #8a6b14;
  --red: #b42318;
  --blue: var(--brand-blue);
  --shadow: 0 14px 40px rgba(26, 47, 80, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.muted {
  color: var(--muted);
}

.login-form,
.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand-blue);
  color: #fff;
  padding: 10px 13px;
  font-weight: 750;
}

.ghost-button {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.form-error {
  min-height: 20px;
  color: var(--red);
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #020403 0%, #0f1622 100%);
  color: #f3f7f5;
  padding: 22px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
}

.brand-block {
  display: block;
  min-width: 0;
}

.brand-logo {
  width: 100%;
  max-width: 184px;
  height: auto;
  display: block;
}

.brand-mark {
  width: 40px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #dfe9e5;
  color: var(--nav);
  font-weight: 850;
}

.brand-block span:last-child,
.sidebar-footer span {
  display: block;
  color: #aebbb5;
  font-size: 13px;
}

nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d6dbe4;
  border: 1px solid transparent;
}

.nav-button.active {
  background: rgba(214, 181, 54, 0.1);
  border-color: rgba(214, 181, 54, 0.45);
  color: #fff;
  box-shadow: inset 4px 0 0 var(--brand-gold);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.main-panel {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.controls {
  display: flex;
  align-items: end;
  gap: 12px;
  min-width: min(520px, 100%);
}

.section-grid {
  display: grid;
  gap: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(15, 31, 27, 0.03);
  padding: 18px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 112px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  font-size: 26px;
  line-height: 1.1;
}

.metric small {
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 16px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td.wrap {
  white-space: normal;
  min-width: 240px;
}

.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green {
  background: #e8edf6;
  color: var(--brand-blue);
}

.badge.orange {
  background: #fff4cf;
  color: var(--warning);
}

.badge.red,
.badge.critical {
  background: #ffe5e2;
  color: var(--red);
}

.badge.blue,
.badge.asked,
.badge.pending_approval {
  background: #e8edf6;
  color: var(--brand-blue);
}

.badge.open {
  background: #fff4cf;
  color: var(--warning);
}

.badge.answered {
  background: #e8edf6;
  color: var(--brand-blue);
}

.badge.processed,
.badge.final,
.badge.completed {
  background: #eef1f7;
  color: var(--brand-blue);
}

.badge.draft,
.badge.mocked,
.badge.fallback {
  background: #fff4cf;
  color: var(--warning);
}

.badge.approved {
  background: #e8edf6;
  color: var(--brand-blue);
}

.badge.rejected {
  background: #ffe5e2;
  color: var(--red);
}

.badge.normal,
.badge.high {
  background: #fff4cf;
  color: var(--warning);
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: #eaedf2;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-gold));
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  display: grid;
  gap: 12px;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.review-actions button {
  background: #eef1f7;
  color: var(--brand-blue);
}

.review-actions button.active {
  background: var(--brand-blue);
  color: white;
}

.review-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.booking-form {
  grid-template-columns: 140px minmax(260px, 1.2fr) minmax(180px, 0.7fr) minmax(220px, 1fr) 120px 120px 170px;
}

.amount-input {
  max-width: 130px;
}

.subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 12px;
}

.download-list,
.client-list {
  display: grid;
  gap: 10px;
}

.download-link,
.client-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.suggestion-row {
  align-items: flex-start;
}

.suggestion-row > div:first-child {
  min-width: 0;
  flex: 1 1 360px;
}

.suggestion-row .review-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.download-link a {
  color: var(--brand-blue);
  font-weight: 800;
  text-decoration: none;
}

.empty {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar,
  .controls {
    display: grid;
    align-items: stretch;
  }

  .kpi-grid,
  .two-col,
  .three-col,
  .review-layout,
  .booking-form,
  .subgrid,
  .insight-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .table-wrap table {
    min-width: 760px;
  }
}

@media (max-width: 560px) {
  .main-panel,
  .sidebar,
  .login-panel {
    padding: 18px;
  }

  nav {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .brand-logo {
    width: 150px;
  }

  .download-link,
  .client-row,
  .review-head {
    align-items: stretch;
    flex-direction: column;
  }

  th,
  td {
    padding: 9px 7px;
  }
}
