:root {
      --bg: #f6f7f8;
      --panel: #ffffff;
      --ink: #1f2933;
      --muted: #64748b;
      --line: #d8dee6;
      --accent: #d8b34a;
      --accent-dark: #a98221;
      --warn: #9a5b00;
      --danger: #b42318;
      --estimate: #c47a1b;
      --soft: #f1f5f9;
      --shadow: 0 14px 32px rgba(15, 23, 42, 0.10);
      --header-bg: rgba(255, 255, 255, 0.94);
      --map-filter: none;
    }
    body[data-theme="dark"] {
      --bg: #0e0f11;
      --panel: #151719;
      --ink: #f5f7fa;
      --muted: #a5adb8;
      --line: #2b3036;
      --accent: #f0c84f;
      --accent-dark: #d5a92c;
      --warn: #f0c36a;
      --danger: #f87171;
      --estimate: #f1a949;
      --soft: #1d2126;
      --shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
      --header-bg: rgba(21, 23, 25, 0.96);
      --map-filter: saturate(0.88) brightness(0.82) contrast(1.08);
    }
    body[data-theme="dark"] input,
    body[data-theme="dark"] select,
    body[data-theme="dark"] textarea {
      background: #101216;
      color: var(--ink);
      border-color: var(--line);
    }
    body[data-theme="dark"] h1,
    body[data-theme="dark"] h2,
    body[data-theme="dark"] h3,
    body[data-theme="dark"] p,
    body[data-theme="dark"] label,
    body[data-theme="dark"] summary,
    body[data-theme="dark"] .header-title,
    body[data-theme="dark"] .client-logo-text,
    body[data-theme="dark"] .section-title,
    body[data-theme="dark"] .viewer-head h2,
    body[data-theme="dark"] .defect-template-head h2 {
      color: var(--ink);
    }
    body[data-theme="dark"] .color-menu,
    body[data-theme="dark"] .mini-tooltip,
    body[data-theme="dark"] .stat,
    body[data-theme="dark"] .legend-item,
    body[data-theme="dark"] button.secondary,
    body[data-theme="dark"] .download.secondary,
    body[data-theme="dark"] .item,
    body[data-theme="dark"] .address-comment summary,
    body[data-theme="dark"] .viewer-panel,
    body[data-theme="dark"] .defect-template-panel,
    body[data-theme="dark"] .gps-editor,
    body[data-theme="dark"] .calendar-panel,
    body[data-theme="dark"] .all-dates-menu,
    body[data-theme="dark"] .all-dates-menu button,
    body[data-theme="dark"] .interfaces-header,
    body[data-theme="dark"] .interface-card,
    body[data-theme="dark"] .interface-row,
    body[data-theme="dark"] .interface-options,
    body[data-theme="dark"] .project-card,
    body[data-theme="dark"] .trash-card {
      background: var(--panel);
      color: var(--ink);
      border-color: var(--line);
    }
    body[data-theme="dark"] .copy:hover,
    body[data-theme="dark"] button.secondary:hover,
    body[data-theme="dark"] .download.secondary:hover,
    body[data-theme="dark"] .legend-editable:hover,
    body[data-theme="dark"] .legend-editable:focus,
    body[data-theme="dark"] .address-comment.has-comment summary,
    body[data-theme="dark"] .item:hover,
    body[data-theme="dark"] .item.active {
      background: #22200f;
      color: var(--ink);
    }
    body[data-theme="dark"] .photo-page-view,
    body[data-theme="dark"] .viewer img,
    body[data-theme="dark"] .viewer video,
    body[data-theme="dark"] .thumb img,
    body[data-theme="dark"] .thumb video,
    body[data-theme="dark"] .mini-tooltip img,
    body[data-theme="dark"] .client-logo-thumb {
      background: var(--soft);
    }
    body[data-theme="dark"] .muted,
    body[data-theme="dark"] .item span,
    body[data-theme="dark"] .header-status,
    body[data-theme="dark"] .projects-title p,
    body[data-theme="dark"] .interfaces-header h2,
    body[data-theme="dark"] .interface-options,
    body[data-theme="dark"] .photo-template-meta span {
      color: var(--muted);
    }
    body[data-theme="dark"] .interfaces-header h2,
    body[data-theme="dark"] .interface-pill,
    body[data-theme="dark"] .interfaces-list,
    body[data-theme="dark"] .interfaces-list .sub,
    body[data-theme="dark"] .trash-title,
    body[data-theme="dark"] .project-badge,
    body[data-theme="dark"] .interface-options label {
      color: var(--ink);
    }
    body[data-theme="dark"] .project-badge,
    body[data-theme="dark"] .copy {
      background: var(--soft);
      color: var(--ink);
      border-color: var(--line);
    }
    body[data-theme="dark"] .calendar-toggle,
    body[data-theme="dark"] .all-dates-toggle,
    body[data-theme="dark"] .calendar-panel,
    body[data-theme="dark"] .all-dates-menu,
    body[data-theme="dark"] .all-dates-menu button,
    body[data-theme="dark"] .leaflet-control-layers {
      background: rgba(21, 23, 25, 0.96);
      color: var(--ink);
      border-color: var(--line);
      box-shadow: var(--shadow);
    }
    body[data-theme="dark"] .calendar-head button,
    body[data-theme="dark"] .calendar-day {
      color: var(--ink);
      background: transparent;
      border-color: transparent;
    }
    body[data-theme="dark"] .calendar-head strong,
    body[data-theme="dark"] .calendar-weekday,
    body[data-theme="dark"] .leaflet-control-layers label {
      color: var(--muted);
    }
    body[data-theme="dark"] .calendar-day:hover,
    body[data-theme="dark"] .all-dates-menu button:hover,
    body[data-theme="dark"] .leaflet-control-layers label:hover {
      background: #22200f;
      color: var(--ink);
    }
    body[data-theme="dark"] .leaflet-control-layers-toggle {
      background-color: rgba(21, 23, 25, 0.96);
      border-radius: 10px;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: Arial, Helvetica, sans-serif;
      color: var(--ink);
      background: var(--bg);
    }
    header {
      padding: 14px 22px;
      background: var(--header-bg);
      border-bottom: 1px solid var(--line);
      display: grid;
      grid-template-columns: minmax(260px, 1fr) auto minmax(360px, 1fr);
      gap: 14px;
      align-items: center;
      min-height: 124px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }
    .brand-row {
      display: flex;
      align-items: center;
      gap: 14px;
      min-width: 0;
      align-self: stretch;
    }
    .brand-logo {
      width: auto;
      max-width: min(520px, 46vw);
      height: 100%;
      max-height: 112px;
      object-fit: contain;
      object-position: left center;
      display: block;
    }
    .client-logo {
      width: 116px;
      max-height: 62px;
      object-fit: contain;
      display: none;
      padding-left: 14px;
      border-left: 1px solid var(--line);
    }
    .client-logo.visible {
      display: block;
    }
    .header-copy {
      min-width: 0;
    }
    .header-title {
      margin: 0;
      text-align: center;
      font-family: Georgia, "Times New Roman", serif;
      font-size: 34px;
      line-height: 1;
      font-weight: 700;
      letter-spacing: 0.18em;
      color: var(--ink);
      text-transform: uppercase;
      justify-self: center;
      white-space: nowrap;
    }
    .theme-toggle {
      position: fixed;
      left: 50%;
      top: 12px;
      transform: translateX(-50%);
      z-index: 3200;
      width: 34px;
      height: 34px;
      min-height: 34px;
      padding: 0;
      border-radius: 50%;
      border: 1px solid var(--line);
      background: var(--panel);
      color: var(--ink);
      box-shadow: var(--shadow);
      font-size: 16px;
      line-height: 1;
    }
    .header-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
      width: 100%;
      max-width: 620px;
      grid-column: 3;
      justify-self: end;
    }
    .header-menu-toggle {
      display: none;
    }
    .header-status {
      grid-column: 1 / -1;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      color: var(--muted);
      font-size: 12px;
      min-height: 16px;
    }
    .color-menu {
      position: fixed;
      z-index: 3000;
      display: none;
      grid-template-columns: repeat(6, 26px);
      gap: 7px;
      padding: 9px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      box-shadow: 0 8px 26px rgba(15, 23, 42, 0.24);
    }
    .color-menu.visible {
      display: grid;
    }
    .color-choice {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      border: 2px solid #fff;
      outline: 1px solid var(--line);
      cursor: pointer;
    }
    .color-choice.default {
      border-radius: 6px;
      background:
        linear-gradient(135deg, transparent 43%, #b42318 44%, #b42318 56%, transparent 57%),
        #f8fafc;
    }
    .login-view,
    .projects-view {
      min-height: 100vh;
      background:
        radial-gradient(circle at top left, rgba(216, 179, 74, .16), transparent 34rem),
        var(--bg);
    }
    .login-view {
      display: grid;
      place-items: center;
      padding: 24px;
    }
    .login-view.hidden,
    .projects-view.hidden {
      display: none;
    }
    .login-panel {
      width: min(420px, 100%);
      padding: 24px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 10px;
      box-shadow: var(--shadow);
    }
    .login-panel img {
      display: block;
      width: auto;
      max-width: min(340px, 100%);
      max-height: 100px;
      object-fit: contain;
      margin: 0 auto 18px;
    }
    .login-panel h2,
    .projects-title h2 {
      margin: 0;
      font-family: Georgia, "Times New Roman", serif;
      color: var(--ink);
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }
    .login-panel h2 {
      text-align: center;
      font-size: 26px;
    }
    .login-panel label {
      display: grid;
      gap: 6px;
      margin-top: 14px;
      color: var(--muted);
      font-size: 13px;
      font-weight: 700;
    }
    .login-panel input {
      width: 100%;
    }
    .login-error {
      min-height: 18px;
      margin: 10px 0 0;
      color: var(--danger);
      font-size: 13px;
      font-weight: 700;
    }
    .login-panel button {
      width: 100%;
      margin-top: 8px;
    }
    .projects-view {
      display: block;
    }
    .projects-header {
      min-height: 104px;
      padding: 14px 22px;
      display: grid;
      grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
      align-items: center;
      gap: 14px;
      background: var(--header-bg);
      border-bottom: 1px solid var(--line);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }
    .projects-header img {
      width: auto;
      max-width: min(380px, 36vw);
      max-height: 88px;
      object-fit: contain;
      object-position: left center;
    }
    .projects-title {
      text-align: center;
    }
    .projects-title h2 {
      font-size: 28px;
      line-height: 1;
    }
    .projects-title p {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 13px;
    }
    .projects-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }
    .projects-list,
    .trash-list {
      display: grid;
      gap: 12px;
      padding: 20px 24px 0;
    }
    .trash-list {
      padding-top: 10px;
    }
    .project-card {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 12px;
      align-items: center;
      padding: 14px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 10px;
      box-shadow: var(--shadow);
    }
    .project-name {
      display: block;
      color: var(--ink);
      font-weight: 800;
      font-size: 16px;
    }
    .project-folder {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }
    .project-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .project-badge {
      min-height: 26px;
      display: inline-flex;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 0 10px;
      background: #f8fafc;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .project-buttons {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .trash-title {
      margin: 24px 24px 0;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .interfaces-view {
      display: none;
      min-height: calc(100vh - 124px);
      background: var(--bg);
    }
    .interfaces-view.visible {
      display: block;
    }
    .interfaces-header {
      min-height: 104px;
      padding: 14px 22px;
      display: grid;
      grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
      align-items: center;
      gap: 14px;
      background: #fff;
      border-bottom: 1px solid var(--line);
    }
    .interfaces-header img {
      width: auto;
      max-width: min(420px, 40vw);
      max-height: 92px;
      object-fit: contain;
      object-position: left center;
    }
    .interfaces-header h2 {
      margin: 0;
      font-family: Georgia, "Times New Roman", serif;
      font-size: 28px;
      line-height: 1;
      letter-spacing: 0.08em;
      color: #0b1f3a;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .interfaces-header button {
      justify-self: end;
    }
    .interfaces-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }
    .client-logo-text {
      width: 190px;
      height: 38px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      font-size: 14px;
    }
    .interfaces-list {
      display: grid;
      gap: 10px;
      padding: 20px 24px;
    }
    .interface-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      padding: 10px;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    .interface-row > button {
      height: 36px;
    }
    .interface-row > .copy:first-of-type {
      margin-left: auto;
    }
    .interface-options {
      display: inline-flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      flex: 1 1 360px;
      color: var(--muted);
      font-size: 12px;
    }
    .interface-options label {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
    }
    .interface-options input {
      width: auto;
      height: auto;
    }
    .interface-pill {
      min-height: 36px;
      border-radius: 999px;
      border: 1px solid var(--accent);
      padding: 0 14px;
      background: var(--accent);
      color: #fff;
      display: inline-flex;
      align-items: center;
      font-size: 14px;
      font-weight: 700;
    }
    .photo-page-view {
      display: none;
      min-height: 100vh;
      background: #fff;
      padding-top: 62px;
    }
    .photo-page-view.visible {
      display: block;
    }
    .photo-page-frame {
      width: 100%;
      height: calc(100vh - 62px);
      border: 0;
      display: block;
    }
    .photo-page-back {
      position: fixed;
      right: 24px;
      top: 12px;
      z-index: 5000;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.24);
    }
    .comments-view {
      display: none;
      min-height: calc(100vh - 124px);
      background: var(--bg);
    }
    .comments-view.visible {
      display: block;
    }
    .comments-header {
      min-height: 82px;
      padding: 16px 24px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(260px, 420px) auto;
      align-items: center;
      gap: 12px;
      background: var(--panel);
      border-bottom: 1px solid var(--line);
    }
    .comments-header h2 {
      margin: 0;
      font-size: 22px;
    }
    .comments-filter {
      display: grid;
      gap: 4px;
      color: var(--muted);
      font-size: 12px;
    }
    .comments-filter select {
      width: 100%;
      height: 38px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      color: var(--ink);
      background: var(--panel);
      font: inherit;
      font-size: 13px;
    }
    .comments-list {
      display: grid;
      gap: 10px;
      padding: 18px 24px 28px;
    }
    .comment-row {
      display: grid;
      grid-template-columns: 104px minmax(180px, .85fr) minmax(420px, 1.45fr);
      gap: 12px;
      align-items: start;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
    }
    .comment-thumb img,
    .comment-thumb video {
      width: 104px;
      height: 78px;
      border-radius: 6px;
      object-fit: cover;
      background: var(--soft);
      display: block;
    }
    .comment-thumb {
      width: 104px;
      min-height: 78px;
      height: auto;
      padding: 0;
      border: 0;
      border-radius: 6px;
      background: transparent;
      cursor: zoom-in;
    }
    .comment-thumb:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }
    .comment-meta {
      display: grid;
      gap: 5px;
      min-width: 0;
    }
    .comment-meta strong,
    .comment-meta span {
      overflow-wrap: anywhere;
    }
    .comment-meta span {
      color: var(--muted);
      font-size: 12px;
    }
    .comment-editor {
      display: grid;
      gap: 8px;
    }
    .comment-editor input,
    .comment-editor select,
    .comment-editor textarea {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--ink);
      background: var(--panel);
      font: inherit;
      font-size: 13px;
    }
    .comment-editor select {
      height: 36px;
      padding: 0 8px;
    }
    .comment-editor input,
    .comment-code-input {
      height: 36px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 9px;
      color: var(--ink);
      background: var(--panel);
      font: inherit;
      font-size: 13px;
    }
    .comment-editor textarea {
      min-height: 154px;
      padding: 9px;
      resize: vertical;
    }
    .copy {
      min-height: 36px;
      border-radius: 999px;
      border: 1px solid var(--line);
      padding: 0 14px;
      background: #fff;
      color: var(--ink);
      font-size: 14px;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      white-space: nowrap;
    }
    .copy:hover {
      border-color: var(--accent);
      background: #eef8f6;
    }
    h1 {
      margin: 0 0 6px;
      font-size: 24px;
      line-height: 1.25;
      font-weight: 700;
      letter-spacing: 0;
    }
    .sub {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
    }
    .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;
    }
    .layout {
      display: grid;
      grid-template-columns: minmax(390px, 500px) minmax(0, 1fr);
      height: calc(100vh - 124px);
      min-height: 640px;
    }
    aside {
      overflow: auto;
      background: var(--panel);
      border-right: 1px solid var(--line);
      padding: 16px;
    }
    #map {
      min-height: 640px;
      position: relative;
      filter: var(--map-filter);
    }
    .leaflet-control-layers {
      overflow: hidden;
      border: 1px solid var(--line) !important;
      border-radius: 12px !important;
      background: rgba(255, 255, 255, 0.96) !important;
      color: var(--ink);
      box-shadow: var(--shadow) !important;
      backdrop-filter: blur(10px);
    }
    .leaflet-control-layers-expanded {
      padding: 8px 10px !important;
    }
    .leaflet-control-layers label {
      display: flex;
      align-items: center;
      gap: 7px;
      margin: 4px 0;
      padding: 5px 7px;
      border-radius: 8px;
      color: var(--ink);
      font-size: 12px;
      line-height: 1.2;
      cursor: pointer;
    }
    .leaflet-control-layers label:hover {
      background: var(--soft);
    }
    .leaflet-control-layers input {
      width: auto;
      height: auto;
      margin: 0;
      accent-color: var(--accent);
    }
    .leaflet-control-layers-toggle {
      width: 40px !important;
      height: 40px !important;
      border-radius: 10px;
      background-color: rgba(255, 255, 255, 0.96);
      background-size: 22px 22px;
    }
    .residence-marker {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      background: #123f3b;
      border: 3px solid #fff;
      box-shadow: 0 3px 12px rgba(15, 23, 42, 0.35);
      font-weight: 700;
      font-size: 13px;
    }
    .residence-marker.active {
      background: #b42318;
      transform: scale(1.08);
    }
    .photo-cluster {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      background: #1d8276;
      border: 2px solid #fff;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.32);
      font-weight: 700;
      font-size: 13px;
    }
    .mini-tooltip {
      width: 170px;
    }
    .mini-tooltip img,
    .mini-tooltip video {
      width: 100%;
      height: 110px;
      object-fit: cover;
      display: block;
      border-radius: 4px;
      margin-bottom: 5px;
      background: #eef1f4;
    }
    .mini-tooltip strong {
      display: block;
      overflow-wrap: anywhere;
    }
    .map-back {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      z-index: 1500;
      display: none;
      height: 34px;
      padding: 0 12px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--panel);
      color: var(--ink);
      box-shadow: var(--shadow);
    }
    .map-back.visible { display: inline-flex; }
    .stats {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 8px;
      margin-bottom: 14px;
    }
    .stat {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: var(--soft);
    }
    .stat-button {
      height: auto;
      min-height: 0;
      display: block;
      width: 100%;
      color: var(--ink);
      text-align: left;
      cursor: pointer;
    }
    body:not([data-theme="dark"]) #photoCommentsCount {
      color: #000;
    }
    .stat-button:hover {
      border-color: var(--accent);
      background: #eef8f6;
    }
    .stat strong {
      display: block;
      font-size: 21px;
      line-height: 1.1;
    }
    .stat span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }
    .status-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 4px 0 14px;
      color: var(--muted);
      font-size: 12px;
    }
    .legend-item {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--panel);
    }
    .legend-swatches {
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: inline-block;
      border: 1px solid #fff;
      outline: 1px solid var(--line);
      flex: 0 0 auto;
    }
    .legend-editable {
      min-width: 90px;
      outline: 0;
      border-radius: 4px;
      padding: 2px 3px;
      color: var(--ink);
      cursor: text;
    }
    .legend-editable:hover,
    .legend-editable:focus {
      background: var(--soft);
      box-shadow: inset 0 0 0 1px var(--accent);
    }
    .legend-reset {
      height: 28px;
      min-height: 28px;
      border-radius: 999px;
      padding: 0 9px;
      font-size: 12px;
    }
    .legend-hint {
      color: var(--muted);
      font-style: italic;
    }
    .dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      display: inline-block;
      background: var(--accent);
    }
    .dot.estimated { background: var(--estimate); }
    .dot.empty { background: #94a3b8; }
    .tools {
      display: flex;
      gap: 8px;
      margin-bottom: 14px;
    }
    .tools.edit-actions {
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
    }
    .tools.edit-actions > button,
    .tools.edit-actions .export-toggle {
      height: 30px;
      min-height: 30px;
      padding: 0 9px;
      font-size: 11px;
      line-height: 1;
    }
    .export-menu {
      position: relative;
      display: inline-flex;
    }
    .export-toggle {
      border-radius: 999px;
    }
    .export-dropdown {
      position: absolute;
      left: 0;
      top: calc(100% + 6px);
      z-index: 1000;
      display: none;
      width: min(520px, calc(100vw - 36px));
      padding: 6px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: var(--shadow);
    }
    .export-menu.open .export-dropdown {
      display: grid;
      gap: 5px;
    }
    .export-dropdown .download,
    .export-dropdown button {
      width: 100%;
      justify-content: flex-start;
    }
    .edit-history-list {
      display: grid;
      gap: 6px;
      max-height: 310px;
      overflow: auto;
      padding: 4px 2px;
    }
    .edit-history-item {
      border: 1px solid var(--line);
      border-radius: 7px;
      padding: 8px;
      background: var(--soft);
      font-size: 12px;
      line-height: 1.35;
    }
    .edit-history-item strong,
    .edit-history-item span {
      display: block;
      overflow-wrap: anywhere;
    }
    .edit-history-item span {
      color: var(--muted);
      margin-top: 3px;
    }
    .edit-history-empty {
      margin: 0;
      padding: 10px;
      color: var(--muted);
      font-size: 12px;
    }
    input {
      width: 100%;
      min-width: 0;
      height: 38px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      font-size: 14px;
      color: var(--ink);
      background: var(--panel);
    }
    button, .download {
      height: 38px;
      border: 1px solid var(--accent);
      border-radius: 6px;
      padding: 0 12px;
      color: #fff;
      background: var(--accent);
      font-size: 14px;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      white-space: nowrap;
    }
    button:hover, .download:hover { background: var(--accent-dark); }
    button.secondary, .download.secondary {
      color: var(--ink);
      background: var(--panel);
      border-color: var(--line);
    }
    button.secondary:hover, .download.secondary:hover {
      border-color: var(--accent);
      background: var(--soft);
    }
    button.active {
      color: #fff;
      background: var(--accent-dark);
      border-color: var(--accent-dark);
    }
    .filter-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 6px;
      margin: 8px 0 12px;
    }
    .filter-row button {
      height: 34px;
      padding: 0 8px;
      font-size: 12px;
    }
    .section-title {
      margin: 16px 0 8px;
      font-size: 15px;
      line-height: 1.35;
    }
    .list {
      display: grid;
      gap: 8px;
    }
    .item {
      width: 100%;
      text-align: left;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: var(--panel);
      cursor: pointer;
      box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    }
    .item:hover, .item.active {
      border-color: var(--accent);
      background: var(--soft);
    }
    .item strong {
      display: block;
      overflow-wrap: anywhere;
      font-size: 13px;
      margin-bottom: 4px;
    }
    .item span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }
    .thumb {
      display: grid;
      grid-template-columns: 92px minmax(0, 1fr);
      gap: 10px;
      align-items: center;
    }
    .thumb img,
    .thumb video {
      width: 92px;
      height: 68px;
      object-fit: cover;
      border-radius: 4px;
      border: 1px solid var(--line);
      background: var(--soft);
    }
    .selected-panel {
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--soft);
      padding: 12px;
      margin: 14px 0;
    }
    .selected-panel h2 {
      margin: 0 0 8px;
      font-size: 16px;
      line-height: 1.35;
    }
    .selected-meta {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
    }
    .selected-meta strong {
      display: block;
      color: var(--ink);
      font-size: 15px;
    }
    .list.compact {
      max-height: 280px;
      overflow: auto;
      padding-right: 2px;
    }
    .address-comment {
      margin-top: 10px;
    }
    .address-comment summary {
      display: inline-flex;
      align-items: center;
      height: 30px;
      padding: 0 10px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: #fff;
      cursor: pointer;
      font-size: 13px;
    }
    .address-comment.has-comment summary {
      border-color: var(--accent);
      background: #eef8f6;
      color: var(--accent-dark);
    }
    .address-comment textarea {
      width: 100%;
      min-height: 76px;
      margin-top: 8px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 9px;
      font: inherit;
      font-size: 14px;
      resize: vertical;
    }
    .defect-tools {
      display: grid;
      grid-template-columns: minmax(120px, 160px) minmax(180px, 1fr) auto;
      gap: 8px;
      margin-top: 10px;
    }
    #viewer[data-comment-editor="false"] .defect-tools {
      display: none;
    }
    .defect-tools input,
    .defect-tools select {
      height: 38px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      font: inherit;
      background: #fff;
    }
    .defect-tools button {
      white-space: nowrap;
    }
    .defect-template-modal {
      position: fixed;
      inset: 0;
      z-index: 3600;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 22px;
      background: rgba(0, 0, 0, .62);
    }
    .defect-template-panel {
      width: min(980px, 96vw);
      max-height: 92vh;
      overflow: auto;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel);
      box-shadow: var(--shadow);
    }
    .defect-template-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }
    .defect-template-head h2 {
      margin: 0;
      font-size: 18px;
    }
    .defect-template-grid {
      display: grid;
      gap: 10px;
    }
    .defect-template-row {
      display: grid;
      grid-template-columns: 82px minmax(180px, 260px) minmax(0, 1fr) auto;
      gap: 10px;
      align-items: end;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--soft);
    }
    .defect-template-code {
      align-self: center;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .defect-template-grid label {
      display: grid;
      gap: 5px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .defect-template-grid textarea {
      width: 100%;
      min-height: 74px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 9px;
      color: var(--ink);
      background: var(--panel);
      font: inherit;
      font-size: 13px;
      resize: vertical;
    }
    .defect-template-grid input {
      width: 100%;
      height: 36px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 9px;
      color: var(--ink);
      background: var(--panel);
      font: inherit;
      font-size: 13px;
    }
    .defect-template-remove {
      align-self: end;
      min-height: 36px;
    }
    .defect-template-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 12px;
    }
    .photo-template-toolbar {
      display: grid;
      grid-template-columns: minmax(180px, 1fr) minmax(190px, auto);
      gap: 8px;
      margin-bottom: 12px;
    }
    .photo-template-list {
      display: grid;
      gap: 8px;
      max-height: min(66vh, 680px);
      overflow: auto;
      padding-right: 2px;
    }
    .photo-template-row {
      display: grid;
      grid-template-columns: 76px minmax(0, 1fr) minmax(220px, 300px);
      gap: 10px;
      align-items: center;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--soft);
    }
    .photo-template-row img,
    .photo-template-row video {
      width: 76px;
      height: 56px;
      object-fit: cover;
      border-radius: 5px;
      border: 1px solid var(--line);
      background: var(--panel);
    }
    .photo-template-meta strong,
    .photo-template-meta span {
      display: block;
      overflow-wrap: anywhere;
    }
    .photo-template-meta strong {
      font-size: 13px;
      color: var(--ink);
    }
    .photo-template-meta span {
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.25;
    }
    .photo-template-row select {
      width: 100%;
      height: 38px;
    }
    .warn {
      border: 1px solid #f0d08a;
      background: #fff8e8;
      border-radius: 6px;
      padding: 10px;
      color: var(--warn);
      font-size: 13px;
      line-height: 1.4;
    }
    .viewer {
      position: fixed;
      inset: 0;
      z-index: 2000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: rgba(15, 23, 42, 0.72);
    }
    .viewer.open { display: flex; }
    .viewer-panel {
      width: min(980px, 96vw);
      max-height: 94vh;
      overflow: auto;
      background: var(--panel);
      border-radius: 10px;
      border: 1px solid var(--line);
      padding: 14px;
      box-shadow: var(--shadow);
      touch-action: pan-y;
    }
    .viewer-head {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      margin-bottom: 10px;
    }
    .viewer-head h2 {
      margin: 0;
      font-size: 16px;
      overflow-wrap: anywhere;
    }
    .viewer-media-frame {
      position: relative;
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 6px;
      overflow: hidden;
      background: var(--soft);
    }
    .viewer img,
    .viewer video {
      display: block;
      width: 100%;
      max-height: 68vh;
      object-fit: contain;
      border: 0;
      border-radius: 0;
      background: transparent;
    }
    .viewer-annotations {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      touch-action: none;
    }
    .viewer-annotations.editing {
      pointer-events: auto;
      cursor: crosshair;
    }
    .viewer-annotations * {
      vector-effect: non-scaling-stroke;
    }
    .annotation-tools {
      display: none;
      grid-template-columns: repeat(5, auto);
      gap: 8px;
      justify-content: flex-start;
      align-items: center;
      margin-top: 10px;
    }
    #viewer[data-comment-editor="true"] .annotation-tools {
      display: grid;
    }
    .annotation-tools button.active {
      background: var(--accent-dark);
      border-color: var(--accent-dark);
      color: #fff;
    }
    .danger-soft {
      border-color: #b42318;
      color: #b42318;
      background: transparent;
    }
    .viewer-panel.fullscreen {
      width: 100vw;
      height: 100vh;
      max-height: 100vh;
      overflow: auto;
      border-radius: 0;
      border: 0;
      padding: 12px;
      display: grid;
      grid-template-rows: auto auto auto auto auto auto;
    }
    .viewer-panel.fullscreen img,
    .viewer-panel.fullscreen video {
      max-height: 82vh;
    }
    .viewer-fullscreen-close {
      display: none;
      position: sticky;
      top: 0;
      margin-left: auto;
      z-index: 4;
      width: 38px;
      min-height: 38px;
      height: 38px;
      padding: 0;
      border-radius: 50%;
      font-size: 18px;
      line-height: 1;
    }
    .viewer-panel.fullscreen .viewer-fullscreen-close {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .viewer-actions {
      display: grid;
      grid-template-columns: repeat(5, auto);
      gap: 8px;
      justify-content: flex-end;
      align-items: center;
    }
    .viewer-actions button {
      white-space: nowrap;
    }
    .comment-box {
      width: 100%;
      min-height: 84px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 10px;
      margin-top: 10px;
      font: inherit;
      font-size: 14px;
      color: var(--ink);
      background: var(--panel);
    }
    .comment-box[readonly] {
      background: var(--soft);
      cursor: default;
    }
    .gps-editor {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      gap: 8px;
      margin-top: 10px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--soft);
    }
    .gps-editor label {
      display: grid;
      gap: 4px;
      font-size: 12px;
      color: var(--muted);
    }
    .gps-editor input {
      height: 34px;
      background: var(--panel);
    }
    .gps-editor button {
      height: 34px;
      align-self: end;
    }
    .map-pick-note {
      display: none;
      position: absolute;
      left: 50%;
      top: 14px;
      transform: translateX(-50%);
      z-index: 1600;
      padding: 8px 12px;
      border-radius: 999px;
      background: #111827;
      color: #fff;
      font-size: 13px;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.22);
    }
    .map-pick-note.visible { display: block; }
    .date-history {
      position: absolute;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 1450;
      display: flex;
      align-items: flex-start;
      gap: 8px;
      max-width: min(760px, calc(100vw - 40px));
    }
    .calendar-shell {
      position: relative;
    }
    .calendar-toggle {
      height: 32px;
      border-radius: 999px;
      padding: 0 10px;
      color: var(--ink);
      background: color-mix(in srgb, var(--panel) 94%, transparent);
      border-color: var(--line);
      font-size: 12px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }
    .calendar-panel,
    .all-dates-menu {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: color-mix(in srgb, var(--panel) 94%, transparent);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }
    .calendar-panel {
      position: absolute;
      left: 0;
      top: calc(100% + 6px);
      display: none;
      width: 238px;
      padding: 8px;
      font-size: 12px;
    }
    .calendar-shell.open .calendar-panel {
      display: block;
    }
    .calendar-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }
    .calendar-head strong {
      font-size: 12px;
      text-transform: capitalize;
    }
    .calendar-head button {
      height: 28px;
      min-width: 28px;
      padding: 0 8px;
    }
    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 3px;
    }
    .calendar-weekday {
      color: var(--muted);
      text-align: center;
      font-size: 10px;
      padding: 3px 0;
    }
    .calendar-day {
      position: relative;
      height: 26px;
      min-height: 26px;
      border-radius: 6px;
      border-color: transparent;
      padding: 0;
      color: var(--ink);
      background: transparent;
      font-size: 12px;
    }
    .calendar-day:hover {
      background: var(--soft);
      border-color: var(--line);
    }
    .calendar-day.has-photos::after {
      content: "";
      position: absolute;
      left: 50%;
      bottom: 3px;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      transform: translateX(-50%);
      background: var(--accent);
    }
    .calendar-day.active {
      color: #fff;
      background: var(--accent-dark);
    }
    .calendar-day.active::after {
      background: #fff;
    }
    .history-side {
      position: relative;
      display: grid;
      gap: 6px;
    }
    .all-dates-toggle {
      height: 32px;
      border-radius: 999px;
      padding: 0 9px;
      color: var(--ink);
      background: color-mix(in srgb, var(--panel) 94%, transparent);
      border-color: var(--line);
      font-size: 12px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }
    .all-dates-toggle.active {
      color: #fff;
      background: var(--accent-dark);
      border-color: var(--accent-dark);
    }
    .all-dates-menu {
      display: none;
      min-width: 190px;
      max-height: 250px;
      overflow: auto;
      padding: 6px;
    }
    .history-side.open .all-dates-menu {
      display: grid;
      gap: 5px;
    }
    .all-dates-menu button {
      height: 28px;
      justify-content: flex-start;
      padding: 0 9px;
      color: var(--ink);
      background: var(--panel);
      border-color: var(--line);
      font-size: 12px;
    }
    .all-dates-menu button.active {
      color: #fff;
      background: var(--accent-dark);
      border-color: var(--accent-dark);
    }
    .danger {
      border-color: #b42318;
      background: #b42318;
    }
    .danger:hover { background: #8f1d14; }
    .excluded-note {
      display: none;
      margin: 8px 0 0;
      padding: 8px;
      border-radius: 6px;
      background: #fee2e2;
      color: #8f1d14;
      font-size: 13px;
    }
    .excluded-note.visible { display: block; }
    .popup {
      width: min(420px, 76vw);
    }
    .popup img,
    .popup video {
      width: 100%;
      max-height: 300px;
      object-fit: contain;
      border-radius: 6px;
      background: #eef1f4;
      border: 1px solid var(--line);
    }
    .popup h2 {
      margin: 8px 0;
      font-size: 16px;
      overflow-wrap: anywhere;
    }
    .meta {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .meta th, .meta td {
      border-top: 1px solid var(--line);
      padding: 5px 0;
      text-align: left;
      vertical-align: top;
    }
    .meta th {
      width: 112px;
      color: var(--muted);
      font-weight: 400;
      padding-right: 8px;
    }
    @media (max-width: 900px) {
      body {
        overflow: auto;
      }
      header {
        position: relative;
        padding: 10px 58px 10px 10px;
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        min-height: 0;
        align-items: center;
      }
      .brand-row {
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        align-self: auto;
      }
      .brand-logo {
        width: auto;
        height: auto;
        max-width: min(280px, 76vw);
        max-height: 62px;
      }
      .header-title {
        font-size: 24px;
        letter-spacing: 0.08em;
        justify-self: center;
        text-align: center;
        white-space: normal;
      }
      .header-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 42px;
        min-height: 42px;
        height: 42px;
        padding: 0;
        font-size: 22px;
        line-height: 1;
      }
      .client-logo {
        width: 76px;
        max-height: 42px;
        padding-left: 0;
        border-left: 0;
      }
      .header-actions {
        justify-content: stretch;
        display: none;
        grid-template-columns: 1fr;
        max-width: none;
        grid-column: 1;
        justify-self: stretch;
        gap: 6px;
      }
      header.menu-open .header-actions {
        display: grid;
      }
      .header-actions button,
      .header-actions .download {
        width: 100%;
        min-width: 0;
        white-space: normal;
        line-height: 1.15;
        height: auto;
        min-height: 38px;
        padding: 6px 8px;
      }
      .header-status {
        display: none;
      }
      .export-menu {
        width: 100%;
      }
      .export-toggle {
        width: 100%;
      }
      .projects-header {
        grid-template-columns: 1fr;
      }
      .projects-header img {
        max-width: min(340px, 88vw);
      }
      .projects-title {
        text-align: left;
      }
      .projects-title h2 {
        font-size: 22px;
      }
      .projects-actions,
      .project-buttons {
        display: grid;
        grid-template-columns: 1fr;
      }
      .project-card {
        grid-template-columns: 1fr;
      }
      .interfaces-header {
        grid-template-columns: 1fr;
      }
      .interfaces-header img {
        max-width: min(340px, 88vw);
      }
      .interfaces-header h2 {
        font-size: 22px;
      }
      .interfaces-header button {
        justify-self: stretch;
      }
      .interfaces-actions {
        display: grid;
        grid-template-columns: 1fr;
      }
      .comments-header {
        grid-template-columns: 1fr;
        align-items: stretch;
        padding: 12px;
      }
      .comments-list {
        padding: 12px;
      }
      .comment-row {
        grid-template-columns: 78px minmax(0, 1fr);
      }
      .comment-thumb img,
      .comment-thumb video {
        width: 78px;
        height: 58px;
      }
      .comment-thumb {
        width: 78px;
        min-height: 58px;
      }
      .comment-editor {
        grid-column: 1 / -1;
      }
      .client-logo-text {
        width: 100%;
      }
      h1 {
        font-size: 18px;
        margin: 0;
      }
      .sub {
        display: none;
      }
      .layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
      }
      aside {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        order: 2;
        max-height: 56vh;
        padding: 10px;
      }
      #map {
        order: 1;
        height: 44vh;
        min-height: 340px;
      }
      .stats, .filter-row {
        grid-template-columns: repeat(2, 1fr);
      }
      .stats {
        gap: 6px;
        margin-bottom: 8px;
      }
      .stat {
        padding: 8px;
      }
      .stat strong {
        font-size: 17px;
      }
      .stat span {
        font-size: 11px;
      }
      .status-legend {
        display: none;
      }
      .tools {
        gap: 6px;
        overflow-x: auto;
        margin-bottom: 8px;
        padding-bottom: 2px;
      }
      input {
        height: 42px;
        font-size: 16px;
      }
      button, .download {
        min-height: 42px;
        height: 42px;
        padding: 0 11px;
        font-size: 13px;
      }
      .section-title {
        margin: 10px 0 6px;
      }
      .list.compact {
        max-height: 170px;
      }
      .thumb {
        grid-template-columns: 78px minmax(0, 1fr);
      }
      .thumb img,
      .thumb video {
        width: 78px;
        height: 58px;
      }
      .selected-panel {
        padding: 10px;
        margin: 10px 0;
      }
      .selected-meta {
        grid-template-columns: repeat(2, 1fr);
      }
      .date-history {
        top: 8px;
        left: 50%;
        width: calc(100% - 118px);
        max-width: calc(100% - 118px);
        flex-wrap: wrap;
        justify-content: center;
      }
      .calendar-panel {
        width: min(238px, 100%);
      }
      .history-side {
        max-width: 100%;
      }
      .map-back {
        left: 10px;
        top: auto;
        bottom: 12px;
        transform: none;
        height: 38px;
      }
      .map-pick-note {
        top: 50px;
        width: calc(100% - 28px);
        text-align: center;
        border-radius: 8px;
      }
      .residence-marker {
        width: 38px;
        height: 38px;
        font-size: 12px;
      }
      .photo-cluster {
        width: 36px;
        height: 36px;
      }
      .mini-tooltip {
        width: 132px;
      }
      .mini-tooltip img,
      .mini-tooltip video {
        height: 82px;
      }
      .leaflet-control-layers {
        font-size: 12px;
      }
      .viewer {
        padding: 0;
        align-items: stretch;
      }
      .viewer-panel {
        width: 100vw;
        max-height: 100vh;
        height: 100vh;
        overflow: auto;
        border: 0;
        border-radius: 0;
        padding: 10px;
      }
      .viewer-head {
        align-items: start;
        grid-template-columns: 1fr;
        gap: 8px;
      }
      .viewer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
      }
      .viewer-actions button {
        width: 100%;
        padding: 0 6px;
      }
      .viewer img,
      .viewer video {
        max-height: 44vh;
      }
      .viewer-panel.fullscreen img,
      .viewer-panel.fullscreen video {
        width: 100%;
        height: auto;
        max-height: none;
        min-height: 68vh;
        max-height: 86vh;
        object-fit: contain;
      }
      .viewer-panel.fullscreen {
        padding: 8px;
        display: block;
      }
      .viewer-panel.fullscreen .viewer-head {
        display: none;
      }
      .viewer-panel.fullscreen img,
      .viewer-panel.fullscreen video {
        width: 100%;
        height: auto;
        max-height: 86vh;
        min-height: 68vh;
        object-fit: contain;
      }
      @media (orientation: portrait) {
        .viewer-panel.fullscreen {
          display: grid;
          grid-template-rows: auto minmax(100vw, auto) auto auto auto;
          align-items: start;
        }
        .viewer-panel.fullscreen img,
        .viewer-panel.fullscreen video {
          width: calc(100vh - 74px);
          max-width: calc(100vh - 74px);
          height: calc(100vw - 18px);
          min-height: 0;
          max-height: calc(100vw - 18px);
          margin: 6px auto 14px;
          transform: rotate(90deg);
          transform-origin: center center;
          object-fit: contain;
        }
      }
      .gps-editor {
        grid-template-columns: 1fr;
      }
      .defect-tools {
        grid-template-columns: 1fr;
      }
      .defect-template-row {
        grid-template-columns: 1fr;
        align-items: stretch;
      }
      .defect-template-remove {
        width: 100%;
      }
      .comment-box {
        min-height: 72px;
      }
    }
    @media (max-width: 520px) {
      .brand-row {
        justify-content: center;
      }
      .header-title {
        font-size: 20px;
      }
    }
    @media print {
      header, aside { break-inside: avoid; }
      .layout { display: block; height: auto; }
      #map { height: 720px; border-top: 1px solid var(--line); }
      .tools { display: none; }
    }
