:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --surface: #ffffff;
  --surface-muted: #f1f5ed;
  --ink: #1d2320;
  --muted: #667069;
  --line: #d9ded7;
  --accent: #23745a;
  --accent-strong: #185741;
  --amber: #a96816;
  --danger: #a43d3d;
  --shadow: 0 16px 40px rgba(29, 35, 32, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

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

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

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

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.1;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 36px);
  background: rgba(247, 247, 243, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.app-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 36px) 48px;
}

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

.stat {
  min-height: 86px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 750;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tab[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.view {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

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

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(35, 116, 90, 0.22);
  border-color: var(--accent);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

.secondary {
  padding: 0 14px;
}

.status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--accent-strong);
  font-size: 13px;
}

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

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

.empty {
  margin: 0;
  color: var(--muted);
}

.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.record-title {
  margin: 0;
  font-size: 16px;
}

.badge {
  flex: none;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-muted);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.record dl {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  color: var(--muted);
}

.record dt {
  color: var(--ink);
  font-weight: 700;
}

.record dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-block {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-number {
  display: block;
  margin-top: 8px;
  color: var(--amber);
  font-size: 30px;
  font-weight: 800;
}

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.export-row a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.export-row a:hover {
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}

@media (max-width: 780px) {
  .app-header {
    align-items: flex-start;
  }

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

  .view,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    position: sticky;
    top: 70px;
    z-index: 9;
    background: var(--bg);
    padding: 6px 0;
  }
}

@media (max-width: 480px) {
  .split,
  .stats,
  .tabs {
    grid-template-columns: 1fr;
  }

  .record dl {
    grid-template-columns: 1fr;
  }
}
