:root {
  --sg-red: #d71920;
  --sg-red-dark: #a70e14;
  --sg-black: #07090c;
  --sg-sidebar: #0d1117;
  --sg-sidebar-line: #20262f;
  --sg-bg: #f3f4f6;
  --sg-surface: #ffffff;
  --sg-surface-soft: #f8f9fb;
  --sg-line: #e1e4e9;
  --sg-text: #15191f;
  --sg-muted: #68717d;
  --sg-success: #218747;
  --sg-warning: #b46a0a;
  --sg-danger: #bd252d;
  --sg-blue: #2d68c4;
  --sidebar-width: 244px;
  --topbar-height: 76px;
  --shadow: 0 8px 24px rgba(18, 25, 35, 0.06);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--sg-bg);
  color: var(--sg-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

.sg-layout { min-height: 100vh; }

.sg-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: #eef1f5;
  background:
    radial-gradient(circle at 10% 0, rgba(215, 25, 32, 0.12), transparent 24%),
    linear-gradient(180deg, #090c10 0%, #111720 100%);
  border-right: 1px solid var(--sg-sidebar-line);
}

.sg-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sg-sidebar-line);
}

.sg-mark {
  width: 54px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 8px 3px 8px 3px;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -2px;
  transform: skew(-8deg);
}

.sg-brand-copy strong {
  display: block;
  font-size: 12px;
  line-height: 1.15;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sg-brand-copy span {
  color: var(--sg-red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sg-nav { padding: 18px 12px; }

.sg-nav-group + .sg-nav-group { margin-top: 22px; }

.sg-nav-label {
  padding: 0 11px 8px;
  color: #77818d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sg-nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 9px 12px;
  border-radius: 7px;
  color: #cbd1d8;
  font-size: 13px;
  text-decoration: none;
  transition: 160ms ease;
}

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

.sg-nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(215, 25, 32, 0.95), rgba(167, 14, 20, 0.72));
  box-shadow: 0 5px 16px rgba(153, 13, 18, 0.22);
}

.sg-icon {
  width: 20px;
  text-align: center;
  color: #aeb6bf;
  font-size: 16px;
}

.sg-nav-link.active .sg-icon { color: #fff; }

.sg-sidebar-foot {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--sg-sidebar-line);
}

.sg-user {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sg-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #3a424d;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.sg-user strong,
.sg-user span { display: block; }
.sg-user strong { font-size: 12px; }
.sg-user span { margin-top: 2px; color: #818b96; font-size: 10px; text-transform: capitalize; }

.sg-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.sg-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 26px;
  color: #fff;
  background: rgba(6, 8, 11, 0.97);
  border-bottom: 1px solid #20242a;
}

.sg-page-title h1 {
  margin: 0 0 3px;
  font-size: 20px;
  line-height: 1.2;
}

.sg-page-title p {
  margin: 0;
  color: #8f99a6;
  font-size: 11px;
}

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

.sg-api {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #abb3bd;
  font-size: 11px;
}

.sg-api::before {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: #79838f;
}

.sg-api.online::before {
  background: #49b873;
  box-shadow: 0 0 0 4px rgba(73, 184, 115, 0.11);
}

.sg-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid #343a43;
  border-radius: 6px;
  color: #f4f6f8;
  background: #10141a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.sg-button:hover { border-color: #6c7580; }

.sg-button.primary {
  border-color: var(--sg-red);
  background: var(--sg-red);
}

.sg-button.primary:hover { background: var(--sg-red-dark); }

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

.sg-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 26px;
}

.sg-error {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #f0b7ba;
  border-radius: 7px;
  color: #8f1d23;
  background: #fff0f1;
  font-size: 12px;
}

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

.sg-card {
  background: var(--sg-surface);
  border: 1px solid var(--sg-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sg-metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.sg-metric-card::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: #c4cbd3;
}

.sg-metric-card.accent::after { background: var(--sg-red); }
.sg-metric-card.success::after { background: var(--sg-success); }
.sg-metric-card.warning::after { background: var(--sg-warning); }

.sg-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--sg-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sg-metric-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #5f6975;
  background: #f0f2f5;
  font-size: 15px;
}

.sg-metric-value {
  margin-top: 9px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.sg-metric-note {
  margin-top: 5px;
  color: #8a929c;
  font-size: 10px;
}

.sg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
  gap: 16px;
  margin-top: 16px;
}

.sg-panel { padding: 18px; }

.sg-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.sg-panel-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.sg-link {
  color: var(--sg-red);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.sg-table-wrap { overflow-x: auto; }

.sg-table {
  width: 100%;
  border-collapse: collapse;
}

.sg-table th,
.sg-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  white-space: nowrap;
}

.sg-table th {
  color: #7c8590;
  background: #fafbfc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sg-table td { font-size: 11px; }
.sg-table tbody tr { cursor: pointer; }
.sg-table tbody tr:hover { background: #fafbfc; }
.sg-table tbody tr:last-child td { border-bottom: 0; }

.sg-number { color: #11151b; font-weight: 800; }
.sg-amount { text-align: right !important; font-weight: 800; }

.sg-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sg-pill.open,
.sg-pill.issued { color: #9a5909; background: #fff4df; }
.sg-pill.paid,
.sg-pill.completed { color: #1b703b; background: #e8f7ee; }
.sg-pill.in_progress,
.sg-pill.booked { color: #265ca7; background: #e9f1fc; }
.sg-pill.void,
.sg-pill.cancelled,
.sg-pill.declined,
.sg-pill.expired { color: #9a2027; background: #fdecee; }
.sg-pill.draft { color: #5f6975; background: #edf0f3; }
.sg-pill.sent { color: #9a5909; background: #fff4df; }
.sg-pill.accepted { color: #1b703b; background: #e8f7ee; }

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

.sg-config {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: var(--sg-surface-soft);
}

.sg-config span {
  display: block;
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.sg-config strong {
  display: block;
  margin-top: 9px;
  font-size: 12px;
}

.sg-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sg-success);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sg-live::before {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--sg-success);
  box-shadow: 0 0 0 4px rgba(33, 135, 71, 0.1);
}

.sg-empty {
  padding: 26px;
  color: var(--sg-muted);
  text-align: center;
  font-size: 11px;
}

.sg-full { margin-top: 16px; }

.sg-catalogue-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.55fr);
  gap: 16px;
  align-items: start;
}

.sg-service-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.sg-service-item {
  width: 100%;
  border: 1px solid var(--sg-line);
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  color: var(--sg-ink);
}

.sg-service-item:hover,
.sg-service-item.active {
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 1px var(--sg-accent);
}

.sg-service-item strong { display: block; font-size: 13px; }
.sg-service-item small { display: block; margin-top: 5px; color: var(--sg-muted); }

.sg-commercial-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.sg-commercial-card {
  background: var(--sg-soft);
  border: 1px solid var(--sg-line);
  border-radius: 9px;
  padding: 12px;
}

.sg-commercial-card span {
  display: block;
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sg-commercial-card strong { display: block; margin-top: 6px; font-size: 18px; }

.sg-technical-hold {
  border-left: 3px solid var(--sg-warning);
  background: #fff8e8;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  color: #5f4917;
  font-size: 12px;
}

.sg-calculator-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: var(--sg-soft);
  border: 1px solid var(--sg-line);
  border-radius: 10px;
  margin: 16px 0;
}

@media (max-width: 1050px) {
  .sg-catalogue-layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sg-commercial-grid { grid-template-columns: 1fr 1fr; }
  .sg-calculator-bar { grid-template-columns: 1fr; }
}

.sg-list-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 190px auto;
  gap: 10px;
  margin: 16px 0;
}

.sg-list-toolbar.jobs {
  grid-template-columns: minmax(240px, 1fr) 175px 175px auto;
}

.sg-field {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid #d8dde3;
  border-radius: 6px;
  outline: none;
  color: var(--sg-text);
  background: #fff;
  font-size: 12px;
}

.sg-field:focus {
  border-color: #8f99a5;
  box-shadow: 0 0 0 3px rgba(58, 70, 84, 0.08);
}

.sg-table-card {
  overflow: hidden;
  padding: 0;
}

.sg-table-card .sg-table { min-width: 880px; }
.sg-table-card .sg-table th,
.sg-table-card .sg-table td { padding: 14px 16px; }

.sg-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  justify-content: flex-end;
  background: rgba(7, 10, 14, 0.68);
  backdrop-filter: blur(2px);
}

.sg-drawer-backdrop.open { display: flex; }

.sg-drawer {
  width: min(620px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  color: var(--sg-text);
  background: #f6f7f9;
  border-left: 1px solid #cfd4db;
  box-shadow: -18px 0 44px rgba(5, 8, 12, 0.2);
}

.sg-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--sg-line);
}

.sg-drawer-head h2 {
  margin: 5px 0 0;
  font-size: 24px;
}

.sg-overline {
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sg-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #d1d6dd;
  border-radius: 6px;
  color: #3d4651;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}

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

.sg-detail {
  padding: 13px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: #fff;
}

.sg-detail span {
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sg-detail strong {
  display: block;
  margin-top: 7px;
  font-size: 12px;
}

.sg-lines {
  margin: 18px 0;
  padding: 0 14px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: #fff;
}

.sg-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 12px;
}

.sg-line:last-child { border-bottom: 0; }

.sg-line small {
  display: block;
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-totals {
  width: min(340px, 100%);
  margin: 0 0 0 auto;
  padding: 13px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: #fff;
}

.sg-total-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 12px;
}

.sg-total-row.grand {
  margin-top: 7px;
  padding: 13px 0 5px;
  border-top: 2px solid #11151b;
  font-size: 18px;
  font-weight: 850;
}

.sg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.sg-share-box {
  display: none;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: #fff;
}

.sg-share-box.open { display: block; }

.sg-share-row {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.sg-share-row .sg-field { flex: 1; }

.sg-share-help {
  margin: 7px 0 0;
  color: var(--sg-muted);
  font-size: 11px;
  line-height: 1.55;
}

.sg-share-contact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.sg-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sg-button.whatsapp {
  color: #fff;
  border-color: #1f9f56;
  background: #1f9f56;
}

.sg-button.whatsapp:hover {
  border-color: #178246;
  background: #178246;
}

.sg-priority {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sg-priority.urgent,
.sg-priority.emergency { color: var(--sg-danger); }

.sg-section-title {
  margin: 24px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.sg-entity-card {
  padding: 18px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.sg-entity-card:hover {
  border-color: #bfc6ce;
  box-shadow: 0 12px 28px rgba(18, 25, 35, 0.09);
  transform: translateY(-2px);
}

.sg-entity-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sg-entity-avatar {
  width: 43px;
  height: 43px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #222933, #11151b);
  font-size: 14px;
  font-weight: 850;
}

.sg-entity-name {
  font-size: 14px;
  font-weight: 800;
}

.sg-entity-contact {
  min-height: 44px;
  margin-top: 14px;
  color: var(--sg-muted);
  font-size: 11px;
  line-height: 1.8;
}

.sg-entity-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf0f3;
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 25px 0 10px;
}

.sg-section-head h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sg-section-head span {
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-mini-vehicle {
  margin-bottom: 9px;
  padding: 13px;
  border: 1px solid var(--sg-line);
  border-radius: 7px;
  background: #fff;
}

.sg-mini-vehicle-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.sg-registration {
  color: var(--sg-red);
  font-weight: 850;
}

.sg-vehicle-meta {
  margin-top: 7px;
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-timeline {
  margin: 4px 0 0 7px;
  padding-left: 19px;
  border-left: 2px solid #dfe3e8;
}

.sg-event {
  position: relative;
  padding: 0 0 20px;
}

.sg-event::before {
  position: absolute;
  top: 3px;
  left: -25px;
  width: 10px;
  height: 10px;
  content: "";
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--sg-red);
  box-shadow: 0 0 0 1px #cbd1d8;
}

.sg-event-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sg-event-type {
  color: var(--sg-red);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sg-event-date {
  color: var(--sg-muted);
  font-size: 9px;
}

.sg-event-title {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
}

.sg-event-meta {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-owner-card {
  margin: 17px 0;
  padding: 14px;
  border: 1px solid #efb8bb;
  border-radius: 7px;
  background: #fff5f5;
}

.sg-owner-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 13px;
}

.sg-vehicle-card {
  overflow: hidden;
  padding: 0;
}

.sg-vehicle-hero {
  min-height: 91px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 17px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(215, 25, 32, 0.28), transparent 30%),
    linear-gradient(135deg, #242c36, #0b0f14 72%);
}

.sg-vehicle-registration {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.025em;
}

.sg-vehicle-year {
  color: #9da6b1;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.sg-vehicle-body { padding: 17px; }

.sg-vehicle-name {
  font-size: 14px;
  font-weight: 850;
}

.sg-vehicle-spec {
  min-height: 43px;
  margin-top: 8px;
  color: var(--sg-muted);
  font-size: 10px;
  line-height: 1.7;
}

.sg-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 16px;
}

.sg-form-panel,
.sg-list-panel { padding: 19px; }

.sg-panel-title {
  margin: 0 0 16px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sg-form-label {
  display: block;
  margin: 13px 0 6px;
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

textarea.sg-field {
  min-height: 78px;
  resize: vertical;
}

.sg-form-submit {
  width: 100%;
  margin-top: 17px;
}

.sg-message {
  min-height: 30px;
  margin-top: 10px;
  color: var(--sg-muted);
  font-size: 11px;
}

.sg-message.error { color: var(--sg-danger); }

.sg-calendar-day + .sg-calendar-day { margin-top: 22px; }

.sg-day-title {
  margin-bottom: 7px;
  color: var(--sg-red);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sg-appointment {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f3;
}

.sg-appointment:last-child { border-bottom: 0; }

.sg-appointment-time {
  font-size: 12px;
  font-weight: 850;
}

.sg-appointment-title {
  font-size: 12px;
  font-weight: 800;
}

.sg-appointment-details {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 10px;
}

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

.sg-inline-actions .sg-button {
  min-height: 31px;
  padding: 6px 9px;
  font-size: 10px;
}

.sg-call-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
}

.sg-call-panel {
  min-height: 430px;
  padding: 14px;
}

.sg-call-item {
  padding: 14px;
  border: 1px solid transparent;
  border-bottom-color: #edf0f3;
  cursor: pointer;
}

.sg-call-item:hover,
.sg-call-item.selected {
  border-color: #dce1e6;
  border-radius: 7px;
  background: #f8f9fb;
}

.sg-call-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sg-call-number {
  font-size: 12px;
  font-weight: 850;
}

.sg-call-details {
  margin-top: 6px;
  color: var(--sg-muted);
  font-size: 10px;
  line-height: 1.5;
}

.sg-call-detail h2 {
  margin: 4px 0;
  font-size: 22px;
}

.sg-detail-section {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--sg-line);
}

.sg-detail-section h3 {
  margin: 0 0 8px;
  color: var(--sg-red);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sg-detail-section p {
  margin: 0;
  white-space: pre-wrap;
  color: #3b424b;
  font-size: 11px;
  line-height: 1.65;
}

.sg-pill.normal { color: #1b703b; background: #e8f7ee; }
.sg-pill.urgent { color: #9a5909; background: #fff4df; }
.sg-pill.emergency,
.sg-pill.failed,
.sg-pill.missed { color: #9a2027; background: #fdecee; }

.sg-callback-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid #edf0f3;
}

.sg-callback-task:last-child { border-bottom: 0; }

.sg-knowledge-entry {
  padding: 16px 0;
  border-bottom: 1px solid #edf0f3;
}

.sg-knowledge-entry:last-child { border-bottom: 0; }

.sg-knowledge-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.sg-knowledge-entry h3 {
  margin: 5px 0 0;
  font-size: 13px;
}

.sg-category {
  color: var(--sg-red);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sg-knowledge-entry p {
  margin: 10px 0;
  color: #3d444d;
  font-size: 11px;
  line-height: 1.6;
}

.sg-keywords {
  color: var(--sg-muted);
  font-size: 10px;
}

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

.sg-settings-grid .full { grid-column: 1 / -1; }

.sg-switch-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 11px;
}

.sg-switch-row:last-child { border-bottom: 0; }

.sg-switch-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--sg-red);
}

.sg-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #edf0f3;
}

.sg-user-row:last-child { border-bottom: 0; }

.sg-user-name {
  font-size: 12px;
  font-weight: 850;
}

.sg-user-meta {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 10px;
}

.sg-button.light {
  border-color: #d4d9df;
  color: #252b33;
  background: #fff;
}

.sg-button.success {
  border-color: var(--sg-success);
  color: #fff;
  background: var(--sg-success);
}

.sg-button.danger {
  border-color: #e0afb2;
  color: var(--sg-danger);
  background: #fff;
}

.sg-model-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.sg-model-card {
  min-height: 126px;
  padding: 15px;
  border: 1px solid var(--sg-line);
  border-radius: 9px;
  color: var(--sg-text);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: 150ms ease;
}

.sg-model-card:hover,
.sg-model-card.active {
  border-color: var(--sg-accent);
  box-shadow: 0 7px 22px rgba(183, 0, 19, 0.12);
  transform: translateY(-1px);
}

.sg-model-card.active { background: #fff7f7; }
.sg-model-card svg { width: 100%; height: 48px; color: #1a2028; }
.sg-model-card strong { display: block; margin-top: 7px; font-size: 14px; }
.sg-model-card small { color: var(--sg-muted); }

@media (max-width: 1180px) {
  .sg-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-grid { grid-template-columns: 1fr; }
  .sg-entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-workspace-grid { grid-template-columns: 1fr; }
  .sg-call-layout { grid-template-columns: 1fr; }
  .sg-model-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 820px) {
  :root { --topbar-height: 66px; }
  .sg-sidebar {
    width: min(280px, 86vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 14px 0 40px rgba(0, 0, 0, 0.25);
  }
  body.nav-open .sg-sidebar { transform: translateX(0); }
  .sg-main { margin-left: 0; }
  .sg-mobile-menu { display: inline-flex; }
  .sg-content { padding: 18px; }
  .sg-list-toolbar { grid-template-columns: 1fr 160px; }
  .sg-list-toolbar.jobs { grid-template-columns: 1fr 1fr; }
  .sg-list-toolbar .sg-button { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .sg-topbar { padding: 12px 14px; }
  .sg-page-title h1 { font-size: 17px; }
  .sg-page-title p,
  .sg-api { display: none; }
  .sg-content { padding: 14px; }
  .sg-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .sg-metric-card { padding: 14px; }
  .sg-metric-value { font-size: 22px; }
  .sg-metric-note { display: none; }
  .sg-panel { padding: 13px; }
  .sg-reception-grid { grid-template-columns: 1fr; }
  .sg-list-toolbar { grid-template-columns: 1fr; }
  .sg-list-toolbar.jobs { grid-template-columns: 1fr; }
  .sg-list-toolbar .sg-button { grid-column: auto; }
  .sg-detail-grid { grid-template-columns: 1fr; }
  .sg-share-row { flex-direction: column; }
  .sg-share-contact { grid-template-columns: 1fr; }
  .sg-entity-grid { grid-template-columns: 1fr; }
  .sg-form-row { grid-template-columns: 1fr; }
  .sg-appointment { grid-template-columns: 64px minmax(0, 1fr); }
  .sg-inline-actions { grid-column: 2; justify-content: flex-start; }
  .sg-callback-task { grid-template-columns: 1fr; }
  .sg-settings-grid { grid-template-columns: 1fr; }
  .sg-settings-grid .full { grid-column: auto; }
  .sg-knowledge-head { flex-direction: column; }
  .sg-user-row { grid-template-columns: 1fr; }
  .sg-model-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

/* Premium invoice workspace */
body.invoice-open { overflow: hidden; }

.sg-invoice-backdrop {
  z-index: 80;
  padding: 0;
  background: rgba(4, 6, 9, 0.72);
}

.sg-invoice-drawer {
  width: min(1440px, calc(100vw - 34px));
  max-width: none;
  height: calc(100vh - 24px);
  margin: 12px 12px 12px auto;
  padding: 0;
  overflow: hidden;
  border-radius: 10px 0 0 10px;
  background: #eef0f3;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.3);
}

.sg-invoice-toolbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 20px;
  color: #fff;
  background: linear-gradient(135deg, #050608, #10141a);
  border-bottom: 1px solid #272c34;
}

.sg-invoice-toolbar-title,
.sg-invoice-title-row,
.sg-invoice-toolbar-actions {
  display: flex;
  align-items: center;
}

.sg-invoice-toolbar-title { gap: 14px; }
.sg-invoice-title-row { gap: 12px; }
.sg-invoice-toolbar-actions { gap: 10px; }
.sg-invoice-toolbar .sg-overline { color: #8e98a5; }
.sg-invoice-toolbar h2 { margin: 2px 0 0; font-size: 20px; }
.sg-invoice-toolbar .sg-button { border-color: #303741; background: #0c1015; }
.sg-invoice-toolbar .sg-button:hover { background: #171d25; }

.sg-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #303741;
  border-radius: 7px;
  color: #fff;
  background: #0c1015;
  cursor: pointer;
}

.sg-invoice-detail {
  height: calc(100% - 74px);
  overflow: auto;
  padding: 18px;
}

.sg-invoice-workspace {
  max-width: 1250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  margin: 0 auto;
}

.sg-invoice-paper {
  overflow: hidden;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(18, 25, 35, 0.05);
}

.sg-invoice-hero {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1.15fr;
  gap: 26px;
  min-height: 210px;
  padding: 30px;
  border-bottom: 1px solid #e3e6ea;
}

.sg-invoice-company strong,
.sg-invoice-company span { display: block; }
.sg-invoice-company strong { font-size: 17px; }
.sg-invoice-company span { margin-top: 4px; color: #545d68; font-size: 12px; }
.sg-invoice-company p { margin: 22px 0 0; color: #444c57; font-size: 12px; line-height: 1.7; }

.sg-document-logo {
  align-self: start;
  justify-self: center;
  min-width: 125px;
  text-align: center;
}
.sg-document-logo b {
  display: block;
  color: #07090c;
  font-size: 56px;
  font-style: italic;
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -8px;
  transform: skew(-10deg);
}
.sg-document-logo span,
.sg-document-logo em {
  display: block;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.13em;
}
.sg-document-logo em { color: var(--sg-red); }

.sg-invoice-meta h1 {
  margin: 0 0 20px;
  text-align: right;
  font-size: 30px;
  letter-spacing: 0.03em;
}

.sg-invoice-meta dl,
.sg-document-card dl,
.sg-invoice-bottom dl,
.sg-payment-summary { margin: 0; }
.sg-invoice-meta dl div,
.sg-document-card dl div,
.sg-invoice-bottom dl div,
.sg-payment-summary div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.sg-invoice-meta dl div { padding: 4px 0; }
.sg-invoice-meta dt,
.sg-document-card dt,
.sg-invoice-bottom dt,
.sg-payment-summary dt { color: #606975; }
.sg-invoice-meta dt,
.sg-invoice-meta dd { font-size: 11px; }
.sg-invoice-meta dd,
.sg-document-card dd,
.sg-invoice-bottom dd,
.sg-payment-summary dd { margin: 0; text-align: right; font-weight: 700; }

.sg-invoice-parties {
  display: grid;
  grid-template-columns: 0.9fr 1.5fr;
  gap: 12px;
  padding: 12px;
  background: #f7f8fa;
}

.sg-document-card {
  min-height: 184px;
  padding: 18px;
  border: 1px solid #e0e4e9;
  border-radius: 7px;
  background: #fff;
}
.sg-document-card h3,
.sg-invoice-items > h3,
.sg-invoice-bottom h3,
.sg-invoice-notes h3,
.sg-side-card h3 {
  margin: 0 0 16px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sg-document-card > strong { display: block; margin-bottom: 8px; font-size: 14px; }
.sg-document-card p { margin: 6px 0 12px; color: #424a55; font-size: 11px; line-height: 1.55; }
.sg-document-card dl div { padding: 3px 0; font-size: 11px; }

.sg-vehicle-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}
.sg-vehicle-silhouette {
  min-width: 120px;
  padding: 24px 14px 10px;
  border-radius: 60% 50% 10px 10px;
  color: #fff;
  background: linear-gradient(155deg, #454b53, #090b0e 65%);
  box-shadow: inset 0 -4px 0 #1b2026;
  text-align: center;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.sg-invoice-items { padding: 22px 18px 26px; }
.sg-invoice-table-wrap { overflow-x: auto; }
.sg-invoice-items table { width: 100%; border-collapse: collapse; }
.sg-invoice-items th {
  padding: 9px 10px;
  color: #58616c;
  background: #f4f6f8;
  border-block: 1px solid #e0e4e8;
  font-size: 9px;
  text-align: left;
  text-transform: uppercase;
}
.sg-invoice-items th:nth-last-child(-n+4),
.sg-invoice-items td:nth-last-child(-n+4) { text-align: right; }
.sg-invoice-items td {
  padding: 10px;
  border-bottom: 1px solid #e7e9ed;
  font-size: 10px;
  vertical-align: top;
}
.sg-invoice-items td strong { display: block; font-size: 11px; }
.sg-invoice-items td small { display: block; margin-top: 3px; color: #6c7580; }
.sg-line-group { font-weight: 900; letter-spacing: 0.04em; }

.sg-invoice-total-block {
  width: min(340px, 100%);
  margin: 14px 0 0 auto;
}
.sg-invoice-total-block > div {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 7px 14px;
  font-size: 11px;
}
.sg-invoice-total-block .grand {
  margin-top: 3px;
  padding: 13px 14px;
  color: #fff;
  background: #090b0e;
  font-size: 15px;
}

.sg-invoice-bottom {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 30px;
  margin: 0 12px 12px;
  padding: 20px;
  border: 1px solid #e0e4e9;
  border-radius: 7px;
}
.sg-invoice-bottom > div + div { padding-left: 28px; border-left: 1px solid #e2e5e9; }
.sg-invoice-bottom dl div { padding: 3px 0; font-size: 10px; }
.sg-invoice-bottom ul { margin: 0; padding-left: 16px; color: #4c5560; font-size: 10px; line-height: 1.7; }
.sg-invoice-notes { margin: 0 12px 12px; padding: 18px 20px; border: 1px solid #e0e4e9; border-radius: 7px; }
.sg-invoice-notes p { margin: 0; color: #4b535d; font-size: 11px; }
.sg-invoice-footer { display: flex; justify-content: space-between; padding: 14px 20px; color: #68717d; background: #f5f6f8; font-size: 9px; }

.sg-invoice-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sg-side-card {
  padding: 16px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
}
.sg-side-card p { margin: 0; color: #555e69; font-size: 11px; line-height: 1.55; }
.sg-side-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid #dce0e5;
  border-radius: 6px;
  color: #252a31;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.sg-side-action:hover { border-color: #aeb5bf; background: #f8f9fa; }
.sg-side-action span { width: 22px; color: #606976; text-align: center; }
.sg-side-action b { font-size: 11px; }
.sg-side-action.primary { color: #fff; background: #12161c; border-color: #12161c; }
.sg-side-action.primary span { color: #fff; }
.sg-side-action.danger { color: #a51b24; }
.sg-payment-summary div { padding: 7px 0; font-size: 10px; }
.sg-payment-summary .total { margin: 6px 0; padding: 12px 0; border-block: 1px solid #dfe3e8; font-size: 12px; }
.sg-payment-summary .paid { color: var(--sg-success); }
.sg-document-file { display: flex; align-items: center; gap: 11px; }
.sg-document-file > span { padding: 7px; border-radius: 5px; color: #fff; background: var(--sg-red); font-size: 9px; font-weight: 900; }
.sg-document-file b,
.sg-document-file small { display: block; font-size: 10px; }
.sg-document-file small { margin-top: 3px; color: #757e89; }

@media (max-width: 980px) {
  .sg-invoice-drawer { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
  .sg-invoice-detail { height: calc(100vh - 74px); }
  .sg-invoice-workspace { grid-template-columns: 1fr; }
  .sg-invoice-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-invoice-toolbar-actions .sg-button:nth-child(3) { display: none; }
}

@media (max-width: 680px) {
  .sg-invoice-toolbar-actions .sg-button { display: none; }
  .sg-invoice-detail { padding: 8px; }
  .sg-invoice-hero { grid-template-columns: 1fr; padding: 20px; }
  .sg-document-logo { display: none; }
  .sg-invoice-meta h1 { text-align: left; }
  .sg-invoice-parties,
  .sg-invoice-bottom,
  .sg-invoice-side { grid-template-columns: 1fr; }
  .sg-invoice-bottom > div + div { padding: 20px 0 0; border: 0; border-top: 1px solid #e2e5e9; }
  .sg-vehicle-heading { align-items: flex-start; flex-direction: column; }
}

@media print {
  body.invoice-open { overflow: visible; background: #fff; }
  body.invoice-open .sg-layout,
  body.invoice-open .sg-invoice-toolbar,
  body.invoice-open .sg-invoice-side { display: none !important; }
  body.invoice-open .sg-invoice-backdrop,
  body.invoice-open .sg-invoice-drawer,
  body.invoice-open .sg-invoice-detail,
  body.invoice-open .sg-invoice-workspace {
    position: static;
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: #fff;
    box-shadow: none;
  }
  body.invoice-open .sg-invoice-paper { border: 0; box-shadow: none; }
}
