:root {
  --ink: #172033;
  --ink-soft: #536174;
  --muted: #7a8797;
  --line: #dce3ea;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --surface-tint: #eef6f4;
  --primary: #1f4ea3;
  --primary-dark: #163b5f;
  --sea: #0f766e;
  --mint: #d9f4ec;
  --amber: #b7791f;
  --amber-soft: #fff4d7;
  --danger: #c24135;
  --danger-soft: #ffe7e3;
  --success: #15803d;
  --success-soft: #e3f7e8;
  --shadow: 0 18px 42px rgba(23, 32, 51, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(31, 78, 163, 0.09), rgba(15, 118, 110, 0.08)),
    radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.14), transparent 32%),
    var(--surface-soft);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body {
  overflow-x: hidden;
  min-height: 100%;
  margin: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  width: 100%;
  min-height: 100vh;
  grid-template-columns: 276px minmax(0, 1fr);
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  background: #12243a;
  color: #f7fbff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f5b84b, #22a699);
  color: #102032;
  font-weight: 800;
}

.sidebar .brand {
  align-self: stretch;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 10px;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #b8c7d8;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.bottom-item {
  border: 0;
  color: inherit;
}

.nav-item {
  width: 100%;
  padding: 12px 13px;
  border-radius: var(--radius);
  background: transparent;
  color: #dfe9f3;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  color: #b8c7d8;
  font-size: 0.86rem;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #9bded5;
  text-align: left;
}

.main-area {
  min-width: 0;
  max-width: 100vw;
  overflow-x: hidden;
  padding: 26px 28px 42px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--sea);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 2.4vw, 2.7rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.field.compact {
  min-width: 180px;
}

.field input,
.field select,
.field textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.signal-button {
  display: grid;
  min-width: 72px;
  min-height: 42px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 800;
}

.signal-button span:last-child {
  font-size: 0.72rem;
  font-weight: 700;
}

.view {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.panel,
.card,
.table-wrap {
  min-width: 0;
  border: 1px solid rgba(220, 227, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.card {
  padding: 15px;
}

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

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

.form-grid .wide {
  grid-column: 1 / -1;
}

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

.metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.38rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-tint);
  color: var(--sea);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button,
.button-secondary,
.button-danger,
.button-ghost {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 10px 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.button:hover {
  background: #173e82;
}

.button-secondary {
  border: 1px solid var(--sea);
  background: var(--sea);
  color: #ffffff;
}

.button-danger {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button-ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button:disabled,
.button-secondary:disabled,
.button-danger:disabled,
.button-ghost:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

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

.small {
  font-size: 0.84rem;
}

.empty-state {
  display: grid;
  min-height: 128px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.timeline {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.timeline li {
  border-left: 3px solid var(--sea);
  padding: 4px 0 4px 10px;
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 20;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 6px;
}

.bottom-item {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.bottom-item.is-active {
  background: var(--primary);
  color: #ffffff;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 360px;
  border-radius: var(--radius);
  background: #12243a;
  color: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

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

  .sidebar {
    display: none;
  }

  .main-area {
    padding: 20px 18px 94px;
  }

  .bottom-nav {
    display: grid;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main-area {
    width: 100vw;
    padding-inline: 12px;
  }

  .panel,
  .card,
  .table-wrap {
    max-width: calc(100vw - 24px);
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .field.compact {
    min-width: 0;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    display: grid;
  }

  .form-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .actions .button,
  .actions .button-secondary,
  .actions .button-danger,
  .actions .button-ghost {
    flex: 1 1 100%;
  }
}
