:root {
  color-scheme: light;
  --bg: #f4f7f4;
  --panel: #ffffff;
  --ink: #1b2625;
  --muted: #62706d;
  --line: #d9e2df;
  --brand: #1f5f5b;
  --brand-2: #2f7d72;
  --accent: #e0a72f;
  --danger: #b8453c;
  --shadow: 0 18px 48px rgba(28, 48, 46, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

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

button,
.file-button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.file-button:hover {
  background: var(--brand-2);
}

button.danger {
  background: var(--danger);
}

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

textarea {
  min-height: 86px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.app-header {
  display: none;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
}

.license-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: #f8fbfa;
  font-size: 12px;
  margin-left: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.license-pill.active {
  border-color: rgba(31, 95, 91, 0.35);
  color: var(--brand);
  background: #e9f4f1;
}

.app-notice {
  position: fixed;
  left: 50%;
  top: max(10px, env(safe-area-inset-top));
  z-index: 200;
  width: min(520px, calc(100vw - 24px));
  transform: translateX(-50%);
  padding: 11px 14px;
  border: 1px solid rgba(31, 95, 91, 0.22);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(20, 36, 34, 0.22);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: app-notice-enter 180ms ease-out;
}

.app-notice.success {
  border-color: rgba(31, 95, 91, 0.32);
  background: #e9f4f1;
  color: var(--brand);
}

.app-notice.warning {
  border-color: rgba(224, 167, 47, 0.42);
  background: #fff8e4;
  color: #73510d;
}

.app-notice.error {
  border-color: rgba(184, 69, 60, 0.36);
  background: #fff0ee;
  color: #7c2f28;
}

@keyframes app-notice-enter {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(420px, 1fr) minmax(280px, 340px);
  gap: 14px;
  padding: 8px;
  height: 100vh;
}

.app-shell.left-panel-collapsed {
  grid-template-columns: 48px minmax(420px, 1fr) minmax(280px, 340px);
}

.app-shell.right-panel-collapsed {
  grid-template-columns: minmax(280px, 340px) minmax(420px, 1fr) 48px;
}

.app-shell.left-panel-collapsed.right-panel-collapsed {
  grid-template-columns: 48px minmax(420px, 1fr) 48px;
}

.panel,
.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

.project-panel,
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
}

.panel-rail-toggle {
  min-height: 34px;
  padding: 7px 9px;
  background: #eef5f3;
  color: var(--brand);
  border-color: var(--line);
}

.app-shell.left-panel-collapsed .project-panel,
.app-shell.right-panel-collapsed .side-panel {
  padding: 7px;
  overflow: hidden;
}

.app-shell.left-panel-collapsed .project-panel > :not(.panel-rail-toggle),
.app-shell.right-panel-collapsed .side-panel > :not(.panel-rail-toggle) {
  display: none !important;
}

.app-shell.left-panel-collapsed .project-panel .panel-rail-toggle,
.app-shell.right-panel-collapsed .side-panel .panel-rail-toggle {
  writing-mode: vertical-rl;
  width: 32px;
  min-height: 86px;
  justify-self: center;
  align-self: start;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 16px;
}

.panel-heading.compact {
  margin-top: 8px;
}

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

.collapsible-section.collapsed .collapsible-body {
  display: none;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.collapse-toggle {
  min-height: 30px;
  padding-inline: 8px;
  background: #eef5f3;
  color: var(--brand);
  border-color: var(--line);
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
  flex: 1;
  min-width: min(100%, 228px);
}

.project-actions button {
  min-height: 34px;
  padding-inline: 8px;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.file-button input {
  display: none;
}

.symbol-editor,
.photo-list,
.quantity-table {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#symbolEditor {
  display: none !important;
}

.settings-summary {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
}

.settings-summary div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  font-size: 12px;
}

.settings-summary strong {
  color: var(--muted);
}

.settings-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-row,
.photo-row,
.quantity-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fbfdfc;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
}

button.quantity-row {
  width: 100%;
  min-height: auto;
  text-align: left;
  color: var(--ink);
}

.symbol-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
}

.symbol-chip {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.symbol-preview {
  background: transparent;
  color: inherit;
}

.symbol-preview svg {
  display: block;
}

.symbol-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.symbol-fields input,
.symbol-fields select {
  min-height: 32px;
  font-size: 12px;
}

.symbol-summary strong,
.symbol-summary span {
  display: block;
}

.symbol-summary strong {
  font-size: 13px;
}

.symbol-summary span,
.symbol-preset-item small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.symbol-builder,
.custom-path-input {
  grid-column: 1 / -1;
}

.symbol-builder {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  align-items: center;
}

.symbol-builder-preview {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.symbol-builder-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.symbol-builder-tools button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.symbol-help {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  position: relative;
}

.canvas-guide {
  position: absolute;
  left: 50%;
  top: 58px;
  z-index: 35;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 95, 91, 0.94);
  color: #fff;
  font-weight: 750;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(20, 36, 34, 0.22);
  pointer-events: none;
}

.toolbar {
  position: relative;
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.toolbar-brand {
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  padding: 0 4px 0 0;
}

.toolbar-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #ffffff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.toolbar-help-link:hover {
  border-color: rgba(31, 95, 91, 0.35);
  background: #eef5f3;
}

.mobile-menu-button {
  display: none;
}

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(17, 28, 26, 0.32);
}

.app-shell.mobile-layout {
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell.mobile-layout.left-panel-collapsed,
.app-shell.mobile-layout.right-panel-collapsed,
.app-shell.mobile-layout.left-panel-collapsed.right-panel-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.mobile-layout .mobile-menu-button {
  display: inline-flex;
}

.app-shell.mobile-layout .project-panel,
.app-shell.mobile-layout .side-panel {
  position: fixed;
  inset: 50px 8px 8px;
  z-index: 130;
  display: none;
  width: auto;
  max-width: none;
  min-width: 0;
  box-shadow: 0 20px 60px rgba(20, 36, 34, 0.26);
}

.app-shell.mobile-layout.mobile-project-open .project-panel,
.app-shell.mobile-layout.mobile-data-open .side-panel {
  display: flex;
}

.app-shell.mobile-layout .workspace {
  grid-column: 1;
}

.app-shell.mobile-layout.left-panel-collapsed .project-panel,
.app-shell.mobile-layout.right-panel-collapsed .side-panel {
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-shell.mobile-layout.left-panel-collapsed .project-panel > :not(.panel-rail-toggle),
.app-shell.mobile-layout.right-panel-collapsed .side-panel > :not(.panel-rail-toggle) {
  display: revert !important;
}

.app-shell.mobile-layout.left-panel-collapsed .project-panel .panel-rail-toggle,
.app-shell.mobile-layout.right-panel-collapsed .side-panel .panel-rail-toggle {
  writing-mode: horizontal-tb;
  width: auto;
  min-height: 32px;
  align-self: stretch;
}

.toolbar button,
.toolbar .file-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

#openLayerSettings.active {
  background: var(--brand-2);
}

.toolbar > select {
  display: none;
  min-width: 150px;
  max-width: 220px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.toolbar > select.visible {
  display: block;
}

.pen-controls,
.shape-controls {
  display: none;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.pen-controls {
  grid-template-columns: auto minmax(110px, 150px) 42px auto;
}

.pen-controls.visible {
  display: grid;
}

.shape-controls.visible {
  display: flex;
  flex-wrap: wrap;
}

.measure-control {
  display: none;
}

.shape-controls.measuring .measure-control {
  display: inline-flex;
}

.pen-controls label,
.shape-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pen-controls input[type="color"],
.shape-controls input[type="color"] {
  width: 34px;
  min-height: 30px;
  padding: 2px;
}

.pen-controls input[type="range"],
.shape-controls input[type="range"] {
  min-height: 30px;
  padding: 0;
}

.shape-controls input[type="range"] {
  width: 76px;
}

.shape-controls select {
  min-height: 30px;
  width: 70px;
}

.shape-preview {
  display: grid;
  place-items: center;
  min-width: 96px;
  min-height: 34px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.shape-preview svg {
  display: block;
  width: 96px;
  height: 34px;
}

.dialog-shape-preview {
  margin-top: 10px;
  min-height: 70px;
}

.dialog-shape-preview svg {
  width: 180px;
  height: 70px;
}

.pen-controls span {
  font-size: 12px;
  color: var(--muted);
}

.pen-controls button {
  min-height: 30px;
  padding: 0 8px;
}

#undoPenStroke {
  display: none !important;
}

.route-controls {
  display: none;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.route-controls.visible {
  display: grid;
}

.route-controls button {
  min-height: 30px;
  padding: 0 12px;
}

.zoom-controls {
  display: grid;
  grid-template-columns: 82px 38px minmax(90px, 1fr) 38px 58px;
  gap: 6px;
  align-items: center;
}

.zoom-controls button {
  min-height: 34px;
  padding: 0 8px;
}

#undoChange {
  white-space: nowrap;
}

.zoom-controls input {
  min-height: 34px;
  padding: 0;
}

.selection-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.selection-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.selection-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.layer-controls {
  display: none;
  position: absolute;
  right: 8px;
  top: calc(100% + 6px);
  z-index: 20;
  box-shadow: 0 14px 34px rgba(28, 48, 46, 0.18);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.layer-controls.visible {
  display: flex;
  flex-wrap: wrap;
  max-width: min(520px, calc(100vw - 40px));
}

.layer-controls label {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.layer-controls input {
  width: auto;
  min-height: auto;
}

.note-style-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.note-style-panel[hidden] {
  display: none;
}

#dialogMemoLabel[hidden] {
  display: none !important;
}

.dialog-photo-preview {
  width: min(220px, 100%);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  cursor: zoom-in;
}

.dialog-photo-preview[hidden] {
  display: none;
}

.dialog-photo-preview img {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 6px;
}

.dialog-photo-preview.expanded {
  position: fixed;
  inset: 16px;
  z-index: 1000;
  width: auto;
  max-width: none;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(18, 28, 27, 0.82);
  border-color: transparent;
  box-shadow: var(--shadow);
  cursor: zoom-out;
}

.dialog-photo-preview.expanded img {
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  object-fit: contain;
}

.note-style-panel input[type="color"] {
  min-height: 36px;
  padding: 2px;
}

#photoStylePanel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

#photoStylePanel label {
  min-height: 52px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  font-size: 12px;
}

#photoStylePanel label:has(input[type="color"]) {
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
}

#photoStylePanel input[type="color"] {
  width: 58px;
  min-height: 38px;
  justify-self: end;
  padding: 2px;
}

#photoStylePanel .check-row {
  grid-column: span 2;
  min-height: 42px;
}

#photoStylePanel label:has(#photoDirectionScale) {
  grid-column: auto;
}

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

.segmented button {
  background: #edf3f1;
  color: var(--ink);
  min-height: 34px;
  padding: 0 10px;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.drawing-frame {
  position: relative;
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: none;
  background:
    linear-gradient(90deg, rgba(31, 95, 91, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(31, 95, 91, 0.06) 1px, transparent 1px),
    #eef4f2;
  background-size: 24px 24px;
}

.drawing-frame::-webkit-scrollbar {
  display: none;
}

.drawing-stage {
  position: relative;
  width: 1200px;
  height: 820px;
  margin: 28px auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(34, 46, 44, 0.16);
}

.drawing-stage img,
.drawing-stage object,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.drawing-stage img,
.drawing-stage object {
  object-fit: contain;
  display: none;
}

#overlay {
  cursor: crosshair;
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 28px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  z-index: 2;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.empty-card {
  display: grid;
  gap: 12px;
  max-width: min(520px, calc(100vw - 48px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(20, 36, 34, 0.12);
}

.empty-card ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 1.35em;
  text-align: left;
  font-size: 13px;
  line-height: 1.55;
}

.marker-symbol {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  cursor: grab;
}

.marker-symbol:active {
  cursor: grabbing;
}

[data-action="resize"] {
  cursor: nwse-resize;
}

[data-action="direction"] {
  cursor: crosshair;
}

.photo-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  text-align: left;
  align-items: start;
}

.photo-row[draggable="true"] {
  cursor: grab;
}

.photo-row.dragging {
  opacity: 0.55;
}

.photo-row.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photo-row img {
  width: 76px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.photo-row strong,
.quantity-row strong {
  display: block;
  font-size: 13px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-row span,
.quantity-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.photo-row > span,
.quantity-row > span {
  min-width: 0;
}

.photo-row > span > span,
.quantity-row > span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.license-box {
  display: grid;
  gap: 8px;
}

.backup-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 13px;
}

.backup-status span {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

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

.backup-list {
  display: grid;
  gap: 8px;
  max-height: min(420px, 52vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.project-list {
  display: grid;
  gap: 8px;
  max-height: min(520px, 56vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.project-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-list-row.active {
  border-color: rgba(31, 95, 91, 0.35);
  background: #eef5f3;
}

.project-list-row > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.project-list-row strong,
.project-list-row span,
.project-list-row small {
  overflow-wrap: anywhere;
}

.project-list-row span,
.project-list-row small {
  color: var(--muted);
}

.project-list-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--brand);
  color: #fff !important;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.project-list-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, auto));
  gap: 6px;
}

.project-list-actions button {
  min-width: 0;
  padding-inline: 10px;
}

.project-list-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.backup-row.invalid {
  border-color: rgba(184, 69, 60, 0.45);
  background: #fff7f6;
}

.backup-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.backup-row span,
.backup-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.backup-row-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px;
}

.backup-row-actions button {
  min-width: 66px;
  padding-inline: 10px;
}

.backup-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.export-option {
  margin-top: auto;
}

.export-grid button {
  min-height: 42px;
}

.export-drawing-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.export-drawing-list .check-row {
  justify-content: flex-start;
  align-items: flex-start;
}

.output-result {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

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

.output-result span,
.output-result small {
  overflow-wrap: anywhere;
}

.output-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--green);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(460px, calc(100vw - 24px));
  padding: 18px;
  box-shadow: var(--shadow);
}

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

dialog h2 {
  margin: 0 0 14px;
}

dialog form {
  display: grid;
  gap: 12px;
}

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

.shortcut-settings-list {
  display: grid;
  gap: 8px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: 1fr minmax(72px, 96px);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.shortcut-row button {
  min-width: 0;
  padding-inline: 10px;
}

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

.two-column .check-row {
  align-self: end;
}

.route-line-type-field {
  grid-column: span 2;
}

.route-line-type-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
}

.route-line-preview {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.route-line-preview svg {
  display: block;
  width: 100%;
  height: 28px;
}

.route-label {
  cursor: grab;
  user-select: none;
}

.symbol-settings {
  display: grid;
  grid-template-columns: minmax(190px, 240px) 1fr;
  gap: 14px;
  min-height: 420px;
}

.symbol-preset-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.symbol-preset-item {
  min-height: 54px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  align-items: center;
  justify-content: start;
  text-align: left;
  background: #f8fbfa;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px;
}

.symbol-preset-item.active {
  border-color: var(--brand);
  background: #e9f4f1;
}

.symbol-preset-editor {
  display: grid;
  grid-template-columns: 120px repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.symbol-preset-editor > label {
  min-width: 0;
}

.symbol-builder-preview.large {
  grid-row: span 6;
  width: 112px;
  height: 112px;
}

.settings-tools,
.symbol-preset-editor .symbol-help,
.custom-part-panel {
  grid-column: 1 / -1;
}

.custom-part-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
}

#symbolSettingsParts[hidden],
#customPartPanel[hidden] {
  display: none !important;
}

.part-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

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

@media (max-width: 760px) {
  .app-notice {
    top: max(8px, env(safe-area-inset-top));
    width: calc(100vw - 16px);
    padding: 10px 12px;
    font-size: 12px;
  }

  dialog {
    width: min(460px, calc(100vw - 12px));
    padding: 12px;
  }

  dialog.wide-dialog {
    width: calc(100vw - 10px);
  }

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

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

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

  .symbol-settings {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
  }

  .symbol-preset-list {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 8px;
  }

  .symbol-preset-item {
    flex: 0 0 132px;
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    padding: 6px 5px;
  }

  .symbol-preset-item .symbol-summary span,
  .symbol-preset-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .symbol-preset-editor {
    grid-template-columns: 74px repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .symbol-builder-preview.large {
    grid-row: span 3;
    width: 72px;
    height: 72px;
  }

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 280px minmax(520px, 1fr) 280px;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .side-panel {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.left-panel-collapsed,
  .app-shell.right-panel-collapsed,
  .app-shell.left-panel-collapsed.right-panel-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .app-shell .project-panel,
  .app-shell .side-panel {
    position: fixed;
    inset: 50px 8px 8px;
    z-index: 130;
    display: none;
    width: auto;
    max-width: none;
    min-width: 0;
    box-shadow: 0 20px 60px rgba(20, 36, 34, 0.26);
  }

  .app-shell.mobile-project-open .project-panel,
  .app-shell.mobile-data-open .side-panel {
    display: flex;
  }

  .app-shell.left-panel-collapsed .project-panel,
  .app-shell.right-panel-collapsed .side-panel {
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app-shell.left-panel-collapsed .project-panel > :not(.panel-rail-toggle),
  .app-shell.right-panel-collapsed .side-panel > :not(.panel-rail-toggle) {
    display: revert !important;
  }

  .app-shell.left-panel-collapsed .project-panel .panel-rail-toggle,
  .app-shell.right-panel-collapsed .side-panel .panel-rail-toggle {
    writing-mode: horizontal-tb;
    width: auto;
    min-height: 32px;
    align-self: stretch;
  }

  .workspace {
    grid-column: 1;
  }

  .toolbar {
    align-items: center;
    gap: 6px;
    padding: 6px;
    max-width: 100%;
    overflow: visible;
  }

  .empty-state {
    inset: 12px;
  }

  .empty-card {
    max-width: calc(100vw - 32px);
    padding: 14px;
  }

  .empty-state strong {
    font-size: 16px;
  }

  .empty-card ol {
    font-size: 12px;
  }

  button,
  .file-button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .panel {
    padding: 8px;
  }

  .project-panel,
  .side-panel {
    gap: 9px;
  }

  .toolbar > select {
    max-width: 160px;
  }

  .toolbar > *,
  .pen-controls,
  .zoom-controls,
  .layer-controls,
  .selection-actions {
    width: auto;
  }

  .app-shell.mobile-layout .segmented {
    flex-wrap: nowrap;
    gap: 3px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-shell.mobile-layout .segmented::-webkit-scrollbar {
    display: none;
  }

  .app-shell.mobile-layout .segmented button {
    min-height: 30px;
    padding: 0 6px;
    font-size: 11px;
    white-space: nowrap;
  }

  .pen-controls {
    grid-template-columns: auto 1fr 42px auto;
  }

  .drawing-stage {
    width: 760px;
    height: 520px;
    margin: 14px;
  }

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

  .project-actions button {
    padding-inline: 5px;
  }

  .panel-heading {
    gap: 6px;
  }

  .panel-heading h2 {
    font-size: 14px;
  }

  .settings-summary div {
    grid-template-columns: 78px minmax(0, 1fr);
    font-size: 11px;
  }

  .quantity-row,
  .photo-row {
    padding: 7px;
  }

  .two-col,
  .note-style-panel,
  .export-grid {
    grid-template-columns: 1fr;
  }

  #photoStylePanel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #photoStylePanel .check-row {
    grid-column: span 2;
  }
}
