/* Anstoss Admin — light, direct, and deliberately motion-free. */

:root {
  color-scheme: light;
  --page: #f5f3ee;
  --surface: #ffffff;
  --surface-muted: #efede7;
  --ink: #181b18;
  --ink-soft: #303630;
  --muted: #566057;
  --faint: #586159;
  --line: #dedbd2;
  --line-strong: #c7c3b8;
  --red: #bd1e15;
  --red-hover: #a91810;
  --red-soft: #fce8e5;
  --green: #21784a;
  --green-soft: #e7f4ec;
  --amber: #805207;
  --amber-soft: #faf0d8;
  --danger: #a61b12;
  --danger-soft: #fdebea;
  --sidebar: 220px;
  --content: 1240px;
  --control-radius: 8px;
  --surface-radius: 12px;
}

* { box-sizing: border-box; }
*, *::before, *::after { animation: none !important; transition: none !important; }

html { min-height: 100%; background: var(--page); scroll-behavior: auto; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.app-shell[hidden],
.login-shell[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
code, pre, .mono { font-family: "SFMono-Regular", "Cascadia Code", Menlo, monospace; font-size: 0.92em; }
code { color: #394139; overflow-wrap: anywhere; }
::selection { color: white; background: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: white;
  background: var(--red);
  border-radius: var(--control-radius);
  font-weight: 700;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.login-shell {
  min-height: 100vh;
  padding: 32px 20px;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(100%, 460px);
  padding: clamp(24px, 4vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(24, 27, 24, 0.08);
}

.login-card__brand {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 630;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.login-copy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.login-submit { width: 100%; }
.login-status { margin-top: 16px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand { padding: 0 8px; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 32px; display: block; object-fit: cover; border-radius: 9px; }
.brand-name { color: var(--ink); font-size: 15px; font-weight: 720; letter-spacing: -0.02em; }
.brand-context { margin-top: 1px; color: var(--faint); font-size: 11px; }
.mobile-nav-toggle { display: none; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-icon { display: none; }
.nav-item {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  color: #4f5950;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 580;
}
.nav-item:hover { color: var(--ink); background: #f3f1ec; }
.nav-item.active { color: var(--ink); background: #ece9e2; font-weight: 680; }

.sidebar-foot {
  min-height: 44px;
  margin-top: auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.sidebar-foot a { min-height: 24px; display: inline-flex; align-items: center; }
.sidebar-foot__meta { margin-left: auto; color: var(--faint); font-size: 10px; }

.main {
  width: calc(100% - var(--sidebar));
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 0 clamp(28px, 5vw, 72px) 80px;
}

.command-bar {
  min-height: 68px;
  max-width: var(--content);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.command-bar__route, .command-bar__meta { display: flex; align-items: center; gap: 10px; }
.command-bar__label { color: var(--faint); font-size: 11px; }
#current-route { color: var(--ink); font-size: 12px; font-weight: 660; }
.environment-chip, .command-link {
  min-height: 34px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 620;
}
.environment-chip > span { width: 5px; height: 5px; background: var(--green); border-radius: 50%; }
.command-link:hover { color: var(--ink); border-color: var(--line-strong); }

.page { max-width: var(--content); margin: 0 auto; padding-top: clamp(46px, 6vw, 78px); }
.page[hidden] { display: none; }
.eyebrow { margin: 0 0 12px; color: var(--red); font-size: 11px; font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
.welcome, .page > h1 { max-width: 760px; margin: 0; color: var(--ink); font-size: clamp(40px, 5vw, 64px); font-weight: 630; letter-spacing: -0.055em; line-height: 1; }
.lede { max-width: 720px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.muted-line { margin: 12px 0 0; color: var(--faint); font-size: 12px; line-height: 1.55; }

.stat-row { margin-top: clamp(34px, 5vw, 52px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 150px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--surface-radius); }
.stat-label { margin: 0; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.stat-value { margin: 26px 0 6px; color: var(--ink); font-size: clamp(34px, 4vw, 50px); font-weight: 610; letter-spacing: -0.06em; line-height: 0.9; }
.stat-sub { margin: 0; color: var(--faint); font-size: 11px; }

.grid-2 { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr); gap: 12px; align-items: start; }
.grid-2 > * { min-width: 0; }
.panel, .list-card, .setting-card { padding: clamp(20px, 2.5vw, 30px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--surface-radius); }
.panel { margin-top: 24px; }
.grid-2 > .panel { margin-top: 0; }
.panel--soft { background: var(--surface-muted); }
.overview-notice { max-width: 760px; }
.panel h2, .list-card h3 { margin: 0; color: var(--ink); font-weight: 630; letter-spacing: -0.035em; }
.panel h2 { font-size: clamp(21px, 2vw, 28px); }
.list-card h3 { font-size: 15px; }
.panel-head, .list-card header, .setting-card header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.action-list { margin: 22px 0 0; padding: 0; list-style: none; }
.action-list a { min-height: 48px; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--ink-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.action-list a::after { content: "↗"; color: var(--faint); }
.action-list li:last-child a { border-bottom: 0; }
.action-list a:hover { color: var(--red); }

.section-tabs { margin-top: 30px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.section-tab { min-height: 44px; padding: 12px 16px 10px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 12px; font-weight: 620; }
.section-tab:hover { color: var(--ink); }
.section-tab--active { color: var(--ink); border-bottom-color: var(--red); }

.tool-links { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool-links a { min-height: 92px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tool-links a:hover { border-color: var(--line-strong); }
.tool-links strong { color: var(--ink); font-size: 13px; }
.tool-links span { color: var(--faint); font-size: 11px; }

.toolbar, .settings-row { margin-top: 30px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .text-input { width: min(100%, 430px); }
.settings-row .text-input { flex: 1; min-width: 220px; }
.text-input, .support-form input, .support-form textarea, .support-form select {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  outline: 0;
  font-size: 12px;
}
select.text-input { appearance: auto; }
.text-input:focus, .support-form input:focus, .support-form textarea:focus, .support-form select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.text-input:disabled, .support-form input:disabled, .support-form textarea:disabled, .support-form select:disabled { opacity: 0.5; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #5f685f; opacity: 1; }
.support-form { margin-top: 22px; display: grid; gap: 15px; }
.support-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 680; }
.support-form textarea { min-height: 104px; resize: vertical; }

.pill {
  min-height: 44px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 740;
}
.pill:hover { background: #f1efe9; border-color: #aaa69b; }
.pill:disabled { opacity: 0.42; cursor: not-allowed; }
.pill--dark { color: white; background: var(--red); border-color: var(--red); }
.pill--dark:hover { color: white; background: var(--red-hover); border-color: var(--red-hover); }

.table-wrap { margin-top: 14px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--surface-radius); scrollbar-color: var(--faint) transparent; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 11px; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f1efe9; font-size: 9px; font-weight: 760; letter-spacing: 0.06em; text-transform: uppercase; }
.data-table td { color: var(--muted); }
.data-table td strong { color: var(--ink); font-weight: 650; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #faf9f6; }
.table-link { min-height: 44px; margin: -10px 0; padding: 10px 0; display: inline-flex; align-items: center; color: var(--ink); background: transparent; border: 0; cursor: pointer; font-weight: 690; text-align: left; }
.table-link::after { content: "↗"; margin-left: 8px; color: var(--faint); font-size: 10px; }
.table-link:hover { color: var(--red); }

.badge { min-height: 24px; padding: 4px 8px; display: inline-flex; align-items: center; color: var(--muted); background: #f1efe9; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
.badge--active { color: var(--green); background: var(--green-soft); border-color: #b9dbc8; }
.badge--past_due, .badge--canceled, .badge--incomplete, .badge--deleted { color: var(--danger); background: var(--danger-soft); border-color: #efc6c2; }
.badge--plus { color: var(--amber); background: var(--amber-soft); border-color: #ead6a8; }

.placeholder { margin: 0; padding: 18px; color: var(--faint); font-size: 12px; line-height: 1.55; }
.data-table .placeholder { padding: 46px 20px; text-align: center; }
.stack-list { margin-top: 18px; display: grid; gap: 9px; }
.list-card, .setting-card { padding: 18px; }
.list-card p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.output { min-height: 80px; margin: 16px 0 0; padding: 15px; overflow: auto; color: var(--muted); background: #f1efe9; border: 1px solid var(--line); border-radius: var(--control-radius); white-space: pre-wrap; word-break: break-word; font-size: 10px; line-height: 1.6; }

.bars, .funnel { margin-top: 20px; display: grid; gap: 10px; }
.bars-row { display: grid; grid-template-columns: 86px 1fr 34px; gap: 10px; align-items: center; font-size: 9px; }
.bars-row .day { color: var(--faint); }
.bars-row .count { color: var(--muted); text-align: right; }
.bars-row .bar, .funnel-meter { height: 5px; overflow: hidden; background: #e4e1d9; border-radius: 2px; }
.bar-fill, .funnel-meter-fill { height: 100%; display: block; background: var(--red); border-radius: inherit; }
.funnel-step { padding: 14px 0; border-bottom: 1px solid var(--line); }
.funnel-step:last-child { border-bottom: 0; }
.funnel-step header { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-soft); font-size: 11px; }
.funnel-step .funnel-meter { margin-top: 10px; }
.funnel-value { margin: 7px 0 0; color: var(--faint); font-size: 9px; }

.setting-card .setting-key { color: var(--ink); font-size: 11px; font-weight: 700; }
.setting-card .setting-meta { color: var(--faint); font-size: 10px; }
.setting-row { margin-top: 14px; display: flex; gap: 8px; align-items: center; }
.setting-row .text-input { flex: 1; }

.detail-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(820px, calc(100vh - 32px)); padding: 0; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(31, 28, 21, 0.16); }
.detail-dialog::backdrop { background: rgba(31, 29, 23, 0.42); }
.detail-dialog__head { padding: 22px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-dialog__head h2 { margin: 0; font-size: 27px; font-weight: 630; letter-spacing: -0.04em; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); background: #f3f1ec; border: 1px solid var(--line); border-radius: var(--control-radius); cursor: pointer; font-size: 20px; }
.icon-button:hover { color: var(--ink); background: #ebe8e1; }
.detail-dialog__content { max-height: calc(100vh - 130px); padding: 22px 24px 28px; overflow-y: auto; }
.detail-meta, .detail-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.detail-meta > div, .detail-stats > div { min-width: 0; padding: 13px; background: var(--page); border: 1px solid var(--line); border-radius: 10px; }
.detail-meta span, .detail-stats span { display: block; color: var(--faint); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; }
.detail-stats { margin-top: 8px; }
.detail-stats strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 620; }
.detail-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-state { margin-top: 0; padding: 14px; color: var(--muted); background: var(--amber-soft); border: 1px solid #ead6a8; border-radius: 10px; }
.detail-owners { margin: 10px 0 0; padding: 0; list-style: none; }
.detail-owners li { padding: 10px 0; display: flex; justify-content: space-between; gap: 14px; color: var(--ink-soft); border-bottom: 1px solid var(--line); font-size: 11px; }
.detail-owners li:last-child { border-bottom: 0; }
.detail-owners span { color: var(--faint); text-align: right; }

@media (max-width: 1100px) {
  :root { --sidebar: 208px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .sidebar { position: sticky; inset: 0 0 auto; width: 100%; height: auto; padding: 12px 16px 0; gap: 0; overflow: visible; overflow-x: clip; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 0 8px; }
  .brand-context, .sidebar-foot { display: none; }
  .nav { margin: 0 -16px; padding: 4px 16px 10px; flex-direction: row; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { min-width: max-content; min-height: 44px; padding: 8px 11px; }
  .main { width: 100%; margin-left: 0; padding: 0 24px 56px; }
  .command-bar { min-height: 56px; }
  .page { padding-top: 46px; }
}

@media (max-width: 680px) {
  .sidebar { padding-inline: 14px; }
  .brand { min-height: 52px; }
  .brand-name { font-size: 14px; }
  .mobile-nav-toggle { min-height: 44px; margin-left: auto; padding: 7px 12px; display: inline-flex; align-items: center; color: var(--ink); background: #f3f1ec; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; font-weight: 700; }
  .nav { max-height: 0; margin-inline: -14px; padding: 0 14px; display: grid; grid-template-columns: 1fr; overflow: hidden; opacity: 0; visibility: hidden; }
  .mobile-nav-open .nav { max-height: 360px; padding-block: 8px 14px; overflow-y: auto; opacity: 1; visibility: visible; }
  .nav-item { min-width: 0; min-height: 44px; }
  .mobile-nav-open .sidebar-foot { min-height: 52px; margin: 0 -14px; padding: 8px 26px 12px; display: flex; border-top: 1px solid var(--line); }
  .mobile-nav-open .sidebar-foot a { min-height: 44px; }
  .command-bar__label, .command-link { display: none; }
  .command-bar__meta { margin-left: auto; }
  .main { padding-inline: 16px; }
  .page { padding-top: 34px; }
  .welcome, .page > h1 { font-size: clamp(38px, 12vw, 52px); }
  .lede { font-size: 14px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 128px; padding: 16px; }
  .stat-value { margin-top: 18px; font-size: 34px; }
  .panel, .list-card, .setting-card { padding: 18px; }
  .toolbar, .settings-row, .setting-row { align-items: stretch; flex-direction: column; }
  .toolbar .text-input, .settings-row .text-input { width: 100%; min-width: 0; }
  .pill { width: 100%; }
  .panel-head .pill, .list-card .pill { width: auto; }
  .table-wrap { margin-inline: -16px; border-inline: 0; border-radius: 0; }
  .data-table th, .data-table td { padding: 13px 14px; }
  .tool-links { grid-template-columns: 1fr; }
  .tool-links a { min-height: 78px; }
  .detail-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .detail-dialog__head, .detail-dialog__content { padding-inline: 18px; }
  .detail-meta, .detail-stats { grid-template-columns: 1fr 1fr; }
  .detail-owners li { flex-direction: column; gap: 3px; }
  .detail-owners span { text-align: left; }
}
