:root {
  --ink: #17211f;
  --muted: #64706d;
  --line: #dce4df;
  --panel: #ffffff;
  --field: #f7f9f5;
  --background: #eef3ee;
  --brand: #176b52;
  --brand-strong: #0f4a3a;
  --accent: #c6512f;
  --gold: #b68a24;
  --blue: #2f6f9f;
  --danger: #a83d39;
  --shadow: 0 18px 50px rgba(34, 47, 42, 0.12);
}

.control-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 20px; }
.control-tabs button { flex: 0 0 auto; padding: 12px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); }
.control-tabs button[aria-selected="true"] { border-bottom-color: var(--brand); color: var(--ink); font-weight: 700; }
.control-tabs button[aria-pressed="true"] { border-bottom-color: var(--brand); color: var(--ink); font-weight: 700; }
.work-toolbar { display: flex; align-items: start; flex-wrap: wrap; gap: 12px; }
.work-toolbar input { flex: 1 1 220px; max-width: 360px; }
[hidden] { display: none !important; }
#access label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
#access label > input:not([type="checkbox"]), #access label > select { width: 100%; }
#access input[type="checkbox"] { width: 18px; height: 18px; padding: 0; flex: 0 0 18px; }
#access fieldset { min-width: 0; border: 1px solid var(--line); padding: 16px; }
.access-projects { display: flex; flex-wrap: wrap; gap: 16px; }
#access-result input { width: 100%; }
.register-heading { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-top: 24px; }
.register-heading span { color: var(--muted); }
.control-entry { border-bottom: 1px solid var(--line); padding: 12px 0 20px; }
.control-entry summary { cursor: pointer; font-weight: 700; margin-bottom: 16px; }
.control-entry label { display: grid; gap: 6px; font-size: 0.9rem; }
.control-entry input, .control-entry textarea { min-width: 0; }
td details { margin-top: 8px; font-size: 0.85rem; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  min-width: 0;
  background: #10251f;
  color: #f5fbf7;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #f2c15d;
  color: #10251f;
  border-radius: 8px;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.brand span,
.eyebrow,
.project-switcher label,
.muted {
  color: var(--muted);
}

.brand span {
  color: #b9c9c2;
  font-size: 0.82rem;
}

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

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dbe8e2;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
}

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

.icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #f2c15d;
  font-weight: 800;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1;
}

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

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

.project-switcher {
  min-width: 230px;
  display: grid;
  gap: 6px;
}

.user-chip {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  box-shadow: var(--shadow);
}

.user-chip span {
  font-weight: 800;
}

.user-chip strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.project-switcher label {
  font-size: 0.82rem;
  font-weight: 700;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

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

select:focus,
input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.14);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.table-wrap,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 112px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

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

.metric strong {
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

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

.health-panel {
  margin-top: 18px;
}

.panel {
  padding: 18px;
}

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

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

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

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

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  font-weight: 800;
}

.btn:hover {
  background: var(--brand-strong);
}

.btn.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.btn.danger {
  background: var(--danger);
}

.table-wrap {
  overflow: auto;
}

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

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

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

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e7efe9;
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 0.78rem;
  white-space: nowrap;
}

.pill.warning {
  background: #fbefd0;
  color: #7c5b0e;
}

.pill.alert {
  background: #f7dedb;
  color: var(--danger);
}

.pill.info {
  background: #dfeaf2;
  color: #214d72;
}

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

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfa;
}

.list-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.list-item p {
  color: var(--muted);
  margin-bottom: 0;
}

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

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}

.empty-state {
  padding: 26px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

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

.small-action {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
  padding: 0;
}

.small-action.secondary {
  color: var(--brand);
}

.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.permission-strip,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.permission-strip strong {
  color: var(--brand);
}

.permission-strip span {
  color: var(--muted);
}

.notice.alert {
  border-color: #e8b2ad;
  background: #fff1ef;
  color: var(--danger);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(rgba(16, 37, 31, 0.78), rgba(16, 37, 31, 0.78)),
    url("https://images.unsplash.com/photo-1541888946425-d81bb19240f5?auto=format&fit=crop&w=1600&q=80") center / cover;
}

.auth-panel {
  width: min(100%, 440px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.96);
  padding: 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.auth-panel h1 {
  margin-top: 24px;
  font-size: 2.5rem;
}

.auth-brand span {
  color: var(--muted);
}

.demo-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.demo-users button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-weight: 800;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
  }

  .main {
    padding: 20px;
  }

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

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

@media (max-width: 620px) {
  .main {
    padding: 16px;
  }

  .metrics,
  .grid-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .project-switcher {
    min-width: 0;
  }

  .user-chip {
    min-width: 0;
  }

  .brand span,
  .nav-item span:last-child {
    display: none;
  }
}
