:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #eef4f1;
  --ink: #1e2825;
  --muted: #64716d;
  --line: #dbe3df;
  --brand: #276c62;
  --brand-dark: #174c45;
  --warn: #a85d20;
  --danger: #a23b3b;
  --ok: #2f7958;
  --shadow: 0 10px 30px rgba(26, 42, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
}

.auth-hero {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(rgba(20, 60, 55, 0.82), rgba(20, 60, 55, 0.72)),
    url("https://images.unsplash.com/photo-1497633762265-9d179a990aa6?auto=format&fit=crop&w=1500&q=80");
  background-size: cover;
  background-position: center;
  color: white;
}

.auth-hero h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-hero p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.8;
}

.auth-panel {
  align-self: center;
  width: min(520px, calc(100% - 48px));
  margin: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 5px;
  background: var(--panel-soft);
  border-radius: 8px;
  margin-bottom: 24px;
}

.tabs button,
.segment button {
  min-height: 42px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tabs button.active,
.segment button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

.form {
  display: grid;
  gap: 16px;
}

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

.field span,
.label {
  color: var(--muted);
  font-size: 13px;
}

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

textarea {
  min-height: 130px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 108, 98, 0.12);
}

.btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 7px;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn.secondary {
  background: var(--panel-soft);
  color: var(--ink);
}

.btn.secondary:hover {
  background: #e0ebe6;
}

.btn.ghost {
  background: transparent;
  color: var(--brand);
  min-height: 36px;
  padding: 0 8px;
}

.btn.danger {
  background: #f7e9e9;
  color: var(--danger);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(246, 247, 244, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav button {
  min-height: 38px;
  border-radius: 7px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.nav button.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.content {
  width: min(1240px, calc(100% - 40px));
  margin: 28px auto 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: 0;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h3 {
  margin: 0;
  font-size: 18px;
}

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

.stat b {
  font-size: 34px;
  letter-spacing: 0;
}

.stat span {
  color: var(--muted);
}

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

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: white;
  display: grid;
  gap: 10px;
}

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

.item h4 {
  margin: 0;
  font-size: 16px;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--brand-dark);
  font-size: 12px;
}

.pill.warn {
  background: #f8eadf;
  color: var(--warn);
}

.pill.ok {
  background: #e2f0e8;
  color: var(--ok);
}

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

.subject-block {
  display: grid;
  gap: 10px;
}

.subject-title {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.empty {
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 22px;
}

.reader {
  display: grid;
  gap: 16px;
}

.reader-content {
  white-space: pre-wrap;
  line-height: 1.85;
  padding: 18px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 220px;
}

.segment {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 6px;
  padding: 5px;
  background: var(--panel-soft);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 48px));
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .auth-shell,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 360px;
    padding: 32px;
  }

  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .content {
    width: min(100% - 24px, 1240px);
    margin-top: 18px;
  }
}

@media (max-width: 560px) {
  .auth-panel {
    width: calc(100% - 24px);
    padding: 20px;
  }

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

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

  .userbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions .btn {
    width: 100%;
  }
}
