:root {
  --workspace-font-family: Pretendard, Inter, SUIT, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --navy-950: #0f2435;
  --navy-900: #153249;
  --navy-800: #1d425c;
  --blue-700: #176997;
  --blue-600: #087eb3;
  --blue-100: #dff1fa;
  --blue-50: #f1f9fc;
  --ink: #18252d;
  --muted: #5f707a;
  --subtle: #80909a;
  --line: #d8e1e6;
  --line-strong: #bdcbd2;
  --surface: #ffffff;
  --surface-alt: #f5f7f8;
  --canvas: #edf1f3;
  --green: #24735a;
  --green-bg: #e5f5ee;
  --amber: #9a6110;
  --amber-bg: #fff2d8;
  --red: #a83737;
  --red-bg: #fceaea;
  --shadow-sm: 0 1px 3px rgba(15, 36, 53, 0.1);
  --shadow-md: 0 10px 30px rgba(15, 36, 53, 0.11);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 15px;
  font-family: var(--workspace-font-family);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
}

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

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

:focus-visible {
  outline: 3px solid rgba(8, 126, 179, 0.35);
}

button {
  color: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy-950);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

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

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 30px;
  color: #fff;
  background: var(--navy-950);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 4px;
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--navy-950);
  background: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: -0.03em;
}

.brand-copy {
  display: grid;
  text-align: left;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 1px;
  color: #9fb6c4;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.header-context {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #c7d4dc;
  font-size: 12px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  color: #d8e3e8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
}

.connection-state::before {
  width: 7px;
  height: 7px;
  margin-right: 6px;
  background: #9aabb5;
  border-radius: 50%;
  content: "";
}

.connection-state[data-tone="good"]::before {
  background: #65d1a6;
}

.connection-state[data-tone="danger"]::before {
  background: #f08f8f;
}

.page-frame,
.project-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.page-heading,
.project-heading,
.panel-heading,
.content-card-heading,
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1,
.project-heading h1,
.panel-heading h2,
.dialog-heading h2 {
  margin: 0;
  color: var(--navy-950);
  line-height: 1.2;
}

.page-heading h1 {
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.035em;
}

.page-heading > div > p:last-child,
.panel-heading > div > p:last-child,
.project-description {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.button,
.icon-button,
.text-button,
.segmented-control button,
.project-tabs button {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--workspace-font-weight-regular, 400);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.button svg {
  width: 17px;
  height: 17px;
  margin-right: 7px;
}

.button:hover:not(:disabled) {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.button:disabled,
.icon-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.button-primary {
  color: #fff;
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.button-primary:hover:not(:disabled) {
  background: #0f5c86;
  border-color: #0f5c86;
}

.button-secondary {
  color: var(--navy-900);
  background: #fff;
  border-color: var(--line-strong);
}

.button-danger {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.button-quiet-danger {
  color: var(--red);
  background: transparent;
  border-color: #dfbbbb;
}

.portfolio-tools,
.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portfolio-tools {
  margin: 30px 0 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.search-field {
  position: relative;
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  max-width: 480px;
}

.search-field svg {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--subtle);
  pointer-events: none;
}

.search-field input,
.select-field select,
.form-field input,
.form-field select,
.form-field textarea,
.registration-mode {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.search-field input,
.select-field select {
  height: 39px;
}

.search-field input {
  padding: 7px 43px 7px 39px;
}

.search-field kbd {
  position: absolute;
  right: 10px;
  padding: 1px 6px;
  color: var(--subtle);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 11px/18px inherit;
  pointer-events: none;
}

.select-field select {
  min-width: 145px;
  padding: 7px 34px 7px 11px;
}

.search-field input:focus,
.select-field select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(8, 126, 179, 0.12);
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented-control button {
  min-height: 31px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.segmented-control button[aria-pressed="true"] {
  color: var(--navy-950);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.icon-button {
  display: grid;
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  place-items: center;
  color: var(--navy-800);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.portfolio-summary {
  min-height: 20px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.project-card {
  position: relative;
  display: flex;
  min-height: 220px;
  flex-direction: column;
  padding: 21px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project-card[href] {
  cursor: pointer;
}

.project-card:focus-visible {
  outline: 3px solid rgba(21, 123, 172, 0.34);
  outline-offset: 3px;
  border-color: var(--blue-700);
  box-shadow: var(--shadow-md);
}

.project-card:hover {
  border-color: #9fb7c4;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--blue-700);
  content: "";
}

.project-card[data-archived="true"]::before {
  background: #8a979e;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-card h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.project-card-description {
  display: -webkit-box;
  min-height: 42px;
  margin: 9px 0 20px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.project-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.project-card-metric {
  padding: 9px 10px;
  background: var(--surface-alt);
  border-radius: 7px;
}

.project-card-metric span,
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.project-card-metric strong {
  display: block;
  margin-top: 3px;
  color: var(--navy-900);
  font-size: 14px;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.project-open-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 0;
  color: var(--blue-700);
  font-weight: var(--workspace-font-weight-regular, 400);
}

.project-open-button svg {
  width: 14px;
  height: 14px;
  margin-left: 5px;
}

.status-badge,
.nav-count,
.table-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

.status-badge,
.table-status {
  padding: 4px 8px;
  color: var(--green);
  background: var(--green-bg);
  font-size: 10px;
}

[data-status-tone="archived"] {
  color: #63727b;
  background: #e9eef0;
}

[data-status-tone="review"] {
  color: var(--amber);
  background: var(--amber-bg);
}

[data-status-tone="danger"] {
  color: var(--red);
  background: var(--red-bg);
}

.project-skeleton,
.detail-skeleton > div {
  background: linear-gradient(90deg, #e5eaed 25%, #f4f6f7 50%, #e5eaed 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.25s infinite;
}

.project-skeleton {
  min-height: 220px;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.empty-state {
  display: grid;
  min-height: 390px;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.empty-state.compact {
  min-height: 280px;
}

.empty-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 17px;
  place-items: center;
  color: var(--blue-700);
  background: var(--blue-50);
  border-radius: 18px;
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 20px;
}

.empty-state p {
  max-width: 440px;
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.inline-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 16px 0;
  padding: 14px 16px;
  color: var(--navy-900);
  background: var(--blue-50);
  border: 1px solid #b8ddea;
  border-left: 4px solid var(--blue-600);
  border-radius: var(--radius-sm);
}

.inline-alert[data-tone="danger"] {
  color: #6e2828;
  background: var(--red-bg);
  border-color: #ebc1c1;
  border-left-color: var(--red);
}

.inline-alert[data-tone="warning"] {
  color: #684711;
  background: var(--amber-bg);
  border-color: #efd79c;
  border-left-color: var(--amber);
}

.inline-alert p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb button {
  padding: 3px 0;
  color: var(--blue-700);
  background: transparent;
  border: 0;
  font-weight: var(--workspace-font-weight-regular, 400);
  cursor: pointer;
}

.breadcrumb svg {
  width: 14px;
  height: 14px;
}

.detail-skeleton {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 20px;
}

.detail-skeleton > div:first-child {
  grid-row: span 2;
  min-height: 560px;
}

.detail-skeleton > div:nth-child(2) {
  min-height: 130px;
}

.detail-skeleton > div:nth-child(3) {
  min-height: 410px;
}

.project-heading {
  margin-bottom: 22px;
  padding: 23px 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.project-heading-main {
  min-width: 0;
}

.project-title-line {
  display: flex;
  align-items: center;
  gap: 11px;
}

.project-title-line h1 {
  overflow-wrap: anywhere;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.project-description {
  max-width: 760px;
}

.project-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.project-metadata div {
  display: flex;
  gap: 5px;
}

.project-metadata dt {
  font-weight: var(--workspace-font-weight-regular, 400);
}

.project-metadata dd {
  margin: 0;
}

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

.workflow-links {
  display: contents;
}

.project-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.project-sidebar {
  position: sticky;
  top: 82px;
  overflow: hidden;
  background: var(--navy-950);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.project-sidebar-label {
  padding: 17px 17px 9px;
  color: #809baa;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-tabs {
  display: grid;
  padding: 0 8px 10px;
}

.project-tabs button {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 8px 10px;
  color: #b8c9d3;
  text-align: left;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.project-tabs button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.project-tabs button[aria-current="page"] {
  color: #fff;
  background: var(--blue-700);
}

.project-tabs button svg {
  width: 18px;
  height: 18px;
  margin-right: 10px;
}

.nav-count {
  min-width: 22px;
  min-height: 20px;
  justify-content: center;
  margin-left: auto;
  padding: 2px 6px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.12);
  font-size: 10px;
}

.sidebar-project-id {
  display: grid;
  gap: 5px;
  padding: 14px 17px 17px;
  color: #809baa;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
}

.sidebar-project-id code {
  overflow: hidden;
  color: #c5d3da;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-main {
  min-width: 0;
}

.project-panel {
  min-height: 560px;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 23px;
  letter-spacing: -0.025em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 19px 0;
}

.metric-card {
  min-height: 92px;
  padding: 15px;
  background: var(--surface-alt);
  border: 1px solid #e4eaed;
  border-radius: 8px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--navy-950);
  font-size: 23px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

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

.overview-columns-single {
  grid-template-columns: minmax(0, 1fr);
}

.content-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.content-card-heading {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.content-card-heading h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 15px;
}

.content-card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  padding: 4px;
  color: var(--blue-700);
  background: transparent;
  font-size: 11px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.compact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f3;
}

.compact-list li:last-child {
  border-bottom: 0;
}

.compact-list strong {
  display: block;
  color: var(--navy-900);
  font-size: 12px;
}

.compact-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.compact-empty {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 25px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.table-tools {
  margin: 17px 0 12px;
}

.filter-summary {
  min-height: 18px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.hierarchy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 17px;
  padding: 13px 14px;
  background: #f6f9fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hierarchy-toolbar strong {
  color: var(--navy-900);
  font-size: 12px;
}

.hierarchy-toolbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.data-table th {
  padding: 10px 13px;
  color: #566a75;
  text-align: left;
  background: #f3f6f7;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.data-table td {
  padding: 13px;
  color: var(--muted);
  border-bottom: 1px solid #e8edef;
  vertical-align: middle;
}

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

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

.data-table tbody .version-detail-row:hover {
  background: transparent;
}

.data-table .status-cell {
  width: 76px;
}

.data-table .version-detail-row > td {
  padding: 0;
  background: #fbfcfd;
}

.data-table .primary-cell strong {
  display: block;
  max-width: 320px;
  overflow: hidden;
  color: var(--navy-900);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .primary-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.building-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.building-card {
  position: relative;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.building-card.entity-archived,
.collection-card.entity-archived,
.hierarchy-drawing.entity-archived,
.data-table tr.entity-archived {
  background: #f5f7f8;
}

.building-card-heading,
.hierarchy-entity-heading,
.collection-toolbar,
.building-title,
.hierarchy-entity-title {
  display: flex;
  align-items: center;
}

.building-card-heading,
.hierarchy-entity-heading,
.collection-toolbar {
  justify-content: space-between;
  gap: 16px;
}

.building-title,
.hierarchy-entity-title {
  min-width: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.building-card h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 16px;
}

.building-card .building-description,
.building-card .building-address,
.hierarchy-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.empty-copy {
  color: var(--subtle) !important;
  font-style: italic;
}

.building-card-metadata {
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin-top: 13px;
  padding: 9px 0;
  color: var(--muted);
  border-top: 1px solid #edf1f3;
  border-bottom: 1px solid #edf1f3;
  font-size: 10px;
}

.collection-section {
  margin-top: 17px;
}

.collection-section > h4 {
  margin: 0 0 8px;
  color: var(--navy-900);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.collection-card {
  margin-top: 7px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.collection-card > summary,
.version-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--navy-900);
  cursor: pointer;
  list-style: none;
}

.collection-card > summary::-webkit-details-marker,
.version-history > summary::-webkit-details-marker {
  display: none;
}

.collection-card > summary {
  min-height: 44px;
  padding: 10px 13px;
  background: #f7f9fa;
}

.collection-card > summary::before,
.version-history > summary::before {
  content: "›";
  flex: 0 0 auto;
  color: var(--blue-700);
  font-size: 16px;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}

.collection-card[open] > summary::before,
.version-history[open] > summary::before {
  transform: rotate(90deg);
}

.collection-summary-title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.collection-summary-title strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hierarchy-count,
.version-count {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.collection-body {
  padding: 13px;
}

.collection-toolbar > .hierarchy-description {
  margin: 0;
}

.hierarchy-drawing-list,
.version-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.hierarchy-drawing {
  padding: 13px;
  border: 1px solid #e5ebee;
  border-radius: 6px;
}

.hierarchy-drawing + .hierarchy-drawing {
  margin-top: 8px;
}

.hierarchy-drawing strong {
  color: var(--navy-950);
  font-size: 12px;
}

.hierarchy-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #fafcfc;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.entity-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.entity-action {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.entity-action:hover:not(:disabled) {
  color: var(--navy-950);
  border-color: #8ea7b4;
}

.entity-action-danger {
  color: var(--red);
  border-color: #dfbbbb;
}

.entity-action:disabled {
  color: var(--subtle);
  background: #f1f3f4;
  cursor: not-allowed;
}

.version-history {
  margin-top: 10px;
  border-top: 1px solid #e8edef;
}

.version-history > summary {
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 2px;
  font-size: 11px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.version-history > summary .version-count {
  margin-left: auto;
}

.version-detail-row .version-history {
  margin: 0;
  padding: 0 13px;
  border-top: 0;
}

.version-list {
  margin-top: 0;
  padding: 0 0 12px;
}

.version-item {
  padding: 13px;
  background: #fff;
  border: 1px solid #e2e9ec;
  border-radius: 6px;
}

.version-item + .version-item {
  margin-top: 8px;
}

.version-heading,
.version-heading > div {
  display: flex;
  align-items: center;
}

.version-heading {
  justify-content: space-between;
  gap: 12px;
}

.version-heading > div {
  gap: 6px;
  flex-wrap: wrap;
}

.version-heading strong {
  color: var(--navy-950);
  font-size: 13px;
}

.version-heading time {
  color: var(--muted);
  font-size: 10px;
}

.latest-badge,
.immutable-badge {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

.latest-badge {
  color: var(--blue-700);
  background: #e5f3fa;
}

.immutable-badge {
  color: #53656f;
  background: #e9eef0;
}

.version-note {
  margin-top: 10px;
  padding: 9px 10px;
  background: #f7f9fa;
  border-left: 3px solid #a9bdc7;
}

.version-note > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.version-note p {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.version-metadata {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.version-metadata > div {
  min-width: 0;
}

.version-metadata dt {
  color: var(--muted);
  font-size: 9px;
}

.version-metadata dd {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--navy-900);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-empty {
  padding: 12px 2px;
  color: var(--muted);
  font-size: 10px;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(8, 29, 42, 0.28);
}

dialog.dialog-wide {
  width: min(760px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(8, 28, 40, 0.58);
  backdrop-filter: blur(2px);
}

dialog form {
  margin: 0;
}

.dialog-heading {
  align-items: center;
  padding: 20px 23px 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  font-size: 21px;
}

.dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--surface-alt);
}

.dialog-content {
  display: grid;
  gap: 17px;
  max-height: calc(100vh - 205px);
  padding: 22px 23px;
  overflow-y: auto;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 23px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
}

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

.form-field {
  display: grid;
  gap: 7px;
}

.form-field > span,
.form-field > label,
.registration-mode legend {
  color: var(--navy-900);
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.form-field em,
.registration-mode em {
  color: var(--red);
  font-size: 10px;
  font-style: normal;
}

.form-field span small,
.form-field label small {
  color: var(--muted);
  font-weight: var(--workspace-font-weight-regular, 400);
}

.form-field input,
.form-field select,
.form-field textarea {
  min-height: 40px;
  padding: 8px 10px;
}

.form-field textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.5;
}

.form-field input[readonly] {
  color: var(--muted);
  background: var(--surface-alt);
  cursor: not-allowed;
}

.form-field > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.address-autocomplete {
  position: relative;
}

.address-suggestion-list {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 250px;
  padding: 5px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.address-suggestion-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 10px;
  gap: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.address-suggestion-option + .address-suggestion-option {
  margin-top: 2px;
}

.address-suggestion-option:hover,
.address-suggestion-option[aria-selected="true"] {
  background: var(--blue-50);
  border-color: #b8d8e7;
}

.address-suggestion-copy {
  min-width: 0;
}

.address-suggestion-copy strong,
.address-suggestion-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.address-suggestion-copy strong {
  color: var(--navy-900);
  font-size: 12px;
  line-height: 1.4;
}

.address-suggestion-copy mark {
  color: inherit;
  background: transparent;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.address-suggestion-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.address-suggestion-kind {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: var(--blue-700);
  background: var(--blue-50);
  border-radius: 999px;
  font-size: 9px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

#buildingDialog .address-suggestion-list {
  position: static;
  max-height: 170px;
  margin-top: 5px;
}

.file-field {
  padding: 13px;
  background: var(--blue-50);
  border: 1px dashed #9ccbdc;
  border-radius: 8px;
}

.file-field input {
  padding: 7px;
  background: #fff;
}

.handoff-notice {
  display: flex;
  gap: 11px;
  padding: 13px;
  color: var(--navy-900);
  background: var(--blue-50);
  border: 1px solid #b8ddea;
  border-radius: 8px;
}

.handoff-notice svg {
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  color: var(--blue-700);
}

.handoff-notice strong {
  display: block;
  font-size: 12px;
}

.handoff-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.immutable-notice {
  padding: 12px 13px;
  color: var(--navy-900);
  background: #f3f6f7;
  border-left: 3px solid #8099a6;
  border-radius: 6px;
}

.immutable-notice strong {
  font-size: 12px;
}

.immutable-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.collection-card > summary:focus-visible,
.version-history > summary:focus-visible {
  outline: 3px solid rgba(8, 126, 179, 0.22);
  outline-offset: -3px;
}

.registration-mode {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 13px;
}

.registration-mode legend {
  padding: 0 5px;
}

.registration-mode > p {
  margin: -2px 0 4px;
  color: var(--amber);
  font-size: 10px;
}

.registration-mode label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.registration-mode label:has(input:checked) {
  background: var(--blue-50);
  border-color: #8fc5da;
}

.registration-mode input {
  margin-top: 2px;
}

.registration-mode strong,
.registration-mode small {
  display: block;
}

.registration-mode strong {
  color: var(--navy-900);
  font-size: 12px;
}

.registration-mode small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.form-error,
.conflict-panel {
  padding: 12px 13px;
  color: #742b2b;
  background: var(--red-bg);
  border: 1px solid #ebc1c1;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.55;
}

.conflict-panel {
  display: flex;
  gap: 11px;
  color: #684711;
  background: var(--amber-bg);
  border-color: #e8cd8f;
}

.conflict-panel p {
  margin: 5px 0 0;
}

.conflict-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.conflict-icon {
  display: grid;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  place-items: center;
  color: #fff;
  background: var(--amber);
  border-radius: 50%;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

.confirm-dialog {
  width: min(470px, calc(100vw - 28px));
}

.confirm-dialog .dialog-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: 78px;
  right: 18px;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  color: var(--navy-900);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue-600);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  line-height: 1.5;
  animation: toast-in 0.18s ease-out;
}

.toast[data-tone="danger"] {
  color: #742b2b;
  border-left-color: var(--red);
}

.toast[data-tone="good"] {
  border-left-color: var(--green);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 1120px) {
  .project-grid,
  .project-skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .project-actions {
    max-width: 410px;
    flex-wrap: wrap;
  }

}

@media (max-width: 900px) {
  .app-header {
    padding: 0 17px;
  }

  .page-frame,
  .project-shell {
    width: min(100% - 28px, 1480px);
    padding-top: 24px;
  }

  .portfolio-tools {
    flex-wrap: wrap;
  }

  .search-field {
    max-width: none;
  }

  .segmented-control {
    order: 3;
  }

  .project-heading {
    display: grid;
  }

  .project-actions {
    max-width: none;
    justify-content: flex-start;
  }

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

  .project-sidebar {
    position: static;
  }

  .project-sidebar-label,
  .sidebar-project-id {
    display: none;
  }

  .project-tabs {
    display: flex;
    padding: 7px;
    overflow-x: auto;
  }

  .project-tabs button {
    flex: 1 0 auto;
    justify-content: center;
  }

  .hierarchy-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hierarchy-toolbar .entity-scope-control {
    order: initial;
  }
}

@media (max-width: 680px) {
  .header-context > span:first-child,
  .search-field kbd {
    display: none;
  }

  .page-heading,
  .panel-heading {
    display: grid;
  }

  .page-heading .button,
  .panel-heading .button {
    width: 100%;
  }

  .portfolio-tools {
    align-items: stretch;
  }

  .portfolio-tools .search-field {
    flex-basis: 100%;
  }

  .select-field,
  .select-field select {
    flex: 1 1 auto;
    min-width: 0;
  }

  .segmented-control {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-grid,
  .project-skeleton-grid,
  .overview-columns,
  .building-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 205px;
  }

  .project-heading {
    padding: 18px;
  }

  .project-title-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-actions,
  .workflow-links {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-actions .button,
  .workflow-links .button {
    width: 100%;
  }

  .project-panel {
    min-height: 480px;
    padding: 18px 14px;
  }

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

  .metric-card {
    min-height: 82px;
  }

  .table-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .building-card-heading,
  .hierarchy-entity-heading,
  .collection-toolbar,
  .version-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .building-card {
    padding: 15px;
  }

  .entity-actions {
    width: 100%;
  }

  .entity-action {
    justify-content: center;
    flex: 1 1 auto;
    min-height: 44px;
  }

  .segmented-control button {
    min-height: 44px;
  }

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

  .dialog-content {
    padding: 18px;
  }

  .dialog-actions {
    padding: 12px 18px;
  }

  .dialog-actions .button {
    flex: 1;
  }
}

@media (max-width: 390px) {
  .workflow-links {
    width: 100%;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-links .button {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
}

@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;
  }
}
