:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef4f2;
  --text: #17201f;
  --muted: #66736f;
  --line: #dbe2df;
  --accent: #247a6b;
  --accent-strong: #14584c;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 18px 45px rgba(26, 38, 36, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(320px, 440px);
  min-height: 100vh;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: 520px;
  padding: 56px;
  background: #173a35;
  color: white;
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.09), transparent 38%),
    url("data:image/svg+xml,%3Csvg width='900' height='900' viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16'%3E%3Cpath d='M120 170h660M120 320h660M120 470h660M120 620h660M230 90v700M410 90v700M590 90v700'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.18'%3E%3Crect x='150' y='120' width='150' height='82' rx='8'/%3E%3Crect x='450' y='270' width='260' height='82' rx='8'/%3E%3Crect x='230' y='520' width='210' height='82' rx='8'/%3E%3Crect x='560' y='645' width='160' height='82' rx='8'/%3E%3C/g%3E%3C/svg%3E") center / cover;
}

.visual-grid {
  position: absolute;
  inset: 42px;
  display: grid;
  grid-template-columns: repeat(4, minmax(66px, 1fr));
  grid-auto-rows: 78px;
  gap: 16px;
  opacity: 0.7;
}

.visual-grid span {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

.visual-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.visual-copy p,
.eyebrow {
  margin: 0 0 12px;
  color: #6b8f88;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.visual-copy h1 {
  margin: 0;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 0.95;
}

.visual-copy span {
  display: block;
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 20px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 48px;
  background: var(--panel);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f6;
}

.segmented button,
.side-nav button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
}

.segmented button.is-active,
.side-nav button.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(31, 45, 42, 0.08);
}

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 122, 107, 0.14);
}

.primary-action,
.ghost-action,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.ghost-action {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.demo-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.demo-note button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  padding: 0;
}

.is-hidden {
  display: none !important;
}

.public-layout {
  min-height: 100vh;
  background: #f6f7f9;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 5vw, 58px);
  border-bottom: 1px solid rgba(219, 226, 223, 0.82);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topnav a,
.ghost-link,
.primary-link {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.topnav a {
  color: var(--muted);
  font-size: 14px;
}

.nav-pill {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff !important;
  padding: 0 12px;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 36px;
  align-items: center;
  min-height: 590px;
  padding: clamp(34px, 6vw, 76px) clamp(18px, 5vw, 58px);
  background:
    linear-gradient(120deg, rgba(36, 122, 107, 0.12), rgba(255, 255, 255, 0) 45%),
    #eef4f2;
}

.public-hero-copy {
  max-width: 760px;
}

.public-hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 1.02;
}

.public-hero p:not(.eyebrow) {
  max-width: 620px;
  margin: 20px 0 0;
  color: #4b5f5a;
  font-size: 19px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-link,
.ghost-link {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
}

.primary-link {
  background: var(--accent);
  color: #fff;
}

.ghost-link {
  border: 1px solid var(--line);
  background: #fff;
}

.hero-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(36, 122, 107, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.hero-board span {
  min-height: 76px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  color: #29423d;
  font-weight: 800;
}

.hero-board a {
  min-height: 76px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  color: #29423d;
  font-weight: 800;
  text-decoration: none;
}

.public-content,
.feature-band,
.auth-strip,
.seo-section {
  padding: clamp(30px, 5vw, 58px) clamp(18px, 5vw, 58px);
}

.section-heading,
.auth-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2,
.auth-strip h2,
.seo-section h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

.public-nav-root {
  display: grid;
  gap: 28px;
  margin-top: 28px;
}

.public-card {
  color: inherit;
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  background: #fff;
}

.feature-band article {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f9fbfa;
}

.feature-band strong,
.feature-band span {
  display: block;
}

.feature-band strong {
  font-size: 20px;
}

.feature-band span {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.auth-strip {
  align-items: center;
  background: #173a35;
  color: #fff;
}

.auth-strip > div:first-child {
  max-width: 620px;
}

.auth-strip p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.7;
}

.auth-strip .auth-panel {
  width: min(460px, 100%);
  border-radius: 8px;
  padding: 24px;
  color: var(--text);
  box-shadow: var(--shadow);
}

.install-page,
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef4f2;
}

.install-card,
.auth-card {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(460px, 100%);
}

.install-card h1,
.auth-card h1 {
  margin: 24px 0 12px;
  font-size: 34px;
}

.install-card p,
.auth-card p {
  color: var(--muted);
  line-height: 1.65;
}

.auth-switch a {
  color: var(--accent-strong);
  font-weight: 800;
}

.notice {
  border-radius: 8px;
  margin: 14px 0;
  padding: 12px 14px;
  font-weight: 700;
}

.notice-success {
  background: #e8f7f1;
  color: #17624f;
}

.notice-error {
  background: #ffe8e6;
  color: var(--danger);
}

.dashboard-lite {
  display: grid;
  gap: 22px;
  padding: 30px clamp(18px, 5vw, 58px);
}

.workspace-header.inline {
  margin: 0;
}

.search-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.two-cols,
.two-panel {
  display: grid;
  gap: 14px;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.small-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.small-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

td form {
  margin: 0;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px clamp(18px, 5vw, 58px);
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.site-footer strong,
.site-footer span {
  display: block;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.seo-section {
  background: #fff;
}

.seo-section p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.seo-link-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.seo-link-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.dashboard {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav button {
  width: 100%;
  text-align: left;
}

#logout-button {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.workspace-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  width: min(38vw, 420px);
}

.view-root {
  display: grid;
  gap: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.stat-box,
.tool-panel,
.admin-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat-box {
  padding: 18px;
}

.stat-box span {
  color: var(--muted);
  font-size: 13px;
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.category-band {
  display: grid;
  gap: 12px;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-title h2 {
  margin: 0;
  font-size: 20px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.link-card {
  position: relative;
  display: grid;
  min-height: 150px;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.link-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.link-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

.link-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.link-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.link-url {
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.tool-panel,
.admin-panel,
.empty-state {
  padding: 18px;
}

.tool-panel h2,
.admin-panel h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch {
  width: 38px;
  height: 38px;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}

.color-swatch.is-active {
  box-shadow: 0 0 0 3px var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.badge.danger {
  background: #ffe8e6;
  color: var(--danger);
}

.badge.warning {
  background: #fff4df;
  color: var(--warning);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 22, 0.48);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-heading h2 {
  margin: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
}

.check-row span {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-tabs,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 940px) {
  .auth-layout,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .public-hero,
  .auth-strip {
    grid-template-columns: 1fr;
  }

  .public-hero {
    min-height: auto;
  }

  .section-heading,
  .auth-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .feature-band {
    grid-template-columns: 1fr;
  }

  .two-cols,
  .two-panel {
    grid-template-columns: 1fr;
  }

  .search-form,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-visual {
    min-height: 320px;
    padding: 34px;
  }

  .auth-panel {
    padding: 32px 22px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-nav button {
    text-align: center;
  }

  .workspace {
    padding: 20px;
  }

  .workspace-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .stats-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .public-hero h1 {
    font-size: 42px;
  }

  .hero-board {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 260px;
  }

  .visual-copy h1 {
    font-size: 44px;
  }

  .side-nav,
  .stats-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .link-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column;
  }
}
