:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #1c1a1a;
  --panel-2: #231f20;
  --text: #f3f1ee;
  --muted: #b8aea7;
  --border: rgba(255,255,255,0.08);
  --accent: #2f63d8;
  --accent-2: #7b2d26;
  --coffee: #5d4037;
  --success: #1d6f42;
  --danger: #8e2a2a;
  --info: #355c7d;
  --shadow: 0 18px 40px rgba(0,0,0,0.28);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #0f0f10 0%, #1a1415 100%);
  color: var(--text);
}
a { color: #c7d8ff; text-decoration: none; }
a:hover { color: white; }
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.brand { font-size: 1.7rem; font-weight: 700; color: white; }
.tagline { margin: 6px 0 0; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav { display: flex; gap: 12px; flex-wrap: wrap; }
.username {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
}
.grid { display: grid; gap: 20px; }
.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-grid { margin-top: 20px; }
.card {
  background: linear-gradient(180deg, rgba(38, 31, 32, 0.95), rgba(25, 22, 22, 0.98));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 24px;
}
.accent-card {
  background: linear-gradient(180deg, rgba(31, 54, 107, 0.95), rgba(54, 22, 22, 0.95));
}
.narrow { max-width: 460px; margin: 6vh auto 0; }
.wide-on-mobile { width: 100%; }
.section-heading h1, .section-heading h2 { margin: 0 0 8px; }
.section-heading p { margin: 0 0 18px; color: var(--muted); }
.section-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.eyebrow { color: #d6c7be; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.metric { font-size: 2.4rem; font-weight: 700; margin: 12px 0 0; }
.field-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field-group label { font-weight: 600; }
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
}
.input:focus {
  outline: 2px solid rgba(47,99,216,0.35);
  border-color: rgba(47,99,216,0.5);
}
.primary-button, .ghost-button, .inline-button, .inline-danger {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--accent), #5b86f7);
}
.ghost-button, .inline-button {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
}
.inline-danger {
  color: #ffd7d7;
  background: rgba(142,42,42,0.2);
  border: 1px solid rgba(142,42,42,0.5);
  padding: 8px 12px;
}
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.text-link { color: #d8e4ff; font-weight: 600; }
.form-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.align-end { align-items: end; }
.filter-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.filter-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hint-box {
  background: rgba(123,45,38,0.18);
  border: 1px solid rgba(123,45,38,0.4);
  color: #f4d9d5;
  padding: 14px;
  border-radius: 14px;
}
.flash-stack { display: grid; gap: 10px; margin-bottom: 20px; }
.flash {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid transparent;
}
.flash.success { background: rgba(29,111,66,0.25); border-color: rgba(29,111,66,0.5); }
.flash.danger { background: rgba(142,42,42,0.25); border-color: rgba(142,42,42,0.5); }
.flash.info { background: rgba(53,92,125,0.25); border-color: rgba(53,92,125,0.5); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: top;
}
th { color: #dbcfc8; font-weight: 600; }
.empty-state { color: var(--muted); margin: 0; }
.errors { list-style: none; padding: 0; margin: 0; color: #ffb4b4; font-size: 0.92rem; }
.inline-actions { display: flex; gap: 10px; align-items: center; }
.inline-actions.wrap { flex-wrap: wrap; }
.inline-actions form { margin: 0; }
.checkbox-grid { display: grid; gap: 12px; margin-top: 8px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
}
@media (max-width: 900px) {
  .two-column, .filter-grid, .filter-grid.compact { grid-template-columns: 1fr; }
  .topbar, .section-heading-row { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .shell { padding-left: 12px; padding-right: 12px; }
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}
.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.lookup-button[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}
.lookup-status {
  min-height: 24px;
  margin: -4px 0 12px;
  color: var(--muted);
}
.lookup-status.is-error { color: #ffb4b4; }
.lookup-status.is-success { color: #bfe8c9; }
.lookup-results {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}
.lookup-results-heading {
  color: #dbcfc8;
  font-weight: 600;
}
.lookup-result {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
}
.lookup-result:hover {
  border-color: rgba(47,99,216,0.55);
  background: rgba(47,99,216,0.12);
}
.lookup-result strong,
.lookup-result span,
.lookup-result small {
  display: block;
}
.lookup-result span,
.lookup-result small,
.cell-subline {
  color: var(--muted);
  margin-top: 4px;
}
code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 8px;
}
@media (max-width: 900px) {
  .lookup-row { grid-template-columns: 1fr; }
}
