/* Cyan 工具箱 · 官网样式
 *
 * 与 App 内设计系统同源（design/Color.kt）：主蓝 #2563EB、深蓝 #1E3A8A、强调青 #06B6D4（只做点缀）、
 * 背景 #F5F7FB、卡片 #FFFFFF、边框 #E5E7EB、主文字 #0F172A、次要文字 #64748B。
 * 不引入任何前端框架：官网要能长期稳定，少一层依赖少一份风险。
 */

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-deep: #1e3a8a;
  --blue-100: #dbeafe;
  --cyan: #06b6d4;
  --cyan-700: #0e7490;
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-soft: #eef2f7;
  --text: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --success: #22c55e;
  --success-text: #15803d;
  --warning: #f59e0b;
  --warning-text: #b45309;
  --error: #ef4444;
  --error-text: #dc2626;
  --radius: 16px;
  --radius-sm: 12px;
  --pill: 999px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "JetBrains Mono", monospace;
  --wrap: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------------------------------------------------------------- 顶栏 */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 14px; min-height: 60px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--blue-deep), var(--blue));
  display: grid; place-items: center; position: relative;
}
.brand-mark::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid #fff; border-right-color: transparent; transform: rotate(-30deg);
}
.brand-mark::after {
  content: ""; position: absolute; right: 4px; top: 13px;
  width: 5px; height: 5px; border-radius: 50%; background: #22d3ee;
}
.brand-sub { font-size: 11px; color: var(--text-2); font-weight: 400; }
.site-nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--text-2); font-size: 14px; }
.site-nav a:hover { color: var(--blue); text-decoration: none; }

/* ---------------------------------------------------------------- 区块 */
section { padding: 44px 0; }
.section-head { margin-bottom: 20px; }
.section-head h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.2px; }
.section-head p { margin: 0; color: var(--text-2); font-size: 14px; }

.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items: start; }
.hero h1 { margin: 0 0 12px; font-size: 34px; line-height: 1.25; letter-spacing: -.6px; }
.hero .lead { margin: 0 0 20px; color: var(--text-2); font-size: 16px; }
.hero .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.hero .sig { margin-top: 18px; font-size: 13px; color: var(--text-2); }
.hero .sig strong { color: var(--text); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card.tight { padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card p { margin: 0 0 10px; color: var(--text-2); font-size: 14px; }
.card p:last-child { margin-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--pill);
  font-size: 12px; background: #f1f5f9; color: var(--text-2);
}
.badge.blue { background: var(--blue-100); color: var(--blue-deep); }
.badge.cyan { background: #cffafe; color: var(--cyan-700); }
.badge.ok { background: #dcfce7; color: var(--success-text); }
.badge.warn { background: #fef3c7; color: var(--warning-text); }
.badge.err { background: #fee2e2; color: var(--error-text); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: var(--pill);
  font-size: 15px; font-weight: 500; border: 1px solid transparent;
  cursor: pointer; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-secondary:hover { background: var(--blue-100); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-danger { background: transparent; color: var(--error-text); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g4 { grid-template-columns: repeat(4, 1fr); }

.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.feature .ico {
  width: 34px; height: 34px; border-radius: 10px; background: var(--blue-100);
  display: grid; place-items: center; font-size: 17px; margin-bottom: 10px;
}
.feature h4 { margin: 0 0 5px; font-size: 15px; }
.feature p { margin: 0; font-size: 13px; color: var(--text-2); }
.feature.planned { opacity: .72; }
.feature.planned .ico { background: #f1f5f9; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.note {
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px;
  background: var(--blue-100); color: var(--blue-deep);
}
.note.cyan { background: #cffafe; color: var(--cyan-700); }
.note.warn { background: #fef3c7; color: var(--warning-text); }
.note.err { background: #fee2e2; color: var(--error-text); }
.note strong { font-weight: 600; }

ol.steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
ol.steps li { margin-bottom: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-2); font-weight: 500; font-size: 12.5px; background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }

.site-footer {
  margin-top: 40px; padding: 32px 0 40px;
  border-top: 1px solid var(--border); background: #fff;
}
.site-footer .wrap { display: grid; gap: 18px; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.footer-meta { font-size: 12.5px; color: var(--text-3); line-height: 1.9; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid.g3, .grid.g4 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 27px; }
}
@media (max-width: 560px) {
  .grid.g2, .grid.g3, .grid.g4 { grid-template-columns: 1fr; }
  .site-nav { gap: 12px; font-size: 13px; }
  section { padding: 32px 0; }
}

/* ================================================================ 管理后台 */
.admin-body { background: #f2f5fa; }
.admin-top {
  background: var(--blue-deep); color: #fff; padding: 0;
}
.admin-top .wrap { display: flex; align-items: center; gap: 14px; min-height: 56px; flex-wrap: wrap; }
.admin-top .brand { color: #fff; }
.admin-top .brand-sub { color: rgba(255, 255, 255, .75); }
.admin-tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.admin-tabs button {
  background: transparent; border: 0; color: rgba(255, 255, 255, .8);
  padding: 8px 14px; border-radius: var(--pill); cursor: pointer; font-size: 13.5px; font-family: inherit;
}
.admin-tabs button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.admin-tabs button.active { background: #fff; color: var(--blue-deep); font-weight: 600; }

.panel { display: none; }
.panel.active { display: block; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.stat .k { font-size: 12.5px; color: var(--text-2); }
.stat .v { font-size: 24px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--text-3); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
textarea { min-height: 120px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1 1 auto; }

.code-out {
  font-family: var(--mono); font-size: 12.5px; background: #0f172a; color: #e2e8f0;
  padding: 14px; border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow: auto;
}
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--text-2); }

#login-view { max-width: 380px; margin: 8vh auto; }
.hidden { display: none !important; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-tabs { margin-left: 0; }
}
