:root {
  color-scheme: light;
  --ink: #203342;
  --muted: #526776;
  --line: #cdd8e0;
  --surface: #f2f5f7;
  --blue: #185e8c;
  --blue-dark: #10476c;
  --blue-soft: #e4f0f8;
  --danger: #a42d30;
  --success: #226246;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 5px; padding: 8px 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; }
button:hover, .button:hover { background: #eaf0f4; border-color: #9ab0bf; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .6; }
.primary { background: var(--blue); color: white; border-color: var(--blue); font-weight: 600; }
.primary:hover { background: var(--blue-dark); color: white; border-color: var(--blue-dark); }
.danger { color: var(--danger); }
:focus-visible { outline: 3px solid #d78312; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 20; padding: 10px; background: white; }
.skip-link:focus { top: 10px; }
.app-header { min-height: 76px; display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 12px 24px; background: white; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--blue); color: white; font-size: 19px; font-weight: 750; border-radius: 5px; }
nav { display: flex; gap: 3px; align-self: stretch; align-items: center; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 5px; white-space: nowrap; font-weight: 600; }
nav a:hover { background: var(--surface); color: var(--ink); }
nav a[aria-current="page"] { color: var(--blue-dark); background: var(--blue-soft); }
.account-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.account-actions select { width: auto; }
.account-actions form { display: contents; }
.text-button { border-color: transparent; background: transparent; padding: 5px 8px; color: var(--blue); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 24px 28px 20px; }
h1 { margin: 0; font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 16px; font-weight: 650; }
h3 { font-size: 14px; margin: 22px 0 10px; font-weight: 700; }
p { margin: 8px 0 16px; max-width: 72ch; }
.subheading, .hint { color: var(--muted); font-size: 13px; }
.subheading { margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.workspace-grid { display: grid; grid-template-columns: 220px minmax(320px, 1fr) 286px; border-top: 1px solid var(--line); min-height: calc(100dvh - 178px); background: white; }
.sidebar { border-right: 1px solid var(--line); background: #f8fafb; padding: 18px 14px; overflow: auto; max-height: calc(100dvh - 178px); }
.sidebar h2 { font-size: 13px; color: var(--muted); margin: 0 8px 16px; }
.building-group { border: 0; margin: 0 0 8px; padding: 0; }
.building-heading { font-weight: 650; margin: 0; padding: 11px 8px; min-height: 44px; border-radius: 5px; }
.building-heading:hover { background: #eaf0f4; }
.building-heading .hint { display: block; padding-left: 16px; }
.building-group .floor-link { padding-left: 24px; }
.floor-link { width: 100%; justify-content: space-between; text-align: left; margin-bottom: 4px; background: transparent; border-color: transparent; }
.floor-link.active { background: var(--blue-soft); color: var(--blue-dark); border-color: #bdd6e8; font-weight: 650; }
.room-link { width: 100%; display: block; text-align: left; background: transparent; border-color: transparent; padding: 7px 8px; margin: 2px 0; line-height: 1.35; }
.room-link.active { background: #dcecf6; border-color: #a8c9dd; }
.room-link small { display: block; color: var(--muted); margin-top: 2px; }
.mobile-room-selector, .mobile-floor-selector { display: none; }
.location-selectors { margin-top: 16px; }
.location-selectors label { font-weight: 600; }
.plan-column { min-width: 0; display: flex; flex-direction: column; background: #e9eff3; }
.plan-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: white; border-bottom: 1px solid var(--line); min-height: 60px; }
.plan-toolbar button { padding: 5px 9px; }
.outline-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; background: white; border-bottom: 1px solid var(--line); }
.outline-toolbar[hidden] { display: none; }
.outline-toolbar p { flex-basis: 100%; margin: 0; }
.outdoor-outline { fill: #167267; fill-opacity: .08; stroke: #167267; stroke-width: 2px; stroke-dasharray: 7 4; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: pointer; }
.outdoor-outline:focus-visible { stroke-width: 4px; stroke-dasharray: none; }
.outdoor-outline.draft { fill: none; }
.outdoor-label { fill: #135d54; stroke: white; stroke-width: 3px; paint-order: stroke; vector-effect: non-scaling-stroke; pointer-events: none; }
.outline-corner { fill: white; stroke: #167267; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.plan-area { flex: 1; position: relative; min-height: 400px; }
.plan-svg { display: block; width: 100%; height: calc(100dvh - 288px); min-height: 400px; background: #fff; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.plan-svg.placing { cursor: crosshair; }
.plan-svg:active { cursor: grabbing; }
.cad-path { fill: none; stroke: #71818c; stroke-width: .8px; vector-effect: non-scaling-stroke; }
.cad-text { fill: #405767; font-family: "Segoe UI", system-ui, sans-serif; }
.room-outline, .room-label-target { fill: #d7eaf6; fill-opacity: .12; stroke: #185e8c; stroke-opacity: .28; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: all; cursor: pointer; }
.room-label-target { fill-opacity: 0; stroke-opacity: 0; }
.room-outline:hover, .room-label-target:hover { fill-opacity: .3; stroke-opacity: .6; }
.room-outline.selected, .room-label-target.selected { fill-opacity: .45; stroke-opacity: .8; stroke-width: 2px; }
.room-outline:focus-visible, .room-label-target:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.plan-svg.pointer-interaction:focus, .plan-svg.pointer-interaction :focus { outline: none; }
.plan-svg.pointer-interaction .outdoor-outline:focus-visible { stroke-width: 2px; stroke-dasharray: 7 4; }
.plan-svg:active .room-outline, .plan-svg:active .room-label-target { cursor: grabbing; }
.plan-svg.placing .room-outline, .plan-svg.placing .room-label-target { cursor: crosshair; }
.plan-svg.placing .asset-marker { cursor: crosshair; }
.plan-svg.placing .outdoor-outline { cursor: crosshair; }
.asset-marker { cursor: pointer; color: white; }
.asset-marker.marker-hidden { display: none; }
.outdoor-mode .entrance-selector, .outdoor-mode .location-kind-selector,
.outdoor-mode .mobile-room-selector, .outdoor-mode .room-list { display: none; }
.marker-hit { fill: transparent; stroke: none; }
.marker-disc { fill: var(--blue); stroke: white; stroke-width: 2; }
.asset-marker.has-issue .marker-disc { fill: #ab3e23; }
.asset-marker.selected .marker-disc { stroke: #f0ad32; stroke-width: 3; }
.asset-marker.selected:not(.has-issue) .marker-disc { fill: #15384f; }
.equipment-icon { flex: 0 0 24px; display: block; }
.equipment-glyph { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.equipment-name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.equipment-name > span { overflow-wrap: anywhere; }
.equipment-type-preview { display: flex; align-items: center; gap: 12px; padding: 12px 0 18px; color: var(--blue-dark); }
.equipment-catalog { margin: 20px 16px; }
.equipment-catalog summary { min-height: 44px; cursor: pointer; font-weight: 600; }
.technical-fields summary, .asset-technical summary { min-height: 44px; cursor: pointer; font-weight: 600; }
.classification-reference { margin: 10px 0; }
.classification-reference button { margin-left: 10px; }
.equipment-catalog td { vertical-align: top; }
.equipment-catalog td:last-child { min-width: 250px; max-width: 380px; }
#markers-hint { display: block; }
#markers-hint[hidden] { display: none; }
.item-button > .equipment-name { flex: 1; }
.plan-caption { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: #f8fafb; }
.inspector { padding: 18px; border-left: 1px solid var(--line); max-height: calc(100dvh - 178px); overflow: auto; }
.inspector h2 { margin-bottom: 4px; }
.inspector .actions { margin: 14px 0; }
.inspector .actions button { width: 100%; }
.item-list { display: grid; gap: 3px; max-height: 300px; overflow: auto; margin: 12px -6px 0; padding: 3px 6px; }
.item-button { justify-content: space-between; text-align: left; padding: 9px; width: 100%; border-color: transparent; }
.item-button.active { background: var(--blue-soft); border-color: #a7c7db; }
.item-button small { display: block; color: var(--muted); }
.item-button[draggable="true"] { cursor: grab; }
.inspector hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
summary { font-weight: 600; cursor: pointer; }
.layer-list { max-height: 220px; overflow: auto; padding: 8px 0; }
.layer-list label { font-size: 12px; overflow-wrap: anywhere; display: flex; gap: 6px; align-items: flex-start; margin: 6px 0; }
.layer-list input { margin-top: 3px; }
.import-warnings { padding-left: 18px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.content { margin: 0 28px 32px; background: white; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 16px; border-bottom: 1px solid var(--line); }
.filters input[type="search"] { width: min(100%, 340px); }
.filters select { width: auto; }
.filters label { margin: 0; display: flex; align-items: center; gap: 8px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { font-size: 12px; font-weight: 650; color: var(--muted); background: #f8fafb; white-space: nowrap; }
th, td { padding: 13px 16px; border-bottom: 1px solid #e0e7ec; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafc; }
td .hint { margin-top: 3px; font-size: 12px; }
.table-link { background: none; border: 0; color: var(--blue); padding: 0; justify-content: flex-start; min-height: 28px; text-align: left; font-weight: 600; }
.table-link:hover { background: transparent; text-decoration: underline; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; background: #e8eef2; color: #3e5666; }
.badge.open, .badge.inprogress { background: #fcf0d7; color: #775115; }
.badge.done { background: #e1f1e8; color: #21573d; }
.badge.urgent, .badge.high { background: #fbe4df; color: #8d3022; }
.empty { padding: 70px 28px; text-align: center; margin: auto; }
.empty h2 { font-size: 22px; margin-bottom: 10px; }
.empty p { margin: 0 auto 20px; color: var(--muted); }
.empty .actions { justify-content: center; }
.loading { padding: 80px 28px; text-align: center; color: var(--muted); }
.notice { position: sticky; top: 0; z-index: 5; margin: 0; padding: 12px 28px; background: #e1f1e8; border-bottom: 1px solid #98c5aa; color: #21573d; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.notice.error, .message.error { background: #fff0ed; color: #8f2823; border-color: #dfb4aa; }
[hidden] { display: none !important; }
.message { margin-bottom: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; overflow-wrap: anywhere; }
dialog { border: 1px solid #b2c2cd; border-radius: 8px; padding: 24px; width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 32px); color: var(--ink); box-shadow: 0 18px 70px #172f4740; }
dialog::backdrop { background: #162e475e; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.dialog-header h2 { font-size: 22px; margin: 3px 0 0; }
.dialog-header button { padding: 0; width: 32px; min-height: 32px; font-size: 22px; flex-shrink: 0; }
form label { display: block; font-weight: 600; margin-bottom: 16px; }
.form-field { margin-bottom: 16px; }
.form-field > label { margin-bottom: 0; }
input, select, textarea { border: 1px solid #9fb3c1; border-radius: 4px; background: white; color: var(--ink); padding: 9px 10px; display: block; width: 100%; min-height: 40px; margin-top: 5px; font-weight: 400; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; margin: 0; display: inline-block; flex-shrink: 0; }
input[type="file"] { font-size: 13px; }
textarea { resize: vertical; min-height: 110px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 22px; }
.detail-list { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; margin: 18px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.photo-field { border: 1px solid var(--line); border-radius: 5px; padding: 12px; margin: 0 0 16px; min-width: 0; }
.pending-imports { padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pending-imports h2 { font-size: 16px; margin: 0 0 10px; }
.import-review { max-width: 1200px; padding: 20px; }
.import-batch { border: 1px solid var(--line); padding: 16px; margin: 24px 0 12px; }
.import-batch legend { font-weight: 600; }
.import-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.import-controls > div { flex: 1; min-width: 150px; }
.import-controls label, .import-assignment label { margin-bottom: 0; }
.import-room { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.import-room .check-label { margin-bottom: 6px; min-height: 44px; }
.import-room .hint { margin: 0; }
.import-assignment { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 12px; }
.import-assignment > div { min-width: 0; }
@media (max-width: 700px) {
    .import-review { padding: 16px; }
    .import-room { grid-template-columns: 1fr; gap: 12px; }
    .import-assignment { grid-template-columns: 1fr 1fr; }
    .import-assignment > div:last-child { grid-column: 1 / -1; }
}
.photo-field legend { font-weight: 600; padding: 0 4px; }
.photo-field .hint { margin: 10px 0 0; }
.photo-icon-button { width: 52px; min-height: 52px; padding: 12px; }
.photo-icon-button img { display: block; }
.photo-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.photo-preview { margin: 12px 0 0; min-width: 0; }
.photo-preview > img { display: block; width: 100%; height: 140px; object-fit: contain; background: var(--surface); }
.photo-preview figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.photo-preview .message { margin: 0; }
.issue-photo-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.issue-photo { display: block; max-width: 100%; max-height: 360px; object-fit: contain; margin-top: 12px; }
.issue-photo-detail { margin: 18px 0; }
.issue-photo-detail figcaption { margin-top: 8px; }
.account-panel { max-width: 440px; margin: 7vh auto; padding: 32px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.account-panel .brand-mark { margin-bottom: 24px; }
.account-panel h1 { font-size: 28px; margin-bottom: 14px; }
.account-panel form { margin-top: 28px; }
.account-panel .primary { width: 100%; }
.order-summary { padding: 20px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 20px 40px; }
.order-summary dt { color: var(--muted); font-size: 12px; }
.order-summary dd { margin: 3px 0 0; }
.crosshair { stroke: #a42d30; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
@media (max-width: 1220px) {
  .app-header { gap: 10px 18px; padding: 12px 18px; }
  .account-actions { width: 100%; justify-content: flex-end; }
  .workspace-grid { grid-template-columns: 185px minmax(300px, 1fr) 250px; }
  .inspector { padding: 14px; }
  .plan-svg { height: 62dvh; }
}
@media (max-width: 880px) {
  .workspace-grid { grid-template-columns: 175px minmax(0, 1fr); min-height: auto; }
  .inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .sidebar { max-height: 70dvh; }
  .item-list { max-height: 240px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .page-heading { padding: 20px; }
  .content { margin: 0 20px 24px; }
  .account-actions { width: auto; }
}
@media (max-width: 560px) {
  .app-header { padding: 12px; gap: 14px; }
  .brand { font-size: 15px; }
  nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  nav a { padding: 7px 9px; }
  .account-actions { width: 100%; justify-content: flex-start; gap: 3px; }
  .page-heading { padding: 18px 14px; }
  h1 { font-size: 23px; }
  .workspace-grid { display: flex; flex-direction: column; }
  .sidebar { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .sidebar .room-list, .location-tree { display: none; }
  .location-selectors { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 0; }
  .mobile-floor-selector, .mobile-room-selector { display: block; min-width: 0; }
  .mobile-room-selector { grid-column: 1 / -1; }
  button, .button, nav a { min-height: 44px; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  input[type="file"] { font-size: 16px; }
  .building-heading { margin-top: 12px; }
  .plan-svg { min-height: 340px; height: 55dvh; }
  .content { margin: 0 12px 24px; }
  th, td { padding: 11px 12px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .account-panel { margin: 24px 12px; padding: 24px; }
  .detail-list { grid-template-columns: 95px 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: reveal .16s ease-out; }
  @keyframes reveal { from { clip-path: inset(0 0 8% 0); } to { clip-path: inset(0); } }
}
