/* ============ Tab bar (Phase 5 統合UI) ============ */
.tab-bar {
  display: flex;
  background: rgba(18, 18, 18, .98);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: 0 40px;
  position: sticky;
  top: 73px;
  z-index: 99;
  backdrop-filter: blur(12px);
}
.tab-btn {
  position: relative;
  background: transparent;
  border: none;
  color: rgba(245, 242, 237, .4);
  padding: 14px 22px 12px;
  cursor: pointer;
  font-family: monospace;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  min-width: 110px;
}
.tab-btn:hover {
  color: rgba(245, 242, 237, .7);
  background: rgba(255, 255, 255, .03);
}
.tab-btn.active {
  color: #F5F2ED;
  border-bottom-color: #5B9BD5;
  background: rgba(91, 155, 213, .06);
}
.tab-btn .tab-label {
  font-family: -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
}
.tab-btn .tab-sub {
  font-size: 10px;
  color: rgba(245, 242, 237, .35);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.tab-btn.active .tab-sub { color: rgba(91, 155, 213, .7); }
.tab-btn .tab-gate {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  color: #C9563C;
  font-weight: 900;
}

/* ============ Tab panels ============ */
main {
  /* panel wrapper */
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Placeholder styling for stub tabs */
.tab-placeholder {
  max-width: 680px;
  margin: 80px auto;
  padding: 40px;
  background: rgba(255, 255, 255, .03);
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: 12px;
  text-align: center;
}
.tab-placeholder h2 {
  font-size: 22px;
  margin-bottom: 14px;
  color: #F5F2ED;
}
.tab-placeholder p {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(245, 242, 237, .65);
  margin-bottom: 12px;
}
.tab-placeholder code {
  background: rgba(91, 155, 213, .15);
  color: #5B9BD5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.tab-placeholder .meta {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(201, 86, 60, .85);
  font-family: monospace;
  font-size: 12px;
  letter-spacing: .05em;
}

/* ============ Markdown panel (script / composition tabs) ============ */
.md-panel {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 32px 64px;
}
.md-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.md-panel-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #F5F2ED;
  margin-bottom: 4px;
}
.md-path { font-family: monospace; font-size: 11px; color: rgba(245, 242, 237, .4); }
.md-path code {
  background: rgba(91, 155, 213, .12);
  padding: 2px 6px;
  border-radius: 3px;
  color: #5B9BD5;
}
.md-panel-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: monospace;
  font-size: 12px;
  color: rgba(245, 242, 237, .6);
}
.md-body .loading {
  padding: 40px;
  text-align: center;
  color: rgba(245, 242, 237, .4);
  font-family: monospace;
}
.md-body .error {
  padding: 20px;
  background: rgba(201, 86, 60, .1);
  border: 1px solid rgba(201, 86, 60, .4);
  border-radius: 8px;
  color: #F5F2ED;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.7;
}
.md-body .hint {
  padding: 16px;
  color: rgba(245, 242, 237, .5);
  font-family: monospace;
  font-size: 12px;
}

.md-frontmatter {
  background: rgba(91, 155, 213, .06);
  border-left: 3px solid rgba(91, 155, 213, .5);
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 4px;
}
.md-fm-label {
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #5B9BD5;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.md-frontmatter pre {
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(245, 242, 237, .7);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.md-preface {
  background: rgba(255, 255, 255, .03);
  border-left: 3px solid rgba(255, 255, 255, .15);
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: 4px;
}
.md-preface pre {
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(245, 242, 237, .8);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- Section (collapsible) --- */
.md-section {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  border-left: 4px solid rgba(255, 255, 255, .15);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color .15s;
}
.md-section[open] { background: rgba(255, 255, 255, .05); }
.md-section.status-approved { border-left-color: #7BC47F; }
.md-section.status-requested_change { border-left-color: #C9563C; }
.md-section.status-question { border-left-color: #C9943E; }
.md-section.status-pending { border-left-color: rgba(255, 255, 255, .2); }

.md-section summary {
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: -apple-system, sans-serif;
  list-style: none;
  user-select: text;   /* セクション見出しもドラッグでコピー可 (owner 2026-06-18)。クリックで開閉は維持 */
}
.md-section summary::-webkit-details-marker { display: none; }
.md-section summary::before {
  content: '▸';
  font-size: 11px;
  color: rgba(245, 242, 237, .4);
  transition: transform .15s;
  display: inline-block;
}
.md-section[open] summary::before { transform: rotate(90deg); }
.md-section .sec-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  font-size: 14px;
  font-weight: 700;
}
.md-section.status-approved .sec-icon { background: rgba(123, 196, 127, .25); color: #7BC47F; }
.md-section.status-requested_change .sec-icon { background: rgba(201, 86, 60, .25); color: #C9563C; }
.md-section.status-question .sec-icon { background: rgba(201, 148, 62, .25); color: #C9943E; }
.md-section .sec-heading {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #F5F2ED;
}
.md-section .sec-meta {
  font-family: monospace;
  font-size: 10px;
  color: rgba(245, 242, 237, .4);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.md-section .sec-body {
  padding: 0 20px 16px 60px;
  border-top: 1px dashed rgba(255, 255, 255, .06);
}
.md-section .sec-body .md-raw {
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(245, 242, 237, .82);
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 14px 0;
  max-height: 480px;
  overflow-y: auto;
}

.approval-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, .08);
}
.ap-btn {
  padding: 6px 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .15);
  color: rgba(245, 242, 237, .8);
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: .04em;
  transition: all .15s;
}
.ap-btn:hover { background: rgba(255, 255, 255, .12); }
.ap-btn.ap-approve:hover { background: rgba(123, 196, 127, .25); border-color: rgba(123, 196, 127, .5); color: #7BC47F; }
.ap-btn.ap-change:hover { background: rgba(201, 86, 60, .25); border-color: rgba(201, 86, 60, .5); color: #C9563C; }
.ap-btn.ap-question:hover { background: rgba(201, 148, 62, .25); border-color: rgba(201, 148, 62, .5); color: #C9943E; }

/* --- Template picker (composition tab) --- */
.template-picker {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 16px 20px;
  background: rgba(91, 155, 213, .06);
  border: 1px solid rgba(91, 155, 213, .2);
  border-radius: 8px;
  margin-bottom: 20px;
}
.template-picker label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}
.tp-label {
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #5B9BD5;
  text-transform: uppercase;
}
.template-picker select {
  background: rgba(0, 0, 0, .4);
  color: #F5F2ED;
  border: 1px solid rgba(91, 155, 213, .4);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tp-detail { flex: 1; }
.tp-name { font-size: 15px; font-weight: 700; color: #F5F2ED; margin-bottom: 4px; }
.tp-desc { font-family: monospace; font-size: 11px; color: #5B9BD5; margin-bottom: 6px; }
.tp-use { font-size: 12px; line-height: 1.6; color: rgba(245, 242, 237, .65); }
.tp-name-link { text-decoration: none; cursor: pointer; transition: color .15s; }
.tp-name-link:hover { color: #9AD0FF; text-decoration: underline; }
.tp-view-btn {
  display: inline-block; margin-top: 10px; padding: 6px 14px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: #1A2028; background: #9AA5B0; border-radius: 4px;
  text-decoration: none; transition: background .15s, transform .1s;
}
.tp-view-btn:hover { background: #B8C2CC; }
.tp-view-btn:active { transform: translateY(1px); }

/* ============ QA tab ============ */
.qa-empty, .qa-section { margin-top: 24px; }
.qa-section h3 {
  font-size: 14px;
  font-family: monospace;
  letter-spacing: .05em;
  color: #5B9BD5;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.qa-count { color: rgba(245, 242, 237, .5); font-weight: 400; }
.qa-check {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-left: 4px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.qa-check.sev-critical { border-left-color: #C9563C; }
.qa-check.sev-high     { border-left-color: #E88A3C; }
.qa-check.sev-medium   { border-left-color: #C9943E; }
.qa-check.sev-low      { border-left-color: #5B9BD5; }
.qa-check.result-pass { opacity: .6; }
.qa-check.result-fail { background: rgba(201, 86, 60, .08); }
.qa-check-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.qa-check-name { flex: 1; font-weight: 600; font-size: 13px; }
.qa-check-result { font-family: monospace; font-size: 11px; font-weight: 700; }
.qa-check-sev {
  font-family: monospace;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 3px;
  text-transform: uppercase;
}
.qa-blocking {
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: #C9563C;
  color: #fff;
  border-radius: 3px;
  letter-spacing: .05em;
}
.qa-check-msg { font-size: 12px; color: rgba(245, 242, 237, .7); line-height: 1.5; }
.qa-check-slide { font-size: 11px; color: rgba(245, 242, 237, .4); margin-top: 4px; }
.qa-check-slide code {
  background: rgba(91, 155, 213, .12);
  padding: 1px 5px;
  border-radius: 3px;
  color: #5B9BD5;
}
.qa-meta { margin-top: 20px; font-family: monospace; font-size: 11px; color: rgba(245, 242, 237, .4); }

#qa-summary .sum-pass     { color: #7BC47F; margin-right: 10px; }
#qa-summary .sum-warn     { color: #C9943E; margin-right: 10px; }
#qa-summary .sum-fail     { color: #C9563C; margin-right: 10px; }
#qa-summary .sum-blocking { color: #fff; background: #C9563C; padding: 2px 8px; border-radius: 4px; font-weight: 700; }

.cmd-block {
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(91, 155, 213, .25);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #5B9BD5;
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 8px 0;
}

/* ============ Export tab ============ */
.export-preset-row {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(91, 155, 213, .06);
  border: 1px solid rgba(91, 155, 213, .2);
  border-radius: 8px;
  margin-bottom: 20px;
}
.export-preset-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.export-preset-row select {
  background: rgba(0, 0, 0, .4);
  color: #F5F2ED;
  border: 1px solid rgba(91, 155, 213, .4);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 13px;
  cursor: pointer;
}
.export-hint {
  flex: 1;
  font-size: 12px;
  color: rgba(245, 242, 237, .6);
  line-height: 1.6;
}
.export-fmt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.export-fmt-card {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 14px 18px;
}
.fmt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.fmt-label {
  font-size: 14px;
  font-weight: 700;
  color: #F5F2ED;
}
.export-validation {
  margin-top: 28px;
  padding: 16px 20px;
  background: rgba(123, 196, 127, .05);
  border: 1px solid rgba(123, 196, 127, .25);
  border-radius: 8px;
}
.export-validation h3 {
  font-size: 12px;
  font-family: monospace;
  letter-spacing: .05em;
  color: #7BC47F;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.export-validation table {
  width: 100%;
  font-family: monospace;
  font-size: 12px;
  border-collapse: collapse;
}
.export-validation td {
  padding: 6px 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, .08);
}
.export-validation td.ok { color: #7BC47F; }
.export-validation td.ng { color: #C9563C; }
.val-extra {
  margin-top: 6px;
  font-family: monospace;
  font-size: 11px;
  color: rgba(245, 242, 237, .5);
}
