:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --bg-strong: #fbf8f2;
  --surface: rgba(251, 248, 242, 0.86);
  --surface-strong: #fffdf9;
  --line: rgba(96, 89, 80, 0.16);
  --line-strong: rgba(37, 38, 41, 0.14);
  --text: #1b1c1d;
  --muted: #605950;
  --accent: #27435d;
  --accent-soft: #e7edf2;
  --secondary: #6a7b70;
  --warning: #8e6146;
  --danger: #8d4b40;
  --success: #4f6b57;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-sans: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 12px 30px rgba(39, 67, 93, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(231, 237, 242, 0.96), transparent 28%),
    radial-gradient(circle at right center, rgba(106, 123, 112, 0.14), transparent 24%),
    linear-gradient(180deg, #f8f4ee 0%, #eee9e1 100%);
}

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

a {
  color: var(--accent);
}

.shell {
  min-height: 100vh;
  padding: 1.4rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, 1280px);
  margin: 0 auto 1.4rem;
}

.brand-lockup {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #27435d, #486685);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.73rem;
  color: var(--muted);
}

h1,
h2,
h3,
p,
dl,
dt,
dd {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-status {
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
}

.layout {
  width: min(100%, 1280px);
  margin: 0 auto;
}

.card,
.hero,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.card {
  border-radius: var(--radius-lg);
  padding: 1.35rem;
}

.auth-card {
  max-width: 480px;
  margin: 5vh auto 0;
}

.shell.auth-only .auth-card {
  margin-top: 12vh;
}

.app-shell {
  display: grid;
  gap: 1rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem;
  border-radius: var(--radius-lg);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.8rem;
  min-width: min(100%, 420px);
}

.hero-meta div {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.hero-meta dt {
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.hero-meta dd {
  font-weight: 600;
}

.dashboard-grid,
.module-grid {
  display: grid;
  gap: 1rem;
}

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

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

.stat-card strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.detail,
.message,
.card-header p,
.empty-state {
  color: var(--muted);
}

.card-header {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-grid,
.inline-form {
  display: grid;
  gap: 0.85rem;
}

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

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0.8rem 0.9rem;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(39, 67, 93, 0.18);
  border-color: rgba(39, 67, 93, 0.3);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

.button.secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--text);
}

.button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.list-panel,
.table-panel {
  display: grid;
  gap: 0.75rem;
}

.result-row,
.activity-row,
.admin-row {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 0.35rem;
}

.result-row button,
.admin-row button {
  justify-self: start;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
}

.pill.warning {
  background: rgba(142, 97, 70, 0.12);
  color: var(--warning);
}

.pill.success {
  background: rgba(79, 107, 87, 0.14);
  color: var(--success);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.detail-card {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.detail-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.05rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

th,
td {
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.message {
  min-height: 1.3rem;
  margin-top: 0.65rem;
}

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

.message.success {
  color: var(--success);
}

.empty-state {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.42);
}

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

@media (max-width: 980px) {
  .topbar,
  .hero {
    flex-direction: column;
  }

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

  .hero-meta,
  .inline-form {
    grid-template-columns: 1fr;
  }
}
