html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

:root {
  --navy: #0d4d8c;
  --blue: #1f6fbf;
  --sky: #dbeeff;
  --white: #ffffff;
  --ink: #0d2236;
  --muted: #5f7992;
  --line: rgba(13, 77, 140, 0.15);
  --bg: linear-gradient(180deg, #eff7ff 0%, #f8fbff 55%, #ffffff 100%);
  --shadow: 0 18px 40px rgba(13, 77, 140, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.screen {
  display: none;
  min-height: 100vh;
}

.screen-active {
  display: flex;
}

#login-screen {
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(31, 111, 191, 0.16), transparent 24rem),
    linear-gradient(180deg, #eef6ff 0%, #ffffff 100%);
}

.login-panel {
  width: min(960px, 100%);
  display: grid;
  gap: 24px;
  grid-template-columns: 1.2fr 0.8fr;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: grid;
  grid-template-columns: minmax(120px, 156px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.logo-slot {
  width: 156px;
  height: 156px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  overflow: hidden;
}

.brand-block .brand-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
}

.brand-block h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
}

.brand-block .muted {
  max-width: 30rem;
  font-size: 1.06rem;
  line-height: 1.5;
}

.logo-slot.small {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  flex: 0 0 68px;
}

.logo-slot.small .brand-image {
  padding: 0;
  object-fit: cover;
  background: #fff;
}

.drawer-logo-slot {
  width: 72px;
  height: 88px;
  border-radius: 22px;
  flex: 0 0 72px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.drawer-logo-slot .brand-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  background: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--blue);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.form,
.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
}

.multi-check-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid rgba(13, 77, 140, 0.18);
  border-radius: 14px;
  background: #fff;
}

.multi-check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.multi-check-option input {
  margin: 0;
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 18px;
  accent-color: var(--navy);
}

.multi-check-option span {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(13, 77, 140, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

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

.primary-button,
.ghost-button,
.icon-button,
.secondary-button,
.record-link-button,
.bottom-tab {
  border: none;
  border-radius: 14px;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  padding: 12px 16px;
}

.primary-button {
  background: var(--navy);
  color: var(--white);
}

.secondary-button {
  background: var(--sky);
  color: var(--navy);
}

.ghost-button,
.icon-button {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--navy);
  border: 1px solid var(--line);
}

.record-link-button {
  padding: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  text-align: left;
}

.record-link-button:hover strong,
.record-link-button:focus-visible strong {
  color: var(--blue);
  text-decoration: underline;
}

.billing-draft-fields {
  display: grid;
  gap: 12px;
  margin: 10px 0 4px;
}

.billing-service-lines {
  display: grid;
  gap: 12px;
}

.billing-breakdown-stack {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.billing-breakdown-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
  overflow: hidden;
}

.billing-breakdown-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.billing-breakdown-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  background: #f7faff;
  border-bottom: 1px solid var(--line);
}

.billing-breakdown-summary-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.billing-breakdown-summary-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.billing-breakdown-edit-field {
  display: grid;
  gap: 4px;
}

.billing-breakdown-edit-field small {
  color: var(--muted);
  font-size: 0.75rem;
}

.billing-breakdown-edit-field input {
  width: 100%;
}

.billing-breakdown-summary-total {
  background: #eef4ff;
}

.billing-draft-grand-total {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f3f7ff;
  overflow: hidden;
}

.billing-draft-grand-total-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #e8f0ff;
  border-bottom: 1px solid var(--line);
}

.billing-breakdown-table-wrap {
  overflow-x: auto;
}

.billing-breakdown-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.billing-breakdown-table th,
.billing-breakdown-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.billing-breakdown-table th {
  font-size: 0.82rem;
  color: var(--muted);
  background: #fff;
}

.billing-breakdown-group-row td {
  font-weight: 700;
  background: #f7faff;
}

.billing-table-input {
  width: 100%;
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.billing-service-line {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
}

.billing-inline-fields {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr) minmax(180px, 240px);
  gap: 12px;
  align-items: end;
}

@media (max-width: 900px) {
  .billing-breakdown-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .billing-breakdown-summary {
    grid-template-columns: 1fr;
  }
}

.billing-list-item {
  display: grid;
  gap: 8px;
}

.billing-list-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 6px;
}

.billing-active-draft-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid rgba(31, 111, 191, 0.22);
  background: linear-gradient(180deg, rgba(219, 238, 255, 0.55), rgba(255, 255, 255, 0.96));
}

.billing-active-draft-toolbar {
  margin-bottom: 0;
  padding-bottom: 0;
}

.billing-collapsed-card {
  width: 100%;
  border: 1px solid rgba(31, 111, 191, 0.35);
  border-radius: 16px;
  background: var(--white);
  overflow: hidden;
}

.billing-collapsed-card-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: block;
  box-shadow: 0 8px 18px rgba(13, 77, 140, 0.08);
}

.billing-collapsed-card:hover,
.billing-collapsed-card:focus-within,
.billing-collapsed-card-button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 12px 24px rgba(13, 77, 140, 0.14);
}

.billing-collapsed-header,
.billing-collapsed-body {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.billing-collapsed-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #eef4fb;
}

.billing-collapsed-body {
  border-top: 1px solid var(--line);
}

.billing-drafts-grid {
  display: grid;
  gap: 12px;
}

.billing-floating-action {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 18;
  min-width: 128px;
  padding: 14px 20px;
  border: 1px solid rgba(13, 77, 140, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue) 0%, #2e7bc7 100%);
  color: var(--white);
  box-shadow: 0 16px 28px rgba(13, 77, 140, 0.24);
  font-weight: 700;
}

.billing-floating-action:hover,
.billing-floating-action:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 20px 32px rgba(13, 77, 140, 0.3);
}

#workspace {
  position: relative;
  max-width: 100%;
  overflow-x: hidden;
}

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(300px, 80vw);
  padding: 24px;
  background: rgba(8, 39, 72, 0.97);
  color: var(--white);
  transform: translateX(-102%);
  transition: transform 180ms ease;
  z-index: 20;
}

.drawer-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.drawer-header h2 {
  margin: 0 0 4px;
  line-height: 1.05;
}

.drawer-header .muted {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.drawer-nav {
  display: grid;
  gap: 8px;
}

.drawer-nav button {
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.shell {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  padding: 18px 18px 92px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 4px 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.sync-status-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-button {
  position: relative;
  min-width: 46px;
  min-height: 46px;
}

.sync-button.is-syncing .sync-symbol {
  display: inline-block;
  animation: sync-spin 1s linear infinite;
}

.sync-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f3a000;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sync-status-text {
  font-size: 0.9rem;
  white-space: nowrap;
}

.content {
  display: grid;
  min-width: 0;
}

.view {
  display: none;
}

.view-active {
  display: block;
  min-width: 0;
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.maintenance-hours-stat h3 {
  color: #1f9d55;
  transition: color 120ms ease;
}

.maintenance-hours-stat.is-warning h3 {
  color: #b7791f;
}

.maintenance-hours-stat.is-danger h3 {
  color: #c0392b;
}

.workspace-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  min-width: 0;
}

.panel {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-nested.pending-sync-panel {
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

.toolbar-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.inline-field span {
  white-space: nowrap;
}

.inline-field input {
  width: 110px;
  min-width: 0;
}

@keyframes sync-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.coordinate-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.is-hidden-field {
  display: none;
}

.view-toggle {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.view-toggle-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.view-toggle-button.is-active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.toolbar-compact {
  margin-top: 8px;
}

.compact-list {
  gap: 10px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--line);
}

.pending-change-item {
  border-style: dashed;
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.service-list-card {
  display: grid;
  gap: 16px;
}

.service-list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.service-list-subcategory {
  color: #5d8fd6;
  font-weight: 700;
}

.service-list-total {
  min-width: 110px;
  text-align: right;
}

.service-list-total strong {
  margin: 0;
}

.service-list-groups {
  display: grid;
  gap: 14px;
}

.service-list-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fbfcff;
}

.service-list-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.service-list-group-header h5 {
  margin: 0;
  font-size: 1.08rem;
}

.service-list-group-total {
  font-weight: 700;
  color: var(--navy);
}

.service-component-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  vertical-align: middle;
}

.service-list-group-table {
  display: grid;
}

.service-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 90px 110px;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.service-list-row:last-child {
  border-bottom: 0;
}

.service-list-row-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: #fff;
}

.service-list-row span:nth-child(2),
.service-list-row span:nth-child(3) {
  text-align: right;
}

.service-list-row-empty {
  color: var(--muted);
}

.service-editor-shell {
  display: grid;
  gap: 18px;
}

.service-editor-header-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
}

.service-editor-header-card h2 {
  margin: 6px 0 0;
  font-size: 1.8rem;
}

.service-editor-subcategory {
  color: #5d8fd6;
  font-weight: 700;
}

.service-editor-total-block {
  min-width: 120px;
  text-align: right;
}

.service-editor-total-block strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
}

.service-builder-form {
  display: grid;
  gap: 18px;
}

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

.service-component-stack {
  display: grid;
  gap: 18px;
}

.service-component-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  overflow: visible;
}

.service-component-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.service-component-header h4 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.service-component-total {
  font-weight: 700;
  color: var(--navy);
}

.service-component-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

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

.service-component-table th,
.service-component-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.service-component-table th {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: #fff;
}

.service-component-table tbody tr:last-child td {
  border-bottom: 0;
}

.service-component-table td select,
.service-component-table td input {
  margin: 0;
}

.service-component-cost {
  white-space: nowrap;
  font-weight: 700;
}

.service-component-remove-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.service-component-empty {
  color: var(--muted);
  font-style: italic;
}

.service-builder-actions {
  display: flex;
  justify-content: flex-end;
}

.priority-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #eef5ff;
  color: var(--navy);
  vertical-align: middle;
}

.priority-flag {
  font-size: 0.92rem;
  line-height: 1;
}

.priority-normal {
  background: #e7f1ff;
  color: #1f6fbf;
}

.priority-medium {
  background: #fff7db;
  color: #b57f00;
}

.priority-high {
  background: #ffe5e2;
  color: #c0392b;
}

.role-group + .role-group {
  margin-top: 14px;
}

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

.role-group-header h4 {
  margin: 0;
}

.role-user-list {
  gap: 10px;
}

.catalog-group + .catalog-group {
  margin-top: 18px;
}

.catalog-group-header {
  margin-bottom: 12px;
}

.catalog-group-header h4 {
  margin: 0;
  color: var(--navy);
}

.catalog-subgroup + .catalog-subgroup {
  margin-top: 14px;
}

.catalog-subgroup-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-list-item {
  display: grid;
  gap: 12px;
}

.user-list-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-list-copy {
  min-width: 0;
}

.user-list-thumbnail {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex: 0 0 52px;
  border: 1px solid var(--line);
  background: #f4f9ff;
}

.user-list-thumbnail-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 14px;
  flex: 0 0 52px;
}

.user-list-thumbnail-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.user-list-thumbnail-placeholder {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--blue);
  background: linear-gradient(135deg, #e8f2ff, #f8fbff);
}

.panel-nested {
  padding: 18px;
}

.user-detail-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.user-profile-card {
  display: grid;
  gap: 10px;
}

.user-picture {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f4f9ff;
}

.user-picture-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 18px;
  width: fit-content;
}

.user-picture-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.user-picture-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
}

.editor-column {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
}

.anchored-editor-layout {
  grid-template-columns: minmax(0, 1fr) minmax(656px, 1000px);
  align-items: start;
}

.anchored-editor-layout .panel:first-child {
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.maintenance-hours-layout {
  grid-template-columns: minmax(0, 1fr) minmax(656px, 1000px);
  align-items: start;
}

.jobs-layout {
  grid-template-columns: minmax(0, 1fr) minmax(656px, 1000px);
  align-items: start;
}

.jobs-layout .panel:first-child {
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.work-orders-layout > [data-list-key="workOrders"] {
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.maintenance-hours-layout .panel:first-child {
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.maintenance-hours-layout .editor-column {
  position: sticky;
  top: 18px;
  align-self: start;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.attachment-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.work-order-map-block {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.map-picker-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

.status-toggle-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, color 120ms ease;
}

.status-toggle-button:hover {
  transform: translateY(-1px);
}

.status-toggle-button.is-active {
  color: var(--white);
  box-shadow: var(--shadow);
}

.status-toggle-button.status-open.is-active {
  background: #1f9d55;
  border-color: #1f9d55;
}

.status-toggle-button.status-closed.is-active {
  background: #c0392b;
  border-color: #c0392b;
}

.inline-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.inline-select select {
  min-width: 120px;
}

.map-status {
  min-height: 1.2rem;
  margin: 0;
}

.work-order-map {
  width: min(100%, 420px);
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f4f9ff;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

@media (max-width: 720px) {
  .work-order-map {
    width: 100%;
    height: 260px;
  }
}

.map-link {
  display: inline-flex;
  width: fit-content;
  text-decoration: none;
}

.work-order-map-picker {
  width: 100%;
  height: 280px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #f4f9ff;
}

.attachment-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.attachment-action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.attachment-action-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}

.attachment-action-button-secondary {
  background: var(--sky);
  color: var(--navy);
}

.attachment-action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 999px;
  background: rgba(13, 77, 140, 0.14);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.attachment-action-badge.is-hidden {
  display: none;
}

.attachment-action-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.attachment-submit-button.is-hidden {
  display: none;
}

.attachment-selection-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
}

.attachment-selection-preview.is-empty {
  opacity: 0.85;
}

.attachment-selection-preview-thumb-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #e9f2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 56px;
}

.attachment-selection-preview-thumb {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-selection-preview-thumb.is-visible {
  display: block;
}

.attachment-selection-preview-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.attachment-selection-clear {
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

.attachment-selection-clear.is-hidden {
  display: none;
}

.attachment-card-wrap {
  position: relative;
  width: 124px;
  flex: 0 0 auto;
}

.attachment-card {
  width: 124px;
  min-height: 124px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f9fcff;
  color: var(--ink);
  text-decoration: none;
  display: grid;
  gap: 8px;
  align-content: start;
  grid-auto-rows: min-content;
  overflow: hidden;
}

.attachment-button {
  text-align: left;
  cursor: pointer;
}

.attachment-delete-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(8, 21, 38, 0.78);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(8, 21, 38, 0.18);
}

.attachment-delete-button:hover,
.attachment-delete-button:focus-visible {
  background: #c0392b;
  outline: none;
}

.attachment-file {
  width: 124px;
  min-height: 124px;
}

.attachment-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

.attachment-card span,
.attachment-card small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-card span {
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.attachment-card small {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.quote-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.import-toolbar {
  margin-top: 28px;
}

.proposal-meta-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-top: 12px;
}

.proposal-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbff;
  padding: 10px;
}

.proposal-meta-grid strong,
.proposal-meta-grid span {
  display: block;
}

.proposal-meta-grid span {
  margin-top: 4px;
  color: var(--muted);
}

.attachment-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 21, 38, 0.68);
  display: grid;
  place-items: center;
  padding: 20px;
}

.attachment-modal {
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 24px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
}

.work-order-composer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 21, 38, 0.68);
  display: grid;
  place-items: center;
  padding: 20px;
}

.work-order-composer-modal {
  width: min(1180px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.work-order-composer-modal .panel {
  margin: 0;
}

.attachment-modal-image,
.attachment-modal-frame {
  width: 100%;
  min-height: 60vh;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f4f9ff;
}

.attachment-modal-image {
  object-fit: contain;
}

.modal-link {
  display: inline-flex;
  text-decoration: none;
  margin-top: 14px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}

.work-order-inline-create-button {
  padding: 10px 14px;
  border-radius: 999px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 10px;
  background: rgba(8, 39, 72, 0.96);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.bottom-tab {
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  padding: 12px 20px;
}

.bottom-tab.active {
  background: var(--white);
  color: var(--navy);
}

.error-message {
  color: #c22f2f;
  min-height: 1.2rem;
}

.success-message {
  color: #257942;
  min-height: 1.2rem;
}

.form-message {
  margin: 0;
}

@media (max-width: 860px) {
  .login-panel,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .maintenance-hours-layout .panel:first-child {
    max-height: none;
    overflow-y: visible;
  }

  .service-builder-basics,
  .service-list-row {
    grid-template-columns: 1fr;
  }

  .service-list-card-header,
  .service-editor-header-card,
  .service-component-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .service-list-total,
  .service-editor-total-block {
    text-align: left;
  }

  .editor-column {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .toolbar-controls {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .billing-inline-fields {
    grid-template-columns: 1fr;
  }

  #login-screen {
    padding: 18px;
  }

  .login-panel {
    gap: 24px;
    padding: 24px 22px;
  }

  .brand-block {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 16px;
  }

  .logo-slot {
    width: min(240px, 72vw);
    height: min(240px, 72vw);
    border-radius: 34px;
  }

  .brand-block .brand-image {
    padding: 2px;
  }

  .brand-block .eyebrow {
    margin-bottom: 8px;
    font-size: 0.68rem;
  }

  .brand-block h1 {
    margin-bottom: 10px;
    font-size: clamp(1.9rem, 7vw, 2.5rem);
    line-height: 0.96;
  }

  .brand-block .muted {
    max-width: none;
    font-size: 0.94rem;
    line-height: 1.35;
  }
}

@media (max-width: 820px) {
  .billing-floating-action {
    right: 18px;
    bottom: 18px;
    min-width: 116px;
    padding: 13px 18px;
  }
}

@media (min-width: 1100px) {
  .billing-floating-action {
    right: 32px;
    bottom: 32px;
  }

  .billing-drafts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}
