/* public/office-inspector/office-inspector.css
   Office Inspector — Astro の CSS 処理を通さないよう public に置く（PDF Inspector と同じ配色） */

.oi-app {
  --acc: #00ff88; --bg: #0d0d0d; --panel: #111; --line: #1a1a1a; --dim: #555; --text: #c0c0c0; --bad: #ff5370; --warn: #ffcb6b; --info: #82aaff;
  display: flex; margin-top: 70px; margin-bottom: 70px; height: calc(100vh - 140px);
  font-family: Consolas, "SF Mono", Menlo, Monaco, "Courier New", monospace; color: var(--text); background: var(--bg);
  position: relative;
}
html.is-embed .oi-app { margin: 0; height: 100vh; }
.oi-app [hidden] { display: none !important; }
.oi-app *, .oi-palette *, .oi-help * { box-sizing: border-box; }

.oi-left { width: 300px; min-width: 300px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.oi-center { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.oi-right { width: 560px; min-width: 320px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

.oi-header { padding: 8px 12px; background: #0a0a0a; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.oi-title { color: var(--acc); font-size: 13px; font-weight: bold; }
.oi-sub { color: #444; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-section { padding: 10px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.oi-section-title { color: var(--acc); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.oi-hint { color: #444; font-size: 10px; text-transform: none; letter-spacing: 0; }
.oi-note { font-size: 10px; color: var(--dim); margin-top: 4px; line-height: 1.5; }
.oi-tree-section { border-bottom: none; padding-bottom: 4px; }
.oi-tree-host { position: relative; flex: 1; min-height: 120px; overflow: hidden; outline: none; }

.oi-drop { border: 2px dashed #333; border-radius: 4px; padding: 16px 12px; text-align: center; cursor: pointer; transition: border-color 0.2s; }
.oi-drop:hover, .oi-drop.drag-over { border-color: var(--acc); }
.oi-drop-icon { font-size: 24px; margin-bottom: 4px; }
.oi-drop-text { font-size: 11px; color: #666; }
.oi-drop-sub { font-size: 10px; color: #3a3a3a; margin-top: 6px; }
.oi-url-row { display: flex; gap: 6px; margin: 8px 0; }
.oi-url-row input { flex: 1; min-width: 0; background: #0a0a0a; border: 1px solid #2a2a2a; color: #ccc; font-family: inherit; font-size: 11px; padding: 6px 8px; outline: none; }
.oi-url-row input:focus { border-color: var(--acc); }
.oi-btn { display: block; width: 100%; padding: 8px; border: 1px solid #333; background: transparent; color: var(--text); font-family: inherit; font-size: 12px; cursor: pointer; text-align: center; transition: all 0.2s; }
.oi-btn:hover { border-color: var(--acc); color: var(--acc); }
.oi-btn-mini { padding: 4px 10px; border: 1px solid #333; background: transparent; color: #aaa; font-family: inherit; font-size: 10px; cursor: pointer; letter-spacing: 1px; transition: all 0.2s; white-space: nowrap; flex-shrink: 0; }
.oi-btn-mini:hover:not(:disabled) { border-color: var(--acc); color: var(--acc); }
.oi-btn-mini:disabled { opacity: 0.3; cursor: not-allowed; }
.oi-btn-mini.on { border-color: var(--acc); color: var(--acc); background: #00ff8812; }
.oi-btn-mini + .oi-btn-mini { margin-left: 4px; }
.oi-btn-help { border-color: #00ff8866; color: var(--acc); }

#info .row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-size: 11px; }
#info .k { color: #666; white-space: nowrap; }
#info .v { color: #ddd; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#info .v.acc { color: var(--acc); }
#info .v.bad { color: var(--bad); }
#info .v.warn { color: var(--warn); }
#info details { margin-top: 4px; font-size: 11px; }
#info summary { color: #777; cursor: pointer; }
#info details .row .v { white-space: normal; text-align: right; word-break: break-all; }

.oi-tabbar { display: flex; align-items: center; gap: 2px; padding: 0 8px; height: 33px; background: #0a0a0a; border-bottom: 1px solid var(--line); flex-shrink: 0; overflow: hidden; }
.oi-tab { background: transparent; border: none; border-bottom: 2px solid transparent; color: #666; font-family: inherit; font-size: 11px; letter-spacing: 1px; padding: 8px 10px; cursor: pointer; white-space: nowrap; }
.oi-tab:hover { color: #aaa; }
.oi-tab.active { color: var(--acc); border-bottom-color: var(--acc); }
.oi-tab-spacer { flex: 1; }
.oi-badge { display: inline-block; min-width: 14px; padding: 0 4px; border-radius: 7px; font-size: 9px; line-height: 14px; text-align: center; background: #222; color: #888; letter-spacing: 0; }
.oi-badge.bad { background: #ff537033; color: var(--bad); }
.oi-badge.warn { background: #ffcb6b22; color: var(--warn); }
.oi-badge.ok { background: #00ff8818; color: var(--acc); }
.oi-goto { min-width: 0; flex-shrink: 1; width: 190px; background: #0a0a0a; border: 1px solid #2a2a2a; color: #777; font-family: inherit; font-size: 10px; padding: 4px 8px; text-align: left; cursor: pointer; margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-goto:hover:not(:disabled) { border-color: var(--acc); color: #aaa; }
.oi-goto:disabled { opacity: 0.3; cursor: default; }

.oi-crumbs { display: flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 11px; border-bottom: 1px solid var(--line); background: #0b0b0b; min-height: 26px; flex-shrink: 0; overflow: hidden; white-space: nowrap; }
.oi-crumbs .back { background: transparent; border: 1px solid #2a2a2a; color: #888; font-size: 9px; padding: 2px 6px; cursor: pointer; font-family: inherit; }
.oi-crumbs .back:hover:not(:disabled) { color: var(--acc); border-color: var(--acc); }
.oi-crumbs .back:disabled { opacity: 0.25; cursor: default; }
.oi-crumbs .crumb { color: #777; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.oi-crumbs .crumb:hover { color: var(--acc); }
.oi-crumbs .crumb.cur { color: #ddd; cursor: default; }
.oi-crumbs .sep { color: #333; }
.oi-crumbs .hint { margin-left: auto; color: #3a3a3a; font-size: 10px; padding-left: 12px; }

.oi-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.oi-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.oi-view.active { display: flex; }
.oi-head { flex-shrink: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #0b0b0b; font-size: 11px; line-height: 1.6; }
.oi-head:empty { display: none; }
.oi-host { position: relative; flex: 1; min-height: 0; overflow: hidden; outline: none; }
.oi-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 32px; font-size: 12px; }
.oi-app .vview canvas { position: absolute; left: 0; top: 0; display: block; }
.oi-app .vsb { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; background: #0a0a0a; border-left: 1px solid #161616; }
.oi-app .vsb-thumb { position: absolute; left: 2px; right: 2px; background: #2a2a2a; border-radius: 3px; display: none; cursor: grab; }
.oi-app .vsb-thumb:hover { background: #00ff8866; }

.oi-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #333; font-size: 13px; pointer-events: none; }
.oi-empty-sub { margin-top: 10px; font-size: 11px; color: #2a2a2a; }
.oi-error { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); max-width: 80%; background: #1a0d0f; border: 1px solid var(--bad); color: #ddd; padding: 12px 16px; font-size: 12px; z-index: 5; }
.oi-error .t { color: var(--bad); font-size: 11px; letter-spacing: 1px; margin-bottom: 6px; }
.oi-progress { position: absolute; inset: 0; background: rgba(0,0,0,0.7); align-items: center; justify-content: center; z-index: 10; display: none; }
.oi-progress.active { display: flex; }
.oi-progress-text { color: var(--acc); font-size: 11px; }

/* 見出し（オブジェクトの情報など） */
.oi-head .title { color: #eee; font-size: 13px; }
.oi-head .title .num { color: var(--acc); }
.oi-head .meta { color: #666; }
.oi-head .meta b { color: #aaa; font-weight: normal; }
.oi-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.oi-chip { border: 1px solid #2a2a2a; color: #999; padding: 1px 7px; font-size: 10px; cursor: pointer; background: transparent; font-family: inherit; }
.oi-chip:hover { border-color: var(--acc); color: var(--acc); }
.oi-chip.ref { color: #ff6b9a; border-color: #ff6b9a44; }
.oi-chip.static { cursor: default; }
.oi-chip.static:hover { border-color: #2a2a2a; color: #999; }
.oi-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oi-row + .oi-row { margin-top: 4px; }
.oi-k { color: var(--acc); font-size: 10px; letter-spacing: 1px; }
.oi-dimtext { color: #555; }
.oi-badtext { color: var(--bad); }
.oi-warntext { color: var(--warn); }
.oi-oktext { color: var(--acc); }

/* 統計・リソース */
.oi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.oi-card { border: 1px solid #1f1f1f; background: #111; padding: 10px 12px; }
.oi-card .ck { color: #555; font-size: 10px; letter-spacing: 1px; }
.oi-card .cv { color: #eee; font-size: 20px; margin: 4px 0 2px; }
.oi-card .cs { color: #666; font-size: 10px; }
.oi-h3 { color: var(--acc); font-size: 11px; letter-spacing: 1px; font-weight: normal; margin: 22px 0 8px; }
.oi-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.oi-table th { text-align: left; color: #555; font-weight: normal; border-bottom: 1px solid #222; padding: 3px 6px; white-space: nowrap; }
.oi-table td { padding: 3px 6px; border-bottom: 1px solid #151515; vertical-align: top; }
.oi-table tr.link { cursor: pointer; }
.oi-table tr.link:hover td { background: #151515; }
.oi-bar { height: 6px; background: #171717; min-width: 60px; }
.oi-bar span { display: block; height: 100%; background: var(--acc); opacity: 0.6; }
.oi-pre { white-space: pre-wrap; word-break: break-all; background: #0a0a0a; border: 1px solid #1a1a1a; padding: 8px; font-size: 11px; max-height: 360px; overflow: auto; color: #bbb; }

/* ステータス・凡例 */
.oi-status { flex-shrink: 0; min-height: 72px; padding: 6px 10px; border-top: 1px solid var(--line); background: #0a0a0a; font-size: 11px; color: #bbb; line-height: 1.6; }
.oi-status .k { color: var(--acc); font-size: 10px; letter-spacing: 1px; margin-right: 2px; }
.oi-status .d { color: #555; }
.oi-status .path { color: #ffcb6b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-status .doc { color: #aaa; }
.oi-status .op { color: #fff; }
.oi-status .sig { color: #89ddff; margin: 0 4px; }
.oi-legend { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 3px 10px; padding: 6px 10px 8px; border-top: 1px solid #161616; font-size: 10px; color: #666; }
.oi-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; vertical-align: -1px; }

/* パレット */
.oi-palette { width: min(860px, 92vw); padding: 0; background: #0d0d0d; color: var(--text, #c0c0c0); border: 1px solid #00ff8855; box-shadow: 0 0 40px #00ff8815; font-family: Consolas, "SF Mono", Menlo, monospace; margin-top: 12vh; }
.oi-palette::backdrop { background: rgba(0,0,0,0.6); }
.oi-palette input { width: 100%; background: #0a0a0a; border: none; border-bottom: 1px solid #1f1f1f; color: #eee; font-family: inherit; font-size: 13px; padding: 12px 14px; outline: none; }
.oi-pal-list { max-height: 50vh; overflow-y: auto; }
.oi-pal-item { display: grid; grid-template-columns: 250px 1fr; gap: 10px; padding: 6px 14px; font-size: 12px; cursor: pointer; color: #bbb; }
.oi-pal-item .a { color: #00ff88; overflow: hidden; white-space: nowrap; }
.oi-pal-item .b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #888; }
.oi-pal-item.sel { background: #00ff8814; }
.oi-pal-foot { font-size: 10px; color: #444; padding: 6px 14px; border-top: 1px solid #1a1a1a; }

/* ヘルプ */
.oi-help { width: min(860px, 92vw); max-height: 84vh; padding: 0; background: #0d0d0d; color: #c0c0c0; border: 1px solid #00ff8855; box-shadow: 0 0 40px #00ff8815; font-family: Consolas, "SF Mono", Menlo, monospace; }
.oi-help::backdrop { background: rgba(0,0,0,0.72); }
.oi-help-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: #0a0a0a; border-bottom: 1px solid #1a1a1a; }
.oi-help-title { color: #00ff88; font-size: 13px; font-weight: bold; letter-spacing: 1px; }
.oi-help-body { padding: 8px 20px 20px; font-size: 12px; line-height: 1.75; overflow-y: auto; max-height: calc(84vh - 46px); }
.oi-help-body h4 { color: #00ff88; font-size: 11px; font-weight: normal; letter-spacing: 1px; margin: 18px 0 6px; }
.oi-help-body p { margin: 0 0 6px; }
.oi-help-body table { width: 100%; border-collapse: collapse; }
.oi-help-body th { text-align: left; vertical-align: top; color: #ddd; font-weight: normal; padding: 4px 12px 4px 0; width: 28%; white-space: nowrap; border-bottom: 1px solid #161616; }
.oi-help-body td { padding: 4px 0; color: #999; border-bottom: 1px solid #161616; }
.oi-help-body th.sub { color: #555; font-size: 10px; padding-top: 10px; }
.oi-help-body code { color: #ffcb6b; background: #151515; padding: 0 4px; }
.oi-help-body kbd { display: inline-block; min-width: 14px; text-align: center; padding: 0 5px; border: 1px solid #333; border-bottom-width: 2px; border-radius: 3px; color: #ddd; font-family: inherit; font-size: 11px; line-height: 1.5; }
.oi-help-body .c-ref { color: #ff6b9a; }

/* 狭い画面 */
.oi-app.left-hidden .oi-left { display: none; }
@media (max-width: 1500px) {
  .oi-right { width: 420px; }
  .oi-left { width: 260px; min-width: 260px; }
}
@media (max-width: 1200px) {
  .oi-right { width: 340px; min-width: 340px; }
  .oi-left { width: 230px; min-width: 230px; }
  .oi-goto { width: 110px; }
  .oi-crumbs .hint { display: none; }
  .oi-tab { padding: 8px 6px; }
  .oi-page-side { width: 280px; }
}
@media (max-width: 900px) {
  .oi-left { display: none; }
  .oi-app.left-shown .oi-left { display: flex; position: absolute; z-index: 20; height: 100%; box-shadow: 8px 0 24px #000a; }
  .oi-right { display: none; }
  .oi-goto { width: 80px; }
}


/* ───── 左パネルの追加 ───── */
.oi-sample-row { display: flex; gap: 6px; }
.oi-sample-row .oi-btn { padding: 7px 4px; font-size: 11px; }
.oi-back-file { margin-bottom: 8px; border-color: #ffcb6b66; color: var(--warn); }

/* ───── セクションの切り替え（CONTENT タブ） ───── */
.oi-secbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; max-height: 78px; overflow-y: auto; }
.oi-chip.on { border-color: var(--acc); color: var(--acc); background: #00ff8812; }
.oi-secbar .oi-chip.hid { color: #ff9e40; border-color: #ff9e4055; }
.oi-secbar .oi-chip.hid.on { background: #ff9e4018; }
.oi-legend-inline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 10px; color: #777; }
.oi-legend-inline b { font-weight: normal; padding: 0 4px; }
.oi-legend-inline .del { color: #ff7b72; background: rgba(255,83,112,0.16); text-decoration: line-through; }
.oi-legend-inline .ins { color: #7ee787; background: rgba(126,231,135,0.13); }
.oi-legend-inline .hid { color: #ff9e40; background: rgba(255,158,64,0.15); }
.oi-legend-inline .fld { color: #89ddff; }
.oi-legend-inline .ref { color: #ff6b9a; }

/* ───── パートの見出し（PART タブ） ───── */
.oi-kv { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; margin-top: 4px; }
.oi-kv > span:nth-child(odd) { color: #666; white-space: nowrap; }
.oi-kv > span:nth-child(even) { color: #bbb; overflow-wrap: anywhere; }
.oi-notes { margin-top: 6px; }
.oi-note-row { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
.oi-note-row[data-off] { cursor: pointer; }
.oi-note-row[data-off]:hover { background: #151515; }
.oi-thumb { max-width: 220px; max-height: 150px; margin-top: 8px; border: 1px solid #222; background: repeating-conic-gradient(#1a1a1a 0 25%, #121212 0 50%) 0 0 / 16px 16px; display: block; }

/* ───── FINDINGS タブ ───── */
.oi-find-sum { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.oi-find-cat { color: var(--acc); font-size: 11px; letter-spacing: 1px; margin: 20px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #1c1c1c; }
.oi-find-cat:first-child { margin-top: 0; }
.oi-find-cat .n { color: #666; letter-spacing: 0; margin-left: 6px; }
.oi-find { border: 1px solid #1c1c1c; background: #101010; margin-bottom: 6px; }
.oi-find-head { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 7px 10px; align-items: baseline; }
.oi-find-head.link { cursor: pointer; }
.oi-find-head.link:hover { background: #151515; }
.oi-find-title { color: #e4e4e4; line-height: 1.5; overflow-wrap: anywhere; }
.oi-find-detail { color: #7a7a7a; font-size: 11px; line-height: 1.6; margin-top: 2px; overflow-wrap: anywhere; }
.oi-find-items { border-top: 1px dashed #1f1f1f; padding: 4px 0; max-height: 260px; overflow-y: auto; }
.oi-find-item { padding: 2px 10px 2px 74px; font-size: 11px; color: #aaa; cursor: pointer; overflow-wrap: anywhere; line-height: 1.5; }
.oi-find-item:hover { background: #161616; color: #fff; }
.oi-find-item.del { color: #ff7b72; }
.oi-find-item.ins { color: #7ee787; }
.oi-find-item.hid { color: #ff9e40; }
.oi-find-more { padding: 2px 10px 2px 74px; font-size: 10px; color: #555; }
.oi-find-none { color: #555; padding: 24px 0; text-align: center; }

/* ───── MEDIA タブ ───── */
.oi-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.oi-media-card { display: flex; gap: 10px; border: 1px solid #1c1c1c; background: #0f0f0f; padding: 8px; cursor: pointer; min-width: 0; }
.oi-media-card:hover { border-color: var(--acc); }
.oi-media-card .th { flex: 0 0 84px; height: 84px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#222 0% 25%, #2c2c2c 0% 50%) 0 0 / 12px 12px; overflow: hidden; }
.oi-media-card .th img { max-width: 84px; max-height: 84px; display: block; }
.oi-media-card .th span { color: #777; font-size: 9px; text-align: center; }
.oi-media-card .m { min-width: 0; font-size: 11px; line-height: 1.5; color: #999; overflow-wrap: anywhere; }
.oi-media-card .m .nm { color: #eee; }
.oi-media-card .m .warn { color: #ff9e40; }
.oi-media-card .m .bad { color: var(--bad); }

/* ───── STATS タブ ───── */
.oi-table td.r, .oi-table th.r { text-align: right; white-space: nowrap; }
.oi-table td.nm { overflow-wrap: anywhere; color: #ddd; }
.oi-table tr.orphan td.nm { color: var(--bad); }

/* 重要度のラベル */
.oi-lv { font-size: 9px; letter-spacing: 1px; text-align: center; padding: 1px 0; border: 1px solid; min-width: 46px; display: inline-block; }
.oi-lv.error { color: var(--bad); border-color: #ff537066; }
.oi-lv.warn { color: var(--warn); border-color: #ffcb6b55; }
.oi-lv.info { color: var(--info); border-color: #82aaff44; }
.oi-help-body .c-del { color: #ff7b72; text-decoration: line-through; }
.oi-help-body .c-ins { color: #7ee787; }
.oi-help-body .c-hid { color: #ff9e40; }
