:root {
  --bg: #f4f1ea;
  --bg-elev: #fffcf7;
  --bg-soft: #ebe6db;
  --ink: #1c1915;
  --ink-2: #4a453d;
  --ink-3: #7a7368;
  --line: #ddd5c6;
  --accent: #0f766e;
  --accent-2: #0d5f59;
  --accent-soft: #d9f0ec;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --ok: #16794c;
  --ok-soft: #e3f5ea;
  --shadow: 0 18px 50px rgba(28, 25, 21, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, #e7f4f1 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, #f3ead8 0%, transparent 50%),
    var(--bg);
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { min-height: 100dvh; }

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Landing */
.landing {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2rem 0 3rem;
}
.hero h1 {
  margin: 0 0 .8rem;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -.04em;
  max-width: 12ch;
}
.hero p.lead {
  margin: 0 0 1.4rem;
  color: var(--ink-2);
  font-size: 1.05rem;
  max-width: 38ch;
}
.hero-points {
  display: grid;
  gap: .55rem;
  margin: 0 0 1.6rem;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}
.hero-points li {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
}
.dot {
  width: 8px;
  height: 8px;
  margin-top: .45rem;
  border-radius: 99px;
  background: var(--accent);
  flex: 0 0 auto;
}
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  background: var(--bg-soft);
  padding: .3rem;
  border-radius: 12px;
  margin-bottom: 1.1rem;
}
.auth-tabs button {
  border: 0;
  background: transparent;
  padding: .65rem;
  border-radius: 10px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
}
.auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.field { display: grid; gap: .35rem; margin-bottom: .85rem; }
.field label {
  font-size: .86rem;
  color: var(--ink-2);
  font-weight: 600;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: .75rem .85rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  border-color: #5fb8af;
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 999px;
  padding: .72rem 1.1rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform .12s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-block { width: 100%; }
.alert {
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: .9rem;
  font-size: .92rem;
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.footer-note {
  padding: 1rem 0 1.5rem;
  color: var(--ink-3);
  font-size: .88rem;
}

/* App shell */
.app-layout {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255,252,247,.75);
  backdrop-filter: blur(10px);
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.nav {
  display: grid;
  gap: .3rem;
}
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: .72rem .85rem;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
}
.nav button.active, .nav button:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.side-user {
  margin-top: auto;
  padding: .85rem;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.side-user .name { font-weight: 700; }
.side-user .meta { color: var(--ink-3); font-size: .84rem; margin-top: .15rem; word-break: break-all; }
.main {
  padding: 1.4rem 1.5rem 2.5rem;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.page-head h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -.03em;
}
.page-head p {
  margin: .25rem 0 0;
  color: var(--ink-3);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.stat, .card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(28,25,21,.04);
}
.stat { padding: 1rem 1.1rem; }
.stat .label { color: var(--ink-3); font-size: .86rem; }
.stat .value {
  margin-top: .25rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -.02em;
  word-break: break-all;
}
.card { padding: 1.1rem 1.15rem; margin-bottom: 1rem; }
.card h3 {
  margin: 0 0 .85rem;
  font-size: 1rem;
  letter-spacing: -.01em;
}
.mono {
  font-family: var(--mono);
  font-size: .88rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .25rem .65rem;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: .8rem;
  font-weight: 650;
}
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row {
  display: flex;
  gap: .55rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem .6rem .55rem .85rem;
}
.copy-row code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: .88rem;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: .75rem .2rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: .93rem;
}
.table th {
  color: var(--ink-3);
  font-weight: 600;
  font-size: .82rem;
}
.table tr:last-child td { border-bottom: 0; }
.muted { color: var(--ink-3); }
.empty {
  padding: 1.4rem .2rem;
  color: var(--ink-3);
  text-align: center;
}
.codebox {
  position: relative;
  background: #171512;
  color: #f4efe6;
  border-radius: 14px;
  padding: 1rem;
  overflow: auto;
  max-height: 420px;
}
.codebox pre {
  margin: 0;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre;
}
.codebox .copy-float {
  position: sticky;
  top: 0;
  float: right;
  margin: 0 0 .5rem .5rem;
}
.steps {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-2);
  display: grid;
  gap: .45rem;
}
.mail-item {
  display: grid;
  gap: .2rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.mail-item:last-child { border-bottom: 0; }
.mail-item:hover .subject { color: var(--accent-2); }
.mail-item .subject { font-weight: 650; }
.mail-item .meta { color: var(--ink-3); font-size: .86rem; }
.mail-detail {
  display: grid;
  gap: .75rem;
}
.mail-detail .body {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  max-height: 50vh;
  overflow: auto;
}
.form-inline {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: .6rem;
  align-items: end;
}
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #171512;
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 999px;
  font-size: .9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1rem; }
  .hero h1 { max-width: none; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    z-index: 20;
  }
  .nav { grid-template-columns: repeat(4, 1fr); }
  .nav button { text-align: center; padding: .55rem .3rem; font-size: .82rem; }
  .side-user { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-inline { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}
