:root {
  --green: #237a4b;
  --ink: #202522;
  --muted: #68716b;
  --line: #e1e5e1;
  --bg: #f4f6f4;
  --surface: #ffffff;
  --amber: #e6a536;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  border-right: 1px solid rgba(232, 236, 239, 0.9);
  background: rgba(255, 255, 255, 0.82);
  overflow-y: auto;
}

.nav-label {
  display: block;
  margin: 22px 14px 8px;
  color: #98a09b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
}

.brand strong {
  font-size: 22px;
}

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

.nav {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 14px;
  border-radius: 12px;
  background: transparent;
  color: #596273;
  text-align: left;
  font-weight: 700;
}

.nav.active {
  background: #eafaf2;
  color: #13844f;
}

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

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

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

h1 {
  margin-bottom: 6px;
}

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

.actions {
  display: flex;
  gap: 10px;
}

.actions button,
.primary {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.secondary {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #334155;
  font-weight: 760;
}

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

.card,
.panel {
  padding: 16px;
  border: 1px solid rgba(232, 236, 239, 0.92);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.metric {
  display: grid;
  gap: 4px;
}

.metric strong {
  font-size: 30px;
}

.followup {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.followup:last-child {
  border-bottom: 0;
}

.followup p {
  margin: 4px 0 0;
}

.followup-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.followup span {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff2d8;
  color: #9a5b00;
  font-size: 12px;
  font-weight: 800;
}

.followup.red span {
  background: #ffe5e2;
  color: #b42318;
}

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

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

.field label {
  color: #455064;
  font-size: 13px;
  font-weight: 760;
}

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

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

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

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
}

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

.table th {
  color: #4b5565;
  background: #f7faf9;
}

.pill {
  display: inline-flex;
  margin: 0 6px 6px 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eafaf2;
  color: #13844f;
  font-size: 12px;
  font-weight: 760;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #20242d;
  color: #fff;
}

.login-mode { display: block; background: #eef1ee; }
.login-mode .sidebar, .login-mode .topbar { display: none; }
.login-mode .main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(31, 37, 34, .10); }
.login-card h1 { margin: 22px 0 8px; }
.login-card label { display: grid; gap: 8px; margin-top: 28px; color: #455049; font-size: 13px; font-weight: 700; }
.login-card input { min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; }
.login-card .primary { width: 100%; margin-top: 18px; }
.brand-mark { display: inline-flex; padding: 8px 11px; border-radius: 8px; background: #202522; color: #fff; font-weight: 800; }
.form-error { margin-top: 12px; color: var(--red); font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: 12px 0 6px; font-size: 30px; }
.metric-card.danger { border-left: 4px solid var(--red); }
.panel { margin-top: 16px; padding: 20px; overflow: hidden; }
.panel-head, .publish-bar, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2, .panel-head p { margin-bottom: 4px; }
.panel button, .toolbar button, .publish-bar button, .back-button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #334039; font-weight: 700; }
.panel button.primary, .toolbar button.primary, .publish-bar button.primary { border-color: #202522; background: #202522; color: #fff; }
.followup-row { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.followup-row:last-child { border-bottom: 0; }
.followup-row strong, .followup-row span { display: block; }
.followup-row p { margin: 6px 0 0; }
.followup-row.red { border-left: 3px solid var(--red); padding-left: 14px; }
.row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.risk-badge, .status { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 6px; background: #edf1ed; color: #536058; font-size: 12px; font-weight: 700; }
.status.red, .followup-row.red .risk-badge { background: #fde8e5; color: var(--red); }
.status.yellow, .followup-row.yellow .risk-badge { background: #fff1d5; color: #8a5908; }
.status.green { background: #e8f6ed; color: #237a4b; }
.tag { display: inline-flex; width: fit-content; margin: 2px 4px 2px 0; padding: 4px 7px; border-radius: 6px; background: #edf1ed; color: #536058; font-size: 11px; }
.toolbar { justify-content: flex-start; margin-bottom: 14px; }
.toolbar input { width: min(420px, 100%); min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.table-panel { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { background: #f7f8f7; color: #59635d; font-weight: 700; }
td strong, td span { display: block; }
td span { margin-top: 3px; color: var(--muted); }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.detail-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
.profile-panel { padding: 24px; border-radius: 12px; background: #202522; color: #fff; }
.profile-panel p { color: #cbd2cd; }
.profile-panel label { display: grid; gap: 6px; margin-top: 14px; color: #cbd2cd; font-size: 12px; font-weight: 700; }
.profile-panel input, .profile-panel select { min-height: 40px; padding: 0 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; }
.profile-panel select option { color: #202522; }
.profile-save { width: 100%; min-height: 40px; margin-top: 16px; border-radius: 8px; background: #e6b254; color: #202522; font-weight: 800; }
.eyebrow { color: #e6b254; font-size: 12px; font-weight: 800; }
.profile-panel dl { margin-top: 28px; }
.profile-panel dl div { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.12); }
.profile-panel dt { color: #9fa9a2; font-size: 12px; }.profile-panel dd { margin: 4px 0 0; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 26px; }
.summary-grid div { padding: 16px; border-radius: 10px; background: #f4f6f4; }.summary-grid strong, .summary-grid span { display: block; }.summary-grid strong { font-size: 24px; }
.timeline > div { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }.timeline time { color: var(--muted); font-size: 12px; }
.back-button { margin-bottom: 14px; }
.no-top { margin-top: 0; }
.membership-editor { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border-radius: 10px; background: #f7f8f7; }
.membership-editor strong, .membership-editor span { display: block; }.membership-editor span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.publish-bar { position: sticky; top: 12px; z-index: 4; padding: 14px 16px; border-radius: 10px; background: #202522; color: #fff; }.publish-bar div { margin-right: auto; }.publish-bar span { display: block; margin-top: 3px; color: #abb5ae; font-size: 12px; }
.config-tabs { display: flex; gap: 6px; margin-top: 14px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.config-tabs button { min-height: 36px; padding: 0 14px; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 700; }.config-tabs button.active { background: #eef1ee; color: var(--ink); }
.config-section { display: none; }.config-section.active { display: block; }.config-section h2 { margin-bottom: 14px; }
.config-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }.config-row.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.config-row label { display: grid; gap: 6px; color: #4e5952; font-size: 12px; font-weight: 700; }.config-row input, .config-row textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-weight: 400; }.config-row textarea { min-height: 66px; resize: vertical; }
.config-row label:has([data-lines]) { grid-column: 1 / -1; }
.version-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-top: 1px solid var(--line); }
code { padding: 4px 7px; border-radius: 5px; background: #eef1ee; }
.two-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.compact-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 36px; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.bar-row > div { height: 8px; overflow: hidden; border-radius: 99px; background: #edf0ed; }.bar-row i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.list-row, .check-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; border-top: 1px solid var(--line); }
.list-row span, .check-row span { color: #4f5953; }.section-gap { margin-top: 28px; }.check-row .ok { color: var(--green); }.check-row .warning { color: #9a5b00; }.system-action { margin-top: 18px; }
.table-input { width: 110px; min-height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }

.modal-mask { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(26, 31, 28, .48); }
.modal-mask[hidden] { display: none; }
.dialog { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(20, 25, 22, .22); }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }.dialog-head h2 { margin: 0; }.dialog-head button { background: transparent; color: var(--muted); }
.dialog-body { padding: 20px; }.dialog-body p { margin-bottom: 0; line-height: 1.65; }.dialog-body li { margin: 8px 0; color: #4f5953; }
.dialog-actions { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }.dialog-actions button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 750; }.dialog-actions .primary { border-color: var(--green); background: var(--green); color: #fff; }.dialog-actions .danger-button { border-color: var(--red); background: var(--red); }
.dialog-field { display: grid; gap: 7px; color: #4f5953; font-size: 13px; font-weight: 700; }.dialog-field + .dialog-field { margin-top: 14px; }.dialog-field input, .dialog-field select, .dialog-field textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; }.dialog-field textarea { min-height: 110px; resize: vertical; }

/* V0.7 compact blue operations theme */
:root { --green: #1769ff; --ink: #172033; --muted: #7b879d; --line: #e3eaf4; --bg: #f3f7fc; }
body { grid-template-columns: 216px 1fr; background: var(--bg); }
.sidebar { padding: 22px 14px; border-right: 1px solid var(--line); background: #fff; }
.brand strong { font-size: 19px; }
.nav-label { margin: 18px 12px 6px; color: #9ba8bb; }
.nav { min-height: 36px; margin-bottom: 4px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.nav.active { color: #1769ff; background: #eaf2ff; box-shadow: inset 3px 0 #1769ff; }
.main { padding: 22px 28px 56px; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
.actions button, .primary { min-height: 34px; border-radius: 6px; background: #1769ff; }
.card, .panel, .metric-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.panel { margin-top: 14px; padding: 16px; }
.metric-card { padding: 14px 16px; }
.metric-card strong { margin: 8px 0 4px; font-size: 24px; }
.panel button.primary, .toolbar button.primary, .publish-bar button.primary { border-color: #1769ff; background: #1769ff; color: #fff; }
.toolbar input, .toolbar select, .table-input { border-color: var(--line); border-radius: 6px; background: #fff; }
th, td { padding: 10px 12px; font-size: 12px; }
th { color: #60708a; background: #f7faff; }
.profile-panel { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.profile-panel p, .profile-panel label { color: var(--muted); }
.profile-panel input, .profile-panel select { border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.profile-panel dl div { border-color: var(--line); }
.profile-save { border-radius: 6px; background: #1769ff; color: #fff; }
.eyebrow { color: #1769ff; }
.summary-grid div, .membership-editor { background: #f7faff; }
.publish-bar { padding: 12px 14px; border: 1px solid #cfe0ff; border-radius: 8px; background: #edf4ff; color: #174ea6; }
.publish-bar span { color: #60708a; }
.config-tabs, .dialog, .login-card { border-radius: 8px; }
.bar-row i { background: #1769ff; }
.status.green { color: #16875d; background: #e8f8f1; }
.toast { border-radius: 8px; }

@media (max-width: 1000px) {
  body { grid-template-columns: 200px 1fr; }
  .main { padding: 22px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .two-panel { grid-template-columns: 1fr; }
}
