:root {
  --bg: #f4f8f6;
  --surface: #ffffff;
  --surface-alt: #eef5f2;
  --text: #12231d;
  --muted: #60736b;
  --line: #d6e0dc;
  --primary: #006950;
  --primary-dark: #064e3b;
  --accent: #2f80ed;
  --warning: #b66a08;
  --danger: #c13d38;
  --success: #238653;
  --shadow: 0 14px 40px rgba(7, 62, 49, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #e8f5f0 0%, #f8fbfa 48%, #eef3fa 100%);
}

.login-panel {
  width: min(460px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-block,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  background: var(--primary-dark);
  color: white;
  border-radius: 8px;
  font-weight: 800;
}

.logo-mark.small {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 18px;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

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

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 105, 80, 0.12);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.primary-btn {
  min-height: 44px;
  padding: 0 18px;
  background: var(--primary);
  color: white;
}

.secondary-btn {
  min-height: 40px;
  padding: 0 14px;
  background: var(--surface-alt);
  color: var(--primary-dark);
  border: 1px solid var(--line);
}

.ghost-btn {
  min-height: 40px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.compact {
  min-height: 38px;
}

.error-text {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  background: #0f2f27;
  color: white;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  color: #a8c7bc;
  font-size: 13px;
}

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

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  color: #dcebe6;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar .ghost-btn {
  margin-top: auto;
  color: white;
  border-color: rgba(255, 255, 255, 0.18);
}

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

.topbar,
.toolbar,
.panel-head,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.view-stack {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

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

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

.metric-card {
  padding: 18px;
}

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

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.metric-card.alert strong {
  color: var(--danger);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.bar-list,
.activity-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 160px minmax(80px, 1fr) 42px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: 4px;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
}

.activity-item {
  padding: 12px;
  background: var(--surface-alt);
  border-radius: 6px;
}

.activity-item strong {
  display: block;
  margin-bottom: 5px;
}

.activity-item span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.toolbar.wrap {
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
}

.toolbar select {
  max-width: 240px;
}

.table-panel {
  overflow-x: auto;
  padding: 0;
}

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

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

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

td {
  font-size: 14px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.chip.danger {
  color: var(--danger);
  background: rgba(193, 61, 56, 0.1);
}

.chip.success {
  color: var(--success);
  background: rgba(35, 134, 83, 0.1);
}

.link-btn {
  min-height: 32px;
  padding: 0 10px;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
}

.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(8, 24, 19, 0.24);
}

.modal.wide {
  width: min(920px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(8, 24, 19, 0.42);
}

.modal-body {
  display: grid;
  gap: 15px;
  padding: 22px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  font-size: 22px;
  background: var(--surface-alt);
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

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

.detail-box {
  padding: 14px;
  background: var(--surface-alt);
  border-radius: 8px;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.proof-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.proof-tile {
  display: grid;
  min-height: 90px;
  place-items: center;
  padding: 10px;
  color: var(--primary);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.status-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.status-form .error-text {
  grid-column: 1 / -1;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .sidebar .ghost-btn {
    margin-top: 0;
    margin-left: auto;
  }

  .metric-grid,
  .two-column,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

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

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

  .metric-card strong {
    font-size: 28px;
  }

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