/* Story Video Studio - 業務UI（高密度・自前フォントのみ） */
:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-surface-muted: #f8f9fd;
  --color-border: #e0e4ee;
  --color-text: #171a31;
  --color-text-muted: #68708a;
  --color-primary: #6157e8;
  --color-primary-dark: #473ec9;
  --color-danger: #c8424d;
  --color-danger-bg: #fff0f1;
  --color-warn: #9a6200;
  --color-warn-bg: #fff7e5;
  --color-info: #4a45c7;
  --color-info-bg: #efefff;
  --color-ok: #13755d;
  --color-ok-bg: #e8f8f2;
  --shadow-card: 0 8px 24px rgba(30, 38, 78, .07);
  --radius: 12px;
  --radius-small: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a { color: var(--color-primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(97, 87, 232, .28);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.app-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 8px 24px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(224, 228, 238, .8);
  backdrop-filter: blur(16px);
}
.app-nav-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); text-decoration: none; line-height: 1.1; }
.app-nav-brand strong { display: block; font-size: 14px; letter-spacing: -.02em; }
.app-nav-brand small { display: block; margin-top: 3px; color: var(--color-text-muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #766cff, #4b41d2); box-shadow: 0 7px 14px rgba(97, 87, 232, .28); font-size: 16px; font-weight: 800; }
.app-nav-links { display: flex; align-items: center; gap: 4px; }
.app-nav-links a, .link-btn { min-height: 36px; padding: 0 10px; border-radius: var(--radius-small); text-decoration: none; color: var(--color-text-muted); font-weight: 700; }
.app-nav-links a { display: inline-flex; align-items: center; }
.app-nav-links a:hover, .app-nav-links a.active { color: var(--color-primary); background: var(--color-info-bg); }
.app-nav-links a.active { font-weight: 800; }

.link-btn {
  border: none;
  background: transparent;
  cursor: pointer;
}
.link-btn:hover { color: var(--color-primary); background: var(--color-info-bg); }

.app-root {
  padding: 24px;
  width: 100%;
}

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-header h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; }
.eyebrow { margin: 0 0 7px; color: var(--color-primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.page-subtitle { margin: 7px 0 0; color: var(--color-text-muted); }
.project-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-card); }
.summary-item span { color: var(--color-text-muted); font-size: 12px; font-weight: 700; }
.summary-item strong { color: var(--color-text); font-size: 22px; letter-spacing: -.04em; }
.summary-active strong { color: var(--color-info); }
.summary-ready strong { color: var(--color-warn); }
.summary-completed strong { color: var(--color-ok); }
.projects-page-header + .project-summary + .toolbar { padding: 10px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-muted); }
.projects-page-header + .project-summary + .toolbar .btn { white-space: nowrap; }
.selection-action-bar { display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 12px; border: 1px solid #d5d1ff; border-radius: var(--radius); background: #f4f2ff; color: #373080; }
.selection-action-bar strong { margin-right: auto; font-size: 13px; }
.selection-action-bar .btn:first-of-type { background: linear-gradient(135deg, #7166f4, var(--color-primary)); border-color: var(--color-primary); color: #fff; }
.project-title-meta { display: block; margin-top: 3px; color: var(--color-text-muted); font-size: 11px; }
.project-next-step-label, .project-next-step-description { display: block; }
.project-next-step-label { color: var(--color-text); font-size: 12px; }
.project-next-step-description { margin-top: 2px; color: var(--color-text-muted); font-size: 11px; line-height: 1.35; }
.data-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-card); }
.data-table { background: var(--color-surface); }
.data-table th { background: #f2f3f9; color: var(--color-text-muted); font-size: 11px; letter-spacing: .03em; }
.data-table tbody tr { transition: background .16s ease; }
.data-table tbody tr:hover { background: #fafaff; }
.data-table td { padding: 11px 10px; }
.data-table td:nth-child(2) a { color: var(--color-text); font-weight: 800; }
.data-table td:nth-child(2) a:hover { color: var(--color-primary); }
.projects-empty { display: grid; place-items: center; min-height: 270px; padding: 32px; border: 1px dashed #c9cdea; border-radius: var(--radius); background: linear-gradient(135deg, #fafaff, #f4f8ff); text-align: center; }
.projects-empty p { max-width: 460px; color: var(--color-text-muted); }
.projects-empty pre { padding: 14px 18px; border-radius: var(--radius-small); background: #1c1b3d; color: #d9d8ff; text-align: left; font-size: 12px; }

.btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-small);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.btn:hover:not(:disabled) { border-color: rgba(97, 87, 232, .45); box-shadow: 0 4px 12px rgba(36, 39, 83, .10); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #7166f4, var(--color-primary)); border-color: var(--color-primary); color: #fff; box-shadow: 0 6px 14px rgba(97, 87, 232, .22); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-small { min-height: 30px; padding: 0 9px; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 750; }
.form-row input, .form-row select, .form-row textarea {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--color-text);
}
.form-row textarea { min-height: auto; }
.form-error { color: var(--color-danger); font-size: 12px; }
.form-hint { color: var(--color-text-muted); font-size: 12px; }
.key-guide-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.key-guide {
  margin: 6px 0;
  padding-left: 1.4em;
  line-height: 1.7;
  font-size: 13px;
}
.key-guide li + li {
  margin-top: 4px;
}
.key-guide-details > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 0;
}
.key-guide-heading {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 13px;
}
.key-guide-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 2px;
}
.key-guide-check {
  margin: 6px 0 0;
  padding: 6px 8px;
  border-left: 3px solid var(--color-border);
  background: var(--color-surface-alt, rgba(0, 0, 0, 0.04));
  font-size: 12px;
  line-height: 1.6;
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  max-width: 960px;
  min-height: 500px;
  margin: clamp(28px, 9vh, 110px) auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: 0 28px 70px rgba(24, 28, 67, .19);
}
.auth-hero { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding: 44px; color: #f9f9ff; background: radial-gradient(circle at 15% 14%, rgba(147, 136, 255, .78), transparent 30%), radial-gradient(circle at 85% 80%, rgba(46, 201, 177, .42), transparent 26%), linear-gradient(135deg, #17143f 0%, #302989 100%); }
.auth-hero .brand-mark { width: 48px; height: 48px; margin-bottom: auto; border-radius: 15px; background: rgba(255, 255, 255, .18); box-shadow: none; }
.auth-kicker { margin: 0 0 12px; color: #c9c6ff; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.auth-hero h1 { max-width: 440px; margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.05em; white-space: pre-line; }
.auth-hero p { max-width: 400px; margin: 18px 0 0; color: rgba(255, 255, 255, .78); font-size: 15px; }
.auth-panel { align-self: center; padding: 42px; }
.auth-panel h2 { margin: 0; color: var(--color-text); font-size: 24px; letter-spacing: -.04em; }
.auth-panel > p { margin: 8px 0 26px; color: var(--color-text-muted); }
.auth-shell .btn-primary { width: 100%; min-height: 44px; }

@media (max-width: 760px) {
  .app-nav { padding: 8px 14px; }
  .app-nav-brand small { display: none; }
  .app-nav-links { gap: 0; }
  .app-nav-links a, .link-btn { padding: 0 7px; font-size: 12px; }
  .app-root { padding: 14px; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; margin: 18px auto; border-radius: 18px; }
  .auth-hero { min-height: 230px; padding: 28px; }
  .auth-hero .brand-mark { margin-bottom: 38px; }
  .auth-hero h1 { font-size: 31px; }
  .auth-panel { padding: 28px; }
  .page-header { align-items: flex-start; margin-bottom: 14px; }
  .project-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-page-header + .project-summary + .toolbar { overflow: visible; }
  .selection-action-bar { align-items: stretch; flex-wrap: wrap; }
  .selection-action-bar strong { flex-basis: 100%; }
  .selection-action-bar .btn { flex: 1 1 30%; padding: 0 8px; font-size: 12px; }
  .data-table { table-layout: fixed; }
  .data-table th, .data-table td { padding: 9px 6px; overflow-wrap: anywhere; }
  .data-table th:nth-child(4), .data-table td:nth-child(4),
  .data-table th:nth-child(6), .data-table td:nth-child(6) { display: none; }
  .data-table th:nth-child(1), .data-table td:nth-child(1) { width: 30px; }
  .data-table th:nth-child(2), .data-table td:nth-child(2) { width: 32%; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { width: 24%; }
  .data-table th:nth-child(5), .data-table td:nth-child(5) { width: 20%; }
  .data-table th:nth-child(7), .data-table td:nth-child(7) { width: 20%; }
}

table.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}
.data-table th { background: #eef0f3; font-weight: 700; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: #e5e7eb;
  color: #333;
}
.badge-draft { background: #e5e7eb; color: #333; }
.badge-voicing, .badge-rendering { background: var(--color-info-bg); color: var(--color-info); }
.badge-ready { background: var(--color-warn-bg); color: var(--color-warn); }
.badge-completed { background: var(--color-ok-bg); color: var(--color-ok); }
.badge-failed { background: var(--color-danger-bg); color: var(--color-danger); }

.progress-bar {
  width: 100px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--color-primary);
}
.progress-text { font-size: 11px; margin-left: 4px; color: var(--color-text-muted); }

.text-danger { color: var(--color-danger); font-weight: 700; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

.toast-root {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toast {
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #1c2128;
  color: #fff;
  min-width: 200px;
  max-width: 360px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.toast-error { background: var(--color-danger); }
.toast-success { background: var(--color-ok); }

.dialog-root { position: fixed; inset: 0; z-index: 90; display: none; }
.dialog-root.open { display: block; }
.dialog-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
}
.dialog-box {
  position: relative;
  max-width: 420px;
  margin: 100px auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* メディア拡大プレビュー（ライトボックス） */
.media-preview-dialog {
  position: relative;
  max-width: 90vw;
  width: fit-content;
  max-height: 90vh;
  margin: 25px auto;
  background: var(--color-surface, #fff);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.media-preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 16px;
}
.media-preview-title {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 75vw;
}
.media-preview-content {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 86vw;
  max-height: 72vh;
  overflow: hidden;
  background: #090d16;
  border-radius: var(--radius);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.media-preview-content img,
.media-preview-content video {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
}
.media-preview-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.error-box {
  border: 1px solid var(--color-danger);
  background: var(--color-danger-bg);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.error-box dt { font-weight: 700; }
.error-box dd { margin: 0 0 4px; }

.validate-list { list-style: none; margin: 0; padding: 0; }
.validate-list li {
  padding: 3px 6px;
  border-radius: var(--radius);
  margin-bottom: 3px;
}
.validate-blocking { background: var(--color-danger-bg); color: var(--color-danger); }
.validate-warning { background: var(--color-warn-bg); color: var(--color-warn); }
.validate-info { background: var(--color-info-bg); color: var(--color-info); }

/* 一覧 */
.projects-empty {
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
}
.projects-empty pre {
  text-align: left;
  display: inline-block;
  background: #eef0f3;
  padding: 8px 10px;
  border-radius: var(--radius);
}

.import-preview {
  margin: 8px 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.import-preview table { width: 100%; border-collapse: collapse; }
.import-preview th, .import-preview td { padding: 4px 6px; border-bottom: 1px solid var(--color-border); }

/* 詳細画面 */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.detail-topbar {
  grid-column: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-topbar input[type=text] { flex: 1; min-width: 160px; }
.detail-script {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 480px;
}
.segments-table-wrap {
  flex: 1;
  width: 100%;
  max-height: calc(100vh - 360px);
  min-height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.segments-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.segments-table th, .segments-table td {
  padding: 8px 10px;
  font-size: 13px;
}
.segment-text-cell {
  line-height: 1.6;
  color: var(--color-text);
  word-break: break-word;
  white-space: normal;
}

/* 台本専用エディタ画面 (URL: #/projects/:id/script) */
.script-editor-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 100px);
  max-width: 1400px;
  margin: 0 auto;
}
.script-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.script-editor-nav-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.script-editor-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--color-text);
}
.script-editor-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.script-editor-stats {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
  padding: 6px 12px;
  border-radius: var(--radius-small);
  border: 1px solid var(--color-border);
}
.script-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.script-editor-textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  padding: 14px 18px;
  font-family: ui-monospace, "Consolas", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.8;
  color: #1a202c;
  background: #fdfdfd;
}
.script-editor-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(97, 87, 232, 0.15);
  background: #ffffff;
}
.script-editor-footer {
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 4px 8px;
}
.detail-right { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.timeline-wrap { overflow-x: auto; white-space: nowrap; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px; }
.slot {
  display: inline-block;
  width: 70px;
  vertical-align: top;
  margin-right: 6px;
  text-align: center;
  white-space: normal;
}
.slot img, .slot video {
  width: 70px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: #eee;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.slot img:hover, .slot video:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.slot .slot-time { font-size: 10px; color: var(--color-text-muted); }
.slot-assignment { margin-top: 2px; color: var(--color-text-muted); font-size: 10px; font-weight: 700; }
.slot.slot-auto .slot-assignment { color: var(--color-primary-dark); }
.slot.slot-unassigned .slot-assignment { color: var(--color-danger); }
.slot.slot-manual img, .slot.slot-manual video { border-color: var(--color-primary); border-width: 2px; }
.slot .slot-menu { font-size: 10px; }

.images-wrap { flex: 1; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.image-item { text-align: center; }
.image-item img, .image-item video {
  width: 100%;
  height: 50px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.image-item img:hover, .image-item video:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.image-item .fname { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-bottom { grid-column: 1 / span 2; max-height: 160px; overflow-y: auto; }

.range-row { display: flex; align-items: center; gap: 8px; }
.slider-value { min-width: 32px; text-align: right; }

/* 設定画面 */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 1100px;
}
@media (max-width: 760px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* 登録されている鍵（一覧）: 設定グリッドの全幅・高密度 */
.credentials-holder { grid-column: 1 / -1; }
.credentials-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.credentials-head h2 { font-size: 13px; margin: 0; }
.credentials-table th, .credentials-table td { padding: 4px 6px; font-size: 11px; vertical-align: top; overflow-wrap: anywhere; }
.credentials-row-unset td { color: var(--color-text-muted); }
.credentials-subhead { font-size: 12px; margin: 8px 0 4px; }
.credentials-loading { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-text-muted); }
.credentials-warnings { border: 1px solid var(--color-danger); background: var(--color-danger-bg); color: var(--color-danger); border-radius: var(--radius); padding: 6px 8px; margin-bottom: 6px; font-size: 12px; }
.credentials-warning-list { margin: 4px 0 0; padding-left: 18px; }
.credentials-error { color: var(--color-danger); font-size: 12px; margin: 0; }

.provider-radio-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.provider-radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.provider-radio-item label { font-weight: 600; flex: 1; cursor: pointer; }

.key-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.key-badge-set { background: var(--color-ok-bg); color: var(--color-ok); }
.key-badge-unset { background: var(--color-warn-bg); color: var(--color-warn); }

.provider-tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.provider-tab-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 12px;
}
.provider-tab-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.provider-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 8px;
}

.rate-note { color: var(--color-text-muted); font-size: 11px; margin: 2px 0 0; }

/* Production workspace: keep the current stage and primary action visible. */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  min-width: 0;
  gap: 14px;
}
.detail-topbar { padding: 14px 16px; background: linear-gradient(135deg, #ffffff, #f6f6ff); border-color: #d8d7f4; }
.detail-topbar input[type=text] { min-height: 42px; border: 0; background: transparent; font-size: 21px; font-weight: 800; letter-spacing: -.04em; }
.detail-topbar .btn-primary { order: 2; }
.detail-topbar .badge { order: 1; }
.detail-next-step { display: inline-flex; align-items: center; gap: 8px; order: 3; }
.detail-next-step small { max-width: 220px; color: var(--color-text-muted); font-size: 11px; }
.detail-stage-card, .detail-actions, .detail-render-settings { grid-column: 1 / span 2; }
.detail-stage-card { display: flex; align-items: center; gap: 18px; padding: 12px 16px; }
.production-stage-rail { display: flex; flex: 1; gap: 4px; margin: 0; padding: 0; list-style: none; }
.production-stage-rail li { flex: 1; min-width: 0; padding: 7px 8px; border-radius: var(--radius-small); background: var(--color-surface-muted); color: var(--color-text-muted); font-size: 11px; font-weight: 700; text-align: center; }
.production-stage-rail li.is-complete { background: var(--color-ok-bg); color: var(--color-ok); }
.production-stage-rail li.is-current { background: #e6e3ff; color: var(--color-primary-dark); box-shadow: inset 0 0 0 1px #b9b1ff; }
.segment-preview-stage { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #111; margin: 8px 0; border-radius: 8px; }
.segment-preview-stage img, .segment-preview-stage video { width: 100%; height: 100%; object-fit: cover; }
.segment-preview-caption { position: absolute; left: 8%; right: 8%; bottom: 10%; padding: 8px 12px; background: rgba(0,0,0,.75); color: #fff; font-size: 13px; font-weight: 700; text-align: center; border-radius: 8px; }
@keyframes svs-kenburns { from { transform: var(--svs-from, none); } to { transform: var(--svs-to, none); } }
@media (prefers-reduced-motion: reduce) {
  .segment-preview-stage img { animation: none !important; }
}
.detail-actions { padding: 10px 14px; }
.detail-actions summary { cursor: pointer; color: var(--color-text-muted); font-size: 12px; font-weight: 700; }
.detail-actions[open] summary { margin-bottom: 10px; color: var(--color-text); }
.detail-script, .detail-right > .card, .detail-bottom { box-shadow: var(--shadow-card); }
.detail-script { padding: 16px; gap: 14px; min-width: 0; }
.segments-table-wrap, .timeline-wrap, .images-wrap { border-color: #dfe2f0; background: var(--color-surface-muted); }
.detail-right { gap: 14px; min-width: 0; }
.detail-right > .card { padding: 16px; }
.detail-bottom { max-height: none; }
.page-wrap > .toolbar { padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-muted); }
.page-wrap > .card { border-radius: var(--radius); box-shadow: var(--shadow-card); }
.video-grid { gap: 14px; }
.video-grid .card video { border-radius: var(--radius-small); background: #171a31; }
.videos-content { margin-top: 18px; }
.video-card { padding: 14px; overflow: hidden; }
.video-card > div:first-child { font-size: 17px !important; letter-spacing: -.02em; }
.video-card video { order: -1; aspect-ratio: 16 / 9; max-height: none !important; object-fit: contain; }
.settings-page-header { margin-bottom: 18px; }
.settings-grid { gap: 16px; max-width: none; }
.settings-grid .card { padding: 20px; }
.settings-grid .card h2 { margin-bottom: 12px !important; color: var(--color-text); font-size: 16px !important; letter-spacing: -.02em; }
.provider-panel { padding: 12px; background: var(--color-surface-muted); }
.provider-tab-btn { min-height: 34px; border-radius: var(--radius-small); font-weight: 700; }

.detail-metadata-card { grid-column: 1 / span 2; padding: 16px; box-shadow: var(--shadow-card); }
.metadata-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.metadata-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.metadata-field-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.metadata-titles-list { display: flex; flex-direction: column; gap: 6px; }
.metadata-title-item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface-muted); font-size: 13px; }
.metadata-title-item.selected { border-color: var(--color-primary); background: rgba(99, 102, 241, 0.08); font-weight: 700; }
.thumbnail-preview-box { width: 100%; aspect-ratio: 16 / 9; background: #0f172a; border-radius: var(--radius-small); overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid var(--color-border); }
.thumbnail-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-placeholder { color: var(--color-text-muted); font-size: 12px; text-align: center; }

@media (max-width: 760px) {
  .metadata-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
 * V2 Workspace UI (T-003, T-004, T-005): Tabs, Dashboard, Voice Workspace
 * --------------------------------------------------------------------------- */

.production-stage-rail li.is-clickable {
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.production-stage-rail li.is-clickable:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}
.production-stage-rail li.is-active-tab {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  font-weight: 800;
}

.workspace-nav-bar {
  grid-column: 1 / span 2;
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 8px;
  margin-bottom: 4px;
  overflow-x: auto;
}
.workspace-nav-btn {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.workspace-nav-btn:hover {
  color: var(--color-text);
  background: #fff;
  border-color: var(--color-primary);
}
.workspace-nav-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.25);
}

.voice-live-banner {
  grid-column: 1 / span 2;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(30, 27, 75, 0.2);
}

.render-live-banner {
  grid-column: 1 / span 2;
  background: linear-gradient(135deg, #701a75, #4a044e);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 6px 16px rgba(74, 4, 78, 0.28);
  animation: pulse-border 2s infinite ease-in-out;
}
@keyframes pulse-border {
  0%, 100% { outline: 2px solid rgba(244, 114, 182, 0.4); }
  50% { outline: 2px solid rgba(244, 114, 182, 0.9); }
}

.project-navigator-bar {
  grid-column: 1 / span 2;
  background: linear-gradient(135deg, #f0fdf4, #e0f2fe);
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.project-navigator-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #0369a1;
}
.project-navigator-info strong {
  font-size: 14px;
}

.dashboard-grid {
  grid-column: 1 / span 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.stage-dash-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stage-dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.stage-dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.stage-dash-card-title {
  font-size: 16px;
  font-weight: 800;
}
.stage-dash-card-body {
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 16px;
  line-height: 1.6;
}
.stage-dash-card-stat {
  font-size: 24px;
  font-weight: 800;
  margin: 6px 0;
  color: var(--color-text);
}
.stage-dash-card-stat small {
  font-size: 12px;
  font-weight: normal;
  color: var(--color-text-muted);
}

.speaker-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.speaker-voice-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.speaker-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.6);
}
.speaker-profile-grid .form-row {
  margin: 0;
}
.speaker-profile-grid label {
  font-size: 12px;
}
@media (max-width: 640px) {
  .speaker-profile-grid { grid-template-columns: 1fr; }
}
.speaker-voice-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.speaker-name-badge {
  font-size: 14px;
  font-weight: 800;
  background: #e0e7ff;
  color: #3730a3;
  padding: 3px 8px;
  border-radius: 4px;
}
.speaker-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.speaker-gender-badge,
.voice-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.speaker-gender-female,
.voice-summary-female {
  color: #9d174d;
  background: #fce7f3;
}
.speaker-gender-male,
.voice-summary-male {
  color: #1d4ed8;
  background: #dbeafe;
}
.speaker-gender-unknown,
.voice-summary-unknown {
  color: #92400e;
  background: #fef3c7;
}
.voice-assignment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.voice-assignment-warning {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
}
.voice-batch-actions {
  align-items: stretch;
}
.voice-batch-actions .btn {
  min-height: 40px;
}
.voice-reassign-action {
  font-weight: 800;
}
.speaker-gender-row {
  margin-bottom: 6px;
}
.speaker-gender-row label {
  font-size: 12px;
}

/* --- レンダー・出力用 ファーストビュー直結アクションカード --- */
.render-primary-action-card {
  border: 2px solid var(--color-primary, #2563eb);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  padding: 16px 20px;
  border-radius: var(--radius, 8px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  margin-bottom: 16px;
}
.render-primary-action-card.disabled-card {
  border-color: #cbd5e1;
  background: #f8fafc;
  box-shadow: none;
}
.render-action-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.render-action-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #1e3a8a;
}
.render-btn-large {
  font-size: 16px;
  font-weight: 800;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease-in-out;
}
.render-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}
.render-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.render-check-item.ok {
  color: #166534;
  font-weight: 600;
}
.render-check-item.ng {
  color: #b91c1c;
  font-weight: 700;
}

/* Channel Tabs and Project Grouping */
.channel-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 6px 8px;
  background: var(--color-surface-muted, #f1f5f9);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  overflow-x: auto;
  scrollbar-width: thin;
}
.channel-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted, #64748b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.channel-tab-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--color-text, #1e293b);
}
.channel-tab-btn.active {
  background: var(--color-primary, #6366f1);
  color: #ffffff;
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}
.channel-tab-count {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
}
.channel-tab-btn.active .channel-tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.channel-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  cursor: pointer;
  transition: all 0.15s ease;
}
.channel-badge-pill.unassigned {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}
.channel-badge-pill:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.sort-select {
  padding: 6px 10px;
  border-radius: var(--radius-small, 6px);
  border: 1px solid var(--color-border, #cbd5e1);
  background: #fff;
  font-size: 13px;
  color: var(--color-text, #1e293b);
  cursor: pointer;
}

/* Dedicated Remotion character and dialogue workspace */
.remotion-settings-page {
  min-width: 0;
  color: var(--color-text);
}
.remotion-settings-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.remotion-settings-toolbar-main,
.remotion-settings-toolbar-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}
.remotion-settings-toolbar h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remotion-settings-save-status {
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}
.remotion-settings-save-status.is-dirty {
  color: #b45309;
}
.remotion-settings-errors:empty {
  display: none;
}
.remotion-settings-errors {
  margin-top: 8px;
}
.remotion-validation-box {
  padding: 8px 12px;
  border: 1px solid #ef4444;
  border-radius: var(--radius-small);
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
}
.remotion-validation-box ul {
  margin: 4px 0 0;
  padding-left: 20px;
}
.remotion-settings-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: var(--color-text-muted);
  font-weight: 700;
}
.remotion-settings-band {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  background: #f8fafc;
}
.remotion-settings-band h2,
.remotion-settings-section-header h2 {
  margin: 0;
  font-size: 14px;
}
.remotion-settings-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.remotion-settings-field,
.remotion-layout-control {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 750;
}
.remotion-settings-field input,
.remotion-settings-field select,
.remotion-character-select-field select,
.remotion-character-create input,
.remotion-character-create textarea {
  min-width: 0;
  width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--color-text);
  font: inherit;
}
.remotion-settings-field input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 6px 0;
}
.remotion-settings-field input[type="color"] {
  min-height: 32px;
  padding: 2px;
}
.remotion-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  overflow: hidden;
}
.remotion-segmented button {
  border: 0;
  border-right: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
  cursor: pointer;
}
.remotion-segmented button:last-child {
  border-right: 0;
}
.remotion-segmented button.active {
  background: #243b53;
  color: #fff;
  font-weight: 800;
}
.remotion-segmented button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.remotion-settings-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}
.remotion-settings-speakers,
.remotion-settings-preview-section,
.remotion-settings-assets {
  min-width: 0;
  border: 1px solid var(--color-border);
  background: #fff;
}
.remotion-settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--color-border);
}
.remotion-settings-section-header span {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}
.remotion-speaker-rows {
  display: grid;
  gap: 5px;
  padding: 6px;
}
.remotion-speaker-row {
  display: grid;
  grid-template-columns: minmax(88px, 130px) minmax(0, 1fr);
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-small);
  background: #fff;
  cursor: pointer;
}
.remotion-speaker-row.is-selected {
  border-left-color: #0f766e;
  background: #f0fdfa;
}
.remotion-speaker-row.is-drop-target {
  border-color: #0f766e;
  border-left-color: #0f766e;
  background: #ccfbf1;
  box-shadow: inset 0 0 0 2px #14b8a6;
}
.remotion-speaker-row.has-error {
  border-color: #fca5a5;
}
.remotion-speaker-identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
.remotion-speaker-identity strong {
  font-size: 13px;
}
.remotion-speaker-identity span {
  color: var(--color-text-muted);
  font-size: 10px;
}
.remotion-speaker-create-button {
  align-self: flex-start;
  margin-top: 5px;
  border-color: #0f766e;
  color: #0f766e;
}
.remotion-speaker-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}
.remotion-speaker-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(95px, 1fr) 72px 58px 82px;
  gap: 5px;
  min-width: 0;
}

.remotion-speaker-extra-fields {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 70px minmax(120px, 1.3fr) minmax(110px, 1.1fr) 95px minmax(130px, 1.3fr) 52px;
  gap: 5px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--color-border);
  min-width: 0;
}
.remotion-ai-assign-btn {
  margin-left: auto;
  border-color: #0f766e;
  color: #0f766e;
  font-weight: 700;
  font-size: 11px;
}

.remotion-character-select-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 750;
}
.remotion-character-select-wrap {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 4px;
}
.remotion-character-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #f1f5f9;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 800;
}
.remotion-character-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.remotion-speaker-error {
  grid-column: 2;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 750;
}
.remotion-settings-side {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 8px;
}
.remotion-settings-preview {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e8eef2;
}
.remotion-preview-character {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 47%;
  height: 92%;
}
.remotion-preview-character.is-left {
  left: 2%;
}
.remotion-preview-character.is-right {
  right: 2%;
}
.remotion-preview-character.is-single {
  left: 26%;
  right: auto;
}
.remotion-preview-character img {
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: contain;
  object-position: center bottom;
}
.remotion-preview-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72%;
  flex: 1;
  margin-bottom: 4px;
  border: 1px dashed #dc2626;
  background: #fff;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}
.remotion-preview-name {
  max-width: 100%;
  margin-bottom: 5px;
  padding: 3px 7px;
  overflow: hidden;
  border: 2px solid;
  background: rgba(255, 255, 255, .94);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remotion-preview-name.bubble-rounded {
  border-radius: 999px;
}
.remotion-preview-name.bubble-none {
  border-color: transparent !important;
  background: transparent;
}
.remotion-preview-empty {
  margin: auto;
  color: var(--color-text-muted);
  font-size: 11px;
}
.storyboard-dialog {
  width: min(1320px, 96vw);
  max-width: min(1320px, 96vw);
  max-height: 92vh;
  overflow: auto;
}
.storyboard-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.storyboard-dialog-header h2 {
  margin: 0;
  font-size: 18px;
}
.storyboard-dialog-header p {
  margin: 5px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.storyboard-frame-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.storyboard-frame {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  overflow: hidden;
  background: var(--color-surface-muted);
}
.storyboard-frame-caption {
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
}
.storyboard-frame-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: #172033;
}
.storyboard-frame-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.storyboard-frame-missing {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: #d8e1ed;
  font-size: 12px;
}
.storyboard-character {
  position: absolute;
  bottom: 0;
  z-index: 1;
  width: 48%;
  height: 93%;
  pointer-events: none;
}
.storyboard-character.is-left { left: 1%; }
.storyboard-character.is-right { right: 1%; }
.storyboard-character img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}
.storyboard-bubble {
  position: absolute;
  z-index: 2;
  right: 8%;
  bottom: 7%;
  left: 8%;
  padding: 9px 12px;
  border: 2px solid;
  background: rgba(10, 18, 31, 0.92);
  color: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.28);
}
.storyboard-bubble.is-rounded { border-radius: 16px; }
.storyboard-bubble.is-square { border-radius: 3px; }
.storyboard-bubble strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}
.storyboard-bubble p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.remotion-asset-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  max-height: 210px;
  padding: 6px;
  overflow-y: auto;
}
.remotion-asset-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}
.remotion-asset-item.is-assigned {
  border-color: #0f766e;
  background: #f0fdfa;
}
.remotion-asset-item.is-dragging {
  opacity: .55;
}
.remotion-asset-preview-button {
  width: 42px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  background: #f1f5f9;
  cursor: zoom-in;
}
.remotion-asset-preview-button img {
  width: 42px;
  height: 50px;
  object-fit: contain;
}
.remotion-asset-assign {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.remotion-asset-item span,
.remotion-asset-item strong,
.remotion-asset-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remotion-asset-item strong {
  font-size: 11px;
}
.remotion-asset-item small {
  color: var(--color-text-muted);
  font-size: 9px;
}
.remotion-asset-item .remotion-asset-action {
  margin-top: 2px;
  color: #0f766e;
  font-weight: 800;
}
.remotion-assets-empty {
  grid-column: 1 / -1;
  margin: 8px;
  color: var(--color-text-muted);
  font-size: 11px;
}
.remotion-character-create {
  display: grid;
  gap: 5px;
  padding: 6px;
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
}
.remotion-assignment-target {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-small);
  background: #f0fdfa;
}
.remotion-assignment-target span {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}
.remotion-assignment-target strong {
  min-width: 0;
  overflow: hidden;
  color: #115e59;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remotion-character-create textarea {
  resize: vertical;
}
.remotion-character-actions {
  display: flex;
  gap: 5px;
}
.remotion-upload-button {
  cursor: pointer;
}
.remotion-upload-button.is-loading {
  cursor: wait;
  opacity: .6;
}
.remotion-upload-button.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  pointer-events: none;
}

@media (max-width: 1500px) {
  .remotion-settings-main {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .remotion-speaker-row {
    grid-template-columns: 106px minmax(0, 1fr);
  }
  .remotion-speaker-fields {
    grid-template-columns: minmax(120px, 1.4fr) minmax(80px, 1fr) 58px 52px 70px;
  }
}

@media (max-width: 1800px) {
  .remotion-settings-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .remotion-settings-side {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .remotion-settings-controls {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
  }
  .remotion-speaker-row {
    grid-template-columns: 1fr;
  }
  .remotion-speaker-fields,
  .remotion-speaker-error {
    grid-column: 1;
  }
  .remotion-speaker-fields {
    grid-template-columns: minmax(150px, 1.5fr) minmax(90px, 1fr) 70px 56px 80px;
  }
}

@media (max-width: 760px) {
  .remotion-settings-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 6px;
  }
  .remotion-settings-toolbar-main {
    flex: 1 1 100%;
  }
  .remotion-settings-toolbar-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .remotion-settings-save-status {
    display: none;
  }
  .remotion-settings-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .remotion-settings-main {
    grid-template-columns: 1fr;
  }
  .remotion-speaker-fields {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
  .remotion-speaker-extra-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .remotion-settings-field,
  .remotion-character-select-field {
    min-width: 0;
  }
  .remotion-settings-side {
    grid-template-columns: 1fr;
  }
  .remotion-asset-list {
    grid-template-columns: 1fr;
  }
  .remotion-assignment-target {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .storyboard-dialog {
    width: 100vw;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }
  .storyboard-dialog-header {
    gap: 10px;
  }
  .storyboard-frame-strip {
    grid-template-columns: 1fr;
  }
}

/* プロジェクト読み辞書パネル */
.project-reading-dict-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-reading-dict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.project-reading-dict-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.project-reading-dict-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--color-info-bg, #efefff);
  color: var(--color-primary, #6157e8);
  font-size: 11px;
  font-weight: 700;
}
.project-reading-dict-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.project-reading-dict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.project-reading-dict-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  color: var(--color-text-muted, #68708a);
  font-size: 11px;
  font-weight: 700;
}
.project-reading-dict-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  vertical-align: middle;
}
.project-reading-dict-override-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--color-warn-bg, #fff7e5);
  color: var(--color-warn, #9a6200);
  font-size: 10px;
  font-weight: 700;
}
.project-reading-dict-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 読み修正モーダル & 共有テイク選択 */
.reading-correction-modal {
  width: min(720px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.reading-correction-body {
  overflow-y: auto;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.reading-correction-preview {
  padding: 10px 12px;
  background: var(--color-surface-muted, #f8f9fd);
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: var(--radius-small, 8px);
  font-size: 13px;
  line-height: 1.6;
}
.reading-correction-scope-picker {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: var(--color-info-bg, #efefff);
  border-radius: var(--radius-small, 8px);
}
.reading-correction-take-box {
  padding: 12px;
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: var(--radius-small, 8px);
  background: var(--color-warn-bg, #fff7e5);
}
.reading-correction-take-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.reading-correction-take-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.reading-audit-summary,
.reading-audit-review {
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: 8px;
  background: var(--color-surface, #fff);
  padding: 10px 12px;
}
.reading-audit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.reading-audit-summary-actions,
.reading-audit-review-heading,
.reading-draft-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reading-audit-review {
  display: grid;
  gap: 8px;
}
.reading-audit-review-heading { justify-content: space-between; }
.reading-audit-row {
  display: grid;
  grid-template-columns: 20px minmax(72px, 160px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  font-size: 13px;
}
.reading-draft-row {
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 8px;
  background: var(--color-surface-muted, #f8f9fd);
}
.reading-draft-row p { flex-basis: 100%; margin: 0; font-size: 13px; }

/* T-004D: レスポンシブ セグメントカード (768px未満) */
@media (max-width: 768px) {
  .reading-audit-summary { align-items: flex-start; flex-direction: column; }
  .reading-audit-summary-actions { width: 100%; flex-wrap: wrap; }
  .reading-audit-row { grid-template-columns: 20px minmax(0, 1fr); }
  .reading-audit-row span { grid-column: 2; }
  .reading-correction-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    padding: 14px !important;
  }
  .segments-table-wrap table.segments-table thead {
    display: none;
  }
  .segments-table-wrap table.segments-table,
  .segments-table-wrap table.segments-table tbody,
  .segments-table-wrap table.segments-table tr,
  .segments-table-wrap table.segments-table td {
    display: block;
    width: 100% !important;
  }
  .segments-table-wrap table.segments-table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--color-border, #e0e4ee);
    border-radius: var(--radius-small, 8px);
    background: var(--color-surface, #fff);
  }
  .segments-table-wrap table.segments-table td {
    padding: 4px 0 !important;
    border-bottom: none !important;
  }
}

/* ==========================================================================
   Revision 5 Production Workspace Shell (R5-T024A)
   Desktop: 3-pane (1440x900 / 1366x768) + collapsible timeline
   Mobile: Tabs (390x844) + sticky action bar
   ========================================================================== */

.production-workspace-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  background: var(--color-bg, #f4f6fb);
}

.production-command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--color-surface, #fff);
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  flex-shrink: 0;
  gap: 12px;
}

.production-stage-rail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--color-surface-muted, #f8f9fd);
  border-radius: var(--radius-small, 8px);
  font-weight: 600;
  font-size: 13px;
}

.production-desktop-panes {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 1px;
  background: var(--color-border, #e0e4ee);
}

.production-pane {
  background: var(--color-surface, #fff);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  position: relative;
}

.production-pane-source {
  min-width: 280px;
}

.production-pane-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.production-pane-inspector {
  min-width: 300px;
}

.production-timeline-tray {
  height: 180px;
  min-height: 120px;
  max-height: 240px;
  background: var(--color-surface, #fff);
  border-top: 1px solid var(--color-border, #e0e4ee);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.production-mobile-tabs {
  display: none;
}

.production-sticky-action {
  display: none;
}

/* 選択状態ハイライト */
.is-selected {
  outline: 2px solid var(--color-primary, #6157e8) !important;
  background-color: var(--color-info-bg, #efefff) !important;
}

/* モバイルビューポート (390x844 / max-width: 1023px) */
@media (max-width: 1023px) {
  .production-workspace-shell {
    height: 100dvh;
    max-height: 100dvh;
  }

  .production-desktop-panes {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  .production-pane {
    display: none;
    flex: 1;
  }

  .production-pane.is-active-tab {
    display: flex;
  }

  .production-timeline-tray {
    display: none;
  }

  .production-timeline-tray.is-active-tab {
    display: block;
    height: 100%;
    max-height: none;
  }

  .production-mobile-tabs {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--color-surface, #fff);
    border-top: 1px solid var(--color-border, #e0e4ee);
    padding: 6px 4px;
    flex-shrink: 0;
    z-index: 10;
  }

  .production-mobile-tabs .tab-item {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text-muted, #68708a);
    border-radius: var(--radius-small, 8px);
  }

  .production-mobile-tabs .tab-item.is-active {
    color: var(--color-primary, #6157e8);
    background: var(--color-info-bg, #efefff);
  }

  .production-sticky-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--color-surface, #fff);
    border-top: 1px solid var(--color-border, #e0e4ee);
    flex-shrink: 0;
    gap: 8px;
    position: sticky;
    bottom: 0;
    z-index: 11;
  }
}

/* デスクトップ高解像度 (min-width: 1024px) */
@media (min-width: 1024px) {
  .production-mobile-tabs {
    display: none !important;
  }
  .production-sticky-action {
    display: none !important;
  }
}

/* ==========================================================================
   Revision 5 Production Asset Library (R5-T024B)
   Discrete cursor pagination, grouping, card/table switch, batch guard
   ========================================================================== */

.production-asset-library {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--color-surface, #fff);
}

.asset-library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.asset-counter-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-small, 8px);
  background: var(--color-info-bg, #efefff);
  color: var(--color-primary, #6157e8);
}

.asset-status-filter, .asset-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.asset-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.asset-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.asset-card {
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: var(--radius-small, 8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--color-surface, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.asset-card:hover {
  border-color: var(--color-primary, #6157e8);
  box-shadow: var(--shadow-card, 0 4px 12px rgba(30, 38, 78, .07));
}

.asset-card-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #0f172a;
}

.asset-card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.asset-table-view {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.asset-table-view th, .asset-table-view td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border, #e0e4ee);
  text-align: left;
}

.asset-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--color-border, #e0e4ee);
  background: var(--color-surface-muted, #f8f9fd);
  flex-shrink: 0;
}

.asset-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--color-text-muted, #68708a);
  text-align: center;
}

/* ==========================================================================
   Revision 5 Explainer Canvas & Motion Editor (R5-T024C)
   DOM/CSS Transform + SVG overlay, timeline scrubber, bounded numeric stepper
   ========================================================================== */

.explainer-canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  background: #0b0f19;
  overflow: hidden;
}

.explainer-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.explainer-canvas-surface {
  position: relative;
  width: 1920px;
  height: 1080px;
  max-width: 100%;
  max-height: 100%;
  background: #1e293b;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
}

.explainer-component-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.explainer-cutout-item {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: center center;
  transition: outline 0.1s ease;
}

.explainer-cutout-item:hover {
  outline: 2px dashed rgba(97, 87, 232, 0.8);
}

.explainer-cutout-item.is-selected {
  outline: 2px solid #6157e8;
}

.motion-path-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.motion-timeline-scrubber {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #1e293b;
  border-top: 1px solid #334155;
  color: #f8fafc;
  flex-shrink: 0;
  gap: 12px;
}

.scrubber-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrubber-slider-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.motion-editor-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--color-surface, #fff);
  gap: 12px;
  border-top: 1px solid var(--color-border, #e0e4ee);
}

.motion-prop-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.motion-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ==========================================================================
   Revision 5 Six-Gate Inspection & Recovery UI (R5-T024D)
   Fail-closed gating, evidence view, focus-trapped modal, accessible badges
   ========================================================================== */

.inspection-gate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--color-surface, #fff);
}

.gate-card {
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: var(--radius-small, 8px);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-surface, #fff);
  transition: border-color 0.15s ease;
}

.gate-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
}

.gate-badge.is-pass {
  background: var(--color-ok-bg, #e8f8f2);
  color: var(--color-ok, #13755d);
}

.gate-badge.is-fail {
  background: var(--color-danger-bg, #fff0f1);
  color: var(--color-danger, #c8424d);
}

.gate-badge.is-blocked {
  background: var(--color-warn-bg, #fff7e5);
  color: var(--color-warn, #9a6200);
}

.gate-badge-pass {
  background: var(--color-ok-bg, #e8f8f2);
  color: var(--color-ok, #13755d);
}

.gate-badge-fail {
  background: var(--color-danger-bg, #fff0f1);
  color: var(--color-danger, #c8424d);
}

.gate-badge-review {
  background: var(--color-info-bg, #efefff);
  color: var(--color-info, #4a45c7);
}

.gate-badge-blocked {
  background: var(--color-warn-bg, #fff7e5);
  color: var(--color-warn, #9a6200);
}

.gate-badge-pending {
  background: var(--color-surface-muted, #f8f9fd);
  color: var(--color-text-muted, #68708a);
}

.explainer-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.explainer-preview-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .explainer-workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.gate-blocked {
  opacity: 0.65;
  background: var(--color-surface-muted, #f8f9fd);
  border-style: dashed;
}

.gate-blocked-reason {
  font-size: 11px;
  color: var(--color-warn, #9a6200);
  font-weight: 600;
}

.gate-evidence-panel {
  padding: 8px;
  background: var(--color-surface-muted, #f8f9fd);
  border-radius: 4px;
  font-size: 12px;
}

.recovery-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.recovery-modal {
  width: 90%;
  max-width: 480px;
  background: var(--color-surface, #fff);
  border-radius: var(--radius, 12px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recovery-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Script Analyzer & Video Format Studio (SA-T005) */
.script-analyzer-studio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 80px);
  max-height: calc(100vh - 80px);
  overflow: hidden;
  box-sizing: border-box;
  padding: 12px;
}

.script-input-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 10px;
  background: var(--color-surface, #1e293b);
  border: 1px solid var(--color-border, #334155);
  border-radius: 8px;
  padding: 14px;
}

.script-input-pane textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  font-family: monospace;
  font-size: 0.875rem;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border, #475569);
  background: var(--color-bg, #0f172a);
  color: var(--color-text);
}

.script-results-pane {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100%;
  gap: 12px;
  background: var(--color-surface, #1e293b);
  border: 1px solid var(--color-border, #334155);
  border-radius: 8px;
  padding: 14px;
}

.format-card {
  border: 1px solid var(--color-border, #334155);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

/* 3-Stage Pipeline UI Styles (T-009 & T-010) */
.analysis-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.step-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-surface-muted, #f8f9fd);
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: 6px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #68708a);
}

.step-item.step-done {
  color: #0068B7;
  font-weight: 700;
}

.step-item.step-done .step-icon {
  background: #0068B7;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.step-item.step-pending .step-icon {
  border: 1px solid var(--color-border, #ccc);
  color: var(--color-text-muted, #888);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.classification-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.classification-info-bar .badge {
  font-size: 0.8125rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: #E8F0F8;
  color: #0068B7;
  border: 1px solid rgba(0, 104, 183, 0.2);
}

.gap-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e0e4ee);
  border-radius: 6px;
  padding: 10px 12px;
}

.gap-list-container h4 {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text, #171a31);
}

.gap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gap-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--color-surface-muted, #f8f9fd);
}

.gap-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  min-width: 55px;
  text-align: center;
}

.gap-status-ok {
  background: #E8F5E9;
  color: #166534;
  border: 1px solid #C8E6C9;
}

.gap-status-missing {
  background: #FFEBEE;
  color: #B91C1C;
  border: 1px solid #FFCDD2;
}

.gap-status-weak {
  background: #FFF8E1;
  color: #9A6200;
  border: 1px solid #FFE082;
}

.gap-element-name {
  font-weight: 700;
  color: var(--color-text, #171a31);
  min-width: 80px;
}

.gap-detail {
  color: var(--color-text-muted, #68708a);
  font-size: 0.75rem;
  flex: 1;
}

.completion-action-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.completion-complete-msg {
  font-size: 0.8125rem;
  color: #166534;
  background: #E8F5E9;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
}

.diff-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #c8e6c9;
  border-radius: 6px;
  background: #fdfefe;
  padding: 10px;
}

.diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diff-header h4 {
  margin: 0;
  font-size: 0.875rem;
  color: #166534;
}

.diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #E8F5E9;
  border: 1px solid #C8E6C9;
  border-radius: 6px;
  padding: 8px 10px;
}

.diff-item.diff-adopted {
  opacity: 0.7;
  border-color: #81c784;
}

.diff-item.diff-rejected {
  opacity: 0.4;
  text-decoration: line-through;
}

.diff-meta {
  font-size: 0.75rem;
  color: #2e7d32;
}

.diff-content {
  font-family: monospace;
  font-size: 0.8125rem;
  color: #1b5e20;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px 8px;
  border-radius: 4px;
}

.diff-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.diff-status-label.status-adopted {
  font-size: 0.75rem;
  font-weight: 700;
  color: #166534;
}

.diff-status-label.status-rejected {
  font-size: 0.75rem;
  font-weight: 700;
  color: #68708a;
}

@media (max-width: 1023px) {
  .script-analyzer-studio {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

/* ==========================================================================
   Production Contract & Pipeline Inspection Checklist (T-CG-008)
   ========================================================================== */

.contract-checklist-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #d9dfeb);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.8125rem;
}

.contract-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.contract-checklist-title {
  font-weight: 700;
  color: #0068B7;
  display: flex;
  align-items: center;
  gap: 6px;
}

.contract-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.6875rem;
}

.contract-badge-passed {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}

.contract-badge-missing {
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #fad2cf;
}

.contract-progress-bar-container {
  width: 100%;
  height: 6px;
  background: #e8eaed;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.contract-progress-bar {
  height: 100%;
  background: #0068B7;
  transition: width 0.3s ease;
}

.contract-stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.stage-loop-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
}

.contract-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px dashed var(--color-border, #d9dfeb);
  padding-top: 8px;
}

.contract-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

/* Script Editor AI Analysis Drawer */
.script-editor-with-drawer {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.script-editor-drawer {
  width: 420px;
  max-width: 50%;
  border-left: 1px solid var(--color-border, #334155);
  background: var(--color-surface, #1e293b);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px;
  gap: 12px;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
}

/* Job Detail Navigation & Deep-Link Highlighting (design.md compliant) */
.nav-target-highlight {
  outline: 2px solid #0068B7 !important;
  box-shadow: 0 0 0 4px #E8F0F8 !important;
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-deep-link {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #0068B7;
  background-color: #E8F0F8;
  border: 1px solid #0068B7;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.btn-deep-link:hover {
  background-color: #d0e2f3;
}
.explainer-approval-form {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-card, #1e1e24);
}

.explainer-approval-title {
  margin: 0 0 4px;
}

.explainer-approval-intro {
  margin: 0 0 10px;
  font-size: 12px;
}

.explainer-approval-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.explainer-approval-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.explainer-approval-field input:not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.explainer-approval-permission {
  flex-direction: row;
  align-items: center;
  align-self: end;
  min-height: 34px;
}

.explainer-approval-brief {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--color-border);
}

.explainer-approval-brief-title {
  margin: 0 0 7px;
}

.explainer-approval-brief-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.explainer-approval-brief-field {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 5px;
  background: var(--color-bg-secondary, rgba(255, 255, 255, 0.04));
}

.explainer-approval-brief-field dt {
  color: var(--color-text-secondary, #777);
  font-size: 11px;
}

.explainer-approval-brief-field dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.explainer-approval-error {
  color: var(--color-danger, #f87171);
  font-size: 11px;
}

.explainer-approval-quote,
.explainer-approval-blocked,
.explainer-approval-feedback {
  margin: 8px 0 0;
  font-size: 12px;
}

.explainer-approval-quote {
  color: var(--color-text-secondary, #aaa);
}

.explainer-approval-blocked {
  padding: 8px 10px;
  border-left: 3px solid var(--color-warning, #d69e2e);
  background: var(--color-bg-secondary, rgba(255, 255, 255, 0.04));
}

.explainer-approval-feedback {
  color: var(--color-text-secondary, #aaa);
}

.explainer-approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.explainer-approval-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 900px) {
  .explainer-approval-grid,
  .explainer-approval-brief-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .explainer-approval-grid,
  .explainer-approval-brief-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 全自動ランナー: 人間確認で止まった工程の審査詳細 */
.review-detail-panel { flex-basis: 100%; font-size: 12px; }
.review-detail-panel summary { cursor: pointer; }
.review-detail-body { padding: 4px 0 0 12px; }
.review-detail-body ul { margin: 2px 0; padding-left: 16px; }
.review-detail-proposal { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; margin: 4px 0 0; }
.review-detail-proposal dd { margin: 0; }

/* CSP: style-src 'self' blocks HTML style attributes. These classes replace them. */
.csp-version-badge {
  margin-left: 6px;
  font-size: 0.6875rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(97, 87, 232, 0.10);
  color: var(--color-text-muted);
}
.csp-pill-info { background: #0284c7; color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 4px; }
.csp-mb-6 { margin-bottom: 6px; }
.csp-mb-4 { margin-bottom: 4px; }
.csp-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.csp-title { margin: 0; font-size: 18px; }
.csp-lead { margin: 4px 0 0; font-size: 13px; color: var(--color-text-muted); }
.csp-row-tight { display: flex; align-items: center; gap: 8px; }
.csp-progress { font-size: 14px; font-weight: bold; }
.csp-h3 { margin: 0; font-size: 15px; font-weight: 700; }
.csp-note { font-size: 12px; color: var(--color-text-muted); }
.csp-col-28 { width: 28%; }
.csp-col-24 { width: 24%; }
.csp-col-20-end { width: 20%; text-align: right; }
.csp-strong { font-weight: bold; margin-bottom: 4px; }
.csp-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.csp-actions { display: flex; gap: 8px; align-items: center; }
.csp-btn-accent { background: #0284c7; color: #fff; border: none; }
.csp-w-40 { width: 40px; }
.csp-w-80 { width: 80px; }
.csp-w-75 { width: 75px; }
.csp-w-115 { width: 115px; }
.csp-w-70-end { width: 70px; text-align: right; }
.csp-w-200 { width: 200px; }
.csp-badge-warn { background: #ef4444; color: #fff; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.csp-badge-auto { background: #0284c7; color: #fff; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.csp-badge-ok { background: #10b981; color: #fff; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.csp-tiny-muted { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }
.csp-dash { color: var(--color-text-muted); }
.csp-hint { color: var(--color-text-muted); }
.csp-mode-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.csp-mode-body { font-size: 12px; color: var(--text-muted, #888); line-height: 1.5; }
.csp-sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.csp-mini-btn { padding: 1px 6px; font-size: 11px; }
.csp-card-title { font-weight: 600; margin-bottom: 3px; font-size: 14px; }
.csp-card-body { font-size: 12px; color: var(--color-text-secondary, #666); line-height: 1.4; }
.csp-card-links { margin-top: 6px; font-size: 12px; }
.csp-link { color: var(--color-primary, #0066cc); text-decoration: underline; }

/* 構造の人間承認(D2)カード: ファーストビューで承認できる高密度レイアウト */
.ssa-host { width: 100%; box-sizing: border-box; }
.ssa-card {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
}
.ssa-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ssa-chip {
  padding: 0 6px;
  border-radius: 8px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  line-height: 18px;
}
.ssa-chip-ok { color: var(--color-ok); background: var(--color-ok-bg); }
.ssa-chip-warn { color: var(--color-warn); background: var(--color-warn-bg); }
.ssa-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.ssa-form input[type="text"] { width: 170px; padding: 2px 6px; font-size: 12px; }
.ssa-form input[type="number"] { width: 130px; padding: 2px 6px; font-size: 12px; }
.ssa-form input[aria-invalid="true"] { outline: 2px solid var(--color-danger); }
.ssa-cost-usd { color: var(--color-text-muted); min-width: 52px; }
.ssa-authorize { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.ssa-approve-btn { font-weight: 700; }
.ssa-feedback { margin: 0; color: var(--color-text-muted); }
.ssa-table { width: 100%; border-collapse: collapse; display: block; max-height: 168px; overflow-y: auto; }
.ssa-table th, .ssa-table td { padding: 1px 6px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; }
.ssa-table th { position: sticky; top: 0; background: var(--color-surface-muted); font-weight: 600; white-space: nowrap; }
.ssa-table td:nth-child(1), .ssa-table td:nth-child(3), .ssa-table td:nth-child(4) { white-space: nowrap; text-align: right; }
.ssa-table td:nth-child(2) { width: 100%; }
.ssa-table summary { cursor: pointer; }
.ssa-scenes { margin: 2px 0 2px 14px; padding: 0; color: var(--color-text-muted); }
.ssa-row-warn td:first-child { box-shadow: inset 3px 0 0 var(--color-warn); }
.ssa-jev-ok { color: var(--color-ok); white-space: nowrap; }
.ssa-jev-warn { color: var(--color-warn); white-space: nowrap; font-weight: 700; }

/* 人物ライブラリ（高密度） */
.lib-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lib-toolbar h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.lib-toolbar .lib-spacer { flex: 1; }
.lib-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lib-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); color: var(--color-text); text-decoration: none; }
.lib-card:hover { border-color: rgba(97, 87, 232, .45); }
.lib-thumb { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 6px; background: var(--color-surface-muted); color: var(--color-text-muted); font-size: 11px; overflow: hidden; }
.lib-thumb img { width: 100%; height: 100%; object-fit: contain; }
.lib-card strong { font-size: 13px; }
.lib-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--color-text-muted); }
.lib-pill { padding: 1px 7px; border-radius: 999px; background: var(--color-info-bg); color: var(--color-info); font-weight: 700; font-size: 11px; }
.lib-pill.ok { background: var(--color-ok-bg); color: var(--color-ok); }
.lib-pill.warn { background: var(--color-warn-bg); color: var(--color-warn); }
.lib-drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; }
.lib-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); padding: 14px; overflow-y: auto; background: var(--color-surface); box-shadow: -4px 0 20px rgba(0, 0, 0, .25); z-index: 51; }
.lib-drawer h2 { margin: 0 0 8px; font-size: 14px; }
.lib-drawer .form-row { margin-bottom: 8px; }
.lib-drawer .form-row input, .lib-drawer .form-row textarea { min-height: 32px; }
.lib-hint { font-size: 11px; color: var(--color-text-muted); }
.lib-image-source { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.lib-image-source select, .lib-image-source input { font-size: 12px; padding: 2px 6px; height: 26px; min-width: 160px; }
.lib-image-source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 2px 0 6px; }
.lib-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 8px; }
.lib-detail-head h1 { margin: 0; font-size: 18px; }
.lib-detail-desc { margin: 0 0 8px; font-size: 12px; color: var(--color-text-muted); }
.lib-job { margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface-muted); font-size: 12px; }
.lib-job.bad { border-color: var(--color-danger); background: var(--color-danger-bg); }
.lib-job-bar { height: 6px; margin-top: 4px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.lib-job-bar > span { display: block; height: 100%; background: var(--color-primary); }
.lib-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .lib-slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lib-slot { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); }
.lib-slot.filled { border-color: var(--color-ok); }
.lib-slot-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; }
.lib-slot-body { display: flex; gap: 8px; }
.lib-slot-main { width: 96px; flex: none; }
.lib-slot-main .lib-thumb { width: 96px; }
.lib-slot-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.lib-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.lib-candidates { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-cand { display: flex; flex-direction: column; gap: 3px; width: 72px; }
.lib-cand .lib-thumb { width: 72px; }
.lib-cand .btn { min-height: 24px; padding: 0 4px; font-size: 11px; }
.lib-gen { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px dashed var(--color-border); border-radius: 6px; font-size: 12px; }
.lib-gen label { display: flex; align-items: center; gap: 6px; }
.lib-gen input, .lib-gen select { min-height: 28px; width: 90px; padding: 2px 6px; border: 1px solid var(--color-border); border-radius: 6px; }
.lib-msg { font-size: 12px; margin: 2px 0; }
.lib-msg.bad { color: var(--color-danger); }
.lib-msg.ok { color: var(--color-ok); }
.lib-bind { margin: 10px 0; padding: 10px 12px; }
.lib-bind h3 { margin: 0 0 6px; font-size: 13px; }
.lib-bind-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.lib-bind-row .lib-bind-name { min-width: 140px; font-weight: 700; }
.lib-bind-row select { min-height: 28px; max-width: 260px; }

/* MCP keys panel (settings): dense layout */
.mcp-keys-holder { display: contents; }
.material-orders-holder { display: contents; }
.material-orders-panel .material-orders-row { padding: 4px 0; border-top: 1px solid var(--color-border, #e5e7eb); font-size: 12px; }
.material-orders-panel .material-orders-head { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.material-orders-panel .material-orders-status { font-weight: 600; }
.material-orders-panel .material-orders-delivery { display: flex; gap: 8px; align-items: center; margin: 2px 0; }
.material-orders-panel .material-orders-preview { width: 72px; height: 72px; object-fit: contain; background: #16213a; border-radius: 4px; }
.material-orders-panel .material-orders-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.material-orders-panel .material-orders-actions { display: flex; gap: 6px; margin-top: 2px; }
.mcp-keys-panel .mcp-keys-form { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-bottom: 6px; }
.mcp-keys-panel .mcp-keys-scopes { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; width: 100%; font-size: 12px; }
.mcp-keys-panel .mcp-keys-scope { display: inline-flex; gap: 2px; align-items: center; margin: 0; }
.mcp-keys-panel input[type="text"] { flex: 1 1 160px; min-width: 120px; padding: 3px 6px; font-size: 12px; }
.mcp-keys-panel .mcp-keys-reveal { margin: 4px 0; padding: 6px; border: 1px solid var(--color-border, #e5e7eb); border-radius: 6px; }
.mcp-keys-panel .mcp-keys-reveal:empty { display: none; }
.mcp-keys-panel .mcp-keys-secret { display: block; margin: 4px 0; padding: 4px 6px; word-break: break-all; user-select: all; font-size: 12px; }
.mcp-keys-panel .mcp-keys-row { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; padding: 3px 0; border-top: 1px solid var(--color-border, #e5e7eb); font-size: 12px; }
.mcp-keys-panel .mcp-keys-row > code { font-weight: 600; }

/* 作品設定の確認（最初の人の確認）: 高密度の一覧。確定ボタンは先頭に置く。 */
.work-settings-panel { width: 100%; font-size: 12px; }
.work-settings-actions { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.work-settings-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.work-settings-item { padding: 2px 4px; border-bottom: 1px solid var(--border, #ddd); }
.work-settings-item-head { display: flex; gap: 6px; align-items: baseline; }
.work-settings-value { display: flex; gap: 6px; padding-left: 8px; }
.work-settings-value.attention { background: rgba(255, 196, 0, 0.12); }
.work-settings-entries { width: 100%; min-height: 60px; font-family: monospace; font-size: 11px; }

/* 用意した素材（docs/SPEC_PROVIDED_MATERIALS.md）: 台本一覧の上の高密度な欄 */
.provided-materials-panel { padding: 6px 8px; margin-bottom: 6px; }
.provided-materials-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.provided-materials-title { font-weight: 700; font-size: 12px; }
.provided-materials-form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; font-size: 12px; }
.provided-materials-form textarea { grid-column: 1 / -1; font-size: 12px; }
.provided-materials-form[hidden] { display: none; }
.provided-materials-message { grid-column: 1 / -1; color: var(--color-danger, #ef4444); font-size: 11px; }
.provided-materials-pinbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; }
.provided-materials-pintext { color: var(--text-muted, #888); }
.provided-materials-select { font-size: 12px; padding: 1px 4px; }
.provided-materials-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 180px; overflow-y: auto; }
.provided-material-row { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; }
.provided-material-thumb { width: 56px; height: 40px; object-fit: contain; background: #000; border-radius: 3px; flex: none; }
.provided-material-body { flex: 1; min-width: 0; }
.provided-material-name { font-weight: 700; }
.provided-material-description, .provided-material-source { color: var(--text-muted, #888); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provided-material-pin { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.provided-material-pin.is-stale { color: var(--color-warning, #f59e0b); }
.btn-pinned-material { border-color: var(--color-success, #22c55e); }

/* ===== 画像の確認画面（背景・挿絵を人が1回確認する）#/projects/:id/image-review ===== */
.image-review-page { padding: 4px 8px 40px; font-size: 12px; }
.ir-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ir-topbar { position: sticky; top: 0; z-index: 20; background: var(--color-bg); padding: 4px 0; border-bottom: 1px solid var(--color-border); }
.ir-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.ir-title { font-size: 14px; margin: 0; }
.ir-approver-wrap { display: inline-flex; align-items: center; gap: 4px; }
.ir-approver { width: 130px; padding: 2px 6px; border: 1px solid var(--color-border); border-radius: 4px; font-size: 12px; }
.ir-approver.is-invalid { border-color: var(--color-danger); background: var(--color-danger-bg); }
.ir-error { color: var(--color-danger); font-size: 11px; font-weight: 700; }
.ir-counts { display: flex; flex-wrap: wrap; gap: 4px; }
.ir-count { padding: 1px 6px; border-radius: 10px; background: var(--color-surface-muted); border: 1px solid var(--color-border); font-weight: 700; }
.ir-count-pass { color: #1b7f3b; }
.ir-count-fail { color: var(--color-danger); }
.ir-count-unsure { color: var(--color-warn); }
.ir-count-attention { color: var(--color-warn); background: var(--color-warn-bg); }
.ir-progress { display: inline-flex; align-items: center; gap: 6px; }
.ir-progress-bar { width: 120px; height: 10px; }
.ir-mode-badge { padding: 1px 8px; border-radius: 10px; font-weight: 700; background: var(--color-surface-muted); border: 1px solid var(--color-border); }
.ir-mode-badge.is-auto { background: var(--color-warn-bg); color: var(--color-warn); }
.ir-filters { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.ir-filter.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.ir-undo { color: var(--color-primary-dark); font-weight: 700; }
.ir-main { margin-top: 6px; }
.ir-empty { padding: 24px; text-align: center; color: var(--color-text-muted); }
.ir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px; }
.ir-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ir-card.is-current { outline: 2px solid var(--color-primary); }
.ir-card.is-fail { border-color: var(--color-danger); border-width: 2px; background: var(--color-danger-bg); }
.ir-card.is-attention:not(.is-fail) { border-color: var(--color-warn); background: var(--color-warn-bg); }
.ir-card.is-dimmed { opacity: .6; }
.ir-card.is-pending { opacity: .85; }
.ir-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ir-line-no { font-weight: 800; }
.ir-kind { padding: 0 5px; border-radius: 8px; background: var(--color-primary); color: #fff; font-size: 11px; }
.ir-state { padding: 0 5px; border-radius: 8px; background: var(--color-surface-muted); border: 1px solid var(--color-border); font-size: 11px; }
.ir-clef { padding: 0 5px; border-radius: 8px; font-size: 11px; font-weight: 700; border: 1px solid var(--color-border); }
.ir-clef-pass { color: #1b7f3b; }
.ir-clef-fail { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.ir-clef-unsure { color: var(--color-warn); background: var(--color-warn-bg); }
.ir-auto-mark { padding: 0 6px; border-radius: 8px; background: var(--color-warn); color: #fff; font-weight: 700; font-size: 11px; }
.ir-not-passed { color: var(--color-warn); font-weight: 700; font-size: 11px; }
.ir-line-text { color: var(--color-text); line-height: 1.35; }
.ir-points { border-left: 4px solid var(--color-warn); background: var(--color-warn-bg); padding: 2px 6px; }
.ir-points.is-fail { border-left-color: var(--color-danger); background: var(--color-danger-bg); }
.ir-points-title { font-weight: 800; font-size: 11px; }
.ir-points-list { margin: 0; padding-left: 16px; }
.ir-card-body { display: flex; gap: 6px; min-width: 0; }
.ir-media { flex: none; width: 150px; display: flex; flex-direction: column; gap: 3px; }
.ir-thumb { width: 150px; height: 100px; object-fit: contain; background: #000; border-radius: 4px; cursor: zoom-in; }
.ir-thumb-big { width: 100%; height: 40vh; max-height: 40vh; object-fit: contain; }
.ir-attempts { display: flex; flex-wrap: wrap; gap: 3px; }
.ir-attempt { position: relative; padding: 0; border: 2px solid transparent; border-radius: 3px; background: none; cursor: pointer; }
.ir-attempt.is-picked { border-color: var(--color-primary); }
.ir-attempt-img { width: 44px; height: 30px; object-fit: cover; display: block; border-radius: 2px; }
.ir-attempt-mark { position: absolute; left: 0; bottom: 0; background: #1b7f3b; color: #fff; font-size: 9px; padding: 0 2px; }
.ir-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ir-where { color: var(--color-text-muted); }
.ir-description { color: var(--color-text); }
.ir-checks { display: flex; flex-direction: column; gap: 1px; }
.ir-check { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.ir-check-label { font-weight: 700; }
.ir-check-word { padding: 0 4px; border-radius: 6px; border: 1px solid var(--color-border); font-size: 11px; }
.ir-check.is-pass .ir-check-word { color: #1b7f3b; }
.ir-check.is-fail .ir-check-word { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.ir-check.is-needs_review .ir-check-word { color: var(--color-warn); background: var(--color-warn-bg); }
.ir-check-reason { color: var(--color-text-muted); font-size: 11px; }
.ir-jump { font-size: 11px; }
.ir-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ir-reason { flex: 1 1 140px; min-width: 100px; padding: 2px 6px; border: 1px solid var(--color-border); border-radius: 4px; font-size: 12px; }
.ir-actions .btn { min-height: 26px; }
.ir-focus-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.ir-focus-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.ir-focus-body .ir-media { width: auto; }
.ir-focus-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ir-card-focus { padding: 8px; gap: 5px; }
.ir-script { display: flex; flex-direction: column; gap: 2px; }
.ir-script-line { display: flex; flex-wrap: wrap; gap: 5px; }
.ir-script-line.is-this { font-weight: 800; background: var(--color-warn-bg); }
.ir-script-label { color: var(--color-text-muted); min-width: 44px; }
.ir-script-speaker { color: var(--color-primary-dark); }
.ir-scene { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 0; }
.ir-scene dt { color: var(--color-text-muted); }
.ir-scene dd { margin: 0; }
.ir-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: zoom-out; }
.ir-overlay-img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.ir-overlay-hint { color: #ddd; font-size: 12px; }
.ir-legend { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 2px 8px; background: rgba(23, 26, 49, .92); color: #fff; font-size: 11px; }
/* 集中表示: 操作の帯は常に画面下（凡例の上）に固定。グリッドはカット内だけスクロールし、ボタンはカット下端に残す。 */
.image-review-page { padding-bottom: 130px; }
.ir-card-focus .ir-actions { position: fixed; left: 0; right: 0; bottom: 22px; z-index: 30; padding: 6px 8px; background: var(--color-surface); border-top: 2px solid var(--color-border); }
.ir-view-grid .ir-card { max-height: 72vh; }
.ir-view-grid .ir-card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ir-view-grid .ir-card .ir-actions { flex: none; }
@media (max-width: 720px) {
  .image-review-page { padding-bottom: 150px; }
  .ir-card-focus .ir-actions { bottom: 0; }
  .ir-grid { grid-template-columns: 1fr; }
  .ir-focus-body { grid-template-columns: 1fr; }
  .ir-legend { display: none; }
  .ir-approver { width: 100px; }
  .ir-progress-bar { width: 80px; }
  .ir-card-focus .ir-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px; background: var(--color-surface); border-top: 2px solid var(--color-border); gap: 8px; }
  .ir-card-focus .ir-actions .btn { min-height: 48px; flex: 1 1 40%; font-size: 14px; }
  .ir-card-focus .ir-reason { flex: 1 1 100%; min-height: 40px; font-size: 14px; }
}
@media (min-width: 721px) and (max-width: 1100px) {
  .ir-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 通知を押すと開く画面（#/notice/<id>）: スマホ 1 画面に収める */
.notice-screen { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin: 0 auto; padding: 12px; background: var(--color-surface, #fff); border-radius: 12px; }
.notice-headline { font-size: 19px; font-weight: 700; line-height: 1.35; }
.notice-round { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: #e3f2fd; color: #0d47a1; font-size: 13px; font-weight: 700; }
.notice-round-extra { background: #ffebee; color: #b71c1c; }
.notice-resolved { padding: 6px 10px; border-radius: 8px; background: #e8f5e9; color: #1b5e20; font-weight: 700; }
.notice-delivery { padding: 6px 10px; border-radius: 8px; background: #fff3e0; color: #8a4b00; font-weight: 700; }
.notice-todo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; background: #fff8e1; }
.notice-label { width: 100%; font-size: 12px; color: var(--color-text-muted, #666); }
.notice-you-do { flex: 1 1 220px; font-size: 16px; font-weight: 700; line-height: 1.4; }
.notice-copy { min-height: 40px; }
.notice-action-desc { font-size: 12px; color: var(--color-text-muted, #666); margin-top: 4px; }
.notice-copy-msg, .notice-action-msg { font-size: 12px; color: var(--color-text-muted, #666); }
.notice-materials { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.4; max-height: 30vh; overflow: auto; }
.notice-decision { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-radius: 8px; background: #f5f7fa; }
.notice-meaning { font-size: 12px; color: var(--color-text-muted, #666); line-height: 1.4; }
.notice-missing { font-weight: 700; color: var(--color-danger, #b00020); }
.notice-inventory-wrap { overflow-x: auto; margin: 4px 0; }
.notice-inventory { border-collapse: collapse; font-size: 12px; line-height: 1.3; }
.notice-inventory th, .notice-inventory td { border: 1px solid var(--border, #ccc); padding: 2px 6px; text-align: right; white-space: nowrap; }
.notice-inventory th:first-child, .notice-inventory td:first-child { text-align: left; }
.notice-inventory-total td { font-weight: 600; }
.notice-inventory-note { font-size: 12px; margin-top: 2px; }
.notice-decision-lines { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.4; max-height: 28vh; overflow: auto; }
.notice-picture { max-width: 100%; max-height: 22vh; object-fit: contain; border-radius: 6px; align-self: flex-start; }
.notice-input { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.notice-input-stacked { flex-direction: column; align-items: stretch; gap: 2px; }
.notice-input-box[type="number"], .notice-input-box[type="text"] { width: 100%; min-height: 40px; font-size: 16px; box-sizing: border-box; }
.notice-input-box[type="checkbox"] { width: 22px; height: 22px; }
.notice-action { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; }
.notice-action-wide { flex: 1 1 100%; }
.notice-answer { display: flex; flex-direction: column; gap: 4px; }
.notice-answer-summary { font-size: 13px; line-height: 1.4; }
.notice-answer-prompt-text { max-height: 20vh; overflow: auto; white-space: pre-wrap; font-size: 12px; margin: 0; }
.notice-answer-text { width: 100%; box-sizing: border-box; font-size: 14px; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; bottom: 0; padding: 8px 0; background: var(--color-surface, #fff); }
.notice-actions .btn { width: 100%; min-height: 44px; font-size: 16px; }
/* 判断ごとのボタンは、その判断（絵・台本）の中に置く。画面下に貼り付けない（貼り付けると 6 区間分で画面が埋まる） */
.notice-actions-inline { position: static; padding: 4px 0 0; background: transparent; }
.notice-picture-wide { width: 100%; max-height: none; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; align-self: stretch; }
.notice-picture-label { font-size: 12px; color: var(--color-text-muted, #666); }
/* 区間の動画: 幅は画面内、高さは 16:9 のまま画面の 4 割まで（スマホのファーストビューに載せる） */
.notice-video { display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; max-height: 40vh; background: #000; border-radius: 6px; align-self: stretch; }
.notice-confirm { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 12px; background: rgba(0, 0, 0, 0.45); }
.notice-confirm-box { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: #fff; }
.notice-confirm-text { font-size: 15px; line-height: 1.45; }
.notice-confirm-row { display: flex; flex-direction: column; gap: 8px; }
.notice-confirm-row .btn { width: 100%; min-height: 44px; font-size: 16px; }
.notice-details { font-size: 12px; color: var(--color-text-muted, #666); }
.notice-detail-line { word-break: break-all; }
.notice-error { color: var(--color-danger, #b00020); }

/* 費用ページ（#/cost）: 高密度・最初の 1 画面 */
.cost-screen { display: flex; flex-direction: column; gap: 6px; max-width: 1100px; margin: 0 auto; padding: 8px; font-size: 13px; }
.cost-top { display: flex; flex-wrap: wrap; gap: 8px; }
.cost-today { padding: 6px 10px; border-radius: var(--radius-small); background: var(--color-info-bg); min-width: 150px; }
.cost-today-amount { font-size: 24px; font-weight: 700; line-height: 1.1; }
.cost-waste { flex: 1; min-width: 200px; padding: 6px 10px; border-radius: var(--radius-small); background: var(--color-surface-muted); border: 1px solid var(--color-border); }
.cost-waste-list { margin: 0; padding-left: 16px; color: var(--color-warn); }
.cost-waste-none { color: var(--color-ok); }
.cost-label { font-size: 11px; color: var(--color-text-muted); }
.cost-periods { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cost-period-total { margin-left: auto; font-weight: 700; }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px; }
.cost-box { padding: 6px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); display: flex; flex-direction: column; gap: 3px; }
.cost-box-title { margin: 0; font-size: 12px; font-weight: 700; }
.cost-box-alert { border-color: var(--color-danger); background: var(--color-danger-bg); color: var(--color-danger); }
.cost-row { display: flex; align-items: center; gap: 6px; }
.cost-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-amount { font-weight: 700; }
.cost-unknown { color: var(--color-danger); }
.cost-count { color: var(--color-text-muted); font-size: 11px; }
.cost-note { font-size: 11px; color: var(--color-text-muted); }
.cost-empty { font-size: 12px; color: var(--color-text-muted); }
.cost-badge { padding: 0 6px; border-radius: 8px; background: var(--color-danger-bg); color: var(--color-danger); font-size: 11px; font-weight: 700; }
.cost-field { display: flex; align-items: center; gap: 6px; }
.cost-field span { width: 76px; font-size: 12px; }
.cost-input { min-width: 0; width: 100%; padding: 3px 6px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; }
.cost-msg { min-height: 14px; font-size: 12px; color: var(--color-warn); }
.cost-vm-row { display: grid; grid-template-columns: 1fr 70px; gap: 3px; margin-bottom: 4px; }
.cost-vm-actions { display: flex; gap: 6px; }
.cost-error { align-items: flex-start; }
.cost-error-text { color: var(--color-danger); }

/* 未解決通知（承認・確認待ち）の共通上部バナー: 1クリックで notice 画面へ */
.pending-notices-banner {
  background: #fff3cd;
  border-bottom: 2px solid #ffeeba;
  color: #856404;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
}
.pending-notice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pending-notice-title {
  font-weight: 700;
  font-size: 14px;
}
.pending-notice-btn {
  background: #d97706;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.pending-notice-btn:hover {
  background: #b45309;
  color: #fff;
}
