:root {
  color-scheme: light;
  --canvas: #f5f8f6;
  --surface: #ffffff;
  --surface-soft: #f3f7f5;
  --surface-accent: #eaf5f0;
  --ink: #14231c;
  --muted: #4f5f57;
  --line: #d7e0db;
  --line-strong: #bcc9c2;
  --brand: #126653;
  --brand-dark: #0b4f40;
  --brand-soft: #dcefe7;
  --accent: #f0a43a;
  --accent-soft: #fff3dd;
  --danger: #b33a32;
  --danger-soft: #fff0ee;
  --success: #23735e;
  --warning: #99630f;
  --shadow-sm: 0 1px 2px rgba(25, 33, 29, 0.05), 0 8px 24px rgba(25, 33, 29, 0.04);
  --shadow-md: 0 16px 46px rgba(25, 33, 29, 0.11);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --header-height: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button,
summary,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4,
strong,
b {
  letter-spacing: -0.02em;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.28);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: var(--header-height);
  padding: 0 28px;
  border-bottom: 1px solid rgba(203, 210, 204, 0.82);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.impersonation-banner {
  order: -1;
  display: flex;
  flex: 0 0 calc(100% + 56px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  margin: 0 -28px;
  background: #6d3c12;
  padding: 8px 28px;
  color: #fff;
  box-shadow: 0 5px 16px rgba(75, 39, 8, 0.18);
}

.impersonation-banner[hidden] {
  display: none;
}

.impersonation-banner p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
}

.impersonation-banner strong {
  color: #fff;
  font-weight: 900;
}

.impersonation-divider {
  color: #f1cfaa;
}

.impersonation-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.impersonation-actions > span {
  max-width: 34em;
  color: #ffe0dc;
  font-size: 11px;
  font-weight: 700;
}

.impersonation-actions button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 9px;
  background: #fff;
  padding: 6px 13px;
  color: #5b2f0b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.impersonation-actions button:hover {
  background: #fff6e9;
}

body.is-impersonating .app-notice {
  top: 128px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 11px;
  min-width: 222px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, 0.1);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.3;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.global-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  margin-left: auto;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--header-height);
  border: 0;
  background: transparent;
  padding: 0 13px;
  color: #606965;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-item::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
  content: "";
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.active {
  color: var(--brand-dark);
}

.nav-item.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-step {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
}

.nav-item.active .nav-step {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.completion-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}

.nav-item.is-complete .completion-dot {
  background: #2d9a77;
  box-shadow: 0 0 0 3px rgba(45, 154, 119, 0.12);
}

.nav-settings {
  margin-left: 6px;
  border-left: 1px solid var(--line);
}

.mobile-view-switcher {
  display: none;
}

.workspace {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 80px;
}

.context-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 47px;
  color: var(--muted);
  font-size: 12px;
}

.context-bar > span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.context-bar strong {
  overflow: hidden;
  max-width: 320px;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-label {
  color: var(--brand);
  font-weight: 700;
}

.context-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.app-notice {
  position: sticky;
  top: calc(var(--header-height) + 10px);
  z-index: 90;
  margin: 0 0 14px;
  border: 1px solid #b9d8cf;
  border-radius: 12px;
  background: #edf8f4;
  color: #155949;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 700;
}

.app-notice.is-warning {
  border-color: #ead09d;
  background: #fff7e8;
  color: #795010;
}

.app-notice.is-error {
  border-color: #edbeb9;
  background: var(--danger-soft);
  color: #8b2c26;
}

.app-notice.is-success {
  border-color: #aed5ca;
  background: #eaf7f2;
  color: #175e4c;
}

.view {
  display: none;
}

.view.active-view {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: 0;
  overflow: hidden;
  min-height: 430px;
  border: 1px solid #d3e2da;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #ffffff 0%, #f1f8f5 100%);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 48px 58px;
}

.hero-copy::before,
.hero-copy::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.hero-copy::before {
  right: -110px;
  bottom: -170px;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(18, 102, 83, 0.1);
}

.hero-copy::after {
  right: -10px;
  bottom: -110px;
  width: 250px;
  height: 250px;
  background: rgba(18, 102, 83, 0.09);
  filter: blur(2px);
}

.hero-copy .eyebrow {
  color: var(--brand);
}

.hero-copy h1 {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin-bottom: 22px;
  font-size: clamp(32px, 3.7vw, 52px);
  line-height: 1.17;
  letter-spacing: -0.055em;
}

.hero-lead {
  position: relative;
  z-index: 1;
  max-width: 590px;
  margin-bottom: 32px;
  color: #42534b;
  font-size: 17px;
  line-height: 1.85;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-actions .primary-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.hero-actions .primary-btn:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.hero-actions .text-btn {
  color: var(--brand-dark);
}

.flow-preview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid #d3e2da;
  background: #f7fbf9;
  padding: 30px 32px;
}

.flow-preview > p {
  margin-bottom: 14px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.flow-preview ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-preview li {
  min-width: 0;
}

.tool-menu-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 76px;
  border: 1px solid #cddbd4;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 3px 12px rgba(20, 35, 28, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background-color 150ms ease;
}

.tool-menu-card:hover {
  border-color: var(--brand);
  background: #f2faf6;
  box-shadow: 0 8px 20px rgba(18, 102, 83, 0.11);
  transform: translateY(-1px);
}

.tool-menu-card > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.tool-menu-card strong,
.tool-menu-card small {
  display: block;
}

.tool-menu-card strong {
  margin-bottom: 3px;
  font-size: 15px;
}

.tool-menu-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tool-menu-card > b {
  color: var(--brand);
  font-size: 18px;
}

.surface,
.form-section,
.output-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.recent-surface {
  margin-top: 24px;
  padding: 28px 32px;
}

.surface-head,
.output-head,
.page-intro,
.form-section-head,
.primary-action-bar,
.case-ribbon,
.dependency-banner,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.surface-head h2,
.output-head h2,
.form-section-head h2,
.dialog-head h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.35;
}

.surface-head p:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--muted);
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.recent-list li {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.recent-list button,
.recent-list .recent-static {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  border: 0;
  background: transparent;
  padding: 14px 16px;
  text-align: left;
}

.recent-list button:hover {
  background: var(--surface-accent);
}

.recent-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-list .recent-item-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.recent-item-copy strong,
.recent-item-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.recent-item-copy small {
  color: var(--muted);
  font-size: 11px;
}

.recent-list b {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 4px 9px;
  font-size: 11px;
}

.recent-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 14px 16px;
  color: var(--muted);
}

.page-intro {
  min-height: 156px;
  padding: 28px 4px 30px;
}

.page-intro h1 {
  margin-bottom: 9px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.28;
}

.page-intro p:not(.eyebrow) {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.compact-intro {
  min-height: 136px;
}

.status-chip {
  flex: 0 0 auto;
  border: 1px solid #bdd9d1;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.page-statuses {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #3f5149;
  font-size: 12px;
  font-weight: 700;
}

.autosave-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  content: "";
  box-shadow: 0 0 0 3px rgba(35, 115, 94, 0.12);
}

.transfer-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 1px solid #bcd8ce;
  border-radius: var(--radius);
  background: #eef8f4;
  padding: 18px 22px;
}

.transfer-panel > div:first-child {
  min-width: 0;
}

.transfer-panel strong {
  font-size: 14px;
}

.transfer-panel strong small {
  margin-left: 4px;
  color: var(--brand);
  font-size: 11px;
}

.transfer-panel p {
  margin: 3px 0 0;
  color: #42564d;
  font-size: 13px;
}

.transfer-panel > .secondary-btn,
.transfer-actions {
  flex: 0 0 auto;
}

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

.case-ribbon {
  min-height: 84px;
  margin-bottom: 18px;
  border: 1px solid #c8dcd5;
  border-radius: var(--radius);
  background: var(--surface-accent);
  padding: 16px 22px;
}

.case-ribbon > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.case-ribbon > div:first-child {
  flex: 1 1 auto;
}

.case-ribbon small {
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.case-ribbon strong,
.case-ribbon span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-ribbon strong {
  font-size: 17px;
}

.case-ribbon span {
  color: #46514c;
  font-size: 13px;
}

.case-ribbon .case-sync span {
  color: var(--brand-dark);
  font-weight: 700;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-section {
  padding: 28px 30px;
}

details.form-section,
details.surface {
  padding: 0;
}

.form-section-head {
  justify-content: flex-start;
  margin-bottom: 24px;
}

.form-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  gap: 20px;
}

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

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

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

label,
.wide-label {
  min-width: 0;
}

label > span,
.wide-label > span,
.history-filters label > span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 7px;
  color: #303934;
  font-size: 13px;
  font-weight: 800;
}

label > span small,
.wide-label > span small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

label > span b,
.wide-label > span b {
  color: var(--danger);
  font-size: 11px;
}

label > small,
.wide-label > small,
.budget-input > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.form-grid > .field,
.form-section > .field,
.details-body .field {
  min-width: 0;
}

.field-example,
.character-count {
  display: block;
  margin-top: 7px;
  color: #506158;
  font-size: 12px;
  line-height: 1.6;
}

.character-count {
  color: var(--brand-dark);
  font-weight: 800;
  text-align: right;
}

.field-error-message:not([hidden]) {
  display: block;
  margin-top: 7px;
  margin-bottom: 0;
  color: #9c2f29;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.field > .field-error-message:not([hidden]) {
  align-items: flex-start;
}

input[type="text"],
input[type="url"],
input[type="search"],
input[type="date"],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.7;
}

input::placeholder,
textarea::placeholder {
  color: #68716c;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9ea9a3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
  outline: none;
}

.field-error {
  border-color: var(--danger) !important;
  background: #fffafa !important;
  box-shadow: 0 0 0 3px rgba(179, 58, 50, 0.1) !important;
}

input[type="file"] {
  width: 100%;
  min-height: 46px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
  align-items: stretch;
}

.file-drop,
.import-preview {
  min-height: 170px;
  border: 1px dashed #a9c8bb;
  border-radius: 14px;
  background: #f6fbf8;
  padding: 18px;
}

.file-drop {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.file-drop input[type="file"] {
  border-color: #9ebfb2;
  background: #fff;
}

.import-preview {
  overflow: auto;
  border-style: solid;
  background: #fff;
  color: #405048;
}

.import-preview strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 14px;
}

.import-preview p {
  margin: 0;
  font-size: 13px;
  white-space: pre-wrap;
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.people-fields {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 25px;
}

.subsection-head {
  margin-bottom: 18px;
}

.subsection-head h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

.subsection-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.choice-field {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 17px;
}

.choice-field legend {
  padding: 0 5px;
  color: #303934;
  font-size: 13px;
  font-weight: 800;
}

.choice-field legend b {
  color: var(--danger);
  font-size: 11px;
}

.choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.choice-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 8px 13px;
  color: #35443d;
  font-size: 13px;
  font-weight: 800;
}

.choice-options label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.choice-options label > span {
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.conditional-fields {
  border: 1px solid #bcd8ce;
  border-radius: 14px;
  background: #f3faf7;
  padding: 18px;
}

.conditional-fields[hidden] {
  display: none;
}

.conditional-fields-title {
  margin-bottom: 15px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.input-with-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.input-with-unit:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 102, 83, 0.12);
}

.input-with-unit input {
  min-width: 0;
  border: 0;
  box-shadow: none !important;
}

.input-with-unit > span {
  flex: 0 0 auto;
  padding-right: 13px;
  color: #4a5b52;
  font-size: 12px;
  font-weight: 800;
}

.checkbox-card {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 46px;
  margin: 0 !important;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  color: #35443d !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.checkbox-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.wide-label {
  display: block;
}

.segmented-fieldset,
.check-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  border: 0;
  padding: 0;
}

.segmented-fieldset legend,
.check-fieldset legend {
  width: 100%;
  margin-bottom: 7px;
  color: #303934;
  font-size: 12px;
  font-weight: 800;
}

.segmented-fieldset label {
  position: relative;
}

.segmented-fieldset input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-fieldset label > span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 8px 13px;
  color: #505a55;
  font-size: 12px;
  font-weight: 700;
}

.segmented-fieldset input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.segmented-fieldset input:focus-visible + span {
  outline: 3px solid rgba(23, 107, 91, 0.22);
  outline-offset: 2px;
}

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

.choice-grid .segmented-fieldset {
  margin: 0;
}

details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 18px 24px;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary > span:first-child {
  display: grid;
  gap: 2px;
}

details > summary b {
  font-size: 15px;
}

details > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.summary-action {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.summary-action::after {
  display: inline-block;
  margin-left: 8px;
  content: "+";
  font-size: 17px;
  line-height: 1;
}

details[open] .summary-action::after {
  content: "−";
}

.details-body {
  border-top: 1px solid var(--line);
  padding: 24px 28px 28px;
}

.compact-grid {
  gap: 14px;
}

.assist-note {
  margin-bottom: 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: #6d501d;
  padding: 10px 13px;
  font-size: 12px;
}

.inline-status {
  margin-top: 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 12px 14px;
  font-size: 12px;
}

.inline-status p,
.inline-status .improvement-summary {
  margin: 0;
}

.inline-status .panel-title {
  margin-bottom: 6px;
}

.keyword-groups {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}

.tag-section > p,
.selected-keywords > p {
  margin-bottom: 9px;
  color: #3d4842;
  font-size: 12px;
  font-weight: 800;
}

.tag-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.tag-meta {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.tag {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 7px 11px;
  color: #4e5953;
  font-size: 11px;
  font-weight: 700;
}

.tag small {
  display: none;
}

.tag:hover,
.tag.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.selected-keywords {
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 15px;
}

.selected-chip,
.empty-chip {
  display: inline-block;
  margin: 3px 5px 3px 0;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
}

.selected-chip {
  background: var(--brand);
  color: #fff;
}

.empty-chip {
  color: var(--muted);
}

.missing-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.missing-guide-head span {
  color: var(--muted);
  font-size: 11px;
}

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

.missing-guide-grid > div {
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 15px;
}

.missing-guide-grid b {
  color: var(--brand-dark);
  font-size: 12px;
}

.missing-guide-grid ul {
  margin: 9px 0 0;
  padding-left: 18px;
  color: #56605b;
  font-size: 12px;
}

.validation-summary {
  margin: 18px 0;
  border: 1px solid #e2aaa5;
  border-left: 5px solid var(--danger);
  border-radius: 13px;
  background: #fff6f5;
  padding: 17px 19px;
  color: #6d2823;
  box-shadow: var(--shadow-sm);
}

.validation-summary[hidden] {
  display: none;
}

.validation-summary strong {
  display: block;
  margin-bottom: 3px;
  color: #7f2923;
  font-size: 15px;
}

.validation-summary p {
  margin-bottom: 9px;
  font-size: 13px;
}

.validation-summary ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
}

.validation-summary button {
  border: 0;
  background: transparent;
  padding: 2px;
  color: #8d2c26;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.primary-action-bar {
  position: sticky;
  bottom: 14px;
  z-index: 50;
  margin: 18px 0 22px;
  border: 1px solid rgba(23, 107, 91, 0.25);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  padding: 15px 17px 15px 22px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.primary-action-bar.is-complete {
  position: static;
  box-shadow: var(--shadow-sm);
}

.primary-action-bar > div {
  display: grid;
  gap: 1px;
}

.primary-action-bar strong {
  font-size: 14px;
}

.primary-action-bar small {
  color: var(--muted);
  font-size: 11px;
}

.primary-btn,
.secondary-btn,
.text-btn,
.mini-btn,
.icon-btn {
  border-radius: 10px;
  font-weight: 800;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
}

.primary-btn:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.large-btn {
  min-height: 48px;
  padding: 12px 20px;
  font-size: 14px;
}

.secondary-btn {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #39433e;
  padding: 8px 13px;
  font-size: 13px;
}

.secondary-btn:hover,
.mini-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.copy-primary-btn {
  min-height: 48px;
  min-width: 170px;
  box-shadow: 0 8px 18px rgba(18, 102, 83, 0.18);
}

.text-btn {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 7px 4px;
  font-size: 13px;
}

.text-btn:hover {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-assist-panel {
  margin: 20px 0;
  border: 1px solid #c9c6e8;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f6f4ff 0%, #fff 68%);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.ai-assist-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.ai-assist-kicker {
  margin: 0 0 5px;
  color: #5d4fa1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.ai-assist-head h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.ai-assist-head p:not(.ai-assist-kicker) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.ai-usage {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 32px;
  border: 1px solid #d5d0ef;
  border-radius: 999px;
  background: #fff;
  padding: 6px 11px;
  color: #564894;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.ai-assist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

.ai-assist-btn {
  min-height: 42px;
  border: 1px solid #7568b3;
  border-radius: 10px;
  background: #6758a7;
  padding: 9px 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.ai-assist-btn:hover:not(:disabled) {
  border-color: #4f428d;
  background: #554795;
  transform: translateY(-1px);
}

.ai-assist-btn:focus-visible {
  outline: 3px solid rgba(103, 88, 167, 0.24);
  outline-offset: 2px;
}

.ai-assist-btn:disabled {
  border-color: #d8d6e2;
  background: #eeedf3;
  color: #827f8e;
  cursor: not-allowed;
}

.ai-plan-note {
  margin: 10px 0 0;
  color: #5e5a6e;
  font-size: 11px;
  line-height: 1.65;
}

.ai-assist-result {
  margin-top: 18px;
  border: 1px solid #d8d4ed;
  border-radius: 13px;
  background: #fff;
  padding: 16px;
}

.ai-assist-result[hidden] {
  display: none;
}

.ai-assist-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.ai-assist-result-head strong {
  color: var(--ink);
  font-size: 14px;
}

.ai-assist-result-text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.85;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ai-assist-panel-compact .ai-assist-actions {
  justify-content: flex-start;
}

.mini-btn {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 5px 9px;
  color: #48524d;
  font-size: 11px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
}

.output-section {
  overflow: hidden;
  margin-top: 20px;
}

.output-head {
  min-height: 90px;
  border-bottom: 1px solid var(--line);
  padding: 19px 26px;
}

.output-actions,
.admin-review-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.output-section:has(.empty-output) .output-actions {
  display: none;
}

.output-bottom-actions {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 20px 24px;
}

.output-section:has(.empty-output) .output-bottom-actions {
  display: none;
}

.empty-output {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.empty-output > div {
  max-width: 440px;
}

.empty-output .empty-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 1px solid #c9d9d3;
  border-radius: 14px;
  background: var(--surface-accent);
  color: var(--brand);
  font-weight: 900;
}

.empty-output strong {
  display: block;
  margin-bottom: 5px;
  color: #3a443f;
}

.empty-output p {
  margin: 0;
  font-size: 13px;
}

.result-review {
  border-bottom: 1px solid var(--line);
}

.result-review:empty {
  display: none;
}

.result-review:not(:empty) {
  padding: 22px 26px;
  background: var(--surface-soft);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}

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

.panel-title span {
  color: var(--muted);
  font-size: 11px;
}

.improvement-summary {
  margin-bottom: 13px;
  color: #4e5953;
  font-size: 13px;
}

.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
}

.check-list li.ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.check-list li.warn {
  background: var(--accent-soft);
  color: #775515;
}

.action-block {
  margin-top: 15px;
  border-left: 3px solid var(--accent);
  background: #fff;
  padding: 10px 13px;
  color: #55605a;
  font-size: 12px;
  white-space: pre-line;
}

.action-block h4 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
}

.output-box,
.simulation-result {
  min-height: 210px;
  background: #fff;
}

.output-box .field {
  padding: 23px 28px;
  color: #323b36;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output-box .field + .field {
  border-top: 1px solid var(--line);
}

.copy-ready + .copy-ready,
.output-details {
  border-top: 1px solid var(--line);
}

.output-details {
  background: var(--surface-soft);
}

.output-details > summary {
  min-height: 68px;
  padding: 14px 28px;
}

.output-details-body {
  border-top: 1px solid var(--line);
  background: #fff;
}

.output-box .field h4 {
  margin-bottom: 10px;
  color: var(--brand-dark);
  font-size: 13px;
}

.output-field-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.output-field-title h4 {
  margin: 0 !important;
}

.field-copy-btn {
  min-width: 76px;
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid #8db9aa;
  border-radius: 9px;
  background: var(--surface-accent);
  color: var(--brand-dark);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
}

.field-copy-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.job-field-copy {
  white-space: pre-wrap;
}

mark {
  border-radius: 3px;
  background: #fff0b8;
  color: inherit;
  padding: 0 2px;
}

.keyword-reflection p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.reflection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reflection-list span {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
}

.reflection-list .reflected {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.reflection-list .missing {
  background: var(--danger-soft);
  color: var(--danger);
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 32px;
  align-items: end;
}

.budget-input > div {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}

.budget-input > div:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.budget-input > div > span {
  padding-left: 15px;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.budget-input input {
  min-height: 58px;
  border: 0;
  box-shadow: none !important;
  font-size: 24px;
  font-weight: 800;
}

.check-fieldset {
  margin: 0;
}

.check-fieldset label,
.favorite-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 7px 11px;
  color: #4b5650;
  font-size: 12px;
  font-weight: 700;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
}

.simulation-result:not(:has(.empty-output)) {
  padding: 26px;
}

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

.median-card {
  border: 1px solid #bed7cf;
  border-radius: 15px;
  background: var(--surface-accent);
  padding: 22px;
}

.median-card span,
.median-card small,
.metric span,
.metric small {
  display: block;
}

.median-card span,
.metric span {
  color: #52605a;
  font-size: 11px;
  font-weight: 800;
}

.median-card b {
  display: block;
  margin: 3px 0 1px;
  color: var(--brand-dark);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.2;
}

.median-card small,
.metric small {
  color: var(--muted);
  font-size: 10px;
}

.metric {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.metric > div {
  background: #fff;
  padding: 16px 19px;
}

.metric b {
  display: block;
  margin: 2px 0;
  font-size: 19px;
}

.simulation-note {
  margin: 15px 0 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #6c521e;
  padding: 11px 13px;
  font-size: 11px;
}

.simulation-result > h4 {
  margin: 22px 0 6px;
  font-size: 13px;
}

.simulation-import-note,
.calculation-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: #53605a;
  padding: 14px;
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-line;
}

.simulation-import-note h4 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
}

.calculation-details {
  padding: 0;
}

.calculation-details > summary {
  min-height: 48px;
  padding: 10px 13px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.calculation-details > div {
  border-top: 1px solid var(--line);
  padding: 13px;
}

.dependency-banner {
  margin-bottom: 18px;
  border: 1px solid #ead7ad;
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 18px 22px;
}

.dependency-banner p {
  margin: 2px 0 0;
  color: #6c5b36;
  font-size: 12px;
}

.memo-field {
  margin-top: 25px;
}

.history-surface {
  overflow: visible;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px auto auto auto;
  gap: 11px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 20px 22px;
}

.history-filters label > span {
  margin-bottom: 5px;
}

.history-filters input,
.history-filters select {
  min-height: 42px;
  padding: 9px 11px;
  font-size: 12px;
}

.favorite-filter {
  margin: 0;
}

.favorite-filter span {
  margin: 0 !important;
  font-size: 11px !important;
}

.advanced-filters {
  position: relative;
}

.advanced-filters > summary {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 8px 12px;
  color: #4b5550;
  font-size: 11px;
  font-weight: 800;
}

.advanced-filters[open] > div {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 12px;
  width: 330px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.table-scroll {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-soft);
  color: #56615b;
  font-size: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #fbfcfa;
}

.favorite-btn {
  border: 0;
  background: transparent;
  color: #c8ceca;
  font-size: 17px;
}

.favorite-btn.active {
  color: var(--accent);
}

.empty-row {
  padding: 36px !important;
  color: var(--muted);
  text-align: center !important;
}

.table-note {
  margin: 0;
  padding: 12px 18px;
  color: var(--muted);
  font-size: 10px;
}

.sync-error {
  color: var(--danger) !important;
}

.data-details {
  margin-bottom: 16px;
}

.data-meta-grid {
  display: grid;
  grid-template-columns: 0.55fr 1.45fr;
  gap: 14px;
}

.data-meta-grid > div {
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 14px;
}

.data-meta-grid small,
.data-meta-grid strong {
  display: block;
}

.data-meta-grid small {
  color: var(--muted);
  font-size: 10px;
}

.data-meta-grid strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.data-meta-grid > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.admin-review-panel {
  overflow: hidden;
}

.admin-review-head {
  padding: 24px 26px;
}

.admin-review-actions select {
  min-width: 150px;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 11px;
}

.dictionary-review-list {
  border-top: 1px solid var(--line);
}

.dictionary-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  background: var(--surface-soft);
  padding: 12px 20px;
}

.dictionary-summary span {
  border-radius: 999px;
  background: #fff;
  padding: 5px 9px;
  color: #59635e;
  font-size: 10px;
  font-weight: 700;
}

.dictionary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  border-top: 1px solid var(--line);
  padding: 11px 20px;
}

.dictionary-row:first-of-type {
  border-top: 0;
}

.dictionary-row > div:first-child {
  display: grid;
}

.dictionary-row b {
  font-size: 13px;
}

.dictionary-row small {
  color: var(--muted);
  font-size: 10px;
}

.dictionary-actions {
  display: flex;
  gap: 5px;
}

.dictionary-actions .active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.history-dialog {
  width: min(860px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  margin: auto;
  border: 0;
  border-radius: 18px;
  background: #fff;
  padding: 0;
  box-shadow: 0 28px 90px rgba(12, 22, 18, 0.28);
}

.history-dialog::backdrop {
  background: rgba(12, 22, 18, 0.5);
  backdrop-filter: blur(3px);
}

.dialog-head {
  border-bottom: 1px solid var(--line);
  padding: 21px 24px;
}

.history-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 20px 24px;
}

.history-detail-meta div {
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.history-detail-meta dt {
  color: var(--muted);
  font-size: 10px;
}

.history-detail-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.history-detail-content {
  max-height: 48vh;
  overflow: auto;
  margin: 0 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 18px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 18px 24px 22px;
}

.print-sheet {
  display: none;
}

@media (max-width: 1120px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 20px 0;
  }

  .impersonation-banner {
    flex: 0 0 auto;
    width: calc(100% + 40px);
    margin: -10px -20px 0;
    padding-right: 20px;
    padding-left: 20px;
  }

  .brand {
    min-width: 0;
    min-height: 48px;
  }

  .global-nav {
    width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .global-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    min-height: 48px;
  }

  .nav-settings {
    margin-left: 0;
  }

  .app-notice {
    top: 110px;
  }

  body.is-impersonating .app-notice {
    top: 156px;
  }

  .home-hero {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 58px 54px;
  }

  .flow-preview {
    border-top: 1px solid #d3e2da;
    border-left: 0;
    padding: 32px 54px;
  }

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

  .history-filters {
    grid-template-columns: 1fr 160px auto auto;
  }

  .history-filters > .text-btn {
    grid-column: 4;
  }
}

@media (max-width: 760px) {
  :root {
    --radius: 14px;
    --radius-lg: 18px;
  }

  body {
    font-size: 15px;
  }

  .app-header {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 8px 14px;
  }

  body.is-impersonating .app-header {
    position: sticky;
  }

  .impersonation-banner {
    grid-column: 1 / -1;
    width: calc(100% + 28px);
    margin: -8px -14px 0;
    padding: 8px 14px;
  }

  .impersonation-banner p {
    display: grid;
    gap: 1px;
    font-size: 12px;
  }

  .impersonation-divider {
    display: none;
  }

  .impersonation-actions {
    gap: 7px;
  }

  .impersonation-actions > span:empty {
    display: none;
  }

  .impersonation-actions button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 11px;
  }

  .brand {
    min-height: 47px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .global-nav {
    display: none;
  }

  .mobile-view-switcher {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .mobile-view-switcher > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-view-switcher select {
    width: auto;
    min-width: 126px;
    min-height: 38px;
    padding: 7px 28px 7px 10px;
    font-size: 11px;
  }

  .workspace {
    width: min(100% - 24px, 680px);
    padding-bottom: 48px;
  }

  .context-bar {
    min-height: 44px;
  }

  .context-bar [data-case-location],
  .context-label,
  .context-divider {
    display: none;
  }

  .app-notice {
    top: 8px;
  }

  body.is-impersonating .app-notice {
    top: 122px;
  }

  .home-hero {
    min-height: 0;
  }

  .hero-copy {
    padding: 42px 25px 38px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .hero-lead {
    font-size: 14px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .hero-actions .text-btn {
    align-self: flex-start;
  }

  .flow-preview {
    padding: 28px 25px;
  }

  .flow-preview ul {
    grid-template-columns: 1fr;
  }

  .recent-surface {
    padding: 22px 18px;
  }

  .surface-head,
  .output-head,
  .page-intro,
  .primary-action-bar,
  .dependency-banner,
  .admin-review-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .page-intro {
    min-height: 0;
    padding: 27px 2px 24px;
  }

  .page-intro h1 {
    font-size: 29px;
  }

  .status-chip {
    align-self: flex-start;
  }

  .page-statuses {
    justify-items: start;
    width: 100%;
  }

  .transfer-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
    padding: 16px 18px;
  }

  .transfer-panel > .secondary-btn,
  .transfer-actions,
  .transfer-actions .secondary-btn {
    width: 100%;
  }

  .transfer-actions {
    display: grid;
  }

  .recent-list {
    grid-template-columns: 1fr;
  }

  .recent-empty {
    grid-column: auto;
  }

  .case-ribbon {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
  }

  .case-ribbon > div:not(:first-child) {
    display: none;
  }

  .case-ribbon .secondary-btn {
    width: 100%;
  }

  .form-section {
    padding: 22px 18px;
  }

  .form-section-head {
    align-items: flex-start;
    gap: 12px;
  }

  .form-section-head h2 {
    font-size: 19px;
  }

  .form-grid,
  .two-col,
  .three-col,
  .choice-grid,
  .budget-row,
  .missing-guide-grid,
  .median-grid,
  .data-meta-grid {
    grid-template-columns: 1fr;
  }

  .import-layout {
    grid-template-columns: 1fr;
  }

  .file-drop,
  .import-preview {
    min-height: 142px;
    padding: 15px;
  }

  .import-actions,
  .import-actions .secondary-btn {
    width: 100%;
  }

  .choice-options {
    display: grid;
    grid-template-columns: 1fr;
  }

  .choice-options label {
    width: 100%;
  }

  .conditional-fields {
    padding: 15px;
  }

  .span-2,
  .span-3,
  .data-meta-grid > p {
    grid-column: auto;
  }

  .segmented-fieldset label > span {
    padding: 8px 10px;
  }

  details > summary {
    min-height: 72px;
    padding: 15px 17px;
  }

  details > summary small {
    display: none;
  }

  .details-body {
    padding: 19px 17px 21px;
  }

  .primary-action-bar {
    bottom: 6px;
    align-items: stretch;
    margin: 14px 0 18px;
    padding: 13px;
  }

  .primary-action-bar > div {
    display: none;
  }

  .primary-action-bar .primary-btn {
    width: 100%;
  }

  .ai-assist-panel {
    margin: 16px 0;
    padding: 18px;
  }

  .ai-assist-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .ai-usage {
    align-self: flex-start;
    white-space: normal;
  }

  .ai-assist-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-assist-btn {
    width: 100%;
  }

  .ai-assist-result-head {
    align-items: flex-start;
  }

  .output-head {
    padding: 18px;
  }

  .output-actions {
    width: 100%;
  }

  .output-actions .secondary-btn,
  .output-actions .primary-btn,
  .output-actions .text-btn {
    flex: 1 1 calc(50% - 9px);
  }

  .copy-primary-btn,
  .output-bottom-actions .copy-primary-btn {
    width: 100%;
    min-width: 0;
  }

  .result-review:not(:empty),
  .simulation-result:not(:has(.empty-output)),
  .output-box .field {
    padding: 19px 18px;
  }

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

  .history-filters {
    grid-template-columns: 1fr;
    padding: 17px;
  }

  .history-filters > .text-btn {
    grid-column: auto;
    justify-self: start;
  }

  .advanced-filters[open] > div {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .table-scroll {
    overflow: visible;
    padding: 12px;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table tr {
    position: relative;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 12px 12px 10px;
  }

  .data-table td {
    border: 0;
    padding: 3px 0;
  }

  .data-table td:first-child {
    position: absolute;
    top: 9px;
    right: 8px;
    width: auto;
  }

  .data-table td.empty-row {
    position: static;
    width: 100%;
    min-height: 80px;
    padding: 28px 12px !important;
  }

  .data-table td:nth-child(2) {
    color: var(--muted);
    font-size: 10px;
  }

  .data-table td:nth-child(3) {
    color: var(--brand);
    font-size: 10px;
    font-weight: 800;
  }

  .data-table td:nth-child(4) {
    padding-right: 38px;
    font-size: 15px;
    font-weight: 800;
  }

  .data-table td:nth-child(6) {
    display: none;
  }

  .data-table td:last-child {
    padding-top: 9px;
  }

  .data-table td:last-child .mini-btn {
    width: 100%;
  }

  .admin-review-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

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

  .dictionary-actions {
    width: 100%;
  }

  .dictionary-actions .mini-btn {
    flex: 1;
  }

  .history-detail-meta {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body.printing-output > *:not(.print-sheet) {
    display: none !important;
  }

  .print-sheet {
    display: block;
    color: #000;
    font-family: "Yu Gothic", sans-serif;
  }

  .print-sheet h1 {
    margin-bottom: 20px;
    font-size: 22px;
  }

  .print-sheet div {
    font-size: 11pt;
    line-height: 1.7;
    white-space: pre-wrap;
  }
}
