:root {
  --bg: #f3efe6;
  --ink: #1b1914;
  --muted: #6d655b;
  --line: #e3d9cb;
  --panel: #fffdf8;
  --sidebar: #14211e;
  --sidebar-ink: #f6f1e7;
  --sidebar-dim: #b7c4be;
  --accent: #0f6e64;
  --accent-ink: #f4fffc;
  --warm: #c6532a;
  --ok: #1d7a45;
  --ok-bg: #e5f5eb;
  --error: #9d342c;
  --error-bg: #fdeceb;
  --warn-bg: #fff4df;
  --shadow: 0 16px 40px rgba(40, 32, 20, 0.06);
  --radius: 16px;
  font-family: "Segoe UI", Candara, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px;
}
.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #e7a15a;
  color: #1b1914;
  font-weight: 750;
}
.brand strong { display: block; font-size: 18px; }
.brand span { color: var(--sidebar-dim); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  color: var(--sidebar-ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
}
.nav a.active, .nav a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar form { margin-top: auto; }
.ghost, .sidebar button.ghost {
  width: 100%;
  background: transparent;
  color: var(--sidebar-ink);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 10px 12px;
}
.content { padding: 28px 32px 64px; max-width: 1080px; }
.guest-main { max-width: 720px; margin: 48px auto; padding: 0 20px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.lead, .help { color: var(--muted); margin: 0; }
.help { font-size: 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 16px 18px; }
.card b { display: block; font-size: 28px; margin-top: 6px; }
.card span, .muted { color: var(--muted); font-size: 13px; }
.panel { padding: 18px; margin: 14px 0; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 650;
}
.btn.secondary, button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.warn { background: var(--warm); }
.btn.small { padding: 7px 12px; font-size: 14px; }
#wa-qr { width: 280px; max-width: 100%; margin-top: 12px; background: #fff; }
.inline { display: inline; }

label { display: block; font-size: 14px; font-weight: 650; margin: 12px 0 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #ddd3c4;
  border-radius: 12px;
  padding: 11px 12px;
}
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 10px 0; }
.check input { margin-top: 3px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1.2fr .8fr .6fr; gap: 12px; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--error-bg); color: var(--error); }
.warning {
  background: var(--warn-bg);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
}

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
}
.item h3 { margin: 0 0 4px; font-size: 17px; }
.item a.title { color: inherit; text-decoration: none; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.badge {
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #efe8dc;
  color: #4d463d;
}
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: #f1f1f1; color: #666; }
.badge.err { background: var(--error-bg); color: var(--error); }
.badge.partial { background: var(--warn-bg); color: #8a5a12; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 650; font-size: 12px; letter-spacing: .03em; }
.tag-form { display: flex; gap: 8px; }
.tag-form input { min-width: 180px; }

.thread { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
}
.bubble.in { background: #fff; border: 1px solid var(--line); }
.bubble.out { background: #e7f3f1; margin-left: auto; }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }

.preview {
  background: #14211e;
  color: #f6f1e7;
  border-radius: 16px;
  padding: 16px;
}
.preview h2 { color: white; }
.preview .result {
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  white-space: pre-wrap;
}
.preview .fail { color: #ffb4ac; }

.steps { margin: 0; padding-left: 18px; }
.steps li { margin: 8px 0; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card { width: min(420px, 100%); padding: 28px; }
code, .mono { font-family: Consolas, monospace; font-size: 13px; }
.secret {
  font-size: 13px;
  color: var(--ok);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 2; min-width: 0; width: 100%; max-width: 100%; }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; min-width: 0; }
  .nav a { white-space: nowrap; }
  .sidebar form { margin-top: 0; }
  .ghost, .sidebar button.ghost { width: auto; }
  .cards, .split, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 48px; }
  .top { flex-direction: column; align-items: flex-start; }
  .item { align-items: flex-start; flex-direction: column; }
}
