:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #fbfcfc;
  --ink: #182321;
  --muted: #5f6f6b;
  --line: #dbe4e1;
  --line-light: #e8eeec;
  --accent: #1f7a64;
  --accent-soft: #e8f3f0;
  --danger: #b54a4a;
  --danger-soft: #fbefef;
  --good: #1f7a64;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24,35,33,0.04), 0 8px 24px rgba(24,35,33,0.03);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.page-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 700px 400px at 10% -10%, rgba(31,122,100,0.08), transparent 70%),
    radial-gradient(ellipse 500px 300px at 90% 0%, rgba(31,122,100,0.05), transparent 70%);
}
.container { width: min(1120px, calc(100% - 48px)); margin: 0 auto; position: relative; z-index: 1; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(246,248,247,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #2a9a7e, #1a6352);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 7px; top: 8px; width: 14px; height: 3px;
  background: rgba(255,255,255,0.9); border-radius: 2px;
  box-shadow: 0 6px 0 rgba(255,255,255,0.7);
}
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: #173a31; }
.brand-sub { font-size: 13px; color: var(--muted); margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav a { color: #30423e; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--accent); }
.nav a.muted { color: var(--muted); }

/* Layout */
.main { padding: 40px 0 56px; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  margin-bottom: 28px; flex-wrap: wrap;
}
.eyebrow {
  margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
h1 { margin: 0; font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; color: #162b26; }
h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; color: #1a2e29; }
.lede { margin: 10px 0 0; color: var(--muted); font-size: 16px; max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 0.92em; }

/* Panels / grid */
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line-light);
}
.pill {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #eef2f1; color: #4a5c58;
  border: 1px solid #dde5e3; white-space: nowrap;
}
.pill.good { background: var(--accent-soft); color: #1a6655; border-color: #cfe3dc; }
.pill.muted-pill { background: #f5f7f6; color: #6b7a77; }

/* KV */
.kv { display: flex; flex-direction: column; }
.kv-row {
  display: flex; justify-content: space-between; gap: 24px;
  padding: 12px 0; border-bottom: 1px solid var(--line-light); font-size: 14px;
}
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-row:first-of-type { padding-top: 0; }
.k { color: var(--muted); }
.v { color: var(--ink); font-weight: 500; text-align: right; word-break: break-word; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 18px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; color: #2a3a37; }
input[type="text"], input[type="password"], textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #cfdad7; background: #fcfefd; color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 400; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus {
  border-color: #7fb5a7; box-shadow: 0 0 0 4px rgba(31,122,100,0.08);
}
textarea.xml-input {
  min-height: 260px; resize: vertical; line-height: 1.6;
  font-family: var(--mono); font-size: 13px; background: #fbfdfc;
}
.form-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-foot { margin: 20px 0 0; font-size: 14px; color: var(--muted); }
.form-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid #1a6a58;
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, transform 0.02s;
}
.button:hover { background: #1a6a58; }
.button:active { transform: translateY(1px); }
.button.small { padding: 9px 14px; font-size: 13px; }

/* Notices */
.notice {
  padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.notice.error { background: var(--danger-soft); color: #8f3a3a; border-color: #f0dada; }
.notice.success { background: #eff7f4; color: #1f6655; border-color: #d5e8e1; }

/* Auth */
.auth-wrap {
  display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 48px;
  align-items: stretch; min-height: 480px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 36px; box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 4px; }
.auth-card .lede { margin-bottom: 28px; }
.auth-side {
  display: flex; align-items: flex-end; padding: 20px 0;
}
.quote { max-width: 420px; padding: 28px 0; }
.quote-big {
  margin: 0 0 14px; font-size: 32px; line-height: 1.25; letter-spacing: -0.02em;
  color: #23423a; font-weight: 700;
}

/* Flag / result */
.flag-box {
  background: linear-gradient(180deg, #f3faf8, #edf7f4);
  border: 1px solid #cfe3dc; border-radius: 12px; padding: 20px;
}
.flag-label { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: #1a6655; }
.flag-text { margin: 0 0 16px; font-size: 14px; color: #4d6a64; }
.flag-value {
  padding: 14px 16px; background: #fff; border: 1px solid #cfe3dc; border-radius: 8px;
  font-size: 14px; color: #174d40; word-break: break-all;
}
.locked-box {
  margin-top: 20px; padding: 20px; border-radius: 10px;
  background: #f7f9f8; border: 1px dashed #d2ddda;
}
.locked-title { font-weight: 600; color: #445552; margin-bottom: 6px; font-size: 14px; }

.result-ok { margin: 0 0 16px; color: #2e5f54; font-weight: 600; font-size: 14px; }
.message-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-light); }
.message-box .k { font-size: 13px; margin-bottom: 8px; }
.message-body {
  font-size: 15px; line-height: 1.7; color: #223330; white-space: pre-wrap; word-break: break-word;
}
.sample { margin-top: 8px; }
.sample-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
pre {
  margin: 0; padding: 16px; background: #f6f8f8; border: 1px solid var(--line-light);
  border-radius: 10px; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #344543;
}
.output {
  min-height: 180px; max-height: 420px; white-space: pre-wrap; word-break: break-word;
  background: #1e2b29; color: #d7e7e2; border-color: #1e2b29;
}

/* Error / traceback */
.error-page h1 { margin-bottom: 8px; }
.traceback {
  margin-top: 20px; background: #fbf6f5; border: 1px solid #ecdedd; color: #6a3a3a;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}

/* Footer */
.footer { padding: 28px 0 40px; position: relative; z-index: 1; }
.footer-inner {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}

@media (max-width: 900px) {
  .grid.two, .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  .container { width: min(1120px, calc(100% - 32px)); }
  h1 { font-size: 28px; }
  .topbar-inner { padding: 10px 0; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .panel { padding: 20px; }
  .auth-card { padding: 24px; }
  .kv-row { flex-direction: column; gap: 4px; }
  .v { text-align: left; }
}
