:root {
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #ccfbf1;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-muted: #f8faf9;
  --text: #17211f;
  --muted: #65716f;
  --line: #d8e1df;
  --sidebar: #17211f;
  --sidebar-soft: #20302d;
  --ok-bg: #dcfce7;
  --ok-fg: #166534;
  --warn-bg: #fef3c7;
  --warn-fg: #92400e;
  --danger-bg: #fee2e2;
  --danger-fg: #991b1b;
  --info-bg: #dbeafe;
  --info-fg: #1e40af;
  --neutral-bg: #e7ecea;
  --neutral-fg: #34403d;
  --shadow: 0 18px 48px rgba(23, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(244, 246, 245, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  overflow-y: auto;
  background: var(--sidebar);
  color: #eef5f3;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f766e, #38bdf8);
  color: #ffffff;
  font-weight: 850;
  letter-spacing: 0;
}

.brand strong,
.workspace-card strong {
  display: block;
  font-size: 16px;
}

.brand small,
.workspace-card small,
.sidebar-foot small {
  display: block;
  color: #a9b8b5;
  font-size: 12px;
  line-height: 1.45;
}

.workspace-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--sidebar-soft);
}

.workspace-label,
.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#nav {
  display: grid;
  gap: 3px;
}

#nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: #d7e1df;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
}

#nav a span {
  color: #7f918d;
  width: 22px;
  font-size: 11px;
  font-weight: 800;
}

#nav a:hover {
  background: rgba(255, 255, 255, 0.07);
}

#nav a.active {
  background: #f7faf9;
  color: #10201d;
}

#nav a.active span {
  color: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

main {
  width: 100%;
  max-width: 1480px;
  padding: 22px 30px 34px;
}

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

.topbar h1 {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.1;
}

.topbar-actions,
.hero-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-chip.ok {
  border-color: #86efac;
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.status-chip.danger {
  border-color: #fca5a5;
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-text,
.hero-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-text {
  padding: 20px 22px;
}

.hero-text h2 {
  margin: 4px 0 6px;
  max-width: 860px;
  font-size: 25px;
  line-height: 1.18;
}

.hero-text p {
  margin: 0;
  max-width: 940px;
  color: var(--muted);
}

.hero-panel {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 18px;
  border-color: rgba(15, 118, 110, 0.24);
  background: linear-gradient(180deg, #ffffff, #ecfdf5);
}

.hero-panel strong {
  font-size: 15px;
}

.hero-panel span {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.pill.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.pill.info {
  background: var(--info-bg);
  color: var(--info-fg);
}

#view-root {
  display: grid;
  gap: 16px;
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.view-head h2 {
  margin: 0;
  font-size: 21px;
}

.view-head p {
  margin: 4px 0 0;
  max-width: 820px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 13px;
}

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

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(23, 33, 31, 0.05);
}

.card.stat {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.card.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.card.stat .stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card.stat .stat-value {
  font-size: 29px;
  font-weight: 850;
  letter-spacing: 0;
}

.card h3 {
  margin: 0 0 11px;
  font-size: 15px;
}

.card.warn-bg {
  background: #fffbeb;
  border-color: #facc15;
}

.card.danger-bg {
  background: #fef2f2;
  border-color: #fca5a5;
}

.card.ok-bg {
  background: #f0fdf4;
  border-color: #86efac;
}

ul.bare {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

ul.bare li {
  padding: 9px 10px;
  border: 1px solid #e8eeee;
  border-radius: 7px;
  background: var(--surface-muted);
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

th {
  background: #edf4f2;
  color: #4d5d59;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 750;
}

.field small,
.subline {
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 11px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-strong);
}

button.secondary {
  border-color: var(--line);
  background: white;
  color: var(--text);
}

button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

button.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.row-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.row-card span.subline {
  display: block;
  margin-top: 2px;
}

.alert {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
}

.alert.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: #f59e0b;
}

.alert.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: #ef4444;
}

.alert.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border-color: #65a30d;
}

.alert.info {
  background: var(--info-bg);
  color: var(--info-fg);
  border-color: #38bdf8;
}

.auth-locked #nav,
.auth-locked .hero {
  display: none;
}

.auth-locked .sidebar-foot {
  margin-top: 0;
}

.login-panel {
  max-width: 760px;
  margin: 42px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 28px;
  background: linear-gradient(180deg, #f8faf9, #ecfdf5);
}

.login-copy h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  padding: 28px;
  align-content: center;
}

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

.status-strip .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f8f7;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.status-strip .step.done {
  border-color: #86efac;
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.status-strip .step.current {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.done {
  background: #16a34a;
}

.status-dot.current {
  background: white;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.error-banner {
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger-fg);
  margin-bottom: 12px;
  padding: 14px 16px;
}

.kbd {
  border-radius: 4px;
  background: var(--sidebar);
  color: white;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .hero {
    grid-template-columns: 1fr;
  }

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

  .login-panel {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form .row {
    grid-template-columns: 1fr;
  }
}
