/*
 * ServisOS Lite — the tenant app.
 *
 * Tokens are ServisOS's own (packages/ui/src/styles/tokens.css in ServisPlus):
 * dark by default, light on request, same names. The component sizes follow
 * its quick-service screens, which are used with a thumb before anything else:
 * fields and main buttons are 56px tall, and inputs are 16px so a phone never
 * zooms in when one is focused.
 */

/* Tokens: tokens.css (shared with the platform panel). */

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

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

img,
svg {
  display: block;
}

.icon {
  flex-shrink: 0;
}

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

::selection {
  background: var(--primary);
  color: #fff;
}

/* ------------------------------------------------------------------ shell */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app.has-nav {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--surface-hover);
}

.icon-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.page {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.page-head .back {
  margin-left: -6px;
}

.title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
}

.section-title .count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.nav-item.active {
  color: var(--ring);
}

.nav-item.center .nav-bubble {
  width: 46px;
  height: 46px;
  margin-top: -18px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

/* ------------------------------------------------------------------ forms */

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field::placeholder {
  color: var(--subtle);
}

.field:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 28%, transparent);
}

.field.invalid {
  border-color: var(--danger);
}

textarea.field {
  height: auto;
  min-height: 96px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.5;
}

select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.field-plate {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-money {
  font-size: 18px;
  font-weight: 700;
}

.input-icon {
  position: relative;
}

.input-icon > .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-icon > .field {
  padding-left: 48px;
}

/* Araç Kabul step bar: 1 Araç · 2 Müşteri · 3 İş Seçimi · 4 İş Emri. */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

/* The line joining a step to the next one. */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  height: 2px;
  border-radius: 2px;
  background: var(--border);
}

.step.done:not(:last-child)::after {
  background: var(--ring);
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.step.current .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary);
}

.step.current {
  color: var(--foreground);
}

.step.done .step-dot {
  border-color: var(--ring);
  color: var(--ring);
  background: var(--primary-soft);
}

/* A field that opens a pick list (brand, model). */
.picker-field {
  position: relative;
}

.picker-field > .field {
  padding-right: 40px;
  cursor: pointer;
  caret-color: transparent;
}

.picker-field > .icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.pick-list {
  max-height: min(56vh, 460px);
  overflow-y: auto;
}

.pick-list .list-row {
  width: 100%;
  text-align: left;
}

/* Plate field with the two big scan buttons under it (home, Araç Kabul). */
.plate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plate-row > .input-icon {
  flex: 1 1 100%;
  min-width: 0;
}

.scan-btn {
  flex: 1 1 0;
  min-height: 84px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--foreground);
  transition: background 0.15s, transform 0.1s;
}

.scan-btn:active {
  transform: scale(0.96);
}

.scan-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary);
}

.scan-btn:disabled {
  opacity: 0.55;
}

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

.scan-status.hidden {
  display: none;
}

.scan-status img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.input-affix {
  position: relative;
}

.input-affix > .affix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

.input-affix > .field {
  padding-left: 34px;
}

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

.error-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger-foreground);
}

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

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.5;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 56px;
  font-size: 16px;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-quiet {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger-foreground);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.link {
  color: var(--ring);
  font-weight: 600;
  font-size: 13px;
}

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

/* ------------------------------------------------------------------ surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card.tight {
  padding: 12px 14px;
}

.card.tap {
  display: block;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.card.tap:hover {
  background: var(--surface-hover);
}

.card.success {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 5%, var(--surface));
}

.card.warning {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
}

.sunken {
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.list > * + * {
  border-top: 1px solid var(--border);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  text-align: left;
}

button.list-row:hover,
a.list-row:hover {
  background: var(--surface-hover);
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  text-align: center;
}

.empty .empty-title {
  font-size: 14px;
  font-weight: 700;
}

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

/* ------------------------------------------------------------------ chips, badges, plate */

.plate {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--plate-bg);
  color: var(--plate-fg);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.3;
  width: fit-content;
  align-self: flex-start;
}

.plate.lg {
  font-size: 18px;
  padding: 5px 10px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 12px;
  white-space: nowrap;
}

button.chip {
  height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

button.chip.on,
.chip.on {
  border-color: var(--ring);
  background: var(--primary-soft);
  color: var(--foreground);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.success {
  color: var(--success-foreground);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.badge.warning {
  color: var(--warning-foreground);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.badge.pending {
  color: var(--pending-foreground);
  background: color-mix(in srgb, var(--pending) 12%, transparent);
  border-color: color-mix(in srgb, var(--pending) 30%, transparent);
}

.badge.danger {
  color: var(--danger-foreground);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.badge.info {
  color: var(--ring);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--ring) 30%, transparent);
}

.badge.neutral {
  color: var(--muted);
  background: var(--surface-hover);
  border-color: var(--border);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.eyebrow.success {
  color: var(--success-foreground);
}

/* ------------------------------------------------------------------ job tiles */

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

@media (min-width: 560px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 96px;
  padding: 12px 8px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.tile:hover {
  background: var(--surface-hover);
}

.tile .emoji {
  font-size: 26px;
  line-height: 1;
}

.tile .tile-label {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.tile .tile-price {
  font-size: 11px;
  color: var(--muted);
}

.tile.on {
  border-color: var(--ring);
  background: var(--primary-soft);
}

.tile .tick {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: none;
  place-items: center;
  background: var(--primary);
  color: #fff;
}

.tile.on .tick {
  display: grid;
}

/* ------------------------------------------------------------------ sticky action bar */

.sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0 -16px -16px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app.has-nav .sticky-bar {
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: 12px;
}

.sticky-bar .missing {
  margin-bottom: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid;
}

.alert.danger {
  color: var(--danger-foreground);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.alert.warning {
  color: var(--foreground);
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}

.alert.info {
  color: var(--foreground);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--ring) 30%, transparent);
}

.alert.success {
  color: var(--foreground);
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
}

/* ------------------------------------------------------------------ stats, key-value, totals */

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

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-width: 0;
}

.stat .stat-value {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat .stat-label {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 13px;
}

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

.kv dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}

.totals {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.totals .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.totals .line span:first-child {
  color: var(--muted);
}

.totals .grand {
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 18px;
  font-weight: 800;
}

.totals .grand span:first-child {
  color: var(--foreground);
}

/* ------------------------------------------------------------------ history timeline */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.visit {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s;
}

.visit:hover {
  background: var(--surface-hover);
}

.visit-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  padding: 6px 0;
  line-height: 1.1;
}

.visit-date .d {
  font-size: 18px;
  font-weight: 800;
}

.visit-date .m {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.visit-date .y {
  font-size: 10px;
  color: var(--subtle);
}

.visit-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.visit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.visit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.visit-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ------------------------------------------------------------------ segmented filters */

.segmented {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px;
}

.segmented::-webkit-scrollbar {
  display: none;
}

/* ------------------------------------------------------------------ sheet, toast, spinner */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 6, 15, 0.62);
  animation: fade-in 0.15s ease-out;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  animation: slide-up 0.2s ease-out;
}

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 0 auto 12px;
}

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

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

@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
  }
  .sheet {
    border-radius: 20px;
    border-bottom: 1px solid var(--border);
  }
}

@keyframes slide-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.toast-host {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  animation: slide-up 0.18s ease-out;
}

.toast.success {
  background: #047857;
}

.toast.error {
  background: #b91c1c;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2.5px solid color-mix(in srgb, var(--muted) 35%, transparent);
  border-top-color: var(--ring);
  animation: spin 0.7s linear infinite;
}

.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-block {
  display: grid;
  place-items: center;
  padding: 48px 0;
}

.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-hover) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ------------------------------------------------------------------ login */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(60% 40% at 50% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%),
    var(--background);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

/* ------------------------------------------------------------------ utilities */

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

.row.top {
  align-items: flex-start;
}

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

.row.wrap {
  flex-wrap: wrap;
}

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

.col.tight {
  gap: 6px;
}

.col.loose {
  gap: 20px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.shrink-0 {
  flex-shrink: 0;
}

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

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

.xs {
  font-size: 11px;
}

.sm {
  font-size: 12px;
}

.md {
  font-size: 14px;
}

.lg {
  font-size: 16px;
}

.xl {
  font-size: 20px;
}

.bold {
  font-weight: 700;
}

.heavy {
  font-weight: 800;
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.success-text {
  color: var(--success-foreground);
}

.danger-text {
  color: var(--danger-foreground);
}

.warning-text {
  color: var(--warning-foreground);
}

.accent-text {
  color: var(--ring);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pre {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------------------------ print: the service summary */

@media print {
  :root {
    --background: #fff;
    --surface: #fff;
    --surface-sunken: #f5f5f5;
    --foreground: #000;
    --muted: #333;
    --border: #ccc;
    --plate-bg: #000;
    --plate-fg: #fff;
  }
  .topbar,
  .bottom-nav,
  .sticky-bar,
  .no-print {
    display: none !important;
  }
  .app.has-nav {
    padding-bottom: 0;
  }
  .card {
    break-inside: avoid;
  }
}

/* ------------------------------------------------------------------ live scanner */

.scanner {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  color: #fff;
  overflow: hidden;
  touch-action: none;
  animation: fade-in 0.15s ease-out;
}

.scanner video,
.scanner .scanner-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner .scanner-still {
  display: none;
}

.scanner.processing .scanner-still {
  display: block;
}

/* The window: everything around it is dimmed by one huge shadow. */
.scanner-frame {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(88vw, 520px);
  /* A little taller than the card itself, so the whole ruhsat fits with room. */
  aspect-ratio: 1.2;
  border-radius: 18px;
  box-shadow: 0 0 0 200vmax rgba(2, 6, 15, 0.62);
  transition: aspect-ratio 0.25s ease, width 0.25s ease;
}

.scanner[data-mode="plate"] .scanner-frame {
  aspect-ratio: 4.2;
}

.scanner-frame .corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 4px solid #fff;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
}

.scanner-frame .tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.scanner-frame .tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.scanner-frame .bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.scanner-frame .br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }

.scanner-line {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 3px;
  top: 8%;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #60a5fa 20%, #93c5fd 50%, #60a5fa 80%, transparent);
  box-shadow: 0 0 14px 3px rgba(59, 130, 246, 0.75);
  animation: scan-sweep 2.2s ease-in-out infinite;
}

.scanner-line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 46px;
  background: linear-gradient(to top, rgba(59, 130, 246, 0.28), transparent);
}

.scanner.processing .scanner-line {
  animation-duration: 0.9s;
}

.scanner.error .scanner-line {
  display: none;
}

@keyframes scan-sweep {
  0%, 100% { top: 8%; }
  50% { top: calc(92% - 3px); }
}

.scanner-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
}

.scanner-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.scanner-btn.on {
  background: #fbbf24;
  color: #111;
}

.scanner-modes {
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.scanner-modes button {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.scanner-modes button.on {
  background: #fff;
  color: #0f172a;
}

.scanner-hint {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(44% + min(44vw, 260px) / 1.2 + 22px);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.scanner[data-mode="plate"] .scanner-hint {
  top: calc(44% + min(44vw, 260px) / 4.2 + 26px);
}

.scanner-hint .sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

.scanner-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 28px;
  padding-bottom: calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

.scanner-bottom > :first-child {
  justify-self: start;
}

.scanner-bottom > :last-child {
  justify-self: end;
}

.shutter {
  width: 78px;
  height: 78px;
  border-radius: 999px;
  border: 5px solid rgba(255, 255, 255, 0.9);
  background: transparent;
  display: grid;
  place-items: center;
  transition: transform 0.1s;
}

.shutter::before {
  content: "";
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.12s, background 0.12s;
}

.shutter:active:not(:disabled)::before {
  transform: scale(0.86);
}

.shutter:disabled {
  opacity: 0.45;
}

.scanner-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.scanner-flash.go {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.scanner-status {
  position: absolute;
  left: 50%;
  bottom: calc(130px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.scanner.processing .scanner-status,
.scanner.error .scanner-status {
  display: flex;
}

.scanner.error .scanner-status {
  border-radius: 14px;
  background: rgba(127, 29, 29, 0.92);
}

/* The sweep stays inside the window, however short the window is (plate mode). */
.scanner-sweep {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 16px;
}

/* ------------------------------------------------------------------ tasks under a job */

.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.task-chip .tick {
  display: none;
  color: var(--ring);
}

.task-chip.on {
  border-color: var(--ring);
  background: var(--primary-soft);
}

.task-chip.on .tick {
  display: inline-flex;
}

.task-chip .product-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--subtle);
}

.product-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.product-row .product-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.product-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.product-pick.empty {
  color: var(--subtle);
  font-weight: 500;
}

.product-pick.empty .need {
  color: var(--warning-foreground);
}

.qty-field {
  position: relative;
}

.qty-field .field {
  height: 48px;
  padding-right: 34px;
  font-weight: 700;
}

.qty-field .unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.done-tasks {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
}

.done-tasks .t {
  display: flex;
  gap: 6px;
  color: var(--muted);
}

.done-tasks .t .icon {
  margin-top: 1px;
  color: var(--success-foreground);
}

.done-tasks .t strong {
  color: var(--foreground);
  font-weight: 700;
}

/* ------------------------------------------------------------------ subscription banner */

.billing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid;
}

.billing-banner .grow strong {
  display: block;
  font-size: 13px;
}

.billing-banner.info {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--ring) 30%, transparent);
}

.billing-banner.warning {
  background: color-mix(in srgb, var(--warning) 14%, var(--background));
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}

.billing-banner.danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--background));
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.billing-banner .icon {
  flex-shrink: 0;
}

.billing-banner.warning .icon { color: var(--warning-foreground); }
.billing-banner.danger .icon { color: var(--danger-foreground); }
.billing-banner.info .icon { color: var(--ring); }

.ref-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 16px;
}

/* ------------------------------------------------------------------ cash book */

.money-in { color: var(--success-foreground); }
.money-out { color: var(--danger-foreground); }

.date-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.date-nav .label {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--foreground);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding-top: 8px;
}

.chart .slot {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  height: 100%;
  min-width: 0;
}

.chart .bar {
  width: 45%;
  max-width: 14px;
  border-radius: 3px 3px 0 0;
  min-height: 0;
}

.chart .bar.in { background: var(--success); }
.chart .bar.out { background: var(--danger); opacity: 0.85; }

.chart-axis {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  font-size: 9px;
  color: var(--subtle);
}

.chart-axis span {
  flex: 1;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
}

.share {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-hover);
  overflow: hidden;
  margin-top: 6px;
}

.share > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.entry.voided {
  opacity: 0.5;
}

.entry.voided .amount {
  text-decoration: line-through;
}

/* ServisGet logotype (logo.js wordmark()): bold, upright, "Get" in brand blue, as in logo.png. */
.wordmark {
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark-get {
  color: var(--ring);
}

.wordmark-lg {
  font-size: 30px;
  line-height: 1.1;
}

/* The logo tile carries its own blue square and corners. */
.brand-mark,
.auth-logo,
.p-brand-mark {
  background: transparent;
}

.brand-mark svg,
.auth-logo svg,
.p-brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------------------------ wide screens (computer, tablet sideways) */

.sidebar {
  display: none;
}

.data-table {
  display: none;
}

@media (min-width: 1024px) {
  :root {
    --sidebar-width: 248px;
  }

  .app.has-nav {
    padding-bottom: 0;
    padding-left: var(--sidebar-width);
  }

  .bottom-nav {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 35;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }

  .side-brand {
    flex: 0 0 auto;
    padding: 4px 6px 8px;
  }

  .side-cta {
    justify-content: center;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
  }

  .side-label {
    margin: 14px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
  }

  .side-link:hover {
    background: var(--surface-hover);
    color: var(--foreground);
  }

  .side-link.active {
    background: var(--primary-soft);
    color: var(--ring);
  }

  .side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .side-user:hover,
  .side-user.active {
    background: var(--surface-hover);
  }

  /* The sidebar carries the brand; the top bar keeps search, theme and account. */
  .topbar .brand {
    visibility: hidden;
  }

  .topbar {
    padding: 10px 28px;
  }

  .page {
    max-width: 1200px;
    padding: 24px 28px 32px;
    gap: 24px;
  }

  .page.narrow {
    max-width: 760px;
  }

  .title {
    font-size: 22px;
  }

  .app.has-nav .sticky-bar {
    bottom: 0;
    padding-bottom: 12px;
  }

  .sticky-bar {
    margin: 0 -28px -32px;
    padding: 14px 28px;
  }

  /* No camera on a computer: the plate is typed. */
  .scan-btn,
  .scan-status {
    display: none !important;
  }

  /* Lists become tables. */
  .data-table {
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    font-size: 14px;
  }

  .data-table + .list,
  .list.mobile-only {
    display: none;
  }

  .data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-sunken, var(--background));
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }

  .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }

  .data-table tr:last-child td {
    border-bottom: 0;
  }

  .data-table tbody tr[data-href] {
    cursor: pointer;
  }

  .data-table tbody tr[data-href]:hover td {
    background: var(--surface-hover);
  }

  .data-table .num {
    text-align: right;
    white-space: nowrap;
  }

  .data-table .clip {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Two columns: the record on the left, its history on the right. */
  .split {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
    align-items: start;
  }

  .split.even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .split.wide-left {
    grid-template-columns: minmax(0, 8fr) minmax(0, 5fr);
  }

  .split > .col-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
  }

  .split .sticky-side {
    position: sticky;
    top: 84px;
  }

  .sheet {
    max-width: 620px;
  }

  /* Chip rows wrap inside a column instead of scrolling off the screen edge. */
  .segmented {
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 1023px) {
  .split > .col-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .split {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
}

@media print {
  .sidebar {
    display: none !important;
  }
  .app.has-nav {
    padding-left: 0;
  }
}
