:root {
  --black: #101114;
  --red: #c8102e;
  --red-dark: #990d24;
  --line: #e6e8ec;
  --soft: #f5f6f8;
  --text: #252932;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--text);
}

a {
  color: var(--red);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  background: var(--black);
  color: #fff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 18px;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 5px;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  padding: 7px 9px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  font-size: 0.88rem;
  line-height: 1.15;
  min-width: 0;
  white-space: nowrap;
}

.sidebar .nav-link i {
  flex: 0 0 18px;
  text-align: center;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-group {
  margin: 4px 0;
}

.nav-group summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.58);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary i {
  flex: 0 0 18px;
  text-align: center;
}

.nav-sub {
  margin-left: 12px;
}

.sidebar .nav {
  flex: 1 1 auto;
  min-height: 0;
  flex-wrap: nowrap !important;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
}

.sidebar-user {
  flex: 0 0 auto;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 12px;
  font-size: 0.88rem;
}

.content {
  padding: 30px;
  min-width: 0;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
}

.page-heading p {
  margin: 4px 0 0;
  color: #69707d;
}

.client-heading {
  align-items: flex-start;
}

.client-heading h1 {
  font-size: 1.82rem;
  line-height: 1.05;
}

.client-heading p {
  font-size: 0.92rem;
}

.client-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.client-back-btn,
.client-actions .btn {
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.86rem;
  font-weight: 600;
}

.client-actions {
  gap: 7px;
  padding-top: 4px;
}

.client-actions .btn-outline-danger {
  color: #c8102e;
  border-color: rgba(200, 16, 46, 0.55);
  background: rgba(200, 16, 46, 0.03);
}

.panel,
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 17, 20, 0.06);
}

.panel {
  padding: 22px;
}

.client-detail-panel {
  padding: 18px 20px;
}

.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 16px;
  font-weight: 800;
}

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

.panel-header h2 {
  margin: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 92px;
  padding: 13px 14px;
  position: relative;
  overflow: hidden;
}

.metric span {
  display: block;
  color: #69707d;
  font-size: 0.78rem;
  line-height: 1.2;
}

.metric strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.05;
  margin-top: 8px;
}

.metric i {
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 1.9rem;
  color: rgba(200, 16, 46, 0.14);
}

.agenda-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.agenda-panel {
  margin-bottom: 22px;
}

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

.agenda-row {
  align-items: center;
  border: 1px solid var(--line);
  border-left: 3px solid rgba(200, 16, 46, 0.5);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 92px 34px minmax(0, 1fr) auto auto auto;
  padding: 10px 12px;
}

.agenda-row.is-overdue {
  border-left-color: var(--red);
  background: rgba(200, 16, 46, 0.035);
}

.agenda-date strong {
  display: block;
  font-size: 0.84rem;
  line-height: 1.1;
}

.agenda-date span,
.agenda-main p {
  color: #69707d;
  font-size: 0.78rem;
}

.agenda-icon {
  align-items: center;
  background: #f5f6f8;
  border-radius: 8px;
  color: var(--red);
  display: flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.agenda-main h3 {
  font-size: 0.96rem;
  line-height: 1.15;
  margin: 0;
}

.agenda-main p {
  margin: 3px 0 0;
}

.agenda-amount {
  font-weight: 800;
  white-space: nowrap;
}

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

.compact-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.compact-metrics .metric {
  min-height: 76px;
  padding: 11px 13px;
}

.compact-metrics .metric strong {
  font-size: 1.34rem;
  margin-top: 6px;
}

.service-filter-panel {
  margin-bottom: 16px;
}

.filter-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.5fr) minmax(180px, 1fr) minmax(145px, 0.75fr) minmax(135px, 0.7fr) minmax(135px, 0.7fr) auto;
}

.agenda-filter-grid {
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1fr) auto;
}

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

.service-table {
  font-size: 0.9rem;
}

.table-main-link {
  color: var(--red);
  display: block;
  font-weight: 700;
  text-decoration: none;
}

.table-main-link:hover {
  text-decoration: underline;
}

.service-table small {
  color: #69707d;
  display: block;
  font-size: 0.76rem;
  line-height: 1.3;
  max-width: 520px;
}

.service-actions {
  white-space: nowrap;
}

.service-quick-actions {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.service-quick-actions .btn {
  padding-inline: 10px;
}

.service-attend-strip {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  padding: 12px 14px;
}

.service-attend-strip span {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.service-attend-strip strong {
  display: block;
  font-size: 0.95rem;
  margin-top: 2px;
}

.dashboard-section {
  max-width: 100%;
}

.panel-subtitle {
  color: #69707d;
  display: block;
  font-size: 0.8rem;
  margin-top: 2px;
}

.compact-header {
  align-items: center;
  margin-bottom: 10px;
}

.compact-header h2 {
  font-size: 1rem;
  margin: 0;
}

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

.report-equipment-row {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.9fr) minmax(130px, 0.7fr) 36px;
}

.report-equipment-photos {
  grid-column: 1 / 4;
}

.report-body-field {
  min-height: 420px;
}

.report-equipment-photos .form-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dashboard-agenda .agenda-row {
  grid-template-columns: 90px 34px minmax(0, 1fr) auto auto auto;
}

.dashboard-alert-list {
  display: grid;
  gap: 8px;
}

.dashboard-alert-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 11px 13px;
  text-decoration: none;
}

.dashboard-alert-item:hover {
  border-color: rgba(200, 16, 46, 0.38);
  box-shadow: 0 8px 20px rgba(16, 17, 20, 0.05);
}

.dashboard-alert-item strong,
.dashboard-alert-item small {
  display: block;
}

.dashboard-alert-item small {
  color: #69707d;
  margin-top: 3px;
}

.dashboard-more-row {
  align-items: center;
  border-top: 1px solid var(--line);
  color: #69707d;
  display: flex;
  font-size: 0.86rem;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
}

.dashboard-more-row a {
  color: var(--red);
  font-weight: 700;
  text-decoration: none;
}

.dashboard-more-row a:hover {
  text-decoration: underline;
}

.technical-plan-shell {
  display: grid;
  gap: 14px;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  align-items: start;
}

.technical-plan-tools,
.technical-plan-export {
  position: sticky;
  top: 18px;
}

.tool-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
}

.tool-grid .btn {
  font-size: 0.78rem;
  justify-content: flex-start;
}

.tool-grid .is-active {
  background: var(--ink);
  color: #fff;
}

.layer-list {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
}

.layer-list label {
  align-items: center;
  display: flex;
  gap: 7px;
}

.technical-plan-workspace {
  min-width: 0;
  overflow: auto;
}

.technical-plan-stage {
  display: inline-block;
  line-height: 0;
  min-width: 680px;
  position: relative;
}

.technical-plan-stage canvas {
  display: block;
}

#planCanvas {
  cursor: crosshair;
  inset: 0;
  position: absolute;
  touch-action: none;
}

#planPdfCanvas {
  background: #fff;
  position: relative;
}

.technical-plan-loading {
  color: #69707d;
  font-size: 0.82rem;
  margin: 10px 0 0;
}

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

.revision-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  text-decoration: none;
}

.revision-list a:hover {
  border-color: rgba(200, 16, 46, 0.45);
}

.revision-list span {
  color: #69707d;
  font-size: 0.78rem;
}

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

.span-2 {
  grid-column: span 2;
}

.action-row {
  display: flex;
  justify-content: flex-end;
}

.diagnostic-area-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) 110px 180px minmax(220px, 2fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfc;
}

.diagnostic-repeat {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfc;
  margin-bottom: 10px;
}

.diagnostic-repeat textarea {
  grid-column: span 2;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.clients-heading h1 {
  font-size: 1.82rem;
}

.clients-heading p {
  font-size: 0.92rem;
}

.clients-heading .btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
}

.clients-panel {
  padding: 18px 20px;
}

.clients-search {
  margin-bottom: 14px;
}

.clients-search .form-control,
.clients-search .btn {
  min-height: 38px;
  font-size: 0.9rem;
}

.clients-table {
  font-size: 0.88rem;
}

.clients-table > :not(caption) > * > * {
  padding: 9px 8px;
}

.clients-table thead th {
  font-size: 0.72rem;
  letter-spacing: 0;
}

.clients-table .btn-sm {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 7px;
}

.receipt-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.receipt-total {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 10px;
  color: #69707d;
}

.receipt-total strong {
  color: var(--red);
}

.pdf-preview-panel {
  padding: 0;
  overflow: hidden;
}

.pdf-preview-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 170px);
  border: 0;
  background: #fff;
}

.detail-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
}

.detail-list dt {
  color: #69707d;
  font-weight: 600;
}

.notes {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.table thead th {
  color: #69707d;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f1f2f5;
  color: #313744;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.empty {
  color: #69707d;
  margin: 0;
}

.client-tabs {
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.client-tabs .nav-link {
  color: #555d6b;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-weight: 700;
  padding: 7px 7px;
  font-size: 0.88rem;
  line-height: 1.15;
}

.client-tabs .nav-link.active {
  color: var(--red);
  background: transparent;
  border-bottom-color: var(--red);
}

.client-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.mini-stat span {
  display: block;
  color: #69707d;
  font-size: 0.78rem;
  font-weight: 700;
}

.mini-stat strong {
  display: block;
  font-size: 1.18rem;
  margin-top: 2px;
}

.linked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 18px;
}

.timeline.compact .timeline-item {
  box-shadow: none;
}

.timeline-item time {
  color: #69707d;
  font-size: 0.85rem;
  font-weight: 700;
}

.timeline-item h3 {
  font-size: 1rem;
  margin: 5px 0 8px;
  font-weight: 800;
}

.timeline-item p:last-child {
  margin-bottom: 0;
}

.timeline-dense {
  gap: 8px;
}

.timeline-dense .timeline-item {
  padding: 10px 12px;
  border-left-width: 3px;
  box-shadow: none;
}

.timeline-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.timeline-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-date small,
.timeline-meta {
  color: #69707d;
  font-size: 0.78rem;
}

.timeline-main {
  min-width: 0;
}

.timeline-dense .timeline-item h3 {
  font-size: 0.92rem;
  margin: 0 0 4px;
}

.timeline-dense .timeline-item p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.timeline-dense .status {
  min-height: 19px;
  padding: 2px 8px;
  font-size: 0.74rem;
}

.timeline-actions {
  white-space: nowrap;
}

.attachment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 110px 150px 140px 42px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.quote-head {
  color: #69707d;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-summary {
  margin-left: auto;
  margin-top: 18px;
  max-width: 360px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.quote-summary div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.quote-summary div:last-child {
  color: var(--red);
  font-size: 1.2rem;
}

.quote-page-heading {
  align-items: flex-start;
}

.quote-workspace {
  display: grid;
  gap: 16px;
  padding-bottom: 92px;
}

.quote-editor-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
  padding: 18px 20px;
}

.quote-editor-main {
  border-top: 3px solid var(--red);
}

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

.quote-editor-header h2,
.quote-subsection h3 {
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.quote-revision-pill {
  background: #f2f3f5;
  border-radius: 999px;
  color: #394150;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
}

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

.quote-basic-grid > :nth-child(3),
.quote-basic-grid > :nth-child(4),
.quote-basic-grid > :nth-child(8) {
  grid-column: span 2;
}

.quote-conditions-grid .span-2 {
  grid-column: span 2;
}

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

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

.quote-payment-header h3 {
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
}

.quote-payment-grid {
  display: grid;
  gap: 9px;
}

.quote-payment-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 180px minmax(0, 1fr) 46px;
}

.quote-payment-row .btn {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.quote-sent-form {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  margin: 0;
}

.quote-sent-check {
  cursor: pointer;
  height: 1.05rem;
  width: 1.05rem;
}

.quote-sent-label {
  background: #eef0f3;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.quote-sent-label.is-sent {
  background: #e7f7ee;
  color: #137a3d;
}

.quote-items-modern {
  overflow-x: auto;
}

.quote-items-modern .quote-row {
  grid-template-columns: minmax(320px, 1.4fr) 96px 105px 140px 140px 40px;
}

.quote-items-modern .quote-item {
  background: #fbfcfd;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 8px;
}

.quote-items-modern .quote-head {
  margin: 0 8px 8px;
}

.quote-summary-modern {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 8px;
  padding: 10px 14px;
}

.quote-summary-modern div:last-child {
  border-top: 1px solid #dfe3e8;
  margin-top: 4px;
  padding-top: 10px;
}

.quote-summary-modern .quote-summary-input {
  align-items: center;
  gap: 12px;
}

.quote-summary-modern .quote-summary-input .form-control {
  max-width: 170px;
  margin-left: auto;
  text-align: right;
  font-weight: 800;
  color: var(--ink);
}

.quote-advanced-card {
  padding: 0;
}

.quote-advanced-card summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 18px 20px;
}

.quote-advanced-card summary::-webkit-details-marker {
  display: none;
}

.quote-advanced-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.quote-advanced-card[open] summary i {
  transform: rotate(180deg);
}

.quote-advanced-body {
  display: grid;
  gap: 18px;
  padding: 18px 20px 20px;
}

.quote-subsection {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.quote-sticky-actions {
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: 18px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  display: flex;
  justify-content: space-between;
  left: calc(var(--sidebar-width) + 42px);
  padding: 12px 14px;
  position: fixed;
  right: 42px;
  z-index: 20;
}

.quote-sticky-actions .muted {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-sticky-actions strong {
  color: var(--ink);
  display: block;
  font-size: 1.18rem;
  line-height: 1.1;
}

.danger-zone {
  margin-top: 16px;
  text-align: right;
}

.toast-stack {
  position: fixed;
  z-index: 1080;
  right: 24px;
  top: 18px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-stack .alert {
  pointer-events: auto;
  margin-bottom: 10px;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #101114 0%, #1d2027 58%, #c8102e 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.login-brand {
  background: var(--black);
  color: #fff;
  padding: 56px;
}

.login-brand img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 28px;
}

.login-brand h1 {
  font-size: 2.6rem;
  font-weight: 900;
}

.login-brand p {
  color: rgba(255, 255, 255, 0.72);
  max-width: 420px;
}

.login-card {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card h2 {
  font-weight: 800;
  margin-bottom: 24px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
  }

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

  .quote-sticky-actions {
    left: 18px;
    right: 18px;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 18px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .compact-metrics,
  .form-grid,
  .filter-grid,
  .agenda-filter-grid,
  .receipt-filters,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .quote-basic-grid,
  .quote-conditions-grid {
    grid-template-columns: 1fr;
  }

  .quote-basic-grid > :nth-child(3),
  .quote-basic-grid > :nth-child(4),
  .quote-basic-grid > :nth-child(8),
  .quote-conditions-grid .span-2 {
    grid-column: span 1;
  }

  .quote-payment-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-payment-row {
    grid-template-columns: 90px minmax(130px, 1fr) minmax(0, 1fr) 42px;
  }

  .diagnostic-area-row,
  .diagnostic-repeat,
  .report-equipment-row {
    grid-template-columns: 1fr;
  }

  .service-attend-strip {
    grid-template-columns: 1fr;
  }

  .report-equipment-photos {
    grid-column: 1;
  }

  .diagnostic-repeat textarea {
    grid-column: span 1;
  }

  .quote-row {
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .quote-items-modern .quote-row {
    grid-template-columns: 1fr;
  }

  .quote-head {
    display: none;
  }

  .quote-sticky-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .timeline-actions {
    white-space: normal;
  }

  .agenda-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .agenda-icon {
    display: none;
  }

  .agenda-actions {
    justify-content: flex-start;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  .service-flow {
    grid-template-columns: 1fr;
  }

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

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

  .technical-plan-shell {
    grid-template-columns: 1fr;
  }

  .technical-plan-tools,
  .technical-plan-export {
    position: static;
  }

  .technical-plan-stage {
    min-width: 620px;
  }
}

.quote-type-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  display: block;
  min-height: 126px;
  padding: 22px;
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.quote-type-card span {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.quote-type-card small {
  color: var(--muted);
  line-height: 1.45;
}

.quote-type-card:hover {
  border-color: var(--red);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.hvac-section {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 20px;
}

.hvac-section h2 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.hvac-table {
  min-width: 980px;
}

.hvac-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.hvac-table input,
.hvac-table select,
.hvac-table textarea {
  font-size: 0.9rem;
}

.internal-panel {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

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

.flow-step {
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 14px 16px;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.flow-step:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}

.flow-step.is-current {
  background: #fff5f6;
  border-color: rgba(200, 16, 46, 0.42);
}

.flow-step strong,
.flow-step span {
  display: block;
}

.flow-step strong {
  font-size: 0.92rem;
}

.flow-step span {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.mini-heading {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.form-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  padding: 10px 12px;
}

.service-action-panel {
  margin-bottom: 16px;
}

.share-hint,
.share-inline-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.share-inline-hint {
  align-self: center;
}

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

.linked-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 8px;
  padding: 9px 12px;
  text-decoration: none;
}

.linked-list a:hover {
  border-color: var(--red);
}

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

.cleanup-grid section {
  min-width: 0;
}

.cleanup-grid h2 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.cleanup-grid .table {
  font-size: 0.86rem;
}

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

.backup-card {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  padding: 18px;
}

.backup-card > i {
  color: var(--red);
  font-size: 1.8rem;
}

.backup-card h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.backup-card p,
.code-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.code-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .service-flow {
    grid-template-columns: 1fr;
  }
}

/* Density tuning: keep the current identity, but make daily operations fit better. */
body {
  font-size: 0.92rem;
}

.app-shell {
  grid-template-columns: 220px minmax(0, 1fr);
}

.sidebar {
  padding: 12px 10px;
}

.brand {
  gap: 8px;
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  padding: 4px;
}

.sidebar .nav {
  overflow-y: visible;
}

.sidebar .nav-link {
  border-radius: 6px;
  font-size: 0.78rem;
  gap: 7px;
  line-height: 1.05;
  margin-bottom: 0;
  padding: 5px 7px;
}

.sidebar .nav-link i,
.nav-group summary i {
  flex-basis: 16px;
  font-size: 0.86rem;
}

.nav-group {
  margin: 2px 0;
}

.nav-group summary {
  font-size: 0.62rem;
  gap: 7px;
  padding: 5px 7px;
}

.nav-sub {
  margin-left: 8px;
}

.sidebar-user {
  font-size: 0.78rem;
  padding-top: 8px;
}

.sidebar-user .btn-sm {
  --bs-btn-font-size: 0.76rem;
  --bs-btn-padding-y: 0.24rem;
  --bs-btn-padding-x: 0.45rem;
}

.content {
  padding: 22px 24px;
}

.page-heading {
  margin-bottom: 16px;
}

.page-heading h1 {
  font-size: 1.68rem;
  line-height: 1.08;
}

.page-heading p {
  font-size: 0.88rem;
}

.panel {
  padding: 16px 18px;
}

.panel h2 {
  font-size: 0.98rem;
  margin-bottom: 10px;
}

.panel-header {
  margin-bottom: 9px;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
}

.metric {
  min-height: 72px;
  padding: 10px 12px;
}

.metric span {
  font-size: 0.7rem;
}

.metric strong {
  font-size: 1.28rem;
  margin-top: 6px;
}

.metric i {
  bottom: 7px;
  font-size: 1.55rem;
  right: 10px;
}

.dashboard-section {
  margin-top: 12px !important;
}

.agenda-list,
.dashboard-alert-list,
.timeline-dense {
  gap: 6px;
}

.agenda-row {
  gap: 9px;
  grid-template-columns: 78px 28px minmax(0, 1fr) auto auto auto;
  padding: 7px 9px;
}

.dashboard-agenda .agenda-row {
  grid-template-columns: 78px 28px minmax(0, 1fr) auto auto auto;
}

.agenda-date strong {
  font-size: 0.76rem;
}

.agenda-date span,
.agenda-main p {
  font-size: 0.7rem;
}

.agenda-icon {
  border-radius: 7px;
  height: 28px;
  width: 28px;
}

.agenda-main h3 {
  font-size: 0.86rem;
}

.agenda-main p {
  margin-top: 1px;
}

.agenda-amount {
  font-size: 0.86rem;
}

.status {
  font-size: 0.7rem;
  min-height: 20px;
  padding: 2px 8px;
}

.timeline-dense .timeline-item {
  padding: 7px 9px;
}

.timeline-row {
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 9px;
}

.timeline-item time {
  font-size: 0.76rem;
}

.timeline-date small,
.timeline-meta {
  font-size: 0.7rem;
}

.timeline-dense .timeline-item h3 {
  font-size: 0.84rem;
  margin-bottom: 2px;
}

.timeline-dense .timeline-item p {
  font-size: 0.8rem;
  line-height: 1.25;
  margin-top: 3px;
}

.dashboard-alert-item {
  gap: 9px;
  padding: 8px 10px;
}

.dashboard-alert-item small {
  margin-top: 1px;
}

.table {
  font-size: 0.86rem;
}

.table > :not(caption) > * > * {
  padding: 0.42rem 0.5rem;
}

.btn {
  --bs-btn-font-size: 0.84rem;
  --bs-btn-padding-y: 0.34rem;
  --bs-btn-padding-x: 0.62rem;
}

.btn-sm {
  --bs-btn-font-size: 0.76rem;
  --bs-btn-padding-y: 0.24rem;
  --bs-btn-padding-x: 0.48rem;
}

@media (max-height: 820px) and (min-width: 981px) {
  .sidebar {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand {
    margin-bottom: 8px;
  }

  .brand img {
    width: 31px;
    height: 31px;
  }

  .sidebar .nav-link {
    font-size: 0.74rem;
    padding-bottom: 4px;
    padding-top: 4px;
  }

  .nav-group summary {
    font-size: 0.59rem;
    padding-bottom: 4px;
    padding-top: 4px;
  }

  .sidebar-user {
    font-size: 0.74rem;
    padding-top: 7px;
  }
}

/* Mobile repair: keep M-Service usable on phone browsers after density overrides. */
@media (max-width: 980px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 8px 10px 6px;
    position: sticky;
    top: 0;
    z-index: 1030;
  }

  .brand {
    margin-bottom: 6px;
  }

  .brand img {
    height: 30px;
    width: 30px;
  }

  .sidebar .nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 4px;
    scrollbar-width: thin;
    white-space: nowrap;
  }

  .nav-group {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    margin: 0;
  }

  .nav-group summary,
  .sidebar .nav-link {
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex: 0 0 auto;
    font-size: 0.72rem;
    margin: 0;
    padding: 5px 7px;
  }

  .nav-sub {
    margin-left: 0;
  }

  .sidebar-user {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 5px;
  }

  .sidebar-user .d-flex {
    margin-top: 0 !important;
  }

  .content {
    padding: 14px;
  }

  .page-heading {
    gap: 8px;
    margin-bottom: 12px;
  }

  .page-heading h1 {
    font-size: 1.42rem;
  }

  .page-heading p {
    font-size: 0.78rem;
  }
}

@media (max-width: 720px) {
  .panel {
    border-radius: 8px;
    padding: 12px;
  }

  .panel-header {
    align-items: flex-start;
    gap: 8px;
  }

  .panel-header h2 {
    font-size: 0.94rem;
    line-height: 1.1;
  }

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

  .metric {
    min-height: 64px;
    padding: 9px 10px;
  }

  .metric span {
    font-size: 0.66rem;
  }

  .metric strong {
    font-size: 1.12rem;
  }

  .metric i {
    font-size: 1.3rem;
  }

  .agenda-row {
    align-items: start;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding: 8px 10px;
  }

  .agenda-date {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .agenda-main {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .agenda-main h3,
  .agenda-main p,
  .timeline-main h3,
  .timeline-main p,
  .timeline-meta {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .agenda-amount,
  .agenda-row > .status,
  .agenda-actions {
    justify-self: start;
  }

  .timeline-dense .timeline-item {
    padding: 8px 10px;
  }

  .timeline-row {
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .timeline-date {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .timeline-main {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .timeline-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .timeline-meta {
    gap: 4px;
  }

  .dashboard-section {
    margin-top: 10px !important;
  }

  .dashboard-more-row,
  .dashboard-alert-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .content {
    padding: 10px;
  }

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

  .btn,
  .btn-sm {
    --bs-btn-font-size: 0.72rem;
    --bs-btn-padding-y: 0.24rem;
    --bs-btn-padding-x: 0.46rem;
  }
}
