:root {
  --bg: #f5f0e8;
  --bg2: #efe8db;
  --surface: #fffcf7;
  --line: #e5dccb;
  --text: #1f1e1d;
  --muted: #6b6560;
  --accent: #d97757;
  --accent-hover: #c6613f;
  --accent-soft: #f3e0d6;
  --accent2: #b54a2f;
  --danger: #c44;
  --ok: #2f6b4a;
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Source Serif 4", Georgia, serif;
  --shadow: 0 10px 30px rgba(60, 40, 20, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 0% 0%, #f8e6d8 0%, transparent 55%),
    radial-gradient(700px 400px at 100% 10%, #ebe4d4 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(245, 240, 232, 0.92);
  z-index: 10;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
}
.site-header nav { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }
.site-header nav a { color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }

main { max-width: 980px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.hero {
  padding: 4rem 0 2.5rem;
  animation: rise 0.65s ease both;
}
.hero-brand {
  font-family: var(--display);
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 0.95;
  margin: 0 0 1.1rem;
  color: var(--text);
  letter-spacing: -0.03em;
}
.hero-brand span { color: var(--accent); }
.hero h1 {
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--muted);
}
.hero-lead, .lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
  margin: 0 0 1.5rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
  animation: rise 0.85s ease both;
}
.strip-item, .pkg-card, .stat, .form-card, .login-card, .check-result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.strip-item { padding: 1rem 1.1rem; }
.strip-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.strip-item code { font-size: 0.86rem; word-break: break-all; color: var(--accent2); }

.doc h1 { font-family: var(--display); font-size: 2.2rem; letter-spacing: -0.02em; margin-top: 0; }
.doc h2 { margin-top: 2.1rem; font-size: 1.3rem; }
.doc h3 { margin-top: 1.3rem; font-size: 1.05rem; color: var(--accent2); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}
.table th { color: var(--muted); font-weight: 600; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.codeblock {
  background: #2a2420;
  border: 1px solid #3a322c;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  color: #f3ebe3;
  white-space: pre;
}

.muted { color: var(--muted); }
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.check-page { max-width: 520px; }
.check-form label, .form-card label, .login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.check-form input, .form-card input, .form-card select, .login-card input, .inline-filter select {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.check-form input { margin-bottom: 1rem; }
.check-result { margin-top: 1.25rem; padding: 1rem 1.1rem; animation: rise 0.35s ease both; }
.check-result.ok { border-color: #b9d4c4; }
.check-result.err { border-color: #e8b4b4; color: #8a2f2f; }
.check-result ul { margin: 0.75rem 0 0; padding-left: 1.1rem; }

.admin-body, .panel-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.admin-nav, .panel-nav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.admin-nav .brand, .panel-nav .brand { margin-bottom: 1rem; }
.admin-nav a, .panel-nav a {
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}
.admin-nav a:hover, .panel-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent2);
  text-decoration: none;
}
.admin-main, .panel-main { padding: 1.5rem 1.75rem 3rem; }
.admin-main h1, .panel-main h1 {
  margin-top: 0;
  font-family: var(--display);
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.stat { padding: 1rem; }
.stat span { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; font-weight: 600; }
.stat strong { font-size: 1.4rem; letter-spacing: -0.02em; }

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}
.pkg-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.55rem; }
.pkg-card h3 { margin: 0; font-family: var(--display); font-size: 1.35rem; }
.pkg-card .price { font-size: 1.6rem; font-weight: 700; color: var(--accent2); }
.pkg-card .meta { color: var(--muted); font-size: 0.92rem; }
.pkg-card form { margin-top: auto; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-soft);
  color: var(--accent2);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-card {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
}
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.3rem; flex-wrap: wrap; }
.form-card hr { border: none; border-top: 1px solid var(--line); margin: 0.4rem 0; }

.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.flash-ok { background: #eef6f0; border-color: #c5ddce; color: var(--ok); }
.flash-err { background: #fbebeb; border-color: #e8b4b4; color: #8a2f2f; }
.key-reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.key-reveal code { word-break: break-all; color: var(--accent2); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.badge-active { background: #e5f2ea; color: var(--ok); }
.badge-disabled { background: #f6e2e2; color: #8a2f2f; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline { display: inline; margin: 0; }
.linkish {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
}
.linkish.danger { color: var(--danger); }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: rise 0.45s ease both;
}
.login-card h1 { margin: 0; font-family: var(--display); font-size: 1.7rem; }
.login-card .hero-brand { font-size: 1.9rem; margin: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .strip, .stat-grid, .pkg-grid { grid-template-columns: 1fr; }
  .admin-body, .panel-body { grid-template-columns: 1fr; }
  .admin-nav, .panel-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}
