/* Hallmark: scope app, community workbench, light/dark, signature: persistent group switcher. */
/* Keep the current group visible instead of repeating it as a headline. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f2; --surface: #fff; --ink: #192820; --muted: #4e6356;
  --line: #c9d2c8; --accent: #18573c; --on-accent: #fff; --tint: #e0efdf;
  --warning: #813818; --warn-bg: #fff0e3;
  --scrim: rgb(10 22 15 / .64);
  --font-body: system-ui, -apple-system, sans-serif;
  --safe-top: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
  font: 100%/1.5 var(--font-body);
  background: var(--bg); color: var(--ink);
  scroll-padding-top: calc(6rem + var(--safe-top));
  scroll-padding-bottom: calc(5rem + var(--safe-bottom));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151e19; --surface: #202b24; --ink: #ecf2e9; --muted: #bacbbb;
    --line: #48584b; --accent: #a5e1b8; --on-accent: #143521; --tint: #2f4435;
    --warning: #ffc399; --warn-bg: #412d24;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark; --bg: #151e19; --surface: #202b24; --ink: #ecf2e9; --muted: #bacbbb;
  --line: #48584b; --accent: #a5e1b8; --on-accent: #143521; --tint: #2f4435;
  --warning: #ffc399; --warn-bg: #412d24;
}
:root[data-theme="light"] { color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { background: var(--surface); border: 1px solid var(--line); border-radius: .55rem; min-height: 44px; padding: .45rem .85rem; font-weight: 600; }
button:disabled, select:disabled { cursor: default; }
button:disabled, select:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
button:not(:disabled):hover { border-color: var(--accent); }
button:not(:disabled):active { background: var(--tint); color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: fixed; top: 0; left: 0; z-index: 5; transform: translateY(-150%); background: var(--surface); color: var(--ink); padding: .6rem; }
.skip:focus { transform: none; }
.context-label { color: var(--muted); font-size: .8rem; }
#mast { position: sticky; z-index: 2; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: var(--safe-top); }
.mast-inner { display: flex; align-items: center; gap: .8rem; max-width: 72rem; margin: auto; padding: .65rem 1rem; }
.brand { width: 38px; height: 38px; flex: none; background: var(--accent); border-radius: .65rem; display: flex; gap: 4px; align-items: center; justify-content: center; }
.brand i { display: block; width: 4px; height: 11px; background: var(--on-accent); border-radius: 2px; }
.brand i:nth-child(2) { height: 21px; } .brand i:last-child { height: 15px; }
.group-box { min-width: 0; flex: 1; position: relative; }
.group-box label { display: block; pointer-events: none; }
#group { width: 100%; max-width: 33rem; display: block; padding: .25rem .5rem; min-height: 44px; background: var(--surface); color: var(--ink); border: 1px solid var(--muted); border-radius: .5rem; font-weight: 700; text-overflow: ellipsis; }
option { color: var(--ink); background: var(--surface); }
#status { font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.workspace { max-width: 72rem; margin: 0 auto; }
main { min-width: 0; padding: 1.5rem 1rem calc(6rem + var(--safe-bottom)); }
h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.12; letter-spacing: -.04em; margin: .3rem 0 1.4rem; }
h2 { font-size: 1.22rem; line-height: 1.32; letter-spacing: -.018em; }
h1, h2 { min-width: 0; overflow-wrap: break-word; text-wrap: balance; }
h3 { font-size: 1rem; }
#nav { position: fixed; z-index: 2; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: .35rem .25rem calc(.35rem + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
#nav button { display: grid; justify-items: center; align-content: center; gap: .2rem; color: var(--muted); font-size: .75rem; line-height: 1.2; padding: .35rem .1rem; border: 0; }
#nav button[aria-current], #status[aria-current] { color: var(--accent); background: var(--tint); }
#nav svg { width: 21px; height: 21px; }
.block { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: .9rem; margin-bottom: 1rem; padding: 1rem; }
.block-head { display: flex; align-items: baseline; gap: .65rem; padding-bottom: .65rem; }
.block-index { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.row { border-top: 1px solid var(--line); padding: .8rem 0; }
.row:last-child { padding-bottom: 0; }
.detail, #review dd { white-space: pre-wrap; }
.detail { color: var(--muted); margin-top: .25rem; }
.row-link { text-align: start; padding: .3rem 0; border: 0; border-radius: 0; width: 100%; color: var(--accent); display: flex; gap: .5rem; justify-content: space-between; align-items: center; }
.row-link::after { content: '›'; font-size: 1.45em; }
.actions, .form-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#notice:not(:empty), #confirm, #form-message:not(:empty) { border: 1px solid var(--accent); border-radius: .5rem; background: var(--tint); padding: .7rem .9rem; margin: 0 0 1rem; }
#notice.warn, #confirm, #form-message.warn { background: var(--warn-bg); color: var(--warning); border-color: var(--warning); }
#notice button { display: block; margin-top: .6rem; }
.empty { color: var(--muted); }
dialog { width: min(32rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem - var(--safe-top) - var(--safe-bottom)); overflow-y: auto; overscroll-behavior: contain; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 1rem; padding: 1.25rem; }
dialog::backdrop { background: var(--scrim); }
#action-title { margin: .4rem 0 1rem; font-size: 1.5rem; }
#fields { min-width: 0; padding: 0; margin: 0; border: 0; display: grid; gap: .85rem; }
.field { display: grid; gap: .3rem; font-weight: 600; }
.field :is(input, textarea, select) { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--muted); border-radius: .45rem; padding: .45rem .6rem; background: var(--surface); font-weight: normal; }
.field textarea { min-height: 7rem; resize: vertical; }
.field.check { display: flex; min-height: 44px; align-items: center; gap: .7rem; }
.field input[type=checkbox] { width: 1.3rem; height: 1.3rem; min-height: 0; accent-color: var(--accent); }
#review dt { font-size: .85rem; font-weight: 700; color: var(--muted); margin-top: .65rem; }
#review h3 { margin-bottom: .6rem; }
#confirm, #form-message:not(:empty) { margin: 1rem 0 0; }
.form-buttons { justify-content: flex-end; }
@media (min-width: 48rem) {
  .mast-inner { padding: .75rem 2rem; }
  .workspace { display: flex; align-items: flex-start; padding: 0 2rem; gap: 2.5rem; }
  #nav { display: grid; position: sticky; inset: calc(5.5rem + var(--safe-top)) auto auto; flex: 0 0 10rem; grid-template-columns: 1fr; gap: .3rem; background: transparent; border: 0; padding: 0; margin-top: 2rem; }
  #nav button { display: flex; justify-content: flex-start; align-items: center; padding: .65rem; gap: .75rem; font-size: .95rem; background: transparent; }
  main { padding: 2rem 0 4rem; flex: 1; max-width: 50rem; }
  .block { padding: 1.15rem 1.4rem; }
}
