/* toolkit.fun v2 — design tokens & components
   (Mint: #14B8A6 · Graphite #111827 · Mist #F6F8FA) */

:root {
  --coral: #14B8A6;
  --coral-deep: #0F766E;
  --coral-tint: #DDFCF4;
  --coral-line: #99F6E4;
  --ink: #111827;
  --espresso: #111827;
  --paper: #F6F8FA;
  --card: #ffffff;
  --line: #E3E8EF;
  --line-soft: #EDF2F7;
  --line-strong: #D5DCE7;
  --txt: #111827;
  --txt-2: #374151;
  --txt-3: #4B5563;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --muted-3: #CBD5E1;
  --green: #15803D;
  --green-tint: #DCFCE7;
  --amber: #B45309;
  --amber-tint: #FEF3C7;
  --red: #DC2626;
  --sans: 'Schibsted Grotesk', 'Noto Sans SC', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
/* 组件类里的 display 会盖掉浏览器默认的 [hidden]，所以显式兜底：
   否则 JS 设了 hidden 的字段（邮箱验证码、重置密码时的邮箱）仍然可见。 */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); font-family: var(--sans); color: var(--txt); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; }
input, textarea, select { font-family: var(--sans); color: var(--txt); }
.mono { font-family: var(--mono); }

.tk-scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.tk-scroll::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 9px; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; min-height: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 26px 32px; }

/* sidebar (AppSidebar 组件) */
.sidebar { width: 236px; height: 100%; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sidebar .logo-row { height: 54px; flex: none; display: flex; align-items: center; gap: 9px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--coral); display: flex; align-items: center; justify-content: center; color: #fff; font: 700 14px var(--mono); flex: none; }
.logo-word { font: 700 15px var(--sans); letter-spacing: -.02em; color: var(--ink); }
.logo-word span { color: var(--muted-2); }
.navbar-brand { display: flex; align-items: center; gap: 9px; }
.brand-logo-svg {
  width: 40px;
  height: 40px;
  flex: none;
  padding: 4px;
  border: 1px solid rgba(15, 118, 110, .34);
  border-radius: 10px;
  background: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .92),
    0 8px 18px rgba(15, 23, 42, .09),
    0 0 0 4px rgba(20, 184, 166, .06);
}
.brand-logo-svg polyline { stroke: var(--ink); }
.brand-logo-svg text { fill: var(--ink); }
.navbar-brand-text {
  color: var(--ink);
  font: 600 21px/1 'Playfair Display', Georgia, serif;
  letter-spacing: .005em;
}
.navbar-brand-accent {
  color: var(--coral-deep);
  font-size: 1em;
  font-style: italic;
  font-weight: 600;
}
.sidebar .brand-logo-svg,
.focus-top .brand-logo-svg {
  width: 30px;
  height: 30px;
  padding: 3px;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .92),
    0 4px 11px rgba(15, 23, 42, .07),
    0 0 0 3px rgba(20, 184, 166, .05);
}
.sidebar .navbar-brand-text,
.focus-top .navbar-brand-text { font-size: 17px; }
.sidebar nav { flex: 1; min-height: 0; overflow: auto; padding: 14px 12px; }
.nav-group { font: 700 10.5px var(--sans); color: var(--muted-3); letter-spacing: .08em; margin: 14px 8px 6px; }
.nav-group:first-child { margin-top: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; color: var(--txt-2); font-size: 13.5px; font-weight: 500; transition: background .12s; }
.nav-item:hover { background: #EEF7F6; }
.nav-item.active { background: #E6FFFA; color: var(--ink); font-weight: 600; }
.nav-icon { width: 24px; height: 24px; border-radius: 6px; background: var(--line-soft); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.nav-item.active .nav-icon { background: var(--coral); color: #fff; }
.nav-badge { margin-left: auto; min-width: 17px; height: 17px; border-radius: 9px; background: var(--coral); color: #fff; font: 700 10px var(--sans); display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.plan-card { margin: 12px; padding: 14px 15px; border-radius: 12px; background: var(--espresso); color: #D9E4EC; }
.plan-card-link {
  display: block;
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.plan-card-link:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, .4);
  box-shadow: 0 10px 20px rgba(15, 23, 42, .16);
  color: #fff;
}
.plan-card-link:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* topbar */
.topbar { height: 54px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.topbar-product-links { display: flex; align-items: center; gap: 6px; }
.topbar-link { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0 9px; color: var(--txt-3); font: 700 12px var(--sans); }
.topbar-link:hover { background: var(--paper); color: var(--txt); }
.topbar-icon-link { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); }
.topbar-icon-link:hover { border-color: var(--muted-3); background: var(--paper); }
.topbar-icon-link svg { width: 17px; height: 17px; display: block; fill: currentColor; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--txt-2); padding: 0; }
.icon-btn:hover { border-color: var(--muted-3); background: var(--paper); color: var(--txt); }
.icon-btn:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.lang-toggle svg { width: 19px; height: 19px; }
.searchbox { flex: none; width: 340px; display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; color: var(--muted-2); font-size: 13px; }
.searchbox input { flex: 1; border: 0; background: transparent; outline: none; font-size: 13px; }
.kbd { font: 600 10px var(--mono); color: var(--muted-2); background: #fff; border: 1px solid var(--line-strong); border-radius: 5px; padding: 2px 5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--coral); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 13px var(--sans); }

/* ---------- components ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; color: var(--txt); font: 600 13px var(--sans); padding: 9px 16px; }
.btn:hover { border-color: var(--muted-3); }
.btn.primary { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.primary:hover { background: #0F9F8F; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--red); border-color: #FECACA; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.tag { display: inline-flex; align-items: center; font: 600 10.5px var(--sans); padding: 3px 8px; border-radius: 6px; background: var(--line-soft); color: var(--txt-2); }
.tag.coral { background: var(--coral-tint); color: var(--coral-deep); }
.tag.green { background: var(--green-tint); color: var(--green); }
.tag.amber { background: var(--amber-tint); color: var(--amber); }

.h1 { font: 800 24px var(--sans); letter-spacing: -.02em; margin: 0; }
.h2 { font: 700 17px var(--sans); letter-spacing: -.01em; margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
.lbl { font: 700 11px var(--sans); color: var(--muted-2); letter-spacing: .06em; text-transform: uppercase; }

.input, textarea.input { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; background: #fff; outline: none; }
.input:focus { border-color: var(--coral); }
textarea.input { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line-strong); background: #fff; color: var(--txt-2); border-radius: 9px; padding: 7px 14px; font: 600 12.5px var(--sans); }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* tool card grid (Toolkit App 工具库) */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tool-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 17px 18px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; cursor: pointer; }
.tool-card:hover { box-shadow: 0 4px 16px rgba(17,24,39,.08); transform: translateY(-1px); }
.tool-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font: 700 15px var(--mono); flex: none; }
.tool-meta { font: 500 11px var(--mono); color: var(--muted-2); }
.tool-desc { font-size: 12.5px; color: var(--txt-3); line-height: 1.55; min-height: 38px; }
.tool-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.stat { font: 500 11px var(--mono); color: var(--muted-2); }

/* output panes */
.pane-dark { background: var(--espresso); color: #D9E4EC; border-radius: 10px; padding: 14px 16px; font: 500 12.5px var(--mono); line-height: 1.7; white-space: pre-wrap; word-break: break-all; min-height: 80px; }
.pane-dark .err { color: #F87171; }

/* toast */
#tk-toast { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; border-radius: 11px; padding: 11px 18px; font: 600 13px var(--sans); opacity: 0; pointer-events: none; transition: all .22s; z-index: 999; box-shadow: 0 8px 24px rgba(17,24,39,.28); }
#tk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-bg.show { display: flex; }
.modal { width: 400px; max-width: calc(100vw - 40px); background: #fff; border-radius: 16px; padding: 28px; max-height: 86vh; overflow: auto; }
body.auth-open { overflow: hidden; }
.auth-modal { width: min(430px, calc(100vw - 32px)); padding: 0; overflow: hidden; border: 1px solid rgba(226,232,240,.95); border-radius: 8px; box-shadow: 0 24px 80px rgba(15,23,42,.22); }
.auth-head { padding: 24px 26px 18px; background: #F8FAFC; border-bottom: 1px solid var(--line-soft); position: relative; }
.auth-close { position: absolute; right: 16px; top: 16px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--txt-3); cursor: pointer; font: 700 17px var(--sans); }
.auth-close:hover { border-color: var(--muted-3); color: var(--txt); }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--txt-2); margin-bottom: 14px; }
.auth-brand .brand-logo-svg { width: 34px; height: 34px; padding: 3px; border-radius: 9px; box-shadow: 0 5px 14px rgba(15, 23, 42, .08), 0 0 0 3px rgba(20, 184, 166, .05); }
.auth-brand .navbar-brand-text { font-size: 20px; }
.auth-title { font: 800 24px/1.2 var(--sans); margin: 0; letter-spacing: 0; }
.auth-sub { color: var(--txt-3); font-size: 13px; line-height: 1.65; margin: 8px 0 0; }
.auth-body { padding: 22px 26px 26px; }
.oauth-stack { display: grid; gap: 10px; }
.oauth-btn { width: 100%; justify-content: center; min-height: 42px; font-size: 13.5px; border-color: #CBD5E1; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.oauth-mark { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--paper); color: var(--ink); font: 800 12px var(--sans); }
.oauth-provider-icon { width: 23px; height: 23px; display: block; flex: none; }
.oauth-provider-icon-google { filter: drop-shadow(0 1px 1px rgba(15,23,42,.04)); }
.oauth-provider-icon-wechat { filter: drop-shadow(0 1px 1px rgba(15,23,42,.06)); }
.auth-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 15px; color: var(--muted-2); font: 600 12px var(--sans); }
.auth-sep::before, .auth-sep::after { content: ''; height: 1px; flex: 1; background: var(--line-soft); }
.auth-field { display: block; margin-bottom: 12px; }
.auth-field .input { width: 100%; margin-top: 7px; min-height: 42px; border-radius: 8px; }
.auth-submit { width: 100%; justify-content: center; min-height: 42px; margin-top: 4px; }
.auth-error { display: none; margin: 12px 0 0; padding: 10px 12px; border: 1px solid #FECACA; background: #FFF7F7; color: var(--red); border-radius: 8px; font-size: 12.5px; line-height: 1.55; }
.auth-note { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); background: var(--paper); color: var(--txt-2); border-radius: 8px; font-size: 12.5px; line-height: 1.6; }
.auth-note b { word-break: break-all; color: var(--ink); }
.auth-foot { margin-top: 13px; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.auth-cancel { border: 0; background: transparent; color: var(--muted-2); font: 600 12.5px var(--sans); cursor: pointer; }
.auth-cancel:disabled { opacity: .55; cursor: default; }
.tk-dialog-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.tk-dialog-bg.show { display: flex; }
.tk-dialog { width: 430px; max-width: 100%; background: #fff; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(17,24,39,.22); padding: 22px; }
.tk-dialog-title { font: 800 17px var(--sans); margin-bottom: 14px; color: var(--ink); }
.tk-dialog-body { max-height: min(62vh, 520px); overflow: auto; }
.tk-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.tk-progress-dialog { width: 380px; }
.tk-progress-list { display: grid; gap: 10px; margin-top: 4px; }
.tk-progress-step { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 700 13px var(--sans); }
.tk-progress-dot { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 50%; flex: none; background: #fff; }
.tk-progress-step.on { color: var(--ink); }
.tk-progress-step.on .tk-progress-dot { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.tk-progress-step.done { color: var(--green); }
.tk-progress-step.done .tk-progress-dot { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px #fff; }

.tk-launch-banner {
  position: sticky;
  top: 0;
  z-index: 1200;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 18px;
  border-bottom: 1px solid rgba(20, 184, 166, .25);
  background: #ECFEFF;
  color: var(--txt-2);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.tk-launch-banner-copy { font: 700 13px/1.5 var(--sans); }
.tk-launch-banner-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tk-launch-banner .icon-btn { width: 30px; height: 30px; font-size: 17px; line-height: 1; }
.tk-launch-dialog { width: 460px; }
.tk-launch-dialog-body { display: grid; gap: 14px; color: var(--txt-3); line-height: 1.7; }
.tk-launch-dialog-body p { margin: 0; }
.tk-launch-brand .brand-logo-svg { width: 34px; height: 34px; padding: 3px; border-radius: 9px; }
.tk-launch-brand .navbar-brand-text { font-size: 21px; }
.tk-founder-grant-card {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, .34);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 52px rgba(15, 23, 42, .18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
}
.tk-founder-grant-card.show { opacity: 1; transform: translateY(0); }
.tk-founder-grant-card strong { display: block; margin-bottom: 5px; color: var(--ink); font: 800 14px var(--sans); }
.tk-founder-grant-card p { margin: 0; color: var(--txt-3); font-size: 12.5px; line-height: 1.6; }
.tk-founder-grant-actions { display: flex; align-items: center; gap: 8px; }
.tk-founder-grant-actions .icon-btn { width: 30px; height: 30px; font-size: 17px; line-height: 1; }

/* tables (admin / lists) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font: 700 11px var(--sans); color: var(--muted-2); letter-spacing: .05em; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); }
.tbl tr:hover td { background: #F8FBFC; }

/* focus-mode topbar (Workbench / Studio 「退出专注」) */
.focus-top { height: 54px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.exit-focus { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); padding: 7px 13px; font: 600 12.5px var(--sans); color: var(--txt-2); }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 54px; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topbar .searchbox { width: 100%; order: 2; }
  .topbar-product-links { margin-left: auto; }
}

@media (max-width: 560px) {
  .topbar-link { padding: 0 7px; font-size: 11.5px; }
}

.empty { text-align: center; color: var(--muted-2); padding: 48px 0; font-size: 13px; }
.login-required { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.login-required.compact { min-height: 150px; padding: 28px 0; }
.login-required.full { min-height: 100vh; padding: 32px; }
.login-required.dark { color: #B8C7D4; }
.login-required-copy { line-height: 1.65; }
.login-required-action { min-width: 120px; justify-content: center; }

.compliance-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 42px;
  padding: 10px 24px 18px;
  color: var(--muted-2);
  font: 500 12px var(--sans);
}
.compliance-footer a { color: var(--muted-2); text-decoration: none; }
.compliance-footer a:hover { color: var(--txt); }
.legal-compliance-footer {
  max-width: 860px;
  margin: -42px auto 0;
  justify-content: flex-start;
}

@media (max-width: 760px) {
  html, body { min-width: 0; }
  .shell { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: 100%; height: auto; max-height: 218px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .logo-row { height: 48px; }
  .sidebar nav { display: flex; overflow-x: auto; overflow-y: hidden; gap: 10px; padding: 10px 12px; }
  .nav-group { display: none; }
  .nav-item { flex: none; white-space: nowrap; padding: 7px 10px; }
  .plan-card { display: none; }
  .main { min-height: 0; }
  .topbar { height: auto; min-height: 54px; padding: 10px 12px; flex-wrap: wrap; }
  .searchbox { width: 100%; min-width: 0; order: 2; }
  .content { padding: 18px 14px; overflow: visible; }
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-card { min-width: 0; }
  .tool-foot { align-items: flex-start; gap: 8px; flex-direction: column; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .btn, .pill { min-height: 34px; }
  .btn.sm { min-height: 32px; }
  .tk-launch-banner { align-items: stretch; flex-direction: column; gap: 8px; padding: 10px 14px; }
  .tk-launch-banner-actions { justify-content: space-between; width: 100%; }
  .tk-founder-grant-card { right: 14px; bottom: 14px; grid-template-columns: minmax(0, 1fr); }
  .tk-founder-grant-actions { justify-content: space-between; }
}
