:root {
  --bg: #edf2f7;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e0ea;
  --panel: #ffffff;
  --soft: #f8fafc;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #d97706;
  --danger: #b91c1c;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --shadow: 0 18px 40px rgba(15, 23, 42, .12);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #0f172a 0%, #111827 46%, #0f766e 100%);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-lockup.compact {
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--brand);
  font-weight: 900;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 20px;
}

.brand-lockup p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, .14);
  border-color: var(--brand);
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: .6;
  cursor: wait;
}

.primary {
  color: #ffffff;
  background: var(--brand);
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary,
.ghost {
  color: var(--ink);
  background: #e2e8f0;
}

.ghost {
  width: 100%;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--sidebar);
  color: #ffffff;
  overflow: auto;
}

.sidebar .brand-lockup h1 {
  color: #ffffff;
  font-size: 17px;
}

.sidebar .brand-lockup p {
  color: #cbd5e1;
}

.main-nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  text-align: left;
  color: #cbd5e1;
  background: transparent;
}

.nav-button.active,
.nav-button:hover {
  color: #ffffff;
  background: var(--sidebar-soft);
}

#logout-button {
  margin-top: 14px;
}

.module-help {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(203, 213, 225, .14);
  border-radius: 8px;
  background: rgba(15, 23, 42, .58);
  color: #dbeafe;
}

.help-eyebrow {
  color: #5eead4;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-help h2 {
  margin: 6px 0 8px;
  color: #ffffff;
  font-size: 17px;
}

.module-help p {
  margin: 0;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}

.help-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(203, 213, 225, .12);
}

.help-block h3 {
  margin: 0 0 5px;
  color: #f8fafc;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 23px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.summary-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.summary-card {
  padding: 15px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 21px;
  overflow-wrap: anywhere;
}

.panel {
  padding: 15px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.inline-form,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.inline-form.wide {
  grid-template-columns: repeat(7, minmax(145px, 1fr));
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

th[title],
input[title],
select[title],
button[title],
.summary-card[title],
.list-row[title] {
  cursor: help;
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--brand-dark);
  background: #ccfbf1;
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: #111827;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.show {
  display: block;
}

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

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

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

  .summary-grid,
  .split-grid,
  .inline-form,
  .inline-form.wide,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .main-nav,
  .summary-grid,
  .split-grid,
  .inline-form,
  .inline-form.wide,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
