:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #14213d;
  --muted: #68708a;
  --line: #dfe5f2;
  --brand: #243c8f;
  --brand-dark: #182866;
  --danger-bg: #fff0f0;
  --danger-text: #8f1d1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.hero-panel,
.module-grid li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(20, 33, 61, 0.08);
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 2.1rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

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

form {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}

button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--brand);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button.secondary {
  width: auto;
  background: white;
  color: var(--brand);
  border: 1px solid var(--line);
}

.alert {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-weight: 700;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px clamp(20px, 4vw, 56px);
  background: white;
  border-bottom: 1px solid var(--line);
}

.topbar form {
  margin: 0;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 32px auto;
}

.hero-panel {
  padding: clamp(24px, 4vw, 44px);
  margin-bottom: 28px;
}

.module-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.module-grid li {
  padding: 20px;
  font-weight: 900;
}

.module-grid span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 24px;
}

.inline-form button {
  width: auto;
}

.table-card {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(20, 33, 61, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

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

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

@media (max-width: 720px) {
  .topbar,
  .inline-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: start;
  }
}

.topnav,
.actions-row,
.split-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topnav {
  justify-content: flex-end;
}

.topnav a,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: white;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.button-link.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.split-row {
  justify-content: space-between;
  align-items: flex-start;
}

.actions-row {
  margin-top: 20px;
}

.actions-row.compact {
  margin-top: 0;
}

.actions-row form {
  margin: 0;
}

button.danger {
  width: auto;
  background: #9f1d1d;
}

.form-card {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(20, 33, 61, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-card label {
  margin: 0;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  resize: vertical;
}

.span-2 {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

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

.detail-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  line-height: 1.4;
  word-break: break-word;
}

.spaced {
  margin-top: 24px;
}

.section-head {
  padding: 18px 18px 0;
}

.table-card a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: white;
}

.inline-form.three-col {
  grid-template-columns: 1fr minmax(180px, 240px) auto;
}

.inline-action {
  margin: 0;
}

.inline-action button {
  width: auto;
  padding: 9px 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(20, 33, 61, 0.08);
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 2rem;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef2ff;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #b9e5c7;
  border-radius: 16px;
  background: #effaf2;
  color: #1f6f3a;
  font-weight: 800;
}

@media (max-width: 720px) {
  .inline-form.three-col {
    grid-template-columns: 1fr;
  }
}

.compact-card {
  max-width: 760px;
}

.form-card.compact-card button {
  width: fit-content;
}

.metric-date {
  font-size: 1.05rem !important;
  line-height: 1.3;
}
