/* Fonts are self-hosted (no requests to Google). PT Serif and Montserrat, SIL Open Font License. */
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/pt-serif-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/pt-serif-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/pt-serif-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/pt-serif-latin-ext-700-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/montserrat-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/montserrat-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --forest: #374C42;
  --forest-deep: #2B3C34;
  --mint: #D8FFD0;
  --sage: #99BAAA;
  --sage-soft: #E2ECE6;
  --ink: #222222;
  --white: #FFFFFF;
  --paper: #F0EDE6;
  --card: #FAF8F4;
  --line: #DED8CC;
  --muted: #5C615E;
  --free: #4E8F6A;
  --warn: #8A4B0F;
  --warn-bg: #FBEBD5;
  --warn-dot: #D49A3A;
  --danger: #A33A2C;
  --serif: 'PT Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; color: var(--forest); }
p { margin: 0 0 .75em; }
a { color: var(--forest); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header and tabs ---------- */
.topbar-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding-top: 22px; padding-bottom: 12px;
}
.app-title { font-size: 26px; letter-spacing: -0.01em; }
.group-box { display: flex; align-items: center; gap: 10px; }
.group-label {
  font-weight: 600; font-size: 14px; color: var(--forest);
  background: var(--mint); padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.group-label.is-empty { background: transparent; color: var(--muted); padding-left: 0; }

.tabs-bar { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 8px; padding-top: 8px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: 9px 20px; border-radius: 999px; border: 1px solid var(--sage);
  background: var(--card); color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.tab:hover { border-color: var(--forest); }
.tab.is-active { background: var(--forest); color: var(--mint); border-color: var(--forest); }

main.wrap { padding-top: 28px; padding-bottom: 96px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--forest); color: var(--mint); }
.btn-primary:hover:not(:disabled) { background: var(--forest-deep); }
.btn-secondary { background: transparent; border-color: var(--sage); color: var(--forest); }
.btn-secondary:hover:not(:disabled) { border-color: var(--forest); background: var(--card); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8A2F23; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-link {
  background: none; border: 0; padding: 0; color: var(--forest); font-weight: 600; font-size: 13.5px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.btn-link.danger { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Generic blocks ---------- */
.page-title { font-size: 30px; margin-bottom: 8px; letter-spacing: -0.01em; }
.lede { font-size: 16px; color: #3A3E3C; max-width: 68ch; }
.section-head { margin-bottom: 16px; }

.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.banner p:last-child { margin: 0; }
.banner-info { background: var(--sage-soft); border-color: var(--sage); color: #1F2E27; }
.banner-warn { background: var(--warn-bg); border-color: #E7C79C; color: #4A3010; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 18px; }
.panel-title { font-family: var(--serif); font-size: 20px; color: var(--forest); font-weight: 700; margin: 0 0 10px; }
label.panel-title { display: block; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head .panel-title { margin: 0; }
.panel-status { margin-bottom: 14px; }

details.panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ''; width: 8px; height: 8px; border-right: 2px solid var(--forest); border-bottom: 2px solid var(--forest);
  transform: rotate(-45deg); transition: transform .15s; align-self: center; margin-right: 2px;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > summary .panel-title { margin: 0; }
details.panel > summary .muted { font-size: 13.5px; }
.panel-body { margin-top: 16px; }

.state-msg, .notice-card, .empty {
  max-width: 660px; padding: 34px 32px; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.state-msg { margin: 40px auto; text-align: center; }
.release-time { font-family: var(--serif); font-size: clamp(26px, 4vw, 36px); color: var(--forest); font-weight: 700; margin: 6px 0 14px; line-height: 1.15; }

/* ---------- Tags and status ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; line-height: 1.4; white-space: nowrap; }
.tag-agent { background: var(--forest); color: var(--mint); }
.tag-workflow { background: var(--sage); color: #17241E; }
.tag-app { background: var(--mint); color: var(--forest); box-shadow: inset 0 0 0 1px #B9E3B0; }
.tag-own { background: transparent; color: var(--muted); border: 1px dashed var(--sage); padding: 2px 8px; }
.tag-tie { background: var(--mint); color: var(--forest); margin-left: 8px; vertical-align: middle; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.status-free { color: var(--forest); }
.status-free::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--free); }
.status-taken { color: #686D6A; }
.status-taken::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #B4AFA4; }
.status-mine { background: var(--mint); color: var(--forest); padding: 4px 10px; border-radius: 999px; }

/* ---------- Group picker ---------- */
.picker { max-width: 900px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 22px 0 26px; }
.group-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 16px 18px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.group-card:hover { border-color: var(--forest); background: var(--white); }
.group-card-name { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--forest); }
.group-card-meta { font-size: 13.5px; color: var(--muted); }
.group-card.is-current { border: 2px solid var(--forest); padding: 15px 17px 17px; background: var(--white); }
.group-card-current { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--forest); background: var(--mint); padding: 2px 8px; border-radius: 6px; }
.picker-foot { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }

/* ---------- Use case list ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 4px 0 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; gap: 8px; align-items: center; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-weight: 500; font-size: 14px; cursor: pointer;
}
.chip:hover { border-color: var(--sage); }
.chip.is-active { border-color: var(--forest); background: var(--mint); color: var(--forest); font-weight: 600; }
.chip-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-active .chip-count { color: var(--forest); }
.availability { font-size: 13.5px; color: var(--muted); }

.uc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.uc-card, .own-tile {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: left;
  min-height: 200px; padding: 18px 18px 16px; border-radius: 14px; cursor: pointer;
}
.uc-card { background: var(--card); border: 1px solid var(--line); transition: border-color .15s; }
.uc-card:hover { border-color: var(--sage); }
.uc-tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.uc-title { display: block; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.25; color: var(--forest); }
.uc-teaser {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13.5px; color: var(--muted); line-height: 1.5;
}
.uc-card .status { margin-top: auto; align-self: flex-start; }
.uc-card.is-taken { background: #EAE7E0; border-color: #E2DDD3; }
.uc-card.is-taken .uc-title { color: #6F7471; }
.uc-card.is-taken .uc-teaser { color: #7D817E; }
.uc-card.is-taken .tag { filter: grayscale(1); opacity: .6; }
.uc-card.is-mine { background: var(--white); border: 2px solid var(--forest); padding: 17px 17px 15px; }

.own-tile { background: transparent; border: 1.5px dashed var(--sage); color: var(--muted); }
.own-tile:hover { border-color: var(--forest); }
.own-plus {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px dashed var(--sage);
  display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--forest); margin-bottom: 4px;
}
.own-title { font-family: var(--serif); font-size: 18px; font-weight: 700; color: #51605A; }
.own-text { font-size: 13.5px; line-height: 1.5; }
.own-hint { margin-top: auto; font-size: 12.5px; color: var(--muted); }
.own-tile[aria-disabled="true"] { opacity: .7; cursor: default; }
.own-tile[aria-disabled="true"]:hover { border-color: var(--sage); }

.list-empty { grid-column: 1 / -1; padding: 24px 0; color: var(--muted); }

/* ---------- Details ---------- */
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 14px; }
.prose p { margin: 0 0 12px; max-width: 70ch; }
.prose strong { color: var(--forest); }
.links { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.links-title { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.links ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.links li { line-height: 1.45; }
.links a { font-weight: 600; }
.links a::after { content: '\2197'; display: inline-block; margin-left: 4px; font-size: .85em; text-decoration: none; }
.hint { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Our use case ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--forest); color: var(--mint);
  border-radius: 20px; padding: 30px 32px 34px; margin-bottom: 20px;
}
.hero-line { position: relative; color: var(--mint); font-size: 14px; margin-bottom: 10px; }
.hero-title { position: relative; color: var(--mint); font-size: clamp(28px, 4.4vw, 46px); line-height: 1.1; max-width: 20ch; letter-spacing: -0.01em; }
.hero-tags { position: relative; display: flex; gap: 6px; margin-top: 16px; }
.hero .tag-agent { background: var(--mint); color: var(--forest); }
.hero .tag-own { color: var(--mint); border-color: var(--sage); }
.hero-num {
  position: absolute; right: 18px; bottom: -0.32em; font-family: var(--serif); font-weight: 700;
  font-size: clamp(140px, 22vw, 240px); line-height: 1; color: var(--mint); opacity: .09; pointer-events: none; user-select: none;
}
.ours-grid { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
.ours-grid .panel { margin: 0; }
@media (min-width: 900px) { .ours-grid { grid-template-columns: 1.05fr 1fr; } }
.note-help { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.note-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.note-status { font-size: 13px; color: var(--muted); }
.note-status.is-error { color: var(--danger); font-weight: 600; }
.note-status.is-dirty { color: var(--warn); }
.panel-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 14px; }
.field-help { font-size: 13px; color: var(--muted); font-weight: 400; }
.optional { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=datetime-local], input:not([type]), textarea, select {
  font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #CDC7BA; border-radius: 10px;
  background: var(--white); color: var(--ink); width: 100%;
}
select { width: auto; min-width: 140px; padding: 8px 10px; font-size: 15px; }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(153, 186, 170, .5); }
.form-error { color: var(--danger); font-size: 14px; margin: 0; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-opt { position: relative; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 14px; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.seg-opt.is-active { background: var(--mint); border-color: var(--forest); color: var(--forest); font-weight: 600; }
.seg-opt:focus-within { outline: 3px solid var(--sage); outline-offset: 2px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(31, 41, 36, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 640px; background: var(--card); border-radius: 18px; outline: none;
  box-shadow: 0 24px 70px rgba(20, 32, 26, .28); animation: rise .18s ease-out;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 0; }
.modal-title { font-size: 24px; line-height: 1.2; }
.modal-close {
  flex: none; border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 2px 8px; border-radius: 8px; margin: -4px -8px 0 0;
}
.modal-close:hover { background: var(--paper); color: var(--ink); }
.modal-body { padding: 14px 24px 6px; }
.modal-foot {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 16px 24px 22px; margin-top: 12px; border-top: 1px solid var(--line);
}
.modal-foot .hint { margin-right: auto; }
.modal-foot .status { margin-right: auto; }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; overflow-y: auto; }
  .modal-foot { position: sticky; bottom: 0; background: var(--card); }
  .modal-foot .btn { flex: 1 1 auto; }
}

/* ---------- Toast ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80;
  width: min(580px, calc(100% - 28px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 12px 12px 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 34px rgba(20, 32, 26, .25); animation: rise .18s ease-out;
}
.toast-ok { background: var(--forest); color: var(--mint); }
.toast-info { background: var(--ink); color: var(--white); }
.toast-error { background: #7C2D22; color: var(--white); }
.toast button { flex: none; background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .8; }

/* ---------- Admin ---------- */
.auth-card { max-width: 480px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.subtabs { display: inline-flex; border: 1px solid var(--sage); border-radius: 999px; padding: 3px; background: var(--card); }
.subtab { padding: 7px 18px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }
.subtab.is-active { background: var(--forest); color: var(--mint); }
.admin-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-bottom: 18px; }
.admin-grid .panel { margin: 0; }
@media (min-width: 860px) { .admin-grid { grid-template-columns: 1.35fr 1fr; } }
.release-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.release-form .field { flex: 1 1 220px; }

.state { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.state::before { content: ''; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.state-on::before { background: var(--free); }
.state-wait::before { background: var(--warn-dot); }
.state-off::before { background: #B4AFA4; }

.switch { display: inline-flex; align-items: center; gap: 12px; background: none; border: 0; padding: 2px 0; cursor: pointer; font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.switch-track { width: 50px; height: 28px; border-radius: 999px; background: #CBC5B8; position: relative; transition: background-color .15s; flex: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch.is-on .switch-track { background: var(--forest); }
.switch.is-on .switch-thumb { transform: translateX(22px); background: var(--mint); }

.summary { margin: 0; font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.flag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td:first-child, .table th:first-child { padding-left: 4px; }
.groups-table tr.is-flagged td:last-child select { border-color: var(--warn-dot); }
.member-count { font-weight: 600; }
.member-names { display: block; font-size: 12.5px; color: var(--muted); max-width: 44ch; margin: 2px 0 4px; }
.chosen-title { display: block; font-weight: 600; color: var(--forest); }
.cell-actions { display: flex; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.jury-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.uc-admin-list { list-style: none; margin: 14px 0 0; padding: 0; }
.uc-admin-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 18px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.uc-admin-list li:last-child { border-bottom: 0; }
.uc-admin-title { display: block; font-weight: 600; }
.uc-admin-sub { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; gap: 14px; }
@media (max-width: 600px) { .uc-admin-list li { grid-template-columns: 1fr; } }

.jurors-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .jurors-grid { grid-template-columns: 1fr 1fr; } }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--paper); padding: 10px 12px; border-radius: 8px; overflow-x: auto; white-space: pre; display: block; }
.danger-zone { border-color: #E5C3BC; }

/* ---------- Judging ---------- */
.juror-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--mint); color: var(--forest); border-radius: 12px; margin-bottom: 18px;
}
.juror-setup { margin-bottom: 26px; }
.team-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 18px 0; }
@media (min-width: 640px) { .juror-setup { margin-bottom: 26px; }
.team-grid { grid-template-columns: 1fr 1fr; } }
.team-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; cursor: pointer;
  padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
}
.team-card:hover { border-color: var(--forest); }
.team-card.is-active { border: 2px solid var(--forest); padding: 17px 19px; background: var(--white); }
.team-card-name { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--forest); }
.name-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.score-list { list-style: none; padding: 0; margin: 0; }
.score-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 20px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.score-row:last-child { border-bottom: 0; }
.score-row-title { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--forest); }
.score-row-sub { display: block; font-size: 13.5px; color: var(--muted); }
.score-state { text-align: right; font-size: 14px; }
.score-state .muted { display: block; font-size: 12.5px; }
@media (max-width: 640px) {
  .score-row { grid-template-columns: 1fr auto; }
  .score-state { text-align: left; grid-column: 1 / 2; }
}

.back-link { display: inline-block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.back-link::before { content: '\2039'; margin-right: 6px; }
.score-head { margin-bottom: 18px; }
.note-view { border-left: 4px solid var(--sage); }
.criterion { margin: 0 0 16px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.crit-name { display: block; font-family: var(--serif); font-size: 20px; color: var(--forest); font-weight: 700; }
.crit-q { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.scale-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; cursor: pointer;
  padding: 12px; min-height: 104px; border: 1px solid var(--line); background: var(--white); border-radius: 12px;
}
.scale-opt:hover { border-color: var(--sage); }
.scale-num { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--forest); line-height: 1; }
.scale-anchor { font-size: 13px; line-height: 1.35; color: #3B3F3D; }
.scale-opt.is-on { background: var(--forest); border-color: var(--forest); }
.scale-opt.is-on .scale-num, .scale-opt.is-on .scale-anchor { color: var(--mint); }
@media (max-width: 760px) {
  .scale { grid-template-columns: 1fr; gap: 6px; }
  .scale-opt { flex-direction: row; align-items: center; min-height: 0; gap: 14px; padding: 10px 12px; }
  .scale-num { width: 22px; flex: none; font-size: 22px; }
}
.score-bar {
  position: sticky; bottom: 12px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  padding: 12px 14px 12px 20px; background: var(--forest); color: var(--mint); border-radius: 16px; margin-top: 8px;
  box-shadow: 0 10px 30px rgba(31, 41, 36, .25);
}
.score-total { display: flex; align-items: baseline; gap: 6px; }
.score-total-num { font-family: var(--serif); font-size: 32px; font-weight: 700; line-height: 1; }
.score-total-label { font-size: 14px; }
.score-bar .btn-primary { background: var(--mint); color: var(--forest); }
.score-bar .btn-primary:hover:not(:disabled) { background: var(--white); }
.score-bar .form-error { color: var(--white); flex-basis: 100%; order: 3; }

.rank-num { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--forest); line-height: 1; }
.rank-cell { white-space: nowrap; }
.avg { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--forest); }
.ratings { display: block; font-size: 12.5px; color: var(--muted); }
.rank-table tr.is-unrated td { color: var(--muted); }
.detail-row td { background: var(--paper); border-radius: 10px; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.breakdown th, .breakdown td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.breakdown th:first-child, .breakdown td:first-child { text-align: left; padding-left: 0; }
.breakdown tfoot td { font-weight: 600; border-bottom: 0; }

/* Stacked tables on small screens */
@media (max-width: 720px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: start; }
  .table.stack td[data-label]::before { content: attr(data-label); font-size: 12.5px; color: var(--muted); font-weight: 600; padding-top: 2px; }
  .table.stack td:not([data-label]) { display: block; }
  .table.stack tr.detail-row { padding: 0 0 12px; }
  .table.stack tr.detail-row td { padding: 10px 12px; }
}
@media (max-width: 560px) {
  .uc-card, .own-tile { min-height: 0; }
  .uc-teaser { -webkit-line-clamp: 2; }
  .tabs { gap: 6px; }
  .tab { padding: 9px 14px; }
  .app-title { font-size: 22px; }
  .page-title { font-size: 26px; }
  .hero { padding: 24px 22px 28px; }
  .panel { padding: 18px; }
  .notice-card, .empty { padding: 26px 22px; }
}

@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
