:root {
  color-scheme: light;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-soft: #f7f9f7;
  --line: #d8e0dc;
  --line-strong: #bdc9c3;
  --text: #17211d;
  --muted: #61706a;
  --accent: #0f766e;
  --accent-strong: #0b5d56;
  --accent-soft: #e1f3ef;
  --warn: #b87503;
  --danger: #b42318;
  --success: #168254;
  --shadow: 0 18px 50px rgba(30, 45, 38, 0.1);
  --radius: 8px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-card h1,
.topbar h1 {
  margin: 0;
  letter-spacing: 0;
}

.auth-card h1 {
  font-size: 1.75rem;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #10231f;
  color: #eef9f5;
}

.brand-block {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(238, 249, 245, 0.16);
}

.brand-block .eyebrow {
  color: #8ed9cc;
}

.brand-block strong {
  display: block;
  font-size: 1.35rem;
}

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

.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(238, 249, 245, 0.72);
  text-decoration: none;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(238, 249, 245, 0.1);
  color: #ffffff;
}

.logout-button {
  margin-top: auto;
  width: 100%;
  border: 1px solid rgba(238, 249, 245, 0.24);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.topbar,
.panel,
.metric,
.record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: 1.35rem;
  word-break: break-all;
}

.topbar-actions,
.actions,
.record-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.metric {
  min-height: 116px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric strong {
  font-size: 1.75rem;
  line-height: 1.1;
}

.metric:last-child strong {
  font-size: 1rem;
  line-height: 1.4;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.3fr) minmax(160px, 0.5fr) minmax(120px, 0.35fr);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
}

.field input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.14);
  border-color: var(--accent);
}

.primary-button,
.secondary-button,
.ghost-button,
.copy-button,
.delete-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 800;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.copy-button:hover,
.delete-button:hover,
.logout-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

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

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.copy-button {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.delete-button {
  background: #fff0ed;
  color: var(--danger);
}

.status {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.status.is-error {
  color: var(--danger);
}

.status.is-success {
  color: var(--success);
}

.records {
  display: grid;
  gap: 10px;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
}

.record-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.latest-card {
  display: grid;
}

.record-main {
  min-width: 0;
}

.record-title {
  margin: 0;
  font-weight: 800;
}

.record-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.record-link {
  display: inline-block;
  margin-top: 10px;
  max-width: 100%;
  color: var(--accent-strong);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.record-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand-block {
    padding: 0 16px 0 0;
    border-right: 1px solid rgba(238, 249, 245, 0.16);
    border-bottom: 0;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
  }

  .logout-button {
    width: auto;
    margin: 0 0 0 auto;
    white-space: nowrap;
  }

  .metric-grid,
  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .latest-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .auth-view,
  .workspace {
    padding: 14px;
  }

  .auth-card,
  .panel,
  .topbar {
    padding: 16px;
  }

  .sidebar {
    padding: 14px;
  }

  .topbar,
  .record-card,
  .topbar-actions,
  .actions,
  .record-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .copy-button,
  .delete-button {
    width: 100%;
  }
}
