/* BiL Voice Interview — shared styles */
:root {
  --ink: #1c2330;
  --ink-2: #47505e;
  --muted: #6b7280;
  --line: #dde1e6;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --accent: #1f6f5c;
  --accent-ink: #14503f;
  --accent-soft: #e3f1ec;
  --warn: #b4432f;
  --warn-soft: #fbeae6;
  --info-soft: #eef2f7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 35, 48, 0.06), 0 4px 16px rgba(28, 35, 48, 0.05);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic Medium", "Meiryo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper);
  line-height: 1.7; -webkit-font-smoothing: antialiased; font-feature-settings: "palt";
}
h1, h2, h3 { margin: 0; line-height: 1.35; letter-spacing: 0.01em; font-weight: 600; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---- top bar ---- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .name { font-weight: 700; letter-spacing: 0.02em; }
.brand .sub { color: var(--muted); font-size: 0.85rem; }

/* ---- layout ---- */
.wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px 80px; }
.wrap.narrow { max-width: 480px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 16px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 500; line-height: 1.3; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--paper); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--warn); border-color: #e7b7ae; }
.btn.danger:hover { background: var(--warn-soft); }
.btn.lg { padding: 14px 24px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: 0.875rem; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 500; font-size: 0.95rem; }
.field .hint { color: var(--muted); font-size: 0.85rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.error { color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }
.notice { background: var(--info-soft); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; color: var(--ink-2); }
.success { background: var(--accent-soft); color: var(--accent-ink); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }

/* ---- role tabs (segmented) ---- */
.tabs { display: flex; gap: 6px; padding: 6px; background: #e9ecf0; border-radius: 12px; }
.tabs button {
  flex: 1; padding: 12px 8px; border: 0; background: transparent; border-radius: 8px;
  color: var(--ink-2); cursor: pointer; font-weight: 500; font-size: 1rem;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* ---- scenario list ---- */
.scenario-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.scenario {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.scenario h3 { font-size: 1.05rem; }
.scenario .desc { color: var(--ink-2); margin-top: 4px; font-size: 0.95rem; }
.scenario .meta { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- interview screen ---- */
.stage { text-align: center; padding: 8px 0 20px; }
.orb {
  width: 132px; height: 132px; margin: 12px auto 18px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #4f9c88, var(--accent) 60%, var(--accent-ink));
  box-shadow: 0 0 0 0 rgba(31, 111, 92, 0.25);
}
.orb.live { animation: breathe 2.6s ease-in-out infinite; }
.orb.done { background: radial-gradient(circle at 35% 30%, #c6ccd4, #9aa3ad 60%, #7d8791); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 111, 92, 0.28); transform: scale(1); }
  50% { box-shadow: 0 0 0 26px rgba(31, 111, 92, 0); transform: scale(1.03); }
}
.stage .status { font-size: 1.1rem; font-weight: 600; }
.stage .who { color: var(--muted); margin-top: 4px; }
.voice-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

.chatlog { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 12px; line-height: 1.65; font-size: 0.97rem; white-space: pre-wrap; }
.bubble.ai { align-self: flex-start; background: var(--info-soft); border-bottom-left-radius: 4px; }
.bubble.user { align-self: flex-end; background: var(--accent-soft); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble .spk { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 2px; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer textarea { min-height: 52px; max-height: 160px; }
.composer .btn { white-space: nowrap; align-self: stretch; }

/* ---- admin layout ---- */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #dfe4ea; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { color: #fff; padding: 6px 10px 18px; display: block; }
.side .brand .sub { color: #9aa5b3; display: block; font-size: 0.8rem; }
.side a { display: block; color: #dfe4ea; padding: 9px 12px; border-radius: 8px; }
.side a:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.side a.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; }
.side .spacer { flex: 1; }
.side .me { color: #9aa5b3; font-size: 0.85rem; padding: 8px 12px; }
.main { padding: 28px 32px 80px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.toolbar .field { margin: 0; min-width: 140px; }
.toolbar .field.wide { min-width: 220px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 0.93rem; }
table.grid th { background: #f8f9fb; font-weight: 600; color: var(--ink-2); white-space: nowrap; user-select: none; }
table.grid th.sortable { cursor: pointer; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid th .dir { color: var(--accent); margin-left: 4px; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: #fafbfc; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; background: var(--info-soft); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent-ink); }
.pill.run { background: #fff4d6; color: #8a5a00; }
.pill.bad { background: var(--warn-soft); color: var(--warn); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 0.9rem; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 0.95rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.transcript { font-family: var(--font); white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; max-height: 560px; overflow-y: auto; line-height: 1.8; font-size: 0.95rem; }
.transcript .ln { display: block; }
.transcript .ln.ai { color: var(--ink-2); }
.transcript .ln.filler { color: #a0a6ae; }
.article-body { line-height: 1.85; }
.article-body h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.article-body p { margin: 0 0 12px; }
.article-body strong { font-weight: 600; }
.modal-bg { position: fixed; inset: 0; background: rgba(28, 35, 48, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 760px; box-shadow: var(--shadow); }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 0.9rem; box-shadow: var(--shadow); z-index: 60; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .side .brand { padding: 4px 10px; } .side .spacer, .side .me { display: none; }
  .main { padding: 20px 16px 60px; }
  .two-col { grid-template-columns: 1fr; }
  .scenario { grid-template-columns: 1fr; }
  .voice-frame { height: 70vh; }
}
