/* GENERATED from ~/saas-core by scripts/sync-core.mjs — edit the core, not this copy. */
/* Shared look for every product. Products override the brand tokens in their own stylesheet. */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede5;
  --ink: #1c2420;
  --ink-2: #44504a;
  --muted: #6a746f;
  --line: #e2ddd2;
  --line-2: #d3cdc0;
  --brand: #1f6b58;
  --brand-hover: #18594a;
  --brand-ink: #ffffff;
  --brand-soft: #e4efe9;
  --ok: #1d7347;
  --ok-soft: #e1f2e8;
  --warn: #8a5d00;
  --warn-soft: #fbf0d6;
  --err: #b42318;
  --err-soft: #fcebea;
  --info-soft: #e8eef8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(28, 36, 32, 0.05), 0 6px 20px rgba(28, 36, 32, 0.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
}
img,
svg {
  max-width: 100%;
}
a {
  color: var(--brand);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--brand-hover);
}
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}
h2 {
  font-size: 1.3rem;
}
h3 {
  font-size: 1.05rem;
}
p {
  margin: 0 0 0.9em;
}
small,
.small {
  font-size: 0.875rem;
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: var(--mono);
}
.center {
  text-align: center;
}
.mt {
  margin-top: 16px;
}
.mb0 {
  margin-bottom: 0;
}
.hidden,
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}
.narrow {
  max-width: 460px;
}
.stack > * + * {
  margin-top: 12px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.spacer {
  flex: 1;
}
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand:hover {
  color: var(--ink);
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}
.footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 24px 0 32px;
  color: var(--muted);
  font-size: 0.875rem;
}
.footer a {
  color: var(--ink-2);
}
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 10px;
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card {
  margin-top: 16px;
}
.card h2:first-child,
.card h3:first-child {
  margin-top: 0;
}
.auth-wrap {
  padding: 40px 0 24px;
}
.auth-wrap .card {
  padding: 28px 24px;
}

.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--info-soft);
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: 0.95rem;
}
.notice.ok {
  background: var(--ok-soft);
}
.notice.warn {
  background: var(--warn-soft);
}
.notice.err {
  background: var(--err-soft);
  color: var(--err);
}
.notice p:last-child {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge.err {
  background: var(--err-soft);
  color: var(--err);
}
.badge.brand {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.btn.primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: var(--brand-ink);
}
.btn.danger {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, var(--line-2));
}
.btn.danger:hover {
  background: var(--err-soft);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.sm {
  min-height: 34px;
  padding: 4px 11px;
  font-size: 0.875rem;
}
.btn.block {
  width: 100%;
}
.linkbtn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- forms ---------- */
.field {
  display: block;
  margin-bottom: 14px;
}
.field > span,
.field > label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 5px;
}
.field .hint {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 4px;
}
.field .field-err {
  display: block;
  color: var(--err);
  font-size: 0.83rem;
  margin-top: 4px;
}
input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* no zoom on iOS */
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent);
  outline-offset: 0;
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--err);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  font-size: 0.93rem;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--brand);
}
.form-error {
  margin-bottom: 14px;
}
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.inline-fields {
  display: grid;
  gap: 0 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.ts-box {
  min-height: 0;
  margin-bottom: 14px;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
table.list th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.list td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.list tr:last-child td {
  border-bottom: 0;
}
table.list tr.clickable {
  cursor: pointer;
}
table.list tr.clickable:hover td {
  background: var(--surface-2);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs a,
.tabs button {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  padding: 12px 12px 10px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tabs a:hover,
.tabs button:hover {
  color: var(--ink);
}
.tabs [aria-current="page"],
.tabs [aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ---------- dialogs & toasts ---------- */
dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop {
  background: rgba(20, 26, 23, 0.45);
}
dialog .dlg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 8px;
}
dialog .dlg-head h2 {
  margin: 0;
  font-size: 1.15rem;
  flex: 1;
}
dialog .dlg-body {
  padding: 8px 20px 4px;
}
dialog .dlg-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 12px 20px 18px;
}
dialog.wide {
  width: min(860px, calc(100vw - 24px));
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  background: #1f2924;
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.93rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}
.toast.err {
  background: var(--err);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}
.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}
.copybox {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copybox input {
  font-family: var(--mono);
  font-size: 0.92rem;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}
.kv dt {
  color: var(--muted);
  font-size: 0.9rem;
}
.kv dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- legal / prose ---------- */
.prose {
  max-width: 760px;
}
.prose h2 {
  margin-top: 1.6em;
}
.prose h3 {
  margin-top: 1.2em;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li {
  margin-bottom: 0.35em;
}

@media (max-width: 640px) {
  .card {
    padding: 16px;
  }
  .auth-wrap {
    padding: 20px 0;
  }
  dialog .dlg-head,
  dialog .dlg-body,
  dialog .dlg-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  dialog .dlg-foot .btn {
    flex: 1;
  }
  table.list.cards thead {
    display: none;
  }
  table.list.cards,
  table.list.cards tbody,
  table.list.cards tr,
  table.list.cards td {
    display: block;
    width: 100%;
  }
  table.list.cards tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  table.list.cards td {
    border: 0;
    padding: 3px 4px;
  }
  table.list.cards td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 0.85rem;
  }
  table.list.cards td.num {
    text-align: left;
  }
  /* First cell as the card title: no "Label:" prefix. */
  table.list.cards td.td-title {
    font-size: 1.02rem;
    padding-top: 4px;
  }
  table.list.cards td.td-title::before {
    content: none;
  }
  /* Tabs wrap into pills instead of hiding the last one off-screen. */
  .tabs {
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    border-bottom: 0;
  }
  .tabs a,
  .tabs button {
    padding: 8px 14px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
  }
  .tabs [aria-current="page"],
  .tabs [aria-selected="true"] {
    border-color: var(--brand);
    background: var(--brand-soft);
  }
}
