:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --brand: #1a56db;
  --brand-dark: #1745b0;
  --danger: #b42318;
  --ok: #05603a;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.brand {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.topbar-heading {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-back {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 10px;
  margin-left: -8px;
  flex: 0 0 auto;
}

.topbar-back:active {
  background: var(--bg);
}

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

.topbar-action {
  font-size: 15px;
  font-weight: 600;
  color: var(--brand);
  padding: 8px 6px;
  flex: 0 0 auto;
}

.topbar-actions form {
  display: flex;
}

.topbar-logout {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 6px;
}

.topbar-menu-btn {
  margin-left: auto;
  margin-right: -8px;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-2);
}

.topbar-menu-btn:active {
  background: var(--bg);
}

/* ---------- Menu ---------- */

.menu-panel {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top));
  right: max(14px, calc(50% - 374px));
  z-index: 25;
  width: min(260px, calc(100vw - 28px));
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  animation: menu-in 0.14s ease-out;
}

.menu-panel[hidden] {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
}

.menu-item:active {
  background: var(--bg);
}

.menu-item.is-active {
  background: #eef4ff;
  color: var(--brand);
}

.menu-panel form {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.menu-logout {
  color: var(--danger);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Layout ---------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
}

.with-sum-bar .page {
  padding-bottom: calc(170px + env(safe-area-inset-bottom));
}

.with-save-bar .page {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

.flash {
  background: #ecfdf3;
  color: var(--ok);
  border: 1px solid #abefc6;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin: 6px 0 0;
  font-weight: 500;
}

/* ---------- Period chips ---------- */

.period-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.period-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

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

.chip-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
}

.chip-sm span {
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Custom period ---------- */

.custom-period {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}

.custom-period summary {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}

.custom-period summary::-webkit-details-marker {
  display: none;
}

.custom-period-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
  align-items: flex-end;
}

.mini-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex: 1 1 130px;
}

.mini-field input {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
  width: 100%;
  font-size: 16px;
}

.custom-period-form .btn-secondary {
  height: 44px;
  padding: 0 16px;
}

/* ---------- Filters ---------- */

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filters-grid-single {
  grid-template-columns: 1fr;
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.select-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.select-field select {
  height: 46px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 0 8px;
  font-size: 16px;
  min-width: 0;
}

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

.search-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
  background: #fff;
}

.search-btn {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 12px;
}

.clear-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 6px 4px;
}

/* ---------- Order list ---------- */

.order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.order-card:active {
  background: #fafbfc;
}

.order-card[hidden],
.order-list[hidden] {
  display: none;
}

.order-card-main {
  flex: 1;
  min-width: 0;
}

.order-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.order-card-link:focus-visible {
  outline-offset: -2px;
}

.order-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.order-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.order-total {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.order-client {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.order-car {
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 2px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.plate {
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.order-photos {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 46px);
  gap: 6px;
  pointer-events: none;
}

.order-photo {
  position: relative;
  z-index: 2;
  padding: 0;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef2f6;
  overflow: hidden;
  pointer-events: auto;
}

.order-photo:active {
  border-color: var(--brand);
}

.order-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.order-photos-more {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.order-mechanics {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Shop report ---------- */

.pay-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-card {
  padding: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.pay-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 2px;
}

.pay-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  min-width: 0;
}

.pay-deleted {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 7px;
  vertical-align: middle;
}

.pay-total {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

.pay-count {
  padding: 0 14px 10px;
  font-size: 13px;
  color: var(--muted);
}

.pay-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.pay-row {
  border-bottom: 1px solid var(--line);
}

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

.pay-row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

.pay-row-link:active {
  background: #fafbfc;
}

.pay-row-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pay-row-head {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.pay-row-title {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-row-client {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-row-amount {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.pay-alert {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  border-color: #fedf89;
  background: #fffaeb;
  color: #b54708;
  font-size: 14px;
}

.pay-alert strong {
  font-weight: 800;
}

.pay-alert:active {
  background: #fef0c7;
}

/* ---------- Sum bar / FAB ---------- */

.sum-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06);
}

.sum-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.sum-total {
  font-size: 14px;
  color: var(--muted);
}

.sum-total strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-left: 4px;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 35;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(26, 86, 219, 0.35);
}

@media (min-width: 780px) {
  .fab {
    right: calc(50% - 344px);
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
  text-align: center;
}

.btn-primary {
  background: var(--brand);
}

.btn-primary:active {
  background: var(--brand-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #fda29b;
}

.btn-block {
  width: 100%;
}

.btn-quick {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  flex: 0 0 auto;
}

.btn-small {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}

.btn-small-danger {
  color: var(--danger);
  border-color: #fda29b;
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > span,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field input,
.field select {
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 12px;
  background: #fff;
  font-size: 16px;
  width: 100%;
  min-width: 0;
}

.field input:focus,
.field select:focus,
.search-row input:focus,
.select-field select:focus,
.mini-field input:focus,
.third-row input:focus,
.third-row select:focus,
.reg-fields input:focus,
.reg-add input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.has-error {
  border-color: #fda29b !important;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-with-add {
  display: flex;
  gap: 8px;
}

.field-with-add select {
  flex: 1;
  min-width: 0;
}

.km-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.km-btn {
  flex: 1;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #f8fafc;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

.km-btn:active {
  background: #eef2f6;
}

.oil-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.oil-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
}

.third-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.third-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 106px 44px;
  gap: 8px;
}

.third-row select,
.third-row input {
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 16px;
  min-width: 0;
  background: #fff;
}

.row-remove {
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 20px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-chip {
  position: relative;
}

.check-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.check-chip input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.check-chip input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2);
}

.chip-add {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

/* ---------- Photos ---------- */

.photo-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px dashed var(--line-strong);
  background: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

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

.photo-grid .hint {
  grid-column: 1 / -1;
  margin: 0;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f6;
  border: 1px solid var(--line);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(16, 24, 40, 0.72);
  color: #fff;
  font-size: 17px;
  line-height: 1;
}

/* ---------- Totals ---------- */

.total-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 15px;
  color: var(--ink-2);
  border-bottom: 1px solid #f2f4f7;
}

.total-line:last-child {
  border-bottom: none;
}

.total-line-main {
  padding-top: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  align-items: baseline;
}

.total-line-main strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Empty state ---------- */

.empty-state {
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 6px;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 14px;
}

/* ---------- Detail ---------- */

.detail-hero {
  background: linear-gradient(135deg, #1a56db, #1745b0);
  color: #fff;
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 12px;
}

.detail-total {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-sub {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

.detail-phone {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: underline;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.detail-grid dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.detail-grid dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.detail-mechanics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mech-pill {
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.detail-page .btn-block {
  margin-bottom: 10px;
}

.danger-zone {
  margin-top: 18px;
}

.photo-thumb {
  border: none;
  padding: 0;
  background: #eef2f6;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  border: none;
  padding: 0;
  background: #000;
  color: #fff;
  max-width: 96vw;
  max-height: 90vh;
  border-radius: 14px;
  overflow: hidden;
}

.photo-dialog::backdrop {
  background: rgba(16, 24, 40, 0.8);
}

.photo-dialog img {
  display: block;
  max-width: 96vw;
  max-height: 86vh;
  object-fit: contain;
}

.photo-dialog [data-photo-close] {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

/* ---------- Registrations ---------- */

.seg-tabs {
  display: flex;
  gap: 6px;
  background: #e9edf2;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.seg-tab {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.seg-tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.reg-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reg-add label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.reg-add input {
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
  background: #fff;
}

.reg-add .btn {
  margin-top: 2px;
}

.reg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reg-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.reg-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reg-fields input {
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 0 10px;
  font-size: 15px;
  background: #fff;
  width: 100%;
  min-width: 0;
}

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

/* ---------- Save bar ---------- */

.save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  max-width: 720px;
  margin: 0 auto;
}

.save-bar .btn {
  flex: 1;
  height: 50px;
}

.save-bar .btn-secondary {
  flex: 0 0 38%;
}

/* ---------- Dialog ---------- */

.quick-dialog {
  width: calc(100vw - 32px);
  max-width: 380px;
  border: none;
  border-radius: 18px;
  padding: 20px;
}

.quick-dialog::backdrop {
  background: rgba(16, 24, 40, 0.55);
}

.quick-dialog h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.quick-dialog .field {
  margin-bottom: 12px;
}

.quick-phone.is-hidden {
  display: none;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.dialog-actions .btn {
  flex: 1;
  min-height: 46px;
  font-size: 15px;
}

/* ---------- Login ---------- */

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.login-card > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Troca de óleo ---------- */

.oil-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.oil-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.oil-stat strong {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.oil-stat span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.oil-stat-danger {
  color: var(--danger);
  border-color: #fecdca;
  background: #fffbfa;
}

.oil-stat-warn {
  color: #b54708;
  border-color: #fedf89;
  background: #fffcf5;
}

.oil-stat-ok {
  color: var(--ok);
  border-color: #abefc6;
  background: #f6fef9;
}

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

.oil-group {
  margin-bottom: 18px;
  scroll-margin-top: 70px;
}

.oil-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.oil-group-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.oil-group-head span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.oil-group-hint {
  margin: 2px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.oil-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oil-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.oil-card:active {
  background: #fafbfc;
}

.oil-card.is-atrasado {
  border-left-color: var(--danger);
}

.oil-card.is-vencendo {
  border-left-color: #d97706;
}

.oil-card.is-em-dia {
  border-left-color: #12b76a;
}

.oil-card.is-sem-dados {
  border-left-color: var(--line-strong);
}

.oil-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.oil-client {
  font-size: 16px;
  font-weight: 700;
}

.oil-pill {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.oil-pill-atrasado {
  background: #fef3f2;
  color: var(--danger);
}

.oil-pill-vencendo {
  background: #fffaeb;
  color: #b54708;
}

.oil-pill-em-dia {
  background: #ecfdf3;
  color: var(--ok);
}

.oil-pill-sem-dados {
  background: #f2f4f7;
  color: var(--muted);
}

.oil-car {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 14px;
  color: var(--ink-2);
}

.oil-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.oil-note {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.oil-note.is-atrasado {
  color: var(--danger);
}

.oil-note.is-vencendo {
  color: #b54708;
}

.oil-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.oil-phone {
  position: relative;
  z-index: 2;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
}

.oil-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.oil-card-link:focus-visible {
  outline-offset: -2px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(90px + env(safe-area-inset-bottom));
  background: rgba(16, 24, 40, 0.94);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  .page {
    padding: 16px 20px 32px;
  }

  .reg-fields {
    flex-direction: row;
  }

  .reg-fields input:first-child {
    flex: 2;
  }

  .reg-fields input:last-child {
    flex: 1;
  }

  .reg-row {
    flex-direction: row;
    align-items: center;
  }

  .reg-fields {
    flex: 1;
  }
}
