/* GTO Admin UI design system — docs/specs/admin-ui-redesign.md.
   Colours are light-dark() tokens. Text takes contrast-color() of the
   surface it sits on; the declaration before it is the fallback for
   browsers without contrast-color(). No colour here may drop text below
   the contrast rule: browser E2E every_text_meets_contrast_in_both_themes. */

:root {
  color-scheme: light dark;
  --bg: light-dark(#fafafa, #0b0b0e);
  --surface: light-dark(#ffffff, #16161a);
  --subtle: light-dark(#f4f4f5, #222228);
  --border: light-dark(#e4e4e7, #34343c);
  --border-strong: light-dark(#d4d4d8, #4a4a54);
  --text: light-dark(#18181b, #f4f4f5); /* fallback for contrast-color() */
  --muted: light-dark(#52525b, #c4c4cc);
  --accent: light-dark(#4338ca, #818cf8);
  --accent-hover: light-dark(#3730a3, #a5b4fc);
  --accent-soft: light-dark(#f4f6ff, #23264a);
  --link: light-dark(#4338ca, #a5b4fc);
  --success: light-dark(#166534, #4ade80);
  --success-bg: light-dark(#dcfce7, #0f2e1b);
  --warning: light-dark(#92400e, #fbbf24);
  --warning-bg: light-dark(#fef3c7, #3a2a0a);
  --danger: light-dark(#991b1b, #f87171);
  --danger-bg: light-dark(#fee2e2, #3a1414);
  --info: light-dark(#1e40af, #93c5fd);
  --info-bg: light-dark(#dbeafe, #172554);
  --purple: light-dark(#6b21a8, #d8b4fe);
  --purple-bg: light-dark(#f3e8ff, #2e1065);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --font-sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --sidebar-w: 232px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: .01em;
  color: var(--text);
  color: contrast-color(var(--bg));
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #fff; color: contrast-color(var(--accent)); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.4; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; min-width: 1024px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px;
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
  border-right: 1px solid var(--border);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; font-weight: 700; font-size: 15px; }
.sidebar__group { margin: 0; padding: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 32px; padding: 4px 10px; border-radius: var(--radius-sm);
  color: inherit; text-decoration: none;
}
.nav-item:hover { background: var(--surface); }
.nav-item[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-weight: 600; }
.nav-pill { font-size: 12px; line-height: 1; padding: 3px 7px; border-radius: 10px; background: var(--accent); color: #fff; color: contrast-color(var(--accent)); }
.sidebar__foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.sidebar__user { display: flex; flex-direction: column; }
.sidebar__user-company { color: var(--muted); }
.theme-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-switch > span { color: var(--muted); }
.page { padding: 24px 32px 64px; max-width: 1200px; width: 100%; }
.page__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page__title { font-size: 20px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 18px;
}
.card + .card { margin-top: 16px; }
.card__header { margin-bottom: 12px; }
.card__title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card__desc { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------- buttons & inputs ---------- */
button, select, input, textarea { font: inherit; }
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 4px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
  font-size: 13.5px; font-weight: 600;
}
.btn:hover:not(:disabled) { background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle)); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; color: contrast-color(var(--accent)); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; color: contrast-color(var(--accent-hover)); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; color: contrast-color(var(--danger)); }
.btn--danger:hover:not(:disabled) { background: var(--danger); color: #fff; color: contrast-color(var(--danger)); filter: brightness(.95); }
.btn--sm { padding: 2px 10px; font-size: 12.5px; }

select, input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea {
  min-height: 32px; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--purple { background: var(--purple-bg); color: var(--purple); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--neutral { background: var(--subtle); color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
/* A refresh after an action (admins.rs) keeps the table mounted instead of
   unmounting it back to a spinner — just dims it, still readable. */
.table-wrap.is-loading { opacity: .5; transition: opacity .15s ease; }
table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
}
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { position: sticky; top: 0; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--muted); }
tbody tr:hover { background: var(--subtle); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- text & states ---------- */
.muted { color: var(--muted); font-size: 13.5px; }
.faint { color: var(--muted); font-size: 12.5px; } /* no fainter grey than --muted */
code { font-family: var(--font-mono); background: var(--subtle); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
pre.code-block {
  margin: 0; max-height: 360px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px;
}
.alert { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-left: 3px solid; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13.5px; }
.alert--error { background: var(--danger-bg); color: var(--text); color: contrast-color(var(--danger-bg)); border-left-color: var(--danger); }
.alert--info { background: var(--info-bg); color: var(--text); color: contrast-color(var(--info-bg)); border-left-color: var(--info); }
.alert--success { background: var(--success-bg); color: var(--text); color: contrast-color(var(--success-bg)); border-left-color: var(--success); }
.alert--warning { background: var(--warning-bg); color: var(--text); color: contrast-color(var(--warning-bg)); border-left-color: var(--warning); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state__icon { font-size: 28px; }
.empty-state__title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); color: contrast-color(var(--bg)); }
.spinner-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 36px 0; color: var(--muted); font-size: 13.5px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sign-in ---------- */
.logo-badge { display: grid; place-items: center; flex-shrink: 0; background: #fff; border: 1px solid var(--border); }
.logo-badge img { display: block; }
.brand__mark { width: 32px; height: 32px; border-radius: 8px; padding: 5px; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-card { width: 100%; max-width: 400px; padding: 40px 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.login-card__mark { width: 64px; height: 64px; border-radius: 16px; padding: 11px; }
.login-card__title { margin: 0; font-size: 20px; font-weight: 700; }
.login-card__desc { margin: 0; color: var(--muted); }
/* Google's button is a light-scheme iframe: a dark-scheme parent would make
   the browser paint an opaque white backdrop behind it. */
#google-signin-button { color-scheme: light; }

/* ---------- slide deck (always dark, full screen) ---------- */
.slide-overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #0b0c10; color: #f4f5f7; color: contrast-color(#0b0c10); }
.slide-overlay__bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid rgb(255 255 255 / .12); font-size: 13px; color: rgb(255 255 255 / .8); }
.slide-overlay__bar .btn { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .2); color: #f4f5f7; }
.slide-overlay__bar .btn:hover:not(:disabled) { background: rgb(255 255 255 / .16); color: #f4f5f7; }
.slide-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; text-align: center; position: relative; }
.slide { max-width: 860px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.slide__eyebrow { display: flex; gap: 8px; align-items: center; }
.slide__person { font-size: 16px; font-weight: 700; color: rgb(255 255 255 / .85); }
.slide__title { font-size: 24px; font-weight: 700; }
.slide__situation { font-size: 17px; line-height: 1.6; color: rgb(255 255 255 / .8); }
.slide__summary { font-size: 27px; line-height: 1.65; font-weight: 600; }
.slide__takeaway { font-size: 17px; line-height: 1.6; background: rgb(129 140 248 / .15); border-radius: 10px; padding: 12px 20px; color: #e0e3ff; }
.slide__meta { font-size: 13px; color: rgb(255 255 255 / .75); }
.slide--title .slide__summary { font-size: 37px; }
.slide-overlay__nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px; border-top: 1px solid rgb(255 255 255 / .12); }
.slide-overlay__dot { min-width: 60px; text-align: center; font-size: 13px; color: rgb(255 255 255 / .75); }

/* ---------- toggle switch ---------- */
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; display: inline-block; width: 38px; height: 32px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; left: 0; right: 0; top: 5px; bottom: 5px; cursor: pointer; border-radius: 999px; background: var(--border-strong); transition: background .15s ease; }
.switch__track::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s ease; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::before { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: .5; cursor: not-allowed; }

/* ---------- tabs & pill filters ---------- */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { appearance: none; border: none; background: transparent; cursor: pointer; min-height: 32px; padding: 8px 2px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); color: contrast-color(var(--bg)); }
.tab[aria-current="true"] { color: var(--link); border-bottom-color: var(--accent); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtab {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.subtab:hover { color: var(--text); color: contrast-color(var(--surface)); }
.subtab[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; color: contrast-color(var(--accent)); }
.subtab__count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle)); font-size: 11.5px; font-weight: 700; }

/* ---------- case sections (ケース詳細) ---------- */
.case-section { margin-bottom: 16px; }
.case-section__label { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.case-section__body { font-size: 15px; line-height: 1.8; }
.case-section--takeaway { background: var(--accent-soft); color: var(--text); color: contrast-color(var(--accent-soft)); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 16px; }
.case-section--takeaway .case-section__label { color: var(--link); }

/* ---------- ui components (src/ui) ---------- */
.panel {
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 20px;
}
.panel__header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel__title { font-size: 16px; font-weight: 600; }
.panel__more { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; font-weight: 600; text-decoration: none; }
.panel__more:hover { text-decoration: underline; }
.panel .empty-state { padding: 24px 12px; }
.panel .empty-state__title { color: var(--text); color: contrast-color(var(--surface)); }
.empty-state__desc { margin: 0; font-size: 13.5px; }
.stat-tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px;
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.stat-tile p { margin: 0; }
.stat-tile__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-tile__value { font-size: 26px; font-weight: 700; line-height: 1.4; }
.stat-tile__note { font-size: 13px; color: var(--muted); }
.stat-tile__note--warning { color: var(--warning); font-weight: 600; }
a.stat-tile__note { text-decoration: underline; }
a.btn { text-decoration: none; }

/* ---------- home ---------- */
.search-box { width: 320px; }
.home { display: flex; flex-direction: column; gap: 24px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.home__lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.item-list li:first-child { border-top: none; padding-top: 0; }
.item-list__main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; min-width: 0; }
.item-list__main a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; text-decoration: none; }
.item-list__main a:hover { text-decoration: underline; }
.item-list__meta { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.panel > .muted { margin: 0; }
.checklist { margin: 8px 0 16px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; align-items: center; gap: 12px; }
.checklist__body { display: flex; flex-direction: column; flex: 1; }
.checklist__title { font-weight: 600; }
.digest { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.digest__title { margin: 0; font-size: 15px; font-weight: 600; }

/* ---------- ui components: pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pager__status { font-size: 13px; color: var(--muted); }

/* ---------- shared by the 学ぶ screens ---------- */
.back-link { display: inline-flex; align-items: center; min-height: 32px; margin-bottom: 8px; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.list-count { margin: 0 0 8px; }

/* ---------- notebooks ---------- */
.notebook-create { display: flex; gap: 8px; margin-bottom: 16px; }
.notebook-create input { width: 320px; }

/* ---------- ケース ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.filter-bar__search { flex: 1 1 320px; display: flex; }
.filter-bar__search .search-box { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13.5px; cursor: pointer; }
.selection-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--text); color: contrast-color(var(--accent-soft));
}
.case-list {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
}
.case-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 16px 12px 8px; border-top: 1px solid var(--border); }
.case-row:first-child { border-top: none; }
.case-row__select { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; cursor: pointer; }
.case-row__body { flex: 1; min-width: 0; }
.case-row__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.case-row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.case-row__title { display: inline-flex; align-items: center; min-height: 32px; font-size: 15px; font-weight: 500; text-decoration: none; }
.case-row--unread .case-row__title { font-weight: 700; }
.case-row__title:hover { text-decoration: underline; }
.case-row__summary { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-row__meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- ケース詳細 ---------- */
.case-detail { display: flex; flex-direction: column; gap: 16px; }
.case-detail__header p { margin: 0; }
.case-detail__title { margin: 6px 0 2px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); color: contrast-color(var(--accent-soft)); }
.case-detail__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tag-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.tag:hover { border-color: var(--accent); }
.exchange > summary { display: flex; align-items: center; min-height: 32px; cursor: pointer; font-weight: 600; color: var(--link); }
.exchange__list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.exchange__time { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.turn { margin-bottom: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.turn--user { background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle)); }
.turn__who { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.turn__text { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ---------- chat ---------- */
.cite { display: inline-flex; align-items: center; min-height: 32px; margin-right: 12px; }
.focus-case { align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* ---------- studio ---------- */
.panel > .panel__lead { margin: 0 0 12px; }
.panel > .form-msg { margin: 12px 0 0; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.field { display: inline-flex; flex-direction: column; gap: 2px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.studio__command { margin-top: 12px; }
.studio__command + .code-block { margin-top: 8px; }
.player__head { display: flex; align-items: center; gap: 16px; }
.player__head p { margin: 0; }
.player__title { font-size: 15px; font-weight: 600; }
.player__progress { font-size: 13px; color: var(--muted); }
.player__bar { display: block; width: 100%; height: 8px; margin: 12px 0; accent-color: var(--accent); }
.player__rates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.digest-list { list-style: none; margin: 0; padding: 0; }
.digest-row { padding: 12px 0; border-top: 1px solid var(--border); }
.digest-row:first-child { border-top: none; padding-top: 0; }
.digest-row__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.digest-row__title { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; font-weight: 600; }
.digest-row__meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.script > summary { display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; font-weight: 600; color: var(--link); }
.script__body {
  margin-top: 8px; padding: 14px 18px; max-width: 46em;
  border-radius: var(--radius-md);
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
  font-size: 15px; line-height: 1.9;
}
.script__body p { margin: 0 0 .8em; }
.script__body p:last-child { margin-bottom: 0; }

/* ---------- Skills審査 ---------- */
a.tab { display: inline-flex; align-items: center; text-decoration: none; }
.page__lead { margin: -8px 0 16px; }
.review__error { margin-bottom: 12px; }
.review { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.queue {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); color: contrast-color(var(--surface));
}
.queue__item + .queue__item { border-top: 1px solid var(--border); }
.queue__link { display: flex; flex-direction: column; gap: 2px; min-height: 32px; padding: 10px 14px; color: inherit; text-decoration: none; }
.queue__link:hover { background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle)); }
.queue__link[aria-current="page"] {
  background: var(--accent-soft); color: var(--text); color: contrast-color(var(--accent-soft));
  box-shadow: inset 3px 0 0 var(--accent);
}
.queue__title { font-weight: 600; }
.queue__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); }
.skill-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.skill-detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.skill-detail__head p { margin: 0; }
.skill-detail__title { font-size: 16px; font-weight: 700; }
.skill-detail__meta { font-size: 13px; color: var(--muted); }
.skill-detail__meta code { color: var(--text); color: contrast-color(var(--subtle)); }
.skill-detail__nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.skill-detail__desc { margin: 0; }
.skill-flags {
  padding: 10px 14px; font-size: 13.5px;
  border-left: 3px solid var(--warning); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--warning-bg); color: var(--text); color: contrast-color(var(--warning-bg));
}
.skill-flags__title { margin: 0 0 4px; font-weight: 700; }
.skill-flags ul { margin: 0; padding-left: 1.2em; }
.skill-body {
  margin: 0; padding: 12px 14px 12px 3.2em;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
}
.skill-body__line { min-height: 1.6em; white-space: pre-wrap; word-break: break-word; }
.skill-body__line--flagged {
  background: var(--warning-bg); color: var(--text); color: contrast-color(var(--warning-bg));
  outline: 1px solid var(--warning);
}
.skill-edit { display: flex; flex-direction: column; gap: 12px; }
.skill-edit .field { display: flex; }
.skill-edit input, .skill-edit textarea { width: 100%; }
.skill-edit textarea { font-family: var(--font-mono); font-size: 13px; line-height: 1.6; resize: vertical; }
.skill-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.skill-actions__reason { flex: 1 1 280px; }
kbd { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.4; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; }
.skill-dist__summary { margin: 0 0 12px; font-weight: 600; }
.skill-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.skill-history li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.skill-history__meta { font-size: 13px; color: var(--muted); }
.skill-history__reason { flex-basis: 100%; margin: 0; }
.history-table a { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- 端末 ---------- */
a.subtab { text-decoration: none; }
.machines__alert { margin-bottom: 12px; }
.machines__filters { margin-bottom: 12px; }
.machines-table td { vertical-align: top; word-break: break-word; }
.machines-table a { display: inline-flex; align-items: center; min-height: 32px; }
.machines__host { display: block; font-weight: 600; max-width: 16em; word-break: break-word; }
.machines__sub { display: block; font-size: 12.5px; color: var(--muted); max-width: 16em; word-break: break-word; }
.machines__error { margin: 0; max-width: 24em; word-break: break-word; }
.machines__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 20em; }
.machines__confirm p { margin: 0; }

/* ---------- 対象者 ---------- */
.people__message { margin-bottom: 12px; }
.import__note { margin: 0 0 12px; }
.import__file { min-height: 32px; }
.import__summary { margin: 12px 0 8px; font-weight: 600; }
.import__result { margin: 12px 0 8px; }
.import__errors { margin: 0; padding-left: 1.2em; }
.import__actions { margin-top: 12px; }
.import-preview td { vertical-align: top; word-break: break-word; }
tbody tr.import-preview__row--error, tbody tr.import-preview__row--error:hover { background: var(--danger-bg); color: var(--text); color: contrast-color(var(--danger-bg)); }
.import-preview__row--error .muted { color: var(--text); color: contrast-color(var(--danger-bg)); }
.import-preview__errors { margin: 4px 0 0; padding-left: 1.2em; }
.people-table a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; }
.people-table__select { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; cursor: pointer; }
.people__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.people__confirm p { margin: 0; }

/* ---------- 対象者の詳細 ---------- */
.person { display: flex; flex-direction: column; gap: 16px; }
.person__header { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.person__header p { margin: 0; }
.person__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.case-detail__person { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- 招待リンク (対象者の詳細) ---------- */
.copy-status { color: var(--muted); font-size: 13px; }
.invite__message { margin: 0 0 12px; }
.invite__row { display: flex; align-items: center; gap: 8px; }
.invite__url { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; }
.invite__issue { margin-top: 12px; }

/* ---------- 招待 (public /join/:token) ---------- */
.join { max-width: 720px; margin: 0 auto; padding: 48px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.join__header { display: flex; flex-direction: column; gap: 8px; }
.join__header p { margin: 0; }
.join__os { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.join__os legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.join__os label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.join__os input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.join__steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.join__step { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.join__step + .join__step { margin-top: 0; }
.join__step h2 { font-size: 16px; font-weight: 600; }
.join__step p { margin: 0; }
.join__code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.join__code {
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 14px; word-break: break-all; user-select: all;
  background: var(--subtle); color: var(--text); color: contrast-color(var(--subtle));
}

/* ---------- 管理者 ---------- */
.admins__status:not(:empty) { margin: 0 0 12px; }
.admins__status:focus { outline-offset: 2px; }
.admins-table td { vertical-align: top; word-break: break-word; }
.admins__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admins__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 22em; }
.admins__confirm p { margin: 0; }

/* ---------- 操作ログ ---------- */
.audit-table td { vertical-align: top; word-break: break-word; }
.audit-table__time { white-space: nowrap; }

/* ---------- AI利用量 ---------- */
.usage-block { margin-top: 12px; }
.usage-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-table tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.usage-price { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 16px; }
.usage-price__field { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.audit-table__sub { display: block; font-size: 13.5px; color: var(--muted); } /* .muted's size — the app's secondary-text size */
