:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #66717d;
  --line: #d9e0e7;
  --accent: #126b71;
  --accent-strong: #0c555a;
  --roof: #d95f43;
  --hole: #f3b23a;
  --danger: #b33a3a;
  --shadow: 0 14px 30px rgba(25, 38, 52, 0.12);
}

.rc-page * {
  box-sizing: border-box;
}

html,
.rc-page {
  width: 100%;
  height: 100%;
  margin: 0;
}

.rc-page {
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.rc-page button,
.rc-page input,
.rc-page select,
.rc-page textarea {
  font: inherit;
}

.rc-page button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 310px minmax(420px, 1fr) 360px;
  height: 100vh;
  min-height: 680px;
}

.sidebar,
.results {
  overflow: auto;
  padding: 18px;
  background: #f7f9fb;
  border-color: var(--line);
}

.sidebar {
  border-right: 1px solid var(--line);
}

.results {
  border-left: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.panel h2,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.panel p,
.hint,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(25, 38, 52, 0.05);
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  color: #35414d;
}

.field-row {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.rc-page label {
  color: #35414d;
  font-size: 13px;
  font-weight: 700;
}

.publish-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.publish-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.rc-page input[type='text'],
.rc-page input[type='number'],
.rc-page select,
.rc-page textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.rc-page textarea {
  resize: vertical;
}

.unit-input {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.unit-input input {
  border: 0;
  border-radius: 0;
}

.unit-input span {
  display: grid;
  place-items: center;
  height: 100%;
  background: #eef3f6;
  color: var(--muted);
  font-size: 13px;
}

.file-button,
.primary,
.secondary,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 6px;
  font-weight: 700;
}

.wide-button {
  width: 100%;
  margin-top: 10px;
}

.provider-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.provider-toggle .secondary {
  min-height: 36px;
}

.active-provider {
  background: var(--accent);
  color: #fff;
}

.provider-status {
  margin-bottom: 10px;
  padding: 9px;
  border-radius: 6px;
  background: #f2f6f8;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.file-button {
  width: 100%;
  background: #e7f1f1;
  color: var(--accent-strong);
  cursor: pointer;
}

.file-button input {
  display: none;
}

.primary {
  width: 100%;
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: #e8edf1;
  color: #26333f;
}

.danger {
  background: #f5e5e4;
  color: var(--danger);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

#selectionFields .button-row {
  grid-template-columns: 1fr 1fr;
}

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

.tool {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 6px;
  border-radius: 6px;
  background: #e8edf1;
  color: #24313d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tool.active {
  background: var(--accent);
  color: #fff;
}

.hint {
  min-height: 38px;
  margin-top: 10px;
}

.tool-legend {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #f3f7f8;
}

.tool-legend div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 8px;
  align-items: baseline;
}

.tool-legend dt,
.tool-legend dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
}

.tool-legend dt {
  color: #26333f;
  font-weight: 800;
}

.tool-legend dd {
  color: var(--muted);
}

.map-guide {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: #f3f7f8;
}

.map-guide summary {
  color: #26333f;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.map-guide ol {
  margin: 10px 0 8px 18px;
  padding: 0;
}

.map-guide li,
.map-guide p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.map-guide p {
  margin: 0;
}

.paste-drop-zone {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 12px;
  border: 2px dashed #b8c7cf;
  border-radius: 8px;
  background: #ffffff;
  color: #26333f;
  cursor: pointer;
}

.paste-drop-zone strong {
  font-size: 13px;
}

.paste-drop-zone span,
.paste-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.feedback-privacy {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-row input {
  margin-top: 2px;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.feedback-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.feedback-status[data-status="success"] {
  color: #126b45;
}

.feedback-status[data-status="error"] {
  color: #a83232;
}

.feedback-status[data-status="pending"] {
  color: #53616f;
}

.paste-drop-zone.drag-over,
.paste-drop-zone:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(18, 107, 113, 0.14);
}

.paste-status {
  margin-top: 8px;
}

.scale-readout {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: #f2f6f8;
}

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

.scale-readout strong {
  font-size: 18px;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: 46px 1fr;
  min-width: 0;
  overflow: hidden;
  background: #cdd5dc;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #b8c2cb;
  background: #f9fbfc;
  color: #35414d;
  font-size: 13px;
  font-weight: 700;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
}

#roofCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: #dce2e7;
  cursor: crosshair;
}

.welcome {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100% - 40px));
  padding: 24px;
  border-radius: 8px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
  pointer-events: none;
}

.welcome h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.welcome p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.total-panel {
  background: #10292b;
  color: #fff;
}

.total-panel h2,
.total-panel p {
  color: rgba(255, 255, 255, 0.78);
}

.total-number {
  margin: 8px 0;
  font-size: 38px;
  font-weight: 800;
}

.device-note {
  margin-top: 10px;
  font-weight: 700;
}

.print-report {
  display: none;
}

.print-report h1,
.print-report h2,
.print-report p {
  margin: 0;
}

.print-report table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
}

.report-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #101820;
}

.report-header h1 {
  margin-bottom: 8px;
  font-size: 20px;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.report-summary-grid div {
  padding: 8px;
  border: 1px solid #cfd7df;
  background: #f7f9fb;
}

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

.report-summary-grid strong {
  font-size: 15px;
}

.report-summary-grid span {
  margin-top: 3px;
  color: #53616f;
  font-size: 10px;
}

.print-report th,
.print-report td {
  padding: 5px;
  border: 1px solid #cfd7df;
}

.print-report th {
  background: #eef2f5;
}

.print-preview {
  max-width: 100%;
  max-height: 500px;
  margin: 12px 0;
  border: 1px solid #cfd7df;
}

.table-wrap {
  overflow: auto;
}

.rc-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rc-page th,
.rc-page td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.rc-page th {
  color: var(--muted);
  font-size: 12px;
}

.rc-page td:nth-child(2),
.rc-page td:nth-child(3),
.rc-page th:nth-child(2),
.rc-page th:nth-child(3) {
  text-align: right;
}

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

  .workspace {
    min-height: 620px;
  }

  .results {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar,
  .results {
    border: 0;
  }

  .workspace {
    height: 68vh;
    min-height: 480px;
  }
}

@media print {
  .rc-page {
    background: #fff;
  }

  .app-shell {
    display: none;
  }

  .print-report {
    display: block;
    padding: 18mm;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
  }

  .print-report section {
    margin-top: 12px;
  }

  .print-report ul {
    margin: 6px 0 0 18px;
    padding: 0;
  }

  .print-report li {
    margin-bottom: 3px;
    font-size: 11px;
  }
}
