:root {
  color-scheme: light;
  --ink: #073f57;
  --ink-2: #3e5f6e;
  --paper: #f3f8fa;
  --surface: #ffffff;
  --line: #cfe0e7;
  --accent: #c9152b;
  --accent-strong: #a90e21;
  --gold: #ffd21a;
  --blue: #0a6383;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(5, 73, 99, 0.14);
  --radius: 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 4%, rgba(255, 210, 26, 0.25), transparent 25rem),
    linear-gradient(180deg, #fbfdfe 0%, var(--paper) 100%);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(5, 73, 99, .16);
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.icon-button:hover { transform: rotate(10deg); border-color: var(--ink); background: #fff; }
.icon-button svg { width: 21px; height: 21px; }

.home-main {
  width: min(1180px, calc(100% - 32px));
  margin: 20px auto 64px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  padding: clamp(32px, 6vw, 76px);
  border-radius: 32px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 210, 26, 0.36);
  border-radius: 50%;
}

.hero::before { width: 440px; height: 440px; right: -180px; top: -210px; }
.hero::after { width: 320px; height: 320px; right: 10px; bottom: -245px; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.65rem, 7vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.hero-note {
  max-width: 520px;
  margin: 28px 0 0;
  color: #cbd5e1;
  font-size: 1.05rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: -64px;
  padding: 0 clamp(18px, 4vw, 52px);
  position: relative;
}

.feature-card {
  min-height: 210px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  text-decoration: none;
  box-shadow: 0 16px 34px rgba(16, 35, 63, 0.08);
}

.feature-card.primary {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.feature-card.primary:hover { transform: translateY(-5px); box-shadow: 0 22px 40px rgba(16, 35, 63, 0.14); }
.feature-card h2 { margin: 0; font-size: clamp(1.45rem, 2.8vw, 2.15rem); line-height: 1.1; letter-spacing: -0.04em; }
.feature-card p { margin: 10px 0 0; color: var(--ink-2); }
.feature-card.primary p { color: rgba(255,255,255,.82); }
.feature-card.primary .eyebrow { color: var(--gold) !important; }
.feature-card .arrow { align-self: flex-end; font-size: 2rem; line-height: 1; }
.feature-card.placeholder { border-style: dashed; background: rgba(255,255,255,.56); color: #7a8798; }
.feature-card.placeholder h2 { font-size: 1.2rem; letter-spacing: 0; }

.page-shell {
  width: min(940px, calc(100% - 32px));
  margin: 18px auto 72px;
}

.page-heading { margin: 30px 0 28px; }
.page-heading h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -0.055em; }
.page-heading p { margin: 14px 0 0; color: var(--ink-2); font-size: 1.05rem; }

.form-card {
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.form-section { padding: 32px 0; border-bottom: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; }
.form-section:last-of-type { border-bottom: 0; }
.section-title { display: flex; gap: 13px; align-items: center; margin-bottom: 22px; }
.section-number { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--gold); font-weight: 800; font-size: .84rem; }
.section-title h2 { margin: 0; font-size: 1.24rem; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label, .legend { color: var(--ink); font-size: .92rem; font-weight: 750; }
.required { color: var(--danger); }
.hint { color: #6d7888; font-size: .82rem; font-weight: 500; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cfd7ca;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfcfa;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea { min-height: 128px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(36,89,224,.11); background: #fff; }

.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  position: relative;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid #cfd7ca;
  border-radius: 999px;
  background: #fff;
  font-weight: 650;
}
.choice input:checked + span { border-color: var(--ink); color: var(--accent); background: var(--ink); }
.choice input:focus-visible + span { outline: 3px solid rgba(36,89,224,.25); outline-offset: 2px; }

.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 16px 0; }
.toggle-line + .toggle-line { border-top: 1px solid var(--line); }
.toggle-copy strong { display: block; }
.toggle-copy small { display: block; max-width: 560px; margin-top: 3px; color: #6d7888; }
.switch { position: relative; flex: 0 0 auto; width: 52px; height: 30px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd3c8; cursor: pointer; transition: background 150ms ease; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 4px; top: 4px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform 150ms ease; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid rgba(36,89,224,.25); outline-offset: 2px; }

.conditional { margin-top: 18px; padding: 20px; border-radius: 18px; background: #f4f7ee; }
.conditional[hidden] { display: none; }
.conditional .field + .field { margin-top: 16px; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; }
.button {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, opacity 150ms ease;
}
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.secondary { color: var(--ink); background: #edf0ea; }
.button.accent { color: #fff; background: var(--accent); }
.button.export { color: #fff; background: var(--accent); }
.button.small { min-height: 38px; padding: 8px 13px; font-size: .84rem; }

dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 40px));
  border: 0;
  border-radius: 24px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 30px 90px rgba(8, 19, 35, .3);
}
dialog::backdrop { background: rgba(7, 19, 36, .62); backdrop-filter: blur(6px); }
.dialog-body { padding: 28px; overflow: auto; }
.dialog-body h2 { margin: 0; font-size: 1.75rem; letter-spacing: -.035em; }
.dialog-body > p { margin: 8px 0 20px; color: var(--ink-2); }
.summary-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.summary-list li { padding: 13px 14px; border-radius: 12px; background: #f5f7f2; }
.summary-list strong { display: block; margin-bottom: 2px; font-size: .78rem; color: #647184; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 13px 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.success-panel { padding: clamp(36px, 8vw, 80px) 24px; text-align: center; }
.success-icon { width: 74px; height: 74px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: var(--gold); font-size: 2rem; font-weight: 900; }
.success-panel h2 { margin: 0; font-size: 2rem; }
.success-panel p { margin: 10px auto 24px; max-width: 480px; color: var(--ink-2); }

/* Admin */
.admin-body { background: #edf5f7; }
.admin-shell { width: min(1320px, calc(100% - 32px)); margin: 16px auto 60px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin: 24px 0 28px; }
.admin-topbar h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -.05em; }
.admin-topbar p { margin: 10px 0 0; color: var(--ink-2); }
.admin-actions { display: flex; gap: 10px; }

.login-wrap { min-height: calc(100vh - 130px); display: grid; place-items: center; padding: 30px 0; }
.login-card { width: min(440px, 100%); padding: 34px; border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.login-card .lock { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--gold); background: var(--ink); }
.login-card h1 { margin: 22px 0 8px; font-size: 2rem; letter-spacing: -.04em; }
.login-card p { margin: 0 0 22px; color: var(--ink-2); }
.login-card .button { width: 100%; margin-top: 14px; }

.dashboard[hidden], .login-wrap[hidden] { display: none; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.metric span { color: #687587; font-size: .85rem; font-weight: 650; }
.metric strong { display: block; margin-top: 7px; font-size: 2.35rem; line-height: 1; letter-spacing: -.04em; }

.data-panel { border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: #fff; }
.data-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.data-toolbar h2 { margin: 0; font-size: 1.15rem; }
.search-wrap { position: relative; width: min(360px, 100%); }
.search-wrap input { padding-left: 42px; background: #f6f8f4; }
.search-wrap svg { position: absolute; left: 14px; top: 15px; width: 20px; color: #718092; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid #edf0ea; text-align: left; vertical-align: middle; }
th { color: #6b7788; background: #fafbf9; font-size: .78rem; letter-spacing: .05em; }
td { font-size: .92rem; }
tbody tr:hover { background: #fbfcf8; }
.title-cell strong, .title-cell span { display: block; }
.title-cell span { color: #758193; font-size: .82rem; }
.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; color: #2042a0; background: #e8eeff; font-size: .78rem; font-weight: 700; }
.tag.mic { color: #5e4200; background: #fff3c6; }
.empty-state { padding: 70px 24px; text-align: center; color: #6d7888; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 1.1rem; }
.loading { padding: 50px; text-align: center; color: #6d7888; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-item { min-width: 0; padding: 14px; border-radius: 13px; background: #f5f7f2; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item dt { margin-bottom: 4px; color: #6b7788; font-size: .78rem; font-weight: 700; }
.detail-item dd { margin: 0; }

.settings-shell { max-width: 840px; }
.settings-grid { display: grid; gap: 18px; }
.settings-card { padding: clamp(24px, 5vw, 38px); border: 1px solid var(--line); border-radius: 24px; display: flex; justify-content: space-between; align-items: center; gap: 28px; background: #fff; box-shadow: 0 16px 38px rgba(5,73,99,.08); }
.settings-card h2 { margin: 0; font-size: 1.35rem; }
.settings-card p { margin: 6px 0 0; color: var(--ink-2); }
.language-options { display: flex; gap: 10px; flex: 0 0 auto; }
.language-option { position: relative; cursor: pointer; }
.language-option input { position: absolute; opacity: 0; }
.language-option span { min-width: 100px; min-height: 48px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; display: grid; place-items: center; font-weight: 750; background: #f7fafb; }
.language-option input:checked + span { border-color: var(--accent); color: #fff; background: var(--accent); }
.language-option input:focus-visible + span { outline: 3px solid rgba(10,99,131,.2); outline-offset: 2px; }

@media (max-width: 760px) {
  .site-header { min-height: 72px; }
  .home-main { margin-top: 8px; }
  .hero { min-height: 390px; padding-top: 50px; }
  .feature-grid { grid-template-columns: 1fr; margin-top: -42px; }
  .feature-card { min-height: 160px; }
  .field-grid, .metric-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-item.full { grid-column: auto; }
  .toggle-line { align-items: flex-start; }
  .form-actions, .dialog-actions { flex-direction: column-reverse; }
  .form-actions .button, .dialog-actions .button { width: 100%; }
  .admin-topbar, .data-toolbar { align-items: stretch; flex-direction: column; }
  .admin-actions { width: 100%; }
  .admin-actions .button { flex: 1; }
  .search-wrap { width: 100%; }
  .settings-card { align-items: stretch; flex-direction: column; }
  .language-options { width: 100%; }
  .language-option { flex: 1; }
  .language-option span { min-width: 0; }
  .admin-setting .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
