:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5f8;
  --line: #d8e0e7;
  --text: #111827;
  --muted: #5a6b7b;
  --blue: #1f6feb;
  --blue-dark: #174ea6;
  --green: #12845a;
  --amber: #a15c05;
  --red: #b42318;
  --shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f9fbfd 0%, var(--bg) 45%, #edf4f6 100%);
  color: var(--text);
  font-family: "Segoe UI", "Aptos", sans-serif;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

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

code {
  background: #f3f6fa;
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
}

.brand { display: grid; gap: 0.1rem; }
.brand strong { font-size: 1rem; }
.brand span { color: var(--muted); font-size: 0.82rem; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav a {
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.48rem 0.65rem;
}

.nav a:hover, .nav a.active {
  background: var(--surface-soft);
  color: var(--text);
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-meta {
  display: grid;
  gap: 0.05rem;
  text-align: right;
}

.user-meta strong { font-size: 0.92rem; }
.user-meta span { color: var(--muted); font-size: 0.82rem; }

.role-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8d7e5;
  border-radius: 999px;
  background: #f4f8fc;
  color: #24476b;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.28rem 0.62rem;
  white-space: nowrap;
}

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 0.3rem;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 3rem); max-width: 820px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.lead { color: var(--muted); max-width: 760px; margin: 0.65rem 0 0; }

.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.7fr); }

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

.panel.soft { background: var(--surface-soft); box-shadow: none; }
.panel + .panel { margin-top: 1rem; }

.metric { display: grid; gap: 0.4rem; }
.metric span { color: var(--muted); font-size: 0.86rem; }
.metric strong { font-size: 2rem; line-height: 1; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 0.78rem 0.55rem; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }

.form-grid { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label, .field-label { color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0.72rem 0.78rem;
}
.textarea { min-height: 130px; resize: vertical; }

.check-grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
}
.checkline { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.checkline input { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.checkline-compact { font-weight: 600; }
.check-option p { color: var(--muted); margin: 0.45rem 0 0; font-size: 0.9rem; }

.actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.inline-actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.inline-form { margin: 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  min-height: 2.4rem;
  padding: 0.58rem 0.82rem;
}
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.danger { border-color: #f2b8b5; color: var(--red); }
.button:hover { border-color: var(--blue); }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  white-space: nowrap;
}
.pill.neutral { background: #e9eef5; color: #344054; }
.pill.success { background: #dff7eb; color: var(--green); }
.pill.warning { background: #fff2d7; color: var(--amber); }
.pill.danger { background: #ffe3e0; color: var(--red); }

.flash {
  border: 1px solid #b8dec9;
  border-radius: 8px;
  background: #ecfff4;
  color: #116149;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.flash-danger {
  border-color: #f2b8b5;
  background: #fff2f1;
  color: #8a1f16;
}

.notice { color: var(--muted); margin: 0; }
.list { display: grid; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.list li { border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; }
.meta { color: var(--muted); font-size: 0.86rem; }
.stack { display: grid; gap: 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.timeline li { border-left: 3px solid var(--line); padding-left: 0.8rem; }
.timeline li.success { border-left-color: var(--green); }
.timeline li.warning { border-left-color: var(--amber); }
.timeline li.danger { border-left-color: var(--red); }

.auth-shell { padding-top: 2rem; }
.auth-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.auth-card { min-height: 100%; }
.form-hint { color: var(--muted); font-size: 0.86rem; margin: 0; }

.footer { color: var(--muted); font-size: 0.85rem; padding: 2rem 0 0; }

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

@media (max-width: 820px) {
  .topbar-inner, .page-head { align-items: flex-start; flex-direction: column; }
  .topbar-meta, .user-strip, .user-meta { width: 100%; justify-content: flex-start; text-align: left; }
  .grid-3, .grid-2, .check-grid { grid-template-columns: 1fr; }
  .main { padding-inline: 1rem; }
}