/*
 * The look every page shares, laid over Bootstrap: one accent colour, one set of buttons, status chips that
 * always mean the same thing. The review editor is the same product in a dark working mode (review-assets/editor.css).
 */
:root {
  --g-brand: #2b4c7e;
  --g-brand-hover: #223e68;
  --g-brand-soft: #e9eef6;
  --g-bg: #f5f6f8;
  --g-surface: #ffffff;
  --g-line: #e3e6eb;
  --g-text: #1f2328;
  --g-muted: #667085;
  --g-ok: #1e7b45;   --g-ok-soft: #e7f4ec;
  --g-warn: #9a5b00; --g-warn-soft: #fff4e0;
  --g-bad: #b42318;  --g-bad-soft: #fcebeb;
  --g-radius: 8px;
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans", sans-serif;
  --bs-body-font-size: 14px;
  --bs-body-color: var(--g-text);
  --bs-body-bg: var(--g-bg);
  --bs-border-color: var(--g-line);
  --bs-secondary-color: var(--g-muted);
  --bs-link-color-rgb: 43, 76, 126;
  --bs-link-hover-color-rgb: 34, 62, 104;
}
body { background: var(--g-bg); }
.ja { font-family: "Hiragino Sans", "Yu Gothic", "PingFang SC", sans-serif; }
.text-muted { color: var(--g-muted) !important; }

/* ---- top bar ---- */
.g-top { height: 56px; background: var(--g-surface); border-bottom: 1px solid var(--g-line);
  display: flex; align-items: center; padding: 0 24px; gap: 12px; }
.g-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--g-brand); color: #fff; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; text-decoration: none; }
.g-mark:hover { color: #fff; }
.g-name { font-weight: 600; font-size: 15px; color: var(--g-text); text-decoration: none; }
.g-name:hover { color: var(--g-brand); }
.g-build { margin-left: auto; color: var(--g-muted); font-size: 12px; }

/* ---- page frame ---- */
.g-page { max-width: 1160px; margin: 0 auto; padding: 28px 24px 64px; }
.g-page.narrow { max-width: 680px; }
.g-crumb { font-size: 13px; color: var(--g-muted); margin-bottom: 6px; }
.g-crumb a { color: var(--g-muted); text-decoration: none; }
.g-crumb a:hover { color: var(--g-brand); }
.g-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.g-head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.2px; }
.g-head .sub { color: var(--g-muted); font-size: 13px; margin-top: 4px; }
.g-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---- buttons: one height, three kinds (primary, secondary, ghost) ---- */
.btn { --bs-btn-padding-y: 5px; --bs-btn-padding-x: 12px; --bs-btn-font-size: 13px; --bs-btn-font-weight: 500; --bs-btn-border-radius: 6px; }
.btn-sm { --bs-btn-padding-y: 3px; --bs-btn-padding-x: 9px; --bs-btn-font-size: 12.5px; --bs-btn-border-radius: 6px; }
.btn-primary, .btn-dark, .btn-success {
  --bs-btn-color: #fff; --bs-btn-bg: var(--g-brand); --bs-btn-border-color: var(--g-brand);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--g-brand-hover); --bs-btn-hover-border-color: var(--g-brand-hover);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--g-brand-hover); --bs-btn-active-border-color: var(--g-brand-hover);
  --bs-btn-disabled-bg: var(--g-brand); --bs-btn-disabled-border-color: var(--g-brand); }
.btn-secondary, .btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-dark {
  --bs-btn-color: var(--g-text); --bs-btn-bg: var(--g-surface); --bs-btn-border-color: var(--g-line);
  --bs-btn-hover-color: var(--g-text); --bs-btn-hover-bg: #f0f2f5; --bs-btn-hover-border-color: #cfd4dc;
  --bs-btn-active-color: var(--g-text); --bs-btn-active-bg: #e8ebf0; --bs-btn-active-border-color: #cfd4dc; }
.btn-outline-danger { --bs-btn-color: var(--g-bad); --bs-btn-bg: var(--g-surface); --bs-btn-border-color: var(--g-line);
  --bs-btn-hover-color: var(--g-bad); --bs-btn-hover-bg: var(--g-bad-soft); --bs-btn-hover-border-color: #f1c4c0; }
.btn-ghost, .btn-link { --bs-btn-color: var(--g-brand); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--g-brand); --bs-btn-hover-bg: var(--g-brand-soft); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--g-brand); --bs-btn-active-bg: var(--g-brand-soft); text-decoration: none; }
td .btn + .btn, td .btn + span, td .btn + .chip { margin-left: 6px; }

/* ---- forms ---- */
.form-control, .form-select { border-color: var(--g-line); border-radius: 6px; }
.form-control:focus, .form-select:focus { border-color: #8fa6c9; box-shadow: 0 0 0 3px rgba(43, 76, 126, .15); }
.form-label { font-weight: 600; }

/* ---- cards and tables ---- */
.card { --bs-card-border-color: var(--g-line); --bs-card-border-radius: var(--g-radius); --bs-card-inner-border-radius: 7px; background: var(--g-surface); }
.shadow-sm { box-shadow: none !important; }
.card h2, .g-section-title { font-size: 15px; font-weight: 600; }
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #fafbfd; margin: 0; }
.table > :not(caption) > * > * { padding: 11px 16px; border-bottom-color: var(--g-line); }
.table.table-sm > :not(caption) > * > * { padding: 8px 12px; }
.table > thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--g-muted);
  font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table > thead th .hint { text-transform: none; letter-spacing: 0; font-weight: 400; display: block; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.card > .table-responsive > .table > thead th:first-child, .card > .table-responsive > .table > thead th:last-child { border-radius: 0; }
tr.link { cursor: pointer; }

/* ---- status: fixed colours, one meaning each ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap; line-height: 1.5; vertical-align: middle; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.run { background: var(--g-brand-soft); color: var(--g-brand); }
.chip.run::before { animation: g-pulse 1.2s infinite; }
.chip.ok { background: var(--g-ok-soft); color: var(--g-ok); }
.chip.warn { background: var(--g-warn-soft); color: var(--g-warn); }
.chip.bad { background: var(--g-bad-soft); color: var(--g-bad); }
.chip.idle { background: #eef0f3; color: var(--g-muted); }
.chip.plain::before { display: none; }
@keyframes g-pulse { 50% { opacity: .3; } }
.g-progress { height: 6px; background: #e8ebf0; border-radius: 3px; overflow: hidden; width: 220px; }
.g-progress i { display: block; height: 100%; width: 100%; background: var(--g-brand); border-radius: 3px; animation: g-pulse 1.6s infinite; }

/* ---- tabs: an underline, not boxes ---- */
.nav-tabs { border-bottom: 1px solid var(--g-line); gap: 24px; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; padding: 10px 0; color: var(--g-muted); font-weight: 500;
  background: none; margin-bottom: -1px; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--g-text); border-bottom-color: var(--g-line); }
.nav-tabs .nav-link.active { color: var(--g-text); border-bottom-color: var(--g-brand); background: none; }

/* ---- the only way files come in: a drop area ---- */
.g-drop { border: 1.5px dashed #c5ccd6; border-radius: var(--g-radius); background: var(--g-surface); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; color: var(--g-muted); transition: border-color .15s, background .15s; }
.g-drop.over { border-color: var(--g-brand); background: var(--g-brand-soft); }
.g-drop .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--g-brand-soft); color: var(--g-brand);
  display: grid; place-items: center; font-size: 18px; flex: none; }
.g-drop b { color: var(--g-text); font-weight: 600; }
.g-drop label { cursor: pointer; color: var(--g-brand); text-decoration: underline; margin: 0; }
.g-drop .chosen { color: var(--g-text); font-size: 12.5px; margin-top: 4px; }
.g-drop .chosen:empty { display: none; }

/* ---- empty and loading ---- */
.g-empty { text-align: center; padding: 48px 20px; color: var(--g-muted); }
.g-empty .ico { font-size: 28px; margin-bottom: 8px; }
.g-empty .title { font-weight: 600; color: var(--g-text); }

/* ---- folded sections ---- */
details.fold > summary { cursor: pointer; list-style: none; padding: 13px 18px; display: flex; align-items: baseline; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--g-muted); width: 10px; }
details.fold[open] > summary::before { content: "▾"; }
details.fold[open] > summary { border-bottom: 1px solid var(--g-line); }
.count { color: var(--g-muted); font-weight: 400; }

/* the two versions of an episode, said once above the table */
.versions { color: var(--g-muted); }
.versions b { color: var(--g-text, inherit); font-weight: 600; }

/* the episode each chosen script will be */
.numbering { margin-top: 6px; font-size: 13px; }
.numbering .numbered { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.numbering .numbered b { min-width: 3.2rem; }
.numbering .numbered-note { color: var(--g-bad); margin-top: 4px; }
td .ep-file { display: block; font-size: 11px; font-weight: 400; color: var(--g-muted); max-width: 9.5rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
