@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --bg: #eef2f0;
  --bg-deep: #e4ebe7;
  --ink: #14201c;
  --muted: #5f726a;
  --line: #d5e0da;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-soft: #d9f5f0;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --warn: #b45309;
  --warn-bg: #ffedd5;
  --bad: #be123c;
  --bad-bg: #ffe4e6;
  --shadow: 0 18px 50px rgba(20, 32, 28, 0.08);
  --radius: 18px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Manrope", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 0% 0%, rgba(15, 118, 110, 0.12), transparent 60%),
    radial-gradient(700px 420px at 100% 10%, rgba(180, 83, 9, 0.08), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-deep));
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), transparent 40%),
    rgba(255, 255, 255, 0.55);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: rise 0.45s ease both;
}

.brand-block { padding: 0 10px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff; font-weight: 800; letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
  margin-bottom: 14px;
}
.brand {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
}
.brand-sub { margin-top: 6px; color: var(--muted); font-size: 12px; }

.nav {
  display: flex; flex-direction: column; gap: 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav a:hover {
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  transform: translateX(2px);
}
.nav a.active {
  background: var(--panel-solid);
  color: var(--accent);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.nav a.logout {
  margin-top: auto;
  color: var(--bad);
}

.main {
  padding: 28px 32px 40px;
  animation: rise 0.5s ease 0.05s both;
}
.page-head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 28px; letter-spacing: -0.03em; font-weight: 800;
}
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card, .panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card.stat {
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.card.stat:hover { transform: translateY(-2px); }
.card.stat::after {
  content: "";
  position: absolute; right: -20px; top: -20px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--accent-soft); opacity: 0.7;
}
.stat .label { position: relative; z-index: 1; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value {
  position: relative; z-index: 1;
  font-size: 32px; font-weight: 800; margin-top: 10px; letter-spacing: -0.04em;
}
.stat.tone-ok .value { color: var(--ok); }
.stat.tone-warn .value { color: var(--warn); }
.stat.tone-bad .value { color: var(--bad); }
.stat.tone-accent .value { color: var(--accent); }

.panel { padding: 22px; margin-bottom: 16px; }
.panel h2 {
  margin: 0 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
}
.panel .lead { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.help-list {
  display: grid; gap: 10px; margin: 0; padding: 0; list-style: none;
}
.help-list li {
  display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start;
  padding: 12px 14px; border-radius: 14px; background: #f7faf8; border: 1px solid var(--line);
}
.help-list .n {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 12px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.field { min-width: 160px; flex: 1; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 700; letter-spacing: 0.02em; }

input, select, textarea {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}
textarea { min-height: 220px; resize: vertical; }

.btn, button, .nav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover, button:hover { transform: translateY(-1px); background: #f8fbf9; }
.btn.primary, button.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent; color: #fff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.25);
}
.btn.danger, button.danger {
  background: var(--bad-bg); border-color: #fecdd3; color: var(--bad);
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { display: contents; }
.actions button { padding: 6px 10px; font-size: 12px; }

.table-wrap {
  overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th {
  background: #f3f7f5; color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase; position: sticky; top: 0;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fbfa; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #eef2f0; color: var(--muted);
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }

.flash {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: 14px;
  animation: pop 0.35s ease both;
}
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

.mono {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  word-break: break-all; font-size: 12.5px;
}
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }

/* Login */
body.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-visual {
  position: relative; overflow: hidden; color: #fff;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.92), rgba(20, 32, 28, 0.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  padding: 56px;
  display: flex; flex-direction: column; justify-content: flex-end;
  animation: fade 0.6s ease both;
}
.login-visual h2 {
  margin: 0 0 10px; font-size: clamp(34px, 5vw, 52px); line-height: 1.05;
  letter-spacing: -0.04em; font-weight: 800; max-width: 10ch;
}
.login-visual p { margin: 0; max-width: 36ch; color: rgba(255,255,255,0.82); font-size: 15px; }
.login-side {
  display: grid; place-items: center; padding: 32px;
  animation: rise 0.5s ease both;
}
.login-box {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
  backdrop-filter: blur(12px);
}
.login-box h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.03em; }
.login-box .muted { margin: 0 0 22px; }
.login-box .field { margin-bottom: 14px; }
.login-box button { width: 100%; padding: 12px 14px; margin-top: 6px; }

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

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 10px 12px; }
  .nav a.logout { margin-top: 0; }
  body.login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 240px; padding: 32px; }
  .main { padding: 20px 16px 32px; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Docs */
.docs .code-block, pre.code-block {
  background: #0f1a17;
  color: #d7f5ea;
  border-radius: 14px;
  padding: 14px 16px;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  border: 1px solid #1f332c;
}
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); }
.plain-list li { margin: 6px 0; }

/* Homepage */
.home-page { background:
  radial-gradient(1000px 520px at 10% -10%, rgba(15,118,110,.16), transparent 55%),
  radial-gradient(800px 480px at 90% 0%, rgba(180,83,9,.10), transparent 50%),
  linear-gradient(165deg, #eef2f0, #e3ebe7);
}
.home-nav { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
  background: rgba(255,255,255,.72); border-bottom: 1px solid var(--line); }
.home-nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.home-logo { font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.home-logo span {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-2), var(--accent)); color: #fff; font-size: 12px;
}
.home-actions { display: flex; gap: 8px; }
.home-hero {
  max-width: 1100px; margin: 0 auto; padding: 56px 20px 28px;
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px; align-items: center;
  animation: rise .5s ease both;
}
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; margin: 0 0 10px; }
.home-hero h1 {
  margin: 0; font-size: clamp(40px, 7vw, 64px); letter-spacing: -0.05em; line-height: 1.02;
}
.hero-desc { color: var(--muted); font-size: 16px; line-height: 1.7; max-width: 46ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.home-hero-panel { display: grid; gap: 12px; }
.mini-card {
  background: rgba(255,255,255,.86); border: 1px solid rgba(255,255,255,.9);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
}
.mini-card strong { display: block; margin-bottom: 4px; font-size: 15px; }
.mini-card span { color: var(--muted); font-size: 13px; }
.home-section { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.home-section h2 { margin: 0 0 16px; font-size: 26px; letter-spacing: -0.03em; }
.home-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.home-grid-3 article {
  background: rgba(255,255,255,.86); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow);
}
.home-grid-3 h3 { margin: 0 0 8px; font-size: 17px; }
.home-grid-3 p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.home-steps { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.9; }
.home-footer {
  max-width: 1100px; margin: 20px auto 40px; padding: 0 20px;
  display: flex; justify-content: space-between; color: var(--muted); font-size: 13px;
}
@media (max-width: 900px) {
  .home-hero, .home-grid-3 { grid-template-columns: 1fr; }
}
