:root {
  color-scheme: light;
  --ink: #192228;
  --muted: #536269;
  --line: #d5dddc;
  --paper: #fffefa;
  --canvas: #edf2f1;
  --accent: #0d6d68;
  --accent-dark: #084b48;
  --warm: #f3ede4;
  font-family: Inter, "Yu Gothic UI", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.65; }
button, input { font: inherit; }
.topbar { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 12px clamp(20px, 5vw, 72px); color: #fff; background: #132f31; }
.brand-block { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.brand { color: inherit; font-size: 18px; font-weight: 750; letter-spacing: .01em; text-decoration: none; }
.brand-note { padding: 2px 7px; border: 1px solid rgb(214 226 224 / .45); border-radius: 999px; color: #d6e2e0; font-size: 12px; font-weight: 700; line-height: 1.4; }
.topbar p { margin: 0; color: #d6e2e0; font-size: 15px; }
.layout { width: min(1440px, 100%); margin: 0 auto; padding: clamp(28px, 5vw, 72px); }
.intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .75fr); gap: 40px; align-items: center; padding: clamp(28px, 5vw, 64px); border-radius: 20px; background: var(--paper); box-shadow: 0 18px 48px rgb(29 48 48 / .09); }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { max-width: 760px; margin: 0; font-size: clamp(31px, 4vw, 54px); line-height: 1.22; letter-spacing: -.025em; }
.lead { max-width: 720px; margin: 20px 0 0; color: var(--muted); font-size: 18px; }
.pickers { display: grid; gap: 12px; }
input[type="file"] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.primary-picker, .file-picker { display: grid; cursor: pointer; border-radius: 12px; transition: transform .15s ease, background .15s ease; }
.primary-picker { gap: 3px; padding: 20px 22px; color: #fff; background: var(--accent); box-shadow: 0 8px 20px rgb(13 109 104 / .25); }
.primary-picker span { font-size: 19px; font-weight: 750; }
.primary-picker small { color: #e1f4f0; font-size: 15px; }
.primary-picker:hover, .primary-picker:focus-within { background: var(--accent-dark); transform: translateY(-1px); }
.file-picker { gap: 2px; place-items: center; min-height: 58px; padding: 9px 16px; border: 1px solid var(--line); color: var(--accent-dark); font-weight: 700; text-align: center; }
.file-picker small { color: var(--muted); font-size: 13px; font-weight: 500; }
.file-picker:hover { background: #f2f8f7; }
.picker-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.privacy { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-column: 1 / -1; gap: 14px; align-items: start; margin: 0; padding: 18px 20px; border: 1px solid #9fc9c0; border-radius: 12px; color: #174841; background: #e9f7f2; }
.privacy-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #c4ebe0; font-size: 16px; }
.privacy strong { display: block; font-size: 17px; line-height: 1.4; }
.privacy p { margin: 5px 0 0; color: #285d55; font-size: 15px; line-height: 1.6; }
.guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 28px 0 0; }
.guide article { position: relative; padding: 28px 24px 22px; background: #e2e9e7; border-radius: 14px; }
.guide-number { display: block; margin-bottom: 12px; color: var(--accent); font-size: 16px; font-weight: 800; }
.guide h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.guide p { margin: 10px 0 0; color: var(--muted); }
.disclaimer { margin: 28px 0 0; padding: 20px 24px; border-left: 3px solid #aab8b5; color: var(--muted); background: #e7eeec; }
.disclaimer h2 { margin: 0; color: var(--ink); font-size: 16px; }
.disclaimer p { margin: 6px 0 0; font-size: 14px; line-height: 1.65; }
.workspace { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); min-height: 720px; margin-top: 28px; overflow: hidden; border-radius: 16px; background: var(--paper); box-shadow: 0 18px 48px rgb(29 48 48 / .09); }
.file-panel { min-width: 0; padding: 24px 16px; background: #e5edeb; border-right: 1px solid var(--line); }
.file-panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; padding: 0 8px; }
.file-panel h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.quiet-button { flex: none; border: 0; padding: 7px 10px; cursor: pointer; color: var(--accent-dark); background: transparent; border-radius: 7px; font-size: 16px; font-weight: 700; }
.quiet-button:hover { background: #d4e2df; }
.file-summary { margin: 14px 8px 12px; color: var(--muted); font-size: 16px; }
.file-list { display: grid; gap: 3px; max-height: 640px; overflow: auto; padding: 4px; }
.file-group-label { margin: 14px 8px 4px; color: var(--accent-dark); font-size: 15px; font-weight: 800; letter-spacing: .04em; }
.file-group-label:first-child { margin-top: 4px; }
.file-row { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 3px 8px; width: 100%; padding: 10px 8px; text-align: left; cursor: pointer; border: 0; border-radius: 9px; color: var(--ink); background: transparent; }
.file-row:hover { background: #d5e3e0; }
.file-row.document { border: 1px solid #99c4bc; background: #f6fffc; }
.file-row.document:hover { background: #e1f5ef; }
.file-row.active { color: #fff; background: var(--accent-dark); }
.file-icon { grid-row: span 2; padding-top: 1px; color: var(--accent); font-size: 18px; font-weight: 800; text-align: center; }
.file-row.active .file-icon { color: #d6f0ea; }
.file-name { display: flex; align-items: start; flex-wrap: wrap; gap: 4px 6px; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.4; }
.file-label { min-width: 0; overflow-wrap: anywhere; }
.file-badge { flex: none; padding: 1px 6px; color: var(--accent-dark); background: #cfeae3; border-radius: 999px; font-size: 13px; font-weight: 800; line-height: 1.4; }
.file-row.active .file-badge { color: #073d3a; background: #bde7dd; }
.file-detail { color: var(--muted); font-size: 15px; }
.file-row.active .file-detail { color: #d9e8e5; }
.viewer-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #fff; }
.viewer-meta { min-height: 75px; display: flex; align-items: center; padding: 15px 28px; border-bottom: 1px solid var(--line); }
.viewer-meta > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.viewer-meta strong { min-width: 0; overflow-wrap: anywhere; font-size: 17px; line-height: 1.4; }
.viewer-meta span { flex: none; padding: 3px 8px; color: var(--accent-dark); background: #d9ece8; border-radius: 999px; font-size: 14px; font-weight: 800; letter-spacing: .06em; }
.viewer { min-width: 0; min-height: 0; padding: 28px; overflow: auto; background: #f6f8f7; }
.empty-state, .error-state, .notice { max-width: 760px; padding: 20px; border-radius: 10px; background: #fff; color: var(--muted); }
.error-state { color: #8a1f18; background: #fff0ef; }
.notice { margin-bottom: 14px; background: #fff8e9; color: #68501b; }
.document-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.document-toolbar button { min-height: 40px; padding: 6px 12px; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; color: var(--accent-dark); background: #fff; font-size: 16px; font-weight: 700; }
.document-toolbar button:hover { background: #e8f4f1; }
.document-toolbar span { margin-left: 4px; color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
.document-stage { overflow: auto; border: 1px solid var(--line); background: #fff; }
.document-frame { display: block; width: 100%; min-height: 920px; border: 0; background: #fff; }
.pdf-frame { min-height: 900px; }
.render-note { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.raw-text { margin: 0; padding: 20px; overflow: auto; color: #202a2f; background: #fff; border: 1px solid var(--line); font: 14px/1.6 Consolas, "Courier New", monospace; white-space: pre-wrap; }
.table-scroll { overflow: auto; border: 1px solid var(--line); background: #fff; }
.csv-table { border-collapse: collapse; min-width: 100%; font-size: 16px; }
.csv-table th, .csv-table td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: pre-wrap; }
.csv-table th { position: sticky; top: 0; color: #fff; background: var(--accent-dark); font-weight: 700; }

@media (max-width: 800px) {
  .topbar { align-items: start; flex-direction: column; gap: 2px; }
  .layout { padding: 20px; }
  .intro { grid-template-columns: 1fr; gap: 28px; padding: 28px 22px; }
  .guide, .workspace { grid-template-columns: 1fr; }
  .workspace { min-height: 0; }
  .file-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .file-list { max-height: 260px; }
  .viewer { min-height: 600px; padding: 16px; }
  .viewer-meta { padding: 15px 18px; }
  .document-frame { min-height: 760px; }
}
