:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2430;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #156b5f;
  --brand-dark: #0f5148;
  --accent: #b84d2a;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(20, 30, 45, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--brand); text-decoration: none; font-weight: 650; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 750; letter-spacing: 0; }
h2 { font-size: 18px; line-height: 1.2; letter-spacing: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 18px clamp(18px, 4vw, 44px) 0;
}

.stats-row div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}

.stats-row strong { font-size: 25px; line-height: 1; }
.stats-row span, small { color: var(--muted); }

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 44px) 18px;
}

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

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

.panel, .wide-panel { padding: 22px; }
.wide-panel { margin: 0 clamp(18px, 4vw, 44px) 32px; }

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

.section-head span, .muted { color: var(--muted); }
.stack { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; }

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(240px, 1.3fr) minmax(180px, 1fr) 120px 120px;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 650;
  min-width: 0;
}

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d0dc;
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input:focus, select:focus {
  outline: 3px solid rgba(21, 107, 95, .15);
  border-color: var(--brand);
}

button, .ghost {
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 10px 15px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.primary { background: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-dark); }
.secondary { background: #eef5f3; color: var(--brand-dark); border-color: #b9d7d0; }
.ghost { background: #fff; color: var(--text); border-color: var(--line); }

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.site-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #fbfcfd;
}

.site-card div:first-child { display: grid; gap: 2px; }
.site-card span { color: var(--muted); word-break: break-word; }

.mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-list em {
  font-style: normal;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef5f3;
  color: var(--brand-dark);
  font-size: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { color: #475467; font-size: 13px; }
td small { display: block; margin-top: 6px; max-width: 520px; }

.title-input {
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  font-weight: 700;
}

.title-input:focus { background: #fff; padding-left: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef5f3;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.status-approved { background: #eef8ef; color: #166534; }
.status-rejected { background: #f5f5f5; color: #667085; }
.status-in_progress { background: #fff7ed; color: #9a3412; }
.status-draft_created { background: #eff6ff; color: #1d4ed8; }
.status-error { background: #fff4f2; color: var(--danger); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 210px;
}

.mini {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.primary-mini {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 28px;
}

.alert {
  border: 1px solid #f2b8b5;
  background: #fff4f2;
  color: var(--danger);
  border-radius: 7px;
  padding: 10px 12px;
  margin: 14px 0;
  font-weight: 650;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 650;
}

@media (max-width: 860px) {
  .topbar { align-items: flex-start; }
  .app-grid, .app-grid.three, .stats-row { grid-template-columns: 1fr; }
  .form-row, .inline-form { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
}
