:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9dee7;
  --soft-line: #edf0f5;
  --brand: #17406d;
  --green: #16715b;
  --warn: #9a6700;
  --danger: #b4234a;
  --shadow: 0 14px 34px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select {
  font: inherit;
}
button, .primary {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, border-color .12s ease, background .12s ease;
}
.danger-button {
  background: var(--danger);
}
.tool-button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--brand);
  min-height: 42px;
  padding: 9px 12px;
}
.tool-button.confirming {
  border-color: #f0c36a;
  background: #fff8e6;
  color: var(--warn);
}
.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 18px;
}
.danger-icon {
  border-color: #edc9cf;
  background: #fff7f8;
  color: var(--danger);
}
button:hover, .primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  padding: 10px;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 22px rgba(23, 32, 51, .04);
}
.topbar div { display: grid; gap: 2px; }
.topbar span { color: var(--muted); font-size: 13px; }
.scope-select {
  min-width: 230px;
}
.scope-select label {
  gap: 3px;
}
.scope-select select {
  min-height: 38px;
  padding: 7px 9px;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 6px; }
.topbar a {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
}
.topbar a.active {
  background: var(--brand);
  color: white;
}

.layout { max-width: 1220px; margin: 0 auto; padding: 22px; }
.hero {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}
.hero h1 { margin: 0 0 10px; font-size: 34px; letter-spacing: 0; }
.hero p { color: var(--muted); line-height: 1.6; max-width: 720px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-weight: 800; }
.score {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.score span { font-size: 46px; font-weight: 800; color: var(--green); }
.score small { color: var(--muted); font-weight: 700; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.metric {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}
.metric strong { font-size: 30px; color: var(--green); }
.metric span { color: var(--muted); font-weight: 700; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.two { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); }
.stack { display: grid; gap: 18px; align-content: start; }
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel h3 { margin: 6px 0 0; font-size: 15px; }
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-title h2 { margin: 0; }
.form-panel { display: grid; gap: 12px; align-content: start; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}
.chip.active { background: var(--brand); color: white; }

.task-list { display: grid; gap: 10px; }
.bulk-bar {
  display: grid;
  grid-template-columns: 110px repeat(4, minmax(120px, 1fr)) 48px 48px;
  align-items: end;
  gap: 8px;
  border: 1px solid #d6e4f5;
  border-radius: 8px;
  background: #f4f9ff;
  padding: 10px;
  margin-bottom: 12px;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar > strong {
  align-self: center;
  color: var(--brand);
  font-size: 13px;
}
.task, .suggestion, .mailbox, .doc {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}
.task:hover {
  border-color: #cdd8e8;
}
.task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 12px;
}
.task-main { min-width: 0; }
.task-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}
.checkline {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  width: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.checkline input {
  width: auto;
}
.task.done { opacity: .65; }
.task h3 { margin: 8px 0 6px; font-size: 16px; }
.task p, .suggestion p, .doc p { margin: 0 0 8px; color: var(--muted); line-height: 1.5; }
.task small { color: var(--muted); font-weight: 700; }
.reason {
  margin-top: 8px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
}
.edit-task {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
}
.row { display: flex; gap: 8px; align-items: end; }
.row.wrap { flex-wrap: wrap; }
.row select { min-width: 105px; }
.row input[type="number"] { max-width: 90px; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8efe9;
  color: var(--green);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}
.badge.warn { background: #fff0cc; color: var(--warn); }
.badge.danger { background: #f9d7dc; color: var(--danger); }

.suggestion, .mailbox {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.mailbox-head, .server-item {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.mailbox-head div, .server-item div {
  display: grid;
  gap: 4px;
}
.mail-actions {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, 160px) auto;
  gap: 8px;
  align-items: end;
}
.server-list {
  display: grid;
  gap: 8px;
}
.server-item, .job-item {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}
.job-list {
  display: grid;
  gap: 8px;
}
.job-item {
  display: grid;
  gap: 4px;
}
.job-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.mailbox span { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); line-height: 1.6; }
.search { display: grid; grid-template-columns: 1fr 100px; gap: 8px; margin-bottom: 12px; }
.log-filter {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.log-list { display: grid; gap: 10px; }
.log-entry {
  display: grid;
  grid-template-columns: 160px 190px 120px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}
.log-entry.danger {
  border-color: #f2b8c6;
  background: #fff8fa;
}
.log-entry.warn {
  border-color: #f1d38f;
  background: #fffaf0;
}
.log-entry.ok {
  border-color: var(--soft-line);
}
.log-entry time, .log-entry span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.log-entry pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  max-height: 260px;
  overflow: auto;
}
.version-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}
.version-card strong { font-size: 34px; color: var(--green); }
.version-card span { color: var(--muted); font-weight: 700; }
.settings-list { display: grid; gap: 10px; }
.settings-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 10px;
}
.settings-list span { color: var(--muted); }
.release-list { display: grid; gap: 14px; }
.release {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}
.release > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.release span { color: var(--muted); font-size: 13px; font-weight: 700; }
.release h3 { margin: 12px 0 6px; }
.release ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.6; }
.roadmap {
  margin: 0;
  white-space: pre-wrap;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}
.notice {
  border-radius: 8px;
  background: #e8efe9;
  color: var(--green);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 700;
}
.notice.warn { background: #fff0cc; color: var(--warn); }
.notice.danger { background: #f9d7dc; color: var(--danger); }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,.14);
  font-weight: 800;
}
.toast.ok { background: #e8efe9; color: var(--green); }
.toast.danger { background: #f9d7dc; color: var(--danger); }

.setup {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.setup-card {
  width: min(820px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 28px;
}
.setup-card.compact { width: min(430px, 100%); }
.setup-card h1 { margin: 0 0 8px; }
.setup-card p { color: var(--muted); line-height: 1.6; }
.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-form button { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .topbar, .hero, .two, .task, .grid-form, .metrics, .log-entry, .bulk-bar, .mail-actions, .log-filter { grid-template-columns: 1fr; }
  .topbar { align-items: start; }
  .hero h1 { font-size: 28px; }
  .layout { padding: 14px; }
}
