:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #fbfbf8;
  --ink: #1f2523;
  --muted: #66706b;
  --line: #d9ded8;
  --line-strong: #b7c0b8;
  --brand: #176b5b;
  --brand-strong: #0f5245;
  --accent: #c47b2c;
  --danger: #a84040;
  --warn: #9a6a16;
  --ok: #267043;
  --focus: #75a99e;
  --shadow: 0 16px 40px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui,
    sans-serif;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: var(--brand);
}

.app-loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fcfcfa;
}

.brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
}

.brand-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 14px 10px;
}

.nav button {
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 8px;
  background: transparent;
  color: #3d4742;
  cursor: pointer;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: #e7eee9;
  color: var(--brand-strong);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  min-height: 66px;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 420px) auto;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.94);
  padding: 12px 24px;
  backdrop-filter: blur(10px);
}

.office-label {
  color: var(--muted);
  font-size: 12px;
}

.office-name {
  font-weight: 700;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
}

.search-results {
  position: absolute;
  right: 0;
  left: 0;
  top: 46px;
  z-index: 20;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-results button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.search-type {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.plan-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid #cbd8d2;
  border-radius: 999px;
  background: #edf4f0;
  padding: 0 12px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.content {
  padding: 24px;
}

.page-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.page-lead {
  max-width: 880px;
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-strong);
  color: white;
}

.btn.danger {
  border-color: #d8b9b9;
  color: var(--danger);
}

.btn.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 37, 35, 0.02);
}

.panel-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.metric {
  display: grid;
  gap: 4px;
}

.metric-value {
  font-size: 27px;
  font-weight: 700;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f3ef;
  color: #47514c;
  font-size: 12px;
  font-weight: 700;
}

td {
  background: var(--surface);
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status.draft,
.status.trialing {
  background: #f5eadc;
  color: #7d4a13;
}

.status.confirmed,
.status.active {
  background: #e3f1e8;
  color: #1d6939;
}

.status.reviewing {
  background: #e6eef7;
  color: #285d8b;
}

.status.delivered {
  background: #ece9f5;
  color: #5b4b87;
}

.status.added {
  background: #dcefe3;
  color: #1d6235;
}

.status.deleted {
  background: #f7d9d9;
  color: #772929;
}

.status.modified {
  background: #f5eadc;
  color: #7d4a13;
}

.status.same {
  background: #e8ece9;
  color: #58615c;
}

.status.inactive,
.status.abolished {
  background: #f2e5e5;
  color: #8b3030;
}

.status.template-untracked,
.status.template-unscheduled {
  background: #f5eadc;
  color: #7d4a13;
}

.status.template-overdue {
  background: #f7d9d9;
  color: #772929;
}

.status.template-upcoming {
  background: #fff1d7;
  color: #8a580f;
}

.status.template-scheduled {
  background: #e3f1e8;
  color: #1d6939;
}

.status.approval-preparing {
  background: #e8ece9;
  color: #58615c;
}

.status.approval-internal_review {
  background: #e6eef7;
  color: #285d8b;
}

.status.approval-client_review {
  background: #e8f1ee;
  color: #216754;
}

.status.approval-returned {
  background: #f7d9d9;
  color: #772929;
}

.status.approval-approved {
  background: #e3f1e8;
  color: #1d6939;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #3f4843;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 9px 10px;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.new-regulation-wizard {
  max-width: 980px;
}

.wizard-sections {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}

.wizard-sections legend {
  margin-bottom: 8px;
  color: #3f4843;
  font-size: 13px;
  font-weight: 700;
}

.wizard-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}

.wizard-section-option {
  display: flex;
  min-height: 62px;
  gap: 10px;
  align-items: flex-start;
  background: white;
  cursor: pointer;
  padding: 10px 12px;
}

.wizard-section-option input {
  width: auto;
  min-width: 16px;
  margin: 3px 0 0;
  accent-color: var(--brand);
}

.wizard-section-option span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.wizard-section-option strong {
  font-size: 13px;
}

.wizard-section-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.rule-settings-panel {
  margin-top: 16px;
}

.cloud-settings-panel {
  margin-top: 16px;
}

.cloud-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cloud-connected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.cloud-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cloud-hint {
  margin-top: 12px;
}

.cloud-diagnostics {
  border-top: 1px solid var(--line);
}

.cloud-diagnostics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f8faf8;
}

.cloud-diagnostic-list {
  padding: 0 16px;
}

.cloud-diagnostic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.cloud-diagnostic-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cloud-diagnostic-main strong {
  font-size: 13px;
}

.cloud-diagnostic-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.status.diagnostic-pass {
  background: #e3f1e8;
  color: #1d6939;
}

.status.diagnostic-warn {
  background: #fff1d7;
  color: #8a580f;
}

.status.diagnostic-fail {
  background: #f7d9d9;
  color: #772929;
}

.status.diagnostic-blocked {
  background: #e8ece9;
  color: #58615c;
}

.status.diagnostic-running {
  background: #e6eef7;
  color: #285d8b;
}

.member-invite-panel {
  margin-bottom: 16px;
}

.member-invite-submit {
  align-self: end;
}

.member-role-select {
  min-width: 132px;
}

.member-actions {
  min-width: 150px;
}

.status.invited,
.status.pending_setup {
  background: #fff1d7;
  color: #8a580f;
}

.status.suspended {
  background: #f2e5e5;
  color: #8b3030;
}

.invite-acceptance-panel {
  max-width: 760px;
}

.workspace-read-only-note {
  margin-bottom: 16px;
  border: 1px solid #d7dfda;
  border-left: 3px solid #5a766b;
  border-radius: 6px;
  background: #f4f7f5;
  color: #40534b;
  padding: 10px 12px;
  font-size: 13px;
}

.workspace-read-only input:not([data-search]),
.workspace-read-only textarea,
.workspace-read-only select:not(.member-role-select) {
  pointer-events: none;
  background: #f3f5f3;
  color: #66716b;
}

.template-review-status {
  display: grid;
  justify-items: start;
  gap: 3px;
}

.template-review-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.regulation-status-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.notice {
  border: 1px solid #d8c7a6;
  border-radius: 8px;
  background: #fff8e9;
  padding: 12px 14px;
  color: #674a1b;
}

.notice strong {
  color: #4d350f;
}

.import-analysis {
  margin-bottom: 16px;
}

.import-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.import-metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbf8;
  padding: 10px 12px;
}

.import-metric-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.import-metric-label {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.import-warnings {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.import-warning {
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: #fff8ea;
  padding: 9px 11px;
  color: #5f4210;
  font-size: 13px;
}

.import-warning.ok {
  border-left-color: var(--ok);
  background: #eef7f0;
  color: #245536;
}

.review-completion {
  margin-bottom: 16px;
}

.completion-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.completion-summary-item {
  display: grid;
  gap: 2px;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 9px 12px;
}

.completion-summary-item:last-child {
  border-right: 0;
}

.completion-summary-item strong {
  font-size: 18px;
  line-height: 1.2;
}

.completion-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.review-issue-list {
  display: grid;
  gap: 6px;
}

.review-issue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.45fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.review-issue:hover {
  border-color: var(--brand);
  background: #f4faf7;
}

.review-issue-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.review-issue-title {
  font-size: 13px;
  font-weight: 700;
}

.review-issue-body,
.review-issue-target {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.review-issue-target {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview {
  margin-bottom: 16px;
}

.import-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.import-preview-pane {
  min-width: 0;
}

.import-preview-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.source-preview-heading,
.source-link-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-preview-heading {
  justify-content: space-between;
}

.source-link-controls {
  min-height: 34px;
  margin-bottom: 8px;
}

.source-link-state,
.source-selection-summary {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-link-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f8f6;
  padding: 3px 8px;
}

.source-link-state.linked {
  border-color: #87b5a4;
  background: #eaf6ef;
  color: #235d47;
}

.source-selection-summary {
  flex: 1;
  color: var(--muted);
}

.source-preview {
  min-height: 320px;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
  padding: 12px;
  color: var(--ink);
  font-family:
    "Yu Gothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.source-preview::selection {
  background: #bdd9ff;
}

.source-hit {
  border-radius: 2px;
  background: #fff0a8;
  box-shadow: inset 0 -1px 0 #d2a935;
  color: inherit;
}

.source-link {
  border-radius: 2px;
  background: #cceede;
  box-shadow: inset 0 -1px 0 #5b9d7d;
  color: inherit;
}

.structure-preview {
  display: grid;
  max-height: 420px;
  overflow: auto;
  gap: 7px;
  padding-right: 2px;
}

.structure-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.structure-item:hover,
.structure-item.active {
  border-color: var(--brand);
  background: #f4faf7;
}

.structure-item.level-4 {
  margin-left: 16px;
}

.structure-item.level-5 {
  margin-left: 30px;
}

.structure-heading {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-type {
  color: var(--muted);
  font-size: 12px;
}

.structure-body {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.three-pane {
  display: grid;
  grid-template-columns: 260px minmax(620px, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.outline-list {
  display: grid;
  max-height: calc(100vh - 210px);
  overflow: auto;
  gap: 6px;
}

.outline-filter {
  width: 100%;
  height: 34px;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  font-size: 13px;
}

.outline-item {
  display: grid;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
}

.outline-item:hover,
.outline-item.active {
  border-color: #c6d8d0;
  background: #eef5f1;
}

.outline-item .meta {
  color: var(--muted);
  font-size: 11px;
}

.outline-item.level-1 {
  font-weight: 700;
}

.outline-item.level-4 {
  margin-left: 16px;
}

.outline-item.level-5 {
  margin-left: 30px;
}

.editor-textarea {
  min-height: 220px;
  font-family: inherit;
  line-height: 1.65;
}

.word-editor-shell {
  background: #ecefea;
}

.word-ribbon {
  position: sticky;
  top: 66px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fbfbf8;
  padding: 10px 14px;
}

.word-ribbon-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.document-stage {
  max-height: calc(100vh - 196px);
  overflow: auto;
  padding: 22px;
}

.word-page {
  width: min(100%, 860px);
  min-height: 1120px;
  margin: 0 auto;
  border: 1px solid #d8ddd7;
  background: #fff;
  box-shadow: 0 16px 36px rgba(31, 37, 35, 0.12);
  padding: 54px 64px 72px;
}

.word-page-cover {
  margin-bottom: 28px;
  text-align: center;
}

.word-doc-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

.word-doc-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.word-block {
  position: relative;
  margin: 8px 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
}

.word-block:hover,
.word-block.selected {
  border-color: #c7d8d0;
  background: #fbfdfb;
}

.word-block.selected {
  padding-top: 34px;
  box-shadow: inset 3px 0 0 var(--brand);
}

.word-block-tools {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(243, 246, 242, 0.96);
  box-shadow: 0 6px 18px rgba(31, 37, 35, 0.1);
}

.word-block-tools select {
  max-width: 128px;
  min-height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  padding: 2px 6px;
  font-size: 12px;
}

.word-heading-row,
.word-article-heading,
.word-line {
  display: flex;
  gap: 0;
  align-items: baseline;
}

.word-heading-row {
  gap: 10px;
}

.word-number,
.word-heading,
.word-title,
.word-body,
.word-table-text {
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  padding: 3px 4px;
}

.word-number:focus,
.word-heading:focus,
.word-title:focus,
.word-body:focus,
.word-table-text:focus,
.word-doc-title:focus {
  border-color: var(--focus);
  background: #f8fbfa;
  outline: 0;
}

.word-number.chapter,
.word-number.section,
.word-number.table {
  width: 82px;
  font-weight: 700;
}

.word-number.article {
  width: 58px;
  font-weight: 700;
}

.word-number.inline {
  width: 54px;
  flex: 0 0 54px;
  text-align: center;
}

.word-heading {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.word-heading.chapter {
  font-size: 20px;
}

.word-heading.section,
.word-heading.table {
  font-size: 17px;
}

.word-article-heading {
  margin-bottom: 4px;
  font-weight: 700;
}

.word-title {
  min-width: 64px;
  max-width: 440px;
  font-weight: 700;
}

.word-paren {
  color: var(--muted);
}

.word-body,
.word-table-text {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
}

.word-body.inline {
  flex: 1;
  min-width: 0;
}

.word-chapter {
  margin-top: 22px;
}

.word-section {
  margin-top: 16px;
}

.word-article {
  margin-top: 12px;
}

.word-item {
  margin-left: 42px;
}

.word-table-text {
  border-color: var(--line);
  background: #fbfbf8;
  font-family:
    "Yu Gothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}

.tabs button {
  min-height: 42px;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 8px;
}

.tabs button.active {
  border-color: var(--brand);
  color: var(--brand-strong);
  font-weight: 700;
}

.check-list,
.simple-list {
  display: grid;
  gap: 10px;
}

.check-item,
.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px;
}

.check-title {
  font-weight: 700;
}

.check-body {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.draft-todo-section {
  margin-bottom: 14px;
}

.template-tracking-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.template-tracking-label {
  font-size: 13px;
  font-weight: 700;
}

.template-tracking-form {
  margin-top: 14px;
}

.template-tracking-actions {
  display: flex;
  justify-content: flex-end;
}

.approval-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.approval-title {
  font-size: 13px;
  font-weight: 700;
}

.approval-actions,
.approval-comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-actions {
  margin-top: 12px;
}

.approval-meta {
  margin-top: 14px;
}

.approval-comments {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.approval-comment-title,
.approval-comment-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.approval-comment-title {
  font-size: 13px;
}

.approval-comment-list {
  display: grid;
  margin-top: 8px;
}

.approval-comment {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  font-size: 13px;
  line-height: 1.55;
}

.approval-comment-head {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.approval-comment-head strong {
  color: var(--ink);
}

.approval-comment-form {
  margin-top: 12px;
}

.approval-comment-actions {
  justify-content: flex-end;
  margin-top: 7px;
}

.draft-todo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 13px;
}

.draft-todo-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
}

.draft-todo-list {
  display: grid;
  gap: 5px;
}

.draft-todo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 0.6fr);
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: #fffdf8;
  cursor: pointer;
  padding: 8px 9px;
  text-align: left;
}

.draft-todo:hover {
  border-color: var(--brand);
  background: #f4faf7;
}

.draft-todo-label {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}

.draft-todo-target {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interview-preview-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 37, 35, 0.36);
  padding: 24px;
}

.interview-preview-dialog {
  display: grid;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.interview-preview-list {
  display: grid;
  gap: 1px;
  overflow: auto;
  background: var(--line);
  padding: 1px;
}

.interview-preview-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: white;
  cursor: pointer;
  padding: 11px 12px;
}

.interview-preview-item input {
  min-width: 16px;
  margin: 4px 0 0;
  accent-color: var(--brand);
}

.interview-preview-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.interview-preview-title {
  font-size: 13px;
  font-weight: 700;
}

.interview-preview-label {
  color: var(--muted);
  font-size: 12px;
}

.interview-preview-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 13px;
  line-height: 1.5;
}

.interview-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.diff-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr) 260px;
  border-bottom: 1px solid var(--line);
}

.diff-row.header {
  background: #f0f3ef;
  color: #47514c;
  font-size: 12px;
  font-weight: 700;
}

.diff-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 10px;
}

.diff-cell:last-child {
  border-right: 0;
}

.diff-text {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

del {
  background: #f7d9d9;
  color: #772929;
  text-decoration: line-through;
}

ins {
  background: #dcefe3;
  color: #1d6235;
  text-decoration: none;
}

.empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  text-align: center;
}

.small-empty {
  min-height: 84px;
  font-size: 13px;
}

.source-box {
  min-height: 220px;
  font-family:
    "Yu Gothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}

.kbd-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini {
  color: var(--muted);
  font-size: 12px;
}

.save-state {
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
}

.save-state.saving {
  color: var(--warn);
}

.mobile-warning {
  display: none;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .grid.cols-2,
  .grid.cols-3,
  .import-metrics,
  .completion-summary,
  .import-preview-grid,
  .form-grid,
  .split,
  .three-pane {
    grid-template-columns: 1fr;
  }

  .word-ribbon {
    position: static;
  }

  .document-stage {
    max-height: none;
    padding: 14px;
  }

  .word-page {
    min-height: auto;
    padding: 34px 28px 44px;
  }

  .word-block.selected {
    padding-top: 8px;
  }

  .word-block-tools {
    position: static;
    margin-bottom: 8px;
    box-shadow: none;
  }

  .diff-row {
    grid-template-columns: 1fr;
  }

  .diff-cell {
    border-right: 0;
  }

  .mobile-warning {
    display: block;
  }
}

@media (max-width: 680px) {
  .content,
  .topbar {
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head {
    display: grid;
  }

  .toolbar {
    width: 100%;
  }

  .btn {
    white-space: normal;
  }

  .source-link-controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .cloud-connected-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .cloud-connected-row .toolbar,
  .cloud-actions {
    justify-content: flex-start;
  }

  .review-issue {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .review-issue-target {
    text-align: left;
  }

  .draft-todo {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .draft-todo-target {
    text-align: left;
  }

  .draft-todo-head {
    align-items: flex-start;
  }

  .draft-todo-actions {
    justify-content: flex-start;
  }

  .template-tracking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-tracking-actions {
    justify-content: flex-start;
  }

  .approval-summary,
  .approval-comment-title,
  .approval-comment-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .approval-comment-actions {
    justify-content: flex-start;
  }

  .interview-preview-backdrop {
    align-items: end;
    padding: 0;
  }

  .interview-preview-dialog {
    max-height: min(80vh, 680px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .interview-preview-actions .btn {
    flex: 1;
  }

  .wizard-section-grid {
    grid-template-columns: 1fr;
  }

  .wizard-section-option,
  .wizard-section-option:nth-child(2n) {
    border: 0;
  }

  .wizard-actions {
    justify-content: stretch;
  }

  .wizard-actions .btn {
    flex: 1;
  }

  .source-selection-summary {
    flex-basis: 100%;
  }

  .word-page {
    padding: 24px 18px 34px;
  }

  .word-doc-title {
    font-size: 22px;
  }

  .word-heading-row,
  .word-article-heading,
  .word-line {
    align-items: stretch;
  }
}
