/* base */
@media all {
  html { -webkit-text-size-adjust: 100%; }
  body { margin: 0; background: var(--c-bg); color: var(--c-ink); font-family: var(--f-sans); font-size: 15px; line-height: 1.55; overflow-x: hidden; }
  :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
  a { color: inherit; }
  img, svg { max-width: 100%; }
}

/* ---------- Layout shell ---------- */
.skip { position: absolute; left: -999px; top: 8px; background: var(--c-accent); color: var(--c-accent-ink); padding: 8px 12px; border-radius: var(--r-md); z-index: 100; }
.skip:focus { left: 8px; }
.shell { display: flex; min-height: 100dvh; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); background: var(--c-surface); border-right: 1px solid var(--c-line); z-index: 40; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform var(--t-base) var(--ease); padding-top: var(--safe-t); }
.shell[data-drawer='open'] .sidebar { transform: none; box-shadow: var(--shadow-2); }
.backdrop { position: fixed; inset: 0; background: rgb(10 14 20 / 0.45); z-index: 30; opacity: 0; pointer-events: none; transition: opacity var(--t-base); }
.shell[data-drawer='open'] .backdrop { opacity: 1; pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--c-line); min-height: 56px; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; flex: 1; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group { margin-bottom: 8px; }
.nav-group-label { margin: 12px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-muted); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: var(--r-md); text-decoration: none; color: var(--c-muted); transition: background var(--t-fast), color var(--t-fast); }
.nav-item:hover { background: var(--c-surface-2); color: var(--c-ink); }
.nav-item[aria-current='page'] { background: color-mix(in srgb, var(--c-accent) 12%, transparent); color: var(--c-ink); font-weight: 600; }
.nav-ico { display: inline-flex; flex: none; }
.collapse-btn { display: flex; align-items: center; gap: 12px; margin: 8px; padding: 0 10px; min-height: 40px; background: none; border: 0; color: var(--c-muted); border-radius: var(--r-md); cursor: pointer; font: inherit; }
.collapse-btn:hover { background: var(--c-surface-2); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: var(--safe-t) 12px 0; background: color-mix(in srgb, var(--c-bg) 92%, transparent); border-bottom: 1px solid var(--c-line); backdrop-filter: blur(6px); }
.page-title { margin: 0; font-size: 17px; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.main { flex: 1; padding: 16px 16px calc(80px + var(--safe-b)); outline: none; min-width: 0; }
#outlet { max-width: 1100px; margin: 0 auto; }

.bottom-bar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--c-surface); border-top: 1px solid var(--c-line); padding-bottom: var(--safe-b); }
.bb-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; font-size: 11px; text-decoration: none; color: var(--c-muted); }
.bb-item[aria-current='page'] { color: var(--c-accent); font-weight: 600; }

/* ---------- Controls ---------- */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: none; border: 0; border-radius: var(--r-md); color: var(--c-ink); cursor: pointer; }
.icon-btn:hover { background: var(--c-surface-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-ink); font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; transition: background var(--t-fast); }
.btn:hover { background: var(--c-surface-2); }
.btn-primary { background: var(--c-accent); color: var(--c-accent-ink); border-color: transparent; }
.btn-primary:hover { background: var(--c-accent); filter: brightness(1.08); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--c-line); }
.pill-ok { color: var(--c-ok); }
.pill-warn { color: var(--c-warn); }

/* ---------- Content ---------- */
.panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-1); }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-warn); }
.h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.01em; }
.h2 { font-size: 19px; margin: 0 0 8px; letter-spacing: -0.01em; }
.h3 { font-size: 15px; margin: 20px 0 6px; }
.muted { color: var(--c-muted); }
.note { margin-top: 16px; padding: 10px 12px; border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.checklist { margin: 8px 0; padding-left: 20px; }
.radio-group { display: grid; gap: 8px; margin-top: 12px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--c-line); border-radius: var(--r-md); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 8%, transparent); }
.radio small { display: block; }
.radio input { margin-top: 4px; accent-color: var(--c-accent); }

.toasts { position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(72px + var(--safe-b)); display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 14px; border-radius: var(--r-md); background: var(--c-ink); color: var(--c-bg); box-shadow: var(--shadow-2); max-width: 480px; justify-self: center; }
.toast-error { background: var(--c-danger); color: #fff; }

.only-desktop { display: none; }

/* ---------- Tablet / desktop ---------- */
@media (min-width: 1024px) {
  .only-mobile, .bottom-bar, .backdrop { display: none !important; }
  .only-desktop { display: flex; }
  .sidebar { position: sticky; top: 0; height: 100dvh; width: var(--nav-w); transform: none; box-shadow: none; flex: none; transition: width var(--t-base) var(--ease); }
  .shell.collapsed .sidebar { width: var(--nav-w-collapsed); }
  .shell.collapsed .nav-label, .shell.collapsed .brand-name, .shell.collapsed .nav-group-label { display: none; }
  .shell.collapsed .nav-item, .shell.collapsed .collapse-btn { justify-content: center; padding: 0; }
  .shell.collapsed .collapse-btn svg { transform: rotate(180deg); }
  .topbar { padding-inline: 24px; }
  .main { padding: 24px 24px 32px; }
  .toasts { bottom: 24px; }
}
@media (min-width: 1536px) { body { font-size: 16px; } }
@media (max-width: 359px) { .main { padding-inline: 12px; } .bb-item { font-size: 10px; } }
