:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647084;
  --line: #dfe5ee;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #12805c;
  --amber: #b45309;
  --red: #b42318;
  --cyan: #0e7490;
  --shadow: 0 14px 38px rgba(23, 32, 51, 0.10);
  --foundation-navigation-width: 208px;
  --foundation-navigation-min: 196px;
  --foundation-navigation-max: 360px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: clamp(var(--foundation-navigation-min), var(--foundation-navigation-width), var(--foundation-navigation-max)) minmax(0, 1fr);
}

.foundation-navigation-resizer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: clamp(var(--foundation-navigation-min), var(--foundation-navigation-width), var(--foundation-navigation-max));
  z-index: 9999;
  width: 13px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  transform: translateX(-50%);
}

.foundation-navigation-resizer::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0);
  transform: translateX(-50%);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.foundation-navigation-resizer:hover::after,
body.foundation-navigation-resizing .foundation-navigation-resizer::after {
  background: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

body.foundation-navigation-resizing {
  cursor: col-resize;
  user-select: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  padding: 18px 10px 14px;
  color: #142d4f;
  background: #f3f6fa;
  border-right: 1px solid #d7e4f2;
  box-shadow: inset -2px 0 0 rgba(65, 139, 219, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 2px 10px 16px;
  border-bottom: 1px solid #dfe8f3;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #0868d2;
  background: #e7f2ff;
  border: 1px solid #c9dff8;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  overflow: hidden;
  color: #122d50;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span {
  margin-top: 3px;
  overflow: hidden;
  color: #6d7f96;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  padding: 0 4px 8px 0;
  overflow-y: auto;
  scrollbar-color: #bfd3e8 transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.nav-list::-webkit-scrollbar {
  width: 5px;
}

.nav-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #bfd3e8;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: #162f50;
  background: transparent;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 12px;
  text-align: left;
  font-weight: 650;
  letter-spacing: 0;
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.nav-item > [data-icon],
.nav-item > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: #0868d2;
  stroke-width: 2;
}

.nav-item > [data-icon] {
  display: block;
  background: currentColor;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.nav-item > [data-icon="clipboard-list"] {
  -webkit-mask-image: url("vendor/lucide-icons/clipboard-list.svg");
  mask-image: url("vendor/lucide-icons/clipboard-list.svg");
}

.nav-item > [data-icon="radio-tower"] {
  -webkit-mask-image: url("vendor/lucide-icons/radio-tower.svg");
  mask-image: url("vendor/lucide-icons/radio-tower.svg");
}

.nav-item > [data-icon="blocks"] {
  -webkit-mask-image: url("vendor/lucide-icons/blocks.svg");
  mask-image: url("vendor/lucide-icons/blocks.svg");
}

.nav-item > [data-icon="library"] {
  -webkit-mask-image: url("vendor/lucide-icons/library.svg");
  mask-image: url("vendor/lucide-icons/library.svg");
}

.nav-item > [data-icon="archive"] {
  -webkit-mask-image: url("vendor/lucide-icons/archive.svg");
  mask-image: url("vendor/lucide-icons/archive.svg");
}

.nav-item > [data-icon="chevron-up"] {
  -webkit-mask-image: url("vendor/lucide-icons/chevron-up.svg");
  mask-image: url("vendor/lucide-icons/chevron-up.svg");
}

.nav-item > [data-icon="chevron-down"] {
  -webkit-mask-image: url("vendor/lucide-icons/chevron-down.svg");
  mask-image: url("vendor/lucide-icons/chevron-down.svg");
}

.nav-item > span:not([data-icon]) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item > .nav-accordion-icon {
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.nav-item:hover {
  color: #075fbe;
  background: #e8f1fb;
}

.nav-item.active {
  color: #0868d2;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(35, 73, 114, 0.08);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #1473df;
}

.nav-item:focus-visible,
.nav-subitem:focus-visible {
  outline: 2px solid rgba(20, 115, 223, 0.42);
  outline-offset: 2px;
}

.nav-submenu {
  display: grid;
  gap: 4px;
  margin: -2px 0 2px 12px;
  padding: 3px 0 5px 22px;
  border-left: 1px solid #ccdaea;
}

.nav-subitem {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: #5c718c;
  background: transparent;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-subgroup {
  display: grid;
  gap: 3px;
  padding-left: 14px;
  border-left: 1px solid #d6e2ef;
}

.nav-subgroup-level-2 {
  margin: -2px 0 2px 6px;
}

.nav-subgroup-level-3 {
  margin-left: 4px;
  padding-left: 12px;
}

.nav-subitem-child {
  min-height: 28px;
  font-size: 12px;
  color: #6d7f95;
}

.nav-subitem-grandchild {
  font-size: 12px;
  color: #75869b;
}

.nav-subitem:hover {
  color: #075fbe;
  background: #e6f0fb;
}

.nav-subitem.active {
  color: #0868d2;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(35, 73, 114, 0.07);
  font-weight: 650;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 0;
  color: #6c7e94;
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
}

.status-dot.online {
  background: #22c55e;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.section-head h2,
.modal h2,
.drawer h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.25;
}

.padded-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-weight: 700;
  font-size: 12px;
}

.topbar-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-region {
  appearance: none;
  min-height: 38px;
  max-width: 320px;
  border: 1px solid #cdd7e6;
  border-radius: 8px;
  padding: 0 12px;
  color: #334155;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.company-region:hover {
  border-color: #8fb5f2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.company-region:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.company-region svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
  flex: 0 0 auto;
}

.company-region.region-missing {
  color: #8a4b0f;
  border-color: #f2c88f;
  background: #fff8eb;
  font-weight: 700;
}

.company-region.region-missing svg {
  color: #b45309;
}

.primary-button:disabled,
.ghost-button:disabled {
  color: #7b8798;
  border-color: #d7dee8;
  background: #eef2f6;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.small-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  padding: 0 15px;
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.compact-action-button {
  min-height: 38px;
  padding: 0 12px;
}

.ghost-button,
.small-button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.danger-button {
  padding: 0 12px;
  color: var(--red);
  background: #fff6f5;
  border-color: #ffd6d1;
}

.icon-button {
  width: 40px;
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

.metrics-strip {
  margin: 26px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.metric {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  text-align: left;
  background: #ffffff;
}

.metric:last-child {
  border-right: 0;
}

.metric:hover {
  background: #f8fafc;
}

.metric:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: -3px;
}

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

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.view-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.toolbar {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

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

.segment {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
}

.segment.active {
  color: #ffffff;
  background: #26384f;
  border-color: #26384f;
}

.filter-field {
  min-width: 190px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

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

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

td {
  font-size: 14px;
}

.rule-title {
  font-weight: 700;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-key,
.source-link,
.subtext {
  color: var(--muted);
  font-size: 12px;
}

.source-link {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.value-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 700;
}

.value-pill {
  color: #0f5132;
  background: #dff8ed;
}

.value-stack {
  display: grid;
  justify-items: start;
  gap: 5px;
}

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

.split-rule-row td:first-child {
  border-left: 4px solid #0e7490;
}

.split-rule-row {
  background: #fbfdff;
}

.split-badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #0e7490;
  background: #e6f6fb;
  font-size: 12px;
  font-weight: 700;
}

.status-pill {
  color: #1f2937;
  background: #eef2f7;
  font-size: 12px;
}

.status-pill.APPROVED {
  color: var(--green);
  background: #e5f6ee;
}

.status-pill.PENDING {
  color: var(--amber);
  background: #fff4de;
}

.status-pill.REJECTED {
  color: var(--red);
  background: #fff1ef;
}

.status-pill.DEFERRED {
  color: var(--blue);
  background: #eaf1ff;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 280px;
}

.actions-col {
  width: 300px;
}

.empty-state {
  padding: 42px 20px;
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--muted);
}

.empty-state svg {
  width: 36px;
  height: 36px;
}

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

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

.module-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  display: grid;
  gap: 14px;
}

.module-head,
.module-columns {
  display: grid;
  gap: 12px;
}

.module-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.module-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.module-item h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.module-section {
  display: grid;
  gap: 8px;
}

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

.module-link {
  max-width: 100%;
}

.source-actions-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.source-actions-line a {
  color: var(--blue);
  text-decoration: none;
}

.legal-layout {
  display: block;
  min-height: 620px;
}

.legal-topic-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #f3f6fa;
}

.legal-topic-panel.has-vertical-tabs {
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: clamp(620px, calc(100vh - 164px), 780px);
  overflow: hidden;
}

.legal-topic-tabs {
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.legal-topic-tabs-vertical {
  display: grid;
  padding: 18px 12px;
  gap: 4px;
  grid-template-columns: 1fr;
  border-bottom: 0;
  border-right: 1px solid var(--line);
  min-height: 0;
  align-content: start;
  background: #ffffff;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.legal-topic-tabs + .legal-reader-search,
.legal-topic-tabs-vertical + .legal-reader-search {
  border-top: 1px solid var(--line);
}

.legal-topic-tab {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  color: #506078;
  background: #ffffff;
}

.legal-topic-tabs-vertical .legal-topic-tab {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.legal-page-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 0;
  background: #ffffff;
}

.legal-reader-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.legal-reader-head-index {
  border-top: 0;
  padding-bottom: 22px;
}

.legal-topic-tab::before {
  content: none;
}

.legal-topic-tab.active {
  color: #1d4ed8;
  background: #eef5ff;
  border-color: #d8e7ff;
  font-weight: 700;
}

.legal-domain-tab {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-radius: 0;
  background: #ffffff;
  color: #5f6c7d;
  font-size: 16px;
}

.legal-domain-tab svg {
  width: 14px;
  height: 14px;
  color: currentColor;
}

.legal-domain-tab.active {
  color: #ffffff;
  background: #18a69a;
  border-color: #18a69a;
}

.legal-domain-children {
  display: grid;
  gap: 2px;
  padding: 4px 0 8px 18px;
}

.legal-subproject-tab {
  min-height: 30px;
  justify-content: flex-start;
  border-radius: 0;
  padding: 0 10px;
  color: #64748b;
  font-size: 16px;
}

.legal-subproject-tab.active {
  color: #0f766e;
  background: #eefdfa;
  border-color: transparent;
}

.region-tree-head {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid #e8edf4;
  background: #f8fbfd;
}

.region-tree-head strong {
  color: var(--ink);
  font-size: 16px;
}

.region-tree-head span {
  color: var(--muted);
  font-size: 12px;
}

.region-tree {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.region-tree-province,
.region-tree-city {
  display: grid;
  gap: 4px;
}

.region-tree-row {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  color: #4d5b70;
  text-align: left;
}

.region-tree-row:hover {
  color: #0f766e;
  background: #eefdfa;
}

.region-tree-row.active {
  color: #0f766e;
  background: #e6faf6;
  font-weight: 700;
}

.region-tree-row small {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.region-tree-province-button {
  padding: 0 10px;
  font-size: 16px;
}

.region-tree-city-button {
  padding: 0 10px 0 22px;
  font-size: 15px;
}

.region-tree-district-button {
  min-height: 30px;
  padding: 0 10px 0 34px;
  font-size: 14px;
}

.region-tree-children.hidden {
  display: none;
}

.region-detail-layout {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.region-summary-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.region-summary-panel h4 {
  margin: 0;
  font-size: 18px;
}

.region-summary-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.region-summary-title-row div {
  display: grid;
  gap: 4px;
}

.region-summary-title-row span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.region-summary-title-row em {
  padding: 4px 8px;
  border-radius: 4px;
  background: #f6f9fc;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.region-summary-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.region-scope-summary {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #b7eee5;
  border-radius: 6px;
  background: #effdfa;
}

.region-scope-summary span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.region-scope-summary strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.region-scope-summary small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.region-scope-summary.verified {
  border-color: #99f6e4;
  background: #ecfdf5;
}

.region-scope-summary.pending {
  border-color: #fde68a;
  background: #fffbeb;
}

.region-scope-summary.pending span,
.region-scope-summary.pending strong {
  color: #92400e;
}

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

.region-wage-metrics article {
  display: grid;
  gap: 8px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid #e3edf5;
  border-radius: 6px;
  background: #f8fbfd;
}

.region-wage-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.region-wage-metrics strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.housing-fund-rule-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe8f2;
  border-radius: 6px;
  background: #fff;
}

.housing-fund-rule-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.housing-fund-rule-table th,
.housing-fund-rule-table td {
  padding: 12px;
  border-bottom: 1px solid #e5eef6;
  color: var(--ink);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.housing-fund-rule-table th {
  background: #f5fafc;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.housing-fund-rule-table tbody tr:last-child td {
  border-bottom: 0;
}

.housing-fund-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.housing-fund-source-actions a,
.housing-fund-source-actions span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #b9e4dc;
  border-radius: 4px;
  color: var(--accent);
  background: #f5fffc;
  text-decoration: none;
  white-space: nowrap;
}

.housing-fund-card-list {
  align-items: start;
}

.housing-fund-rule-card > small {
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.housing-fund-rule-card .housing-fund-base-upper-label {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
}

.housing-fund-rule-card .housing-fund-base-rule-note {
  display: grid;
  gap: 3px;
  margin: 6px 0;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
}

.housing-fund-rule-card .housing-fund-base-rule-note small {
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.housing-fund-rule-card .housing-fund-source-actions {
  margin-top: 2px;
}

.minimum-wage-scope-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.minimum-wage-scope-strip article {
  display: grid;
  gap: 6px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #d9ebe8;
  border-radius: 6px;
  background: #f6fffc;
}

.minimum-wage-scope-strip span {
  color: #0f766e;
  font-size: 12px;
}

.minimum-wage-scope-strip strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.minimum-wage-scope-note {
  margin: 8px 0 14px;
  color: #334155;
  font-size: 13px;
  line-height: 1.7;
}

.region-detail-layout-inherited {
  gap: 0;
}

.minimum-wage-inherited-summary .region-wage-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.minimum-wage-tier-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.minimum-wage-tier-list-combined {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.minimum-wage-tier-list article {
  min-height: 0;
  padding: 12px;
  border: 1px solid #dbe8f4;
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  gap: 8px;
  align-content: start;
}

.minimum-wage-tier-list header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef3f8;
}

.minimum-wage-tier-list span {
  color: var(--muted);
  font-size: 12px;
}

.minimum-wage-tier-list strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.minimum-wage-tier-list > article > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.minimum-wage-tier-region {
  display: grid;
  gap: 4px;
}

.minimum-wage-tier-region small {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.minimum-wage-tier-region p {
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.minimum-wage-region-details {
  margin-top: 2px;
}

.minimum-wage-region-details summary {
  cursor: pointer;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.minimum-wage-region-details p {
  margin-top: 6px;
  padding: 8px;
  border-radius: 6px;
  background: #f8fbfd;
}

.minimum-wage-tier-region em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.minimum-wage-tier-source {
  color: #2563eb;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.minimum-wage-tier-source:hover {
  text-decoration: underline;
}

.minimum-wage-field-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.minimum-wage-system-fields {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fbfd;
}

.minimum-wage-system-fields summary {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.minimum-wage-system-fields summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.minimum-wage-system-fields .minimum-wage-field-table {
  margin: 0 12px 12px;
}

.minimum-wage-system-fields:not([open]) .minimum-wage-field-table {
  display: none;
}

.minimum-wage-field-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1fr) minmax(260px, 2fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-top: 1px solid #eef3f8;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
}

.minimum-wage-field-row:first-child {
  border-top: 0;
}

.minimum-wage-field-head {
  background: #f8fbfd;
  color: var(--muted);
  font-weight: 700;
}

.minimum-wage-field-row strong {
  color: var(--ink);
}

.minimum-wage-field-row code {
  color: #475569;
  white-space: normal;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.social-fund-status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 10px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-color: #bfd3e8 transparent;
  scrollbar-width: thin;
}

.social-fund-status-list-wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.social-fund-status-list article {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #dbe8f4;
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  align-content: start;
  gap: 8px;
}

.social-fund-status-list span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.social-fund-status-list strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.social-base-row {
  display: grid;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px dashed #e2e8f0;
  align-content: start;
}

.social-base-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.social-fund-status-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.social-base-source {
  color: #64748b;
  display: block;
  font-size: 11px;
  line-height: 1.35;
  text-decoration: none;
}

a.social-base-source {
  color: #2563eb;
}

a.social-base-source:hover {
  text-decoration: underline;
}

.legal-document-section.social-coverage-section h5 {
  text-align: left;
}

.social-ratio-five-column {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.social-ratio-five-column::-webkit-scrollbar {
  height: 6px;
}

.social-ratio-five-column::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #bfd3e8;
}

.social-ratio-insurance-column {
  min-width: 220px;
}

.social-ratio-standard-list {
  display: grid;
  align-content: start;
}

.social-ratio-standard-row {
  display: grid;
  gap: 8px;
}

.social-ratio-standard-name {
  color: var(--muted);
  font-weight: 600;
}

.social-ratio-base-row {
  grid-template-columns: minmax(0, 1fr);
}

.social-ratio-candidate-panel {
  border-color: #b7eee5;
  background: #f8fffd;
}

.social-ratio-candidate-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.social-ratio-candidate-card {
  align-content: start;
}

.social-ratio-candidate-item-list {
  display: grid;
}

.social-ratio-candidate-item strong {
  font-size: 14px;
}

.legal-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.legal-source-link {
  width: fit-content;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.legal-source-link:hover {
  text-decoration: underline;
}

.legal-topic-detail {
  padding: 0;
  display: grid;
  gap: 0;
  min-width: 0;
}

.legal-topic-panel.has-vertical-tabs .legal-topic-detail {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.legal-topic-head {
  margin: 18px 18px 0;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.legal-topic-head h3 {
  margin: 0;
  font-size: 22px;
}

.legal-topic-head p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.legal-topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.legal-topic-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: #0f5132;
  background: #dff8ed;
  font-size: 12px;
  font-weight: 700;
}

.legal-section {
  display: grid;
  gap: 10px;
}

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

.legal-param-grid-compact {
  grid-template-columns: 1fr;
}

.legal-param-card,
.legal-law-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.legal-param-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.legal-param-value {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.legal-param-value span {
  color: var(--ink);
  font-weight: 700;
}

.legal-param-value em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.legal-law-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.legal-law-item {
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
  display: grid;
  gap: 8px;
}

.legal-law-main {
  display: grid;
  gap: 5px;
  color: var(--ink);
  text-decoration: none;
}

.legal-law-main:hover strong {
  color: #0f766e;
}

.legal-law-main span,
.legal-law-actions span {
  color: var(--muted);
  font-size: 12px;
}

.legal-law-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.legal-law-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #cdeee8;
  border-radius: 4px;
  color: #0f766e;
  background: #f0fdfa;
  font-size: 12px;
  text-decoration: none;
}

.legal-inline-placeholder {
  min-height: 72px;
  padding: 14px;
  border: 1px dashed #b8c5d6;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.legal-inline-placeholder svg {
  width: 20px;
  height: 20px;
  color: #64748b;
  flex: 0 0 auto;
}

.legal-inline-placeholder strong {
  color: var(--muted);
  font-size: 13px;
}

.legal-placeholder {
  border: 1px dashed #b8c5d6;
  border-radius: 8px;
  margin: 18px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fbfdff;
}

.legal-placeholder-error {
  border-color: #f4b4b4;
  background: #fff7f7;
}

.legal-placeholder-error svg {
  color: #dc2626;
}

.legal-placeholder svg {
  width: 24px;
  height: 24px;
  color: var(--cyan);
  flex: 0 0 auto;
}

.legal-placeholder p {
  margin: 6px 0 0;
  color: var(--muted);
}

.legal-reader-search {
  min-height: 56px;
  padding: 10px 24px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background:
    linear-gradient(135deg, rgba(237, 252, 250, 0.92), rgba(244, 248, 255, 0.92)),
    repeating-linear-gradient(45deg, rgba(14, 116, 144, 0.08) 0 1px, transparent 1px 22px);
}

.legal-reader-search label {
  width: min(620px, 100%);
}

.legal-reader-search input {
  width: 100%;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
}

.legal-reader-search svg {
  width: 18px;
  height: 18px;
  color: #93a4b8;
  margin-left: -42px;
  pointer-events: none;
}

.legal-reader-head {
  min-height: 78px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.legal-reader-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.legal-reader-meta-line {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  color: #8b95a5;
  font-size: 13px;
}

.legal-share-button {
  flex: 0 0 auto;
  text-decoration: none;
}

.legal-reader-layout {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.legal-reader-aside {
  display: grid;
  gap: 18px;
}

.legal-reader-card {
  border: 1px solid #edf1f6;
  border-radius: 4px;
  padding: 18px;
  background: #ffffff;
}

.legal-reader-card h4 {
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 4px solid #14a69a;
  font-size: 15px;
}

.legal-info-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  color: #606b7a;
  font-size: 13px;
}

.legal-info-row span {
  white-space: nowrap;
}

.legal-info-row strong {
  min-width: 0;
  color: #4b5565;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.legal-reader-catalog {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 4px;
}

.legal-reader-catalog button,
.legal-reader-catalog a {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  padding: 0 10px;
  color: #5d6676;
  background: transparent;
  text-align: left;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.legal-reader-catalog button:hover,
.legal-reader-catalog button.active,
.legal-reader-catalog a:hover {
  color: #0f766e;
  background: #eefdfa;
}

.legal-file-catalog button {
  min-height: 54px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  align-items: start;
}

.legal-file-catalog button span {
  font-weight: 700;
  color: inherit;
}

.legal-file-catalog button em {
  color: #7a8699;
  font-size: 12px;
  font-style: normal;
}

.legal-reader-document {
  min-height: 640px;
  padding: 42px min(7vw, 76px);
  background: #ffffff;
  border: 1px solid #edf1f6;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.03);
}

.leave-rules-frame {
  margin: 18px;
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.leave-rules-directory {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
}

.leave-directory-card {
  min-height: 0;
  border: 1px solid #edf1f6;
  border-radius: 4px;
  padding: 18px;
  background: #ffffff;
  overflow: hidden;
}

.leave-directory-card h4 {
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 4px solid #14a69a;
  font-size: 15px;
}

.leave-directory-list {
  max-height: 470px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 4px;
}

.leave-directory-button {
  min-height: 48px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 10px;
  color: #4b5565;
  background: transparent;
  text-align: left;
  display: grid;
  gap: 3px;
}

.leave-directory-button:hover,
.leave-directory-button.active {
  color: #0f766e;
  border-color: #c9f2ea;
  background: #eefdfa;
}

.leave-directory-button span {
  font-size: 14px;
  font-weight: 600;
}

.leave-directory-button em {
  color: #8b95a5;
  font-size: 12px;
  font-style: normal;
}

.leave-rules-content {
  min-height: 640px;
  max-height: calc(100vh - 260px);
  border: 1px solid #edf1f6;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.03);
  overflow: auto;
}

.leave-rules-content-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 26px 28px 12px;
  background: #ffffff;
  border-bottom: 1px solid #edf1f6;
}

.leave-rules-content-head h4 {
  margin: 2px 0 0;
  font-size: 18px;
}

.leave-rule-entry-list {
  display: grid;
  gap: 12px;
  padding: 18px 28px 30px;
}

.leave-selection-empty {
  min-height: 260px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  padding: 42px 20px;
  color: #64748b;
  background: #f8fafc;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.leave-selection-empty [data-icon] {
  width: 30px;
  height: 30px;
  color: #0f766e;
}

.leave-selection-empty strong {
  color: #152238;
  font-size: 16px;
}

.leave-selection-empty p {
  max-width: 520px;
  margin: 0;
  line-height: 1.7;
}

.leave-rule-entry {
  scroll-margin-top: 88px;
  border: 1px solid #dce4ee;
  border-radius: 4px;
  padding: 16px;
  background: #ffffff;
  display: grid;
  gap: 12px;
}

.leave-rule-entry.active {
  border-color: #14a69a;
  box-shadow: inset 3px 0 0 #14a69a;
}

.leave-rule-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.leave-rule-entry-head span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.leave-rule-entry-head h5 {
  margin: 4px 0;
  color: #152238;
  font-size: 16px;
}

.leave-rule-entry p {
  margin: 0;
  color: #4b5565;
  line-height: 1.7;
}

.leave-rule-value {
  flex: 0 0 auto;
  min-width: 132px;
  border-radius: 4px;
  padding: 10px 12px;
  color: #152238;
  background: #f8fafc;
  text-align: right;
}

.leave-rule-value strong {
  display: block;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.leave-rule-value em {
  color: #8b95a5;
  font-size: 12px;
  font-style: normal;
}

.leave-rule-basis {
  display: grid;
  gap: 4px;
  color: #5d6676;
  font-size: 13px;
}

.leave-rule-basis strong,
.leave-rule-laws > strong {
  color: #152238;
  font-size: 13px;
}

.leave-rule-laws {
  display: grid;
  gap: 8px;
}

.legal-document-title {
  margin-bottom: 26px;
  text-align: center;
}

.legal-document-title p {
  margin: 0 0 10px;
  color: #68758a;
  font-size: 13px;
}

.legal-document-title h4 {
  margin: 0;
  font-size: 22px;
  line-height: 1.45;
}

.legal-document-section {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.legal-document-section h5 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
}

.legal-document-section p {
  margin: 0;
  color: #202938;
  font-size: 16px;
  line-height: 2;
  text-indent: 2em;
}

.legal-document-section .legal-basis-line {
  color: #637086;
  font-size: 14px;
}


.tag-list,
.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.code-tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
}

.tag {
  color: #164e63;
  background: #e6f6fb;
}

.code-tag {
  color: #334155;
  background: #f1f5f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.source-item h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.source-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 18, 32, 0.45);
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal-head,
.drawer-head {
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.modal-body {
  padding: 18px 20px;
  display: grid;
  gap: 14px;
}

.modal-body label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.review-summary {
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #f6f8fb;
  border: 1px solid var(--line);
  font-size: 14px;
}

.modal-actions {
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 35;
  width: min(620px, 100%);
  height: 100vh;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.drawer pre {
  margin: 0;
  padding: 18px;
  overflow: auto;
  min-height: 0;
  flex: 1;
  color: #dbeafe;
  background: #101827;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #1f2937;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid #d7e4f2;
    box-shadow: inset 0 -2px 0 rgba(65, 139, 219, 0.10);
  }

  .foundation-navigation-resizer {
    display: none;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    padding: 0;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .nav-item {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-item.active::before {
    top: auto;
    right: 12px;
    bottom: 0;
    left: 12px;
    width: auto;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }

  .nav-submenu {
    flex: 1 1 100%;
    min-width: 0;
    max-height: 420px;
    overflow-y: auto;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 18px 14px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .metric:nth-child(2),
  .metric:nth-child(4) {
    border-right: 0;
  }

  .source-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

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

  .legal-param-grid,
  .legal-law-list,
  .legal-reader-layout,
  .leave-rules-frame,
  .social-fund-status-list,
  .minimum-wage-tier-list {
    grid-template-columns: 1fr;
  }

  .minimum-wage-field-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .legal-topic-panel.has-vertical-tabs {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }

  .legal-topic-tabs-vertical {
    min-height: 0;
    max-height: 420px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .legal-topic-panel.has-vertical-tabs .legal-topic-detail {
    max-height: none;
  }

  .legal-reader-document {
    padding: 28px 20px;
  }

  .leave-rules-frame {
    margin: 14px;
  }

  .leave-rules-directory {
    grid-template-rows: auto auto;
  }

  .leave-directory-list {
    max-height: 260px;
  }

  .leave-rules-content {
    max-height: none;
  }

  .legal-reader-head {
    align-items: flex-start;
    flex-direction: column;
  }

}

@media (max-width: 520px) {
  .topbar h1 {
    font-size: 22px;
  }

  .metrics-strip {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .company-region {
    grid-column: 1 / -1;
    max-width: none;
    width: 100%;
  }

  .primary-button {
    width: 100%;
  }

  .leave-rule-entry-head {
    display: grid;
  }

  .leave-rule-value {
    min-width: 0;
    text-align: left;
  }
}

.local-ai-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px 8px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #0f4fac;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(23, 32, 51, 0.16);
  font-weight: 700;
}

.local-ai-launcher:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.local-ai-launcher-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  background: #1769cf;
  font-size: 12px;
}

.local-ai-panel {
  position: fixed;
  right: 18px;
  bottom: 74px;
  z-index: 1199;
  display: grid;
  width: min(400px, calc(100vw - 28px));
  height: min(660px, calc(100vh - 96px));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid #d4deeb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.18);
}

.local-ai-panel.hidden,
body.foundation-embedded:not(.local-ai-debug) .local-ai-panel {
  display: none;
}

.local-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
}

.local-ai-header h2,
.local-ai-header p {
  margin: 0;
}

.local-ai-header h2 {
  font-size: 17px;
}

.local-ai-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.local-ai-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  background: #fbfcfe;
}

.local-ai-message {
  max-width: 88%;
  padding: 9px 11px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  color: #243047;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.local-ai-message.user {
  align-self: flex-end;
  border-color: #1769cf;
  color: #ffffff;
  background: #1769cf;
}

.local-ai-message.pending {
  color: var(--muted);
}

.local-ai-quick-prompts {
  display: flex;
  gap: 7px;
  padding: 10px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.local-ai-prompt {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #cdd9e8;
  border-radius: 6px;
  color: #1f4f8f;
  background: #ffffff;
  font-size: 13px;
}

.local-ai-prompt:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.local-ai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.local-ai-form textarea {
  min-width: 0;
  max-height: 120px;
  resize: vertical;
  border: 1px solid #cdd9e8;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.45;
}

.local-ai-form textarea:focus {
  border-color: #3b82f6;
  outline: 2px solid rgba(59, 130, 246, 0.14);
}

.local-ai-send,
.local-ai-send.primary-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

@media (max-width: 520px) {
  .local-ai-launcher {
    right: 10px;
    bottom: 10px;
  }

  .local-ai-panel {
    right: 8px;
    bottom: 64px;
    width: calc(100% - 16px);
    height: min(620px, calc(100vh - 76px));
  }
}
