:root {
  background: #eef1f5;
  color: #172033;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  line-height: 1.35;
  margin: 0;
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.login-view {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgb(23 32 51 / 10%);
  padding: 28px;
  width: min(100%, 410px);
}

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

.brand-mark {
  align-items: center;
  border: 2px solid #cf0a2c;
  color: #cf0a2c;
  display: flex;
  font-size: 23px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #6a7589;
  font-size: 12px;
  margin-top: 3px;
}

h1 {
  font-size: 28px;
  margin: 28px 0 22px;
}

h2 {
  font-size: 19px;
  margin: 0;
}

h3 {
  font-size: 16px;
  margin: 0;
}

h4 {
  font-size: 13px;
  margin: 0;
}

label {
  color: #4d5a70;
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  color: #172033;
  display: block;
  margin-top: 7px;
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  line-height: 1.4;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #cf0a2c;
  outline: 2px solid rgb(207 10 44 / 12%);
}

.primary-button,
.secondary-button,
.text-button,
.nav-button,
.icon-button {
  border-radius: 6px;
  min-height: 40px;
}

.primary-button {
  background: #cf0a2c;
  border: 1px solid #cf0a2c;
  color: #ffffff;
  font-weight: 700;
  padding: 8px 16px;
}

.login-panel .primary-button {
  width: 100%;
}

.secondary-button {
  background: #ffffff;
  border: 1px solid #cfd6e2;
  color: #172033;
  padding: 8px 16px;
}

.app-view {
  min-height: 100vh;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid #d8dee8;
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 18px 14px;
  position: fixed;
  top: 0;
  width: 240px;
}

.sidebar-brand {
  margin: 0 5px 28px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  background: #ffffff;
  border: 1px solid #d8dee8;
  color: #172033;
  padding: 9px 12px;
  text-align: left;
}

.nav-button.is-active {
  background: #fff5f7;
  border-color: #cf0a2c;
  color: #cf0a2c;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid #e2e6ed;
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 16px 5px 0;
}

.sidebar-footer span {
  color: #6a7589;
  font-size: 13px;
}

.text-button {
  background: transparent;
  border: 0;
  color: #cf0a2c;
  margin-top: 7px;
  padding: 0;
  text-align: left;
}

.content {
  margin-left: 240px;
  min-height: 100vh;
  padding: 24px 28px;
}

.page-header,
.section-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 2px 0 0;
}

.eyebrow {
  color: #cf0a2c;
  font-size: 11px;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
}

.connection-status {
  color: #087a45;
  font-size: 13px;
  font-weight: 700;
}

.connection-status.is-offline {
  color: #cf0a2c;
}

.connection-status.is-syncing {
  color: #9a6700;
}

.page-view {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  min-height: 360px;
  padding: 20px;
}

.section-header {
  border-bottom: 1px solid #e2e6ed;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.section-header p,
.form-note {
  color: #6a7589;
  font-size: 13px;
  margin: 6px 0 0;
}

.approval-note {
  background: #fff8e6;
  border: 1px solid #e9c766;
  border-radius: 6px;
  color: #765900;
  font-size: 13px;
  margin: 12px 0 0;
  padding: 12px;
}

.data-list {
  display: grid;
  gap: 10px;
}

.data-row {
  align-items: center;
  background: #fafbfc;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  padding: 13px 14px;
}

.row-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.backup-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.data-row strong,
.data-row span {
  display: block;
}

.data-row > div:first-child span {
  color: #6a7589;
  font-size: 13px;
  margin-top: 4px;
}

.status-tag {
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.status-tag.is-active {
  background: #edf8f2;
  border-color: #8cc8a9;
  color: #087a45;
}

.status-tag.is-inactive {
  background: #f2f4f7;
  border-color: #cfd6e2;
  color: #6a7589;
}

.status-tag.is-error-tag {
  background: #fff1f3;
  border-color: #e7a4b0;
  color: #b00020;
}

.status-tag.is-progress {
  background: #fff8e6;
  border-color: #e9c766;
  color: #765900;
}

.compact-filter {
  min-width: 240px;
}

.dashboard-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.dashboard-summary > div {
  background: #fafbfc;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  padding: 12px;
}

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

.dashboard-summary span {
  color: #6a7589;
  font-size: 12px;
  margin-bottom: 4px;
}

.dashboard-summary strong {
  font-size: 22px;
}

.dashboard-alerts {
  align-items: flex-start;
  background: #fff1f3;
  border: 1px solid #e7a4b0;
  border-radius: 6px;
  color: #7a0018;
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
  padding: 10px 12px;
}

.dashboard-alerts strong,
.dashboard-alerts span {
  display: block;
}

.dashboard-alerts span {
  color: #7a0018;
  font-size: 13px;
}

.traffic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 14px;
}

.traffic-legend span {
  align-items: center;
  color: #4d5a70;
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
}

.traffic-dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.traffic-dot.is-red,
.traffic-unit.is-red {
  background: #fff1f3;
  border-color: #e7a4b0;
  color: #b00020;
}

.traffic-dot.is-yellow,
.traffic-unit.is-yellow {
  background: #fff8e6;
  border-color: #e9c766;
  color: #765900;
}

.traffic-dot.is-green,
.traffic-unit.is-green {
  background: #edf8f2;
  border-color: #8cc8a9;
  color: #087a45;
}

.unit-traffic-map {
  overflow-x: auto;
  padding-bottom: 4px;
}

.traffic-map-content {
  display: grid;
  gap: 10px;
  min-width: max-content;
}

.traffic-floor-row {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: 86px max-content;
}

.traffic-floor-label {
  align-items: center;
  background: #f2f4f7;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  color: #4d5a70;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  padding: 8px;
}

.traffic-floor-units {
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
}

.traffic-unit {
  border: 1px solid;
  border-radius: 6px;
  flex: 0 0 118px;
  min-height: 58px;
  padding: 8px;
  position: relative;
  text-align: left;
}

.traffic-unit.is-over-threshold {
  box-shadow: inset 0 0 0 2px #cf0a2c;
}

.traffic-unit strong,
.traffic-unit span,
.traffic-unit em {
  display: block;
}

.traffic-unit strong {
  color: #172033;
  font-size: 13px;
}

.traffic-unit span {
  font-size: 11px;
  margin-top: 4px;
}

.traffic-unit em {
  color: #cf0a2c;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  margin-top: 4px;
}

.alerts-list {
  display: grid;
  gap: 10px;
}

.alert-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 14px;
}

.alert-row.is-critical {
  background: #fff8fa;
  border-color: #e7a4b0;
}

.alert-row strong,
.alert-row span,
.alert-row small {
  display: block;
}

.alert-row span {
  color: #172033;
  margin-top: 4px;
}

.alert-row small {
  color: #6a7589;
  font-size: 12px;
  margin-top: 5px;
}

.empty-state {
  color: #6a7589;
  padding: 38px 12px;
  text-align: center;
}

.back-button {
  margin: 0 0 10px;
}

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

.detail-section {
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  padding: 16px;
}

.detail-section-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.detail-section-header p {
  color: #6a7589;
  font-size: 13px;
  margin: 5px 0 0;
}

.check-list,
.compact-list {
  display: grid;
  gap: 8px;
}

.check-row,
.compact-row {
  align-items: center;
  background: #fafbfc;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: flex;
  margin: 0;
  min-height: 46px;
  padding: 8px 10px;
}

.check-row {
  gap: 10px;
}

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

.check-row strong,
.check-row small {
  display: block;
}

.check-row small {
  color: #6a7589;
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}

.compact-row {
  justify-content: space-between;
}

.room-name-field {
  flex: 1;
  margin: 0;
}

.room-name-field span,
.room-order-field span {
  color: #6a7589;
  display: block;
  font-size: 11px;
}

.room-name-field input {
  font-weight: 700;
  margin-top: 3px;
  min-height: 32px;
}

.room-actions {
  align-items: end;
  display: flex;
  gap: 8px;
}

.room-order-field {
  margin: 0;
}

.room-order-field input {
  margin-top: 3px;
  min-height: 32px;
  width: 82px;
}

.compact-row .icon-button {
  min-height: 32px;
  min-width: 32px;
}

.inline-form,
.import-form {
  align-items: end;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-form input,
.import-form input {
  margin: 0;
}

.inline-form input:first-child {
  flex: 1;
}

.inline-form input[type="number"] {
  width: 140px;
}

.room-order-note {
  margin: -4px 0 12px;
}

.inactive-rooms-section {
  border-top: 1px solid #e2e6ed;
  margin-top: 16px;
  padding-top: 14px;
}

.inactive-rooms-section > p {
  color: #6a7589;
  font-size: 12px;
  margin: 5px 0 10px;
}

.compact-row.is-muted {
  color: #6a7589;
}

.units-section {
  margin-top: 16px;
}

.units-preview-section {
  border-bottom: 1px solid #e2e6ed;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.filters-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.filters-row label {
  margin: 0;
}

.units-filters {
  align-items: end;
}

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

.advanced-filters-toggle {
  display: none;
}

.advanced-filters-panel {
  display: contents;
}

.unit-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.unit-summary > div {
  background: #fafbfc;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  padding: 14px;
}

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

.unit-summary span {
  color: #6a7589;
  font-size: 12px;
  margin-bottom: 6px;
}

.unit-field-status {
  display: none;
}

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

.finish-review-panel {
  align-items: center;
  background: #fff8e6;
  border: 1px solid #e9c766;
  border-radius: 6px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 14px;
  padding: 14px;
}

.report-panel {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px;
}

.report-panel p {
  color: #6a7589;
  font-size: 13px;
  margin: 5px 0 0;
}

.report-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.report-actions select {
  margin: 0;
  min-width: 170px;
}

.print-report-view {
  display: none;
}

.finish-review-panel p {
  color: #765900;
  font-size: 13px;
  margin: 5px 0 0;
}

.green-seal-panel {
  background: #edf8f2;
  border-color: #8cc8a9;
}

.green-seal-panel p {
  color: #087a45;
}

.client-final-lock-panel {
  background: #fff1f3;
  border-color: #e7a4b0;
}

.client-final-lock-panel p {
  color: #9f1239;
}

.client-final-lot-panel {
  background: #fffdf7;
  border-color: #e9c766;
  margin-top: 14px;
}

.client-final-lot-list {
  display: grid;
  gap: 8px;
}

.client-final-lot-row {
  align-items: start;
  background: #ffffff;
  border: 1px solid #ead89a;
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 132px 1fr auto;
  padding: 10px 12px;
}

.original-observation-number {
  color: #6a7589;
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.finish-review-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.finish-review-actions select {
  margin: 0;
  min-width: 220px;
}

.room-section-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.room-section-actions .inline-form {
  margin: 0;
}

.room-card {
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  min-height: 82px;
  padding: 14px;
}

.room-card.has-observations {
  grid-column: 1 / -1;
}

.room-card.is-completed {
  background: #edf8f2;
  border-color: #8cc8a9;
}

.room-card strong,
.room-card span {
  display: block;
}

.completed-label {
  color: #087a45 !important;
  font-weight: 700;
}

.offline-label {
  color: #cf0a2c !important;
  font-weight: 700;
}

.room-card-actions {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.room-toggle-button {
  margin-top: 12px;
  width: 100%;
}

.room-observations {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.room-observation-empty {
  color: #6a7589;
  font-size: 13px;
  margin: 12px 0 0;
}

.observation-row {
  align-items: start;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 76px 1fr auto;
  padding: 12px;
}

.observation-row.is-reserved {
  background: #fff8e6;
  border-color: #e9c766;
}

.observation-reserve-title {
  color: #765900;
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0 6px;
  text-transform: uppercase;
}

.observation-number {
  color: #cf0a2c;
  font-weight: 700;
}

.observation-row p {
  color: #4d5a70;
  font-size: 13px;
  margin: 0;
}

.observation-photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.observation-photo-strip img {
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  height: 76px;
  object-fit: cover;
  width: 96px;
}

.observation-meta {
  text-align: right;
}

.observation-meta span,
.observation-meta small {
  display: block;
}

.observation-meta span {
  font-size: 12px;
  font-weight: 700;
}

.observation-meta small {
  color: #6a7589;
  margin-top: 5px;
}

.observation-action {
  margin-top: 10px;
  min-height: 34px;
  padding: 6px 10px;
}

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

.client-final-check {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.client-final-check input {
  margin: 0;
  min-height: auto;
  width: auto;
}

@media print {
  @page {
    margin: 12mm;
    size: A4;
  }

  body {
    background: #ffffff;
  }

  .login-view,
  .sidebar,
  .page-header,
  .content > .page-view:not(#unit-detail-view),
  #unit-detail-view > :not(#print-report-view) {
    display: none !important;
  }

  .app-view,
  .content,
  #unit-detail-view {
    background: #ffffff !important;
    display: block !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body * {
    visibility: hidden;
  }

  .print-report-view {
    color: #111827;
    display: block !important;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    position: static;
    visibility: visible;
    width: 100%;
  }

  .print-report-view * {
    visibility: visible;
  }

  .print-report-document {
    width: 100%;
  }

  .print-report-header {
    align-items: flex-start;
    border-bottom: 2px solid #cf0a2c;
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
  }

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

  .print-report-header p,
  .print-report-header span {
    color: #4d5a70;
  }

  .print-report-header h1 {
    font-size: 20px;
    margin: 4px 0;
  }

  .print-brand {
    border: 1px solid #cf0a2c;
    color: #cf0a2c;
    font-weight: 700;
    padding: 8px 10px;
  }

  .print-report-meta,
  .print-summary {
    display: grid;
    gap: 4px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
  }

  .print-photo-note {
    color: #6a7589;
    margin: 10px 0 0;
  }

  .print-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .print-summary div {
    border: 1px solid #cfd6e2;
    padding: 4px 6px;
  }

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

  .print-summary strong {
    font-size: 16px;
  }

  .print-room-group {
    break-inside: auto;
    margin-top: 8px;
    page-break-inside: auto;
  }

  .print-report-section-title {
    color: #cf0a2c;
    font-size: 14px;
    margin: 10px 0 6px;
  }

  .print-room-group h3 {
    border-bottom: 1px solid #cfd6e2;
    break-after: avoid;
    font-size: 12px;
    margin: 0 0 6px;
    padding-bottom: 4px;
  }

  .print-observation-line {
    border: 1px solid #dfe4ec;
    display: grid;
    gap: 6px;
    grid-template-columns: 52px 42px 66px 112px 1fr;
    margin-bottom: 4px;
    padding: 5px;
  }

  .print-observation-block {
    break-inside: avoid;
    margin-bottom: 4px;
  }

  .print-photo-grid {
    border: 1px solid #dfe4ec;
    border-top: 0;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, 120px);
    padding: 6px;
  }

  .print-photo-grid img {
    height: 90px;
    object-fit: cover;
    width: 120px;
  }

  .print-empty {
    color: #6a7589;
    margin-top: 20px;
    text-align: center;
  }
}

.segmented-control {
  background: #f6f8fa;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  display: flex;
  padding: 3px;
}

.segmented-control button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: #4d5a70;
  font-weight: 700;
  min-height: 34px;
  padding: 6px 12px;
}

.segmented-control button.is-active {
  background: #cf0a2c;
  color: #ffffff;
}

.room-card span {
  color: #6a7589;
  font-size: 12px;
  margin-top: 8px;
}

.preview-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.preview-header p {
  color: #6a7589;
  font-size: 12px;
  margin: 5px 0 0;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #e2e6ed;
  font-size: 13px;
  padding: 10px;
  text-align: left;
}

th {
  background: #f6f8fa;
  color: #4d5a70;
  font-weight: 700;
}

.secondary-link {
  background: #ffffff;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  color: #172033;
  font-size: 13px;
  font-weight: 700;
  min-height: 40px;
  padding: 11px 14px;
  text-decoration: none;
}

.message.is-success {
  color: #087a45;
}

.voice-tools {
  align-items: center;
  background: #f6f8fa;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  display: flex;
  gap: 10px;
  margin: -6px 0 16px;
  padding: 10px;
}

.voice-tools .secondary-button.is-active {
  background: #fff1f3;
  border-color: #cf0a2c;
  color: #cf0a2c;
  font-weight: 700;
}

.voice-tools.is-note {
  background: #fff8e6;
  border-color: #e9c766;
}

.voice-tools span {
  color: #6a7589;
  font-size: 12px;
}

.voice-tools.is-note span {
  color: #765900;
  font-weight: 700;
}

.photo-preview {
  align-items: center;
  border: 1px dashed #cfd6e2;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 10px;
  padding: 10px;
}

.photo-preview:empty {
  display: none;
}

.photo-preview span {
  color: #4d5a70;
  font-size: 12px;
  font-weight: 700;
}

.photo-preview img {
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  height: 72px;
  object-fit: cover;
  width: 90px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgb(23 32 51 / 22%);
  padding: 0;
  width: min(92vw, 620px);
}

dialog::backdrop {
  background: rgb(23 32 51 / 42%);
}

dialog form {
  padding: 22px;
}

.dialog-header,
.dialog-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.dialog-header {
  margin-bottom: 20px;
}

.dialog-actions {
  border-top: 1px solid #e2e6ed;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
}

.icon-button {
  background: #ffffff;
  border: 1px solid #cfd6e2;
  color: #cf0a2c;
  font-weight: 700;
  min-width: 40px;
}

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

.message {
  font-size: 13px;
  margin: 10px 0;
}

.message.is-error {
  color: #b00020;
}

@media (max-width: 1100px) {
  .filters-row,
  .unit-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-filters {
    grid-column: 1 / -1;
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    background: #eef1f5;
    font-size: 14px;
  }

  .sidebar {
    border-bottom: 1px solid #d8dee8;
    border-right: 0;
    bottom: auto;
    gap: 8px;
    padding: 8px 10px;
    position: static;
    width: 100%;
  }

  .sidebar-brand {
    margin: 0;
  }

  .sidebar .brand-mark {
    font-size: 16px;
    height: 32px;
    width: 32px;
  }

  .sidebar .brand {
    gap: 8px;
  }

  .sidebar .brand strong {
    font-size: 14px;
  }

  .sidebar .brand span {
    font-size: 11px;
  }

  nav {
    gap: 5px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    font-size: 13px;
    min-height: 36px;
    padding: 6px 8px;
    text-align: center;
  }

  .sidebar-footer {
    align-items: center;
    border-top: 0;
    display: grid;
    gap: 2px 10px;
    grid-template-columns: 1fr auto;
    margin-top: 0;
    padding: 0;
  }

  .sidebar-footer strong {
    font-size: 13px;
  }

  .sidebar-footer span {
    font-size: 11px;
  }

  .sidebar-footer .text-button {
    font-size: 13px;
    grid-row: 1 / span 2;
    margin: 0;
    min-height: 34px;
  }

  .content {
    margin-left: 0;
    padding: 10px 8px 16px;
  }

  .page-header,
  .section-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .page-header {
    margin-bottom: 8px;
  }

  .page-header h1 {
    font-size: 21px;
  }

  h2 {
    font-size: 17px;
  }

  h3 {
    font-size: 15px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .connection-status {
    align-self: flex-start;
    background: #edf8f2;
    border: 1px solid #8cc8a9;
    border-radius: 999px;
    font-size: 11px;
    padding: 4px 8px;
  }

  .connection-status.is-offline {
    background: #fff1f3;
    border-color: #e7a4b0;
  }

  .connection-status.is-syncing {
    background: #fff8e6;
    border-color: #e9c766;
  }

  .page-view {
    border-radius: 6px;
    min-height: auto;
    padding: 10px;
  }

  .section-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .section-header p,
  .form-note,
  .detail-section-header p,
  .report-panel p,
  .finish-review-panel p {
    font-size: 12px;
  }

  .section-header .primary-button,
  .detail-section-header .primary-button,
  .detail-section-header .secondary-link,
  .data-row .secondary-button,
  .row-actions .secondary-button {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .secondary-link,
  input,
  select,
  textarea {
    font-size: 14px;
    min-height: 38px;
  }

  .primary-button,
  .secondary-button,
  .secondary-link {
    padding: 7px 11px;
  }

  label {
    font-size: 12px;
    margin-bottom: 9px;
  }

  input,
  select,
  textarea {
    margin-top: 5px;
    padding: 7px 9px;
  }

  textarea {
    min-height: 92px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filters-row,
  .room-grid {
    grid-template-columns: 1fr;
  }

  .advanced-filters {
    display: block;
    grid-column: auto;
  }

  .advanced-filters-toggle {
    align-items: center;
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .advanced-filters-toggle::after {
    content: "+";
    font-weight: 700;
  }

  .advanced-filters.is-open .advanced-filters-toggle::after {
    content: "-";
  }

  .advanced-filters-panel {
    display: none;
    padding-top: 8px;
  }

  .advanced-filters.is-open .advanced-filters-panel {
    display: block;
  }

  .advanced-filters-panel label {
    margin-bottom: 8px;
  }

  .unit-summary {
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-summary {
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-summary > div {
    padding: 9px;
  }

  .dashboard-summary strong {
    font-size: 18px;
  }

  .compact-filter {
    min-width: 0;
    width: 100%;
  }

  .traffic-floor-row {
    gap: 6px;
    grid-template-columns: 54px max-content;
  }

  .traffic-floor-label {
    font-size: 11px;
    padding: 6px;
  }

  .traffic-floor-units {
    gap: 6px;
  }

  .traffic-unit {
    flex-basis: 94px;
    min-height: 50px;
    padding: 6px;
  }

  .traffic-unit strong {
    font-size: 12px;
  }

  .traffic-unit span {
    font-size: 10px;
  }

  .unit-summary > div {
    padding: 9px;
  }

  .app-view[data-role="ito"] #unit-report-panel,
  .app-view[data-role="supervisor"] #unit-report-panel,
  .app-view[data-role="ito"] .unit-summary,
  .app-view[data-role="supervisor"] .unit-summary {
    display: none !important;
  }

  .app-view[data-role="ito"] .unit-field-status,
  .app-view[data-role="supervisor"] .unit-field-status {
    align-items: center;
    background: #ffffff;
    border: 1px solid #dfe4ec;
    border-radius: 6px;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin: 0 0 10px;
    padding: 8px 10px;
  }

  .unit-field-status span {
    color: #6a7589;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .unit-field-status strong {
    color: #172033;
    font-size: 13px;
    text-align: right;
  }

  .finish-review-panel,
  .report-panel,
  .finish-review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .report-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-actions select,
  .report-actions button,
  .finish-review-actions select,
  .finish-review-actions button {
    min-width: 0;
    width: 100%;
  }

  .detail-section-header,
  .preview-header,
  .inline-form,
  .import-form {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-section {
    padding: 10px;
  }

  .detail-section-header {
    gap: 8px;
  }

  .room-section-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    width: 100%;
  }

  .room-section-actions > button,
  .room-section-actions .segmented-control {
    width: 100%;
  }

  .inline-form input[type="number"] {
    width: 100%;
  }

  .compact-row,
  .room-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .room-order-field input {
    width: 100%;
  }

  .data-row {
    align-items: stretch;
    display: grid;
    gap: 8px;
    padding: 10px;
  }

  .backup-actions {
    justify-content: stretch;
  }

  .row-actions {
    align-items: stretch;
    display: grid;
    gap: 6px;
  }

  .status-tag {
    font-size: 11px;
    justify-self: start;
    max-width: 100%;
    white-space: normal;
  }

  .room-card {
    min-height: 0;
    padding: 10px;
  }

  .room-card strong {
    font-size: 14px;
  }

  .room-card span {
    font-size: 11px;
    margin-top: 5px;
  }

  .room-card-actions {
    gap: 6px;
    margin-top: 9px;
  }

  .room-card-actions button {
    min-height: 38px;
    width: 100%;
  }

  .room-toggle-button {
    margin-top: 9px;
  }

  .room-observations {
    gap: 6px;
    margin-top: 9px;
  }

  .observation-row {
    gap: 6px 8px;
    grid-template-columns: 58px 1fr;
    padding: 9px;
  }

  .observation-number {
    font-size: 13px;
  }

  .observation-row p {
    font-size: 12px;
  }

  .observation-meta {
    grid-column: 1 / -1;
    text-align: left;
  }

  .observation-meta span,
  .observation-meta small {
    display: inline-block;
    font-size: 11px;
    margin-right: 8px;
  }

  .observation-action,
  .review-actions button {
    min-height: 38px;
    width: 100%;
  }

  .review-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
    margin-top: 8px;
  }

  .client-final-check {
    justify-content: flex-start;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
    min-height: 36px;
    padding: 5px 8px;
  }

  .client-final-lot-row {
    grid-template-columns: 1fr;
  }

  dialog {
    border-radius: 8px 8px 0 0;
    margin: auto 0 0;
    max-height: 94dvh;
    overflow: auto;
    width: 100vw;
  }

  dialog form {
    padding: 12px;
  }

  .dialog-header {
    margin-bottom: 10px;
  }

  .dialog-actions {
    background: #ffffff;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr;
    position: sticky;
  }

  .dialog-actions button {
    min-height: 40px;
    width: 100%;
  }

  .voice-tools,
  .photo-preview {
    margin-top: -4px;
  }

  .photo-preview img {
    height: 72px;
    width: 92px;
  }
}
