:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #10231b;
  --muted: #5f7067;
  --line: #d8e2dc;
  --brand: #167a4a;
  --brand-dark: #0c5f37;
  --warn: #9a5b00;
  --danger: #b42318;
  --soft: #eaf5ee;
  --shadow: 0 16px 40px rgba(16, 35, 27, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  background: linear-gradient(135deg, #0e6b3c, #1c9b64);
  color: #fff;
}

.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; opacity: 0.85; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); }
h2 { margin: 0; font-size: 18px; }
.subtitle { margin: 8px 0 0; opacity: 0.9; }
.status-card {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 210px;
  text-align: center;
  font-weight: 700;
}

.layout { padding: 24px clamp(18px, 4vw, 48px) 48px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 20px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(22,122,74,0.2); border-color: var(--brand); }

button {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: var(--brand-dark); }
button.secondary { background: var(--soft); color: var(--brand-dark); }
button.secondary:hover { background: #d8eddf; }
button.danger { background: var(--danger); }
button.ghost { background: #fff4f2; color: var(--danger); border: 1px solid #ffd1cb; }
button.small { padding: 6px 10px; font-size: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.button-column { display: grid; gap: 10px; max-width: 320px; }
.hint { color: var(--muted); font-size: 13px; }
.pill { background: var(--soft); color: var(--brand-dark); border-radius: 999px; padding: 6px 10px; font-weight: 800; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
td { font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.row-title { font-weight: 900; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #edf4ff; color: #175cd3; }
.status.verified { background: #eaf5ee; color: #167a4a; }
.status.rejected { background: #fff4f2; color: #b42318; }
.status.pending { background: #fff7e6; color: #9a5b00; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { padding: 6px 8px; font-size: 12px; }

.output, #messageLog {
  background: #0d1d15;
  color: #d8f5e3;
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
  min-height: 140px;
  white-space: pre-wrap;
}
.message-panel { margin-bottom: 0; }

@media (max-width: 980px) {
  .topbar, .split { display: block; }
  .status-card { margin-top: 16px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

.auth-panel {
  max-width: 520px;
  margin: 2rem auto 0;
  padding: 0 1rem;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.auth-card form {
  display: grid;
  gap: 1rem;
}

.hidden {
  display: none !important;
}

.backup-select-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.backup-select-label select {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.metric-card {
  background: linear-gradient(180deg, #ffffff, #f4faf6);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  min-height: 118px;
}
.metric-card span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.metric-card strong { display: block; font-size: 32px; margin: 8px 0 4px; color: var(--ink); }
.metric-card small { color: var(--muted); font-weight: 700; }
.metric-card.warn { background: linear-gradient(180deg, #fffdf7, #fff7e6); }
.compact-table table { min-width: 620px; }
.admin-section-title { margin-bottom: 12px; }
.dashboard-panel { border-color: rgba(22, 122, 74, 0.28); }
.status.disabled { background: #f2f4f7; color: #475467; }
.status.open { background: #fff7e6; color: #9a5b00; }
.status.in_progress { background: #edf4ff; color: #175cd3; }
.status.resolved { background: #eaf5ee; color: #167a4a; }
@media (max-width: 900px) {
  .topbar { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
