:root {
  --bg: #edf2f7;
  --bg-accent: #dbeafe;
  --card: rgba(255, 255, 255, 0.94);
  --card-border: rgba(148, 163, 184, 0.26);
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-soft: rgba(34, 197, 94, 0.12);
  --shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 22%),
    radial-gradient(circle at right 20%, rgba(16, 185, 129, 0.1), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  height: 100vh;
  padding: clamp(10px, 0.9vw, 18px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 0.8vw, 14px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon,
.car-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.brand-icon svg,
.car-card__icon svg {
  width: 100%;
  height: 100%;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

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

.clock-card {
  min-width: 128px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow);
  text-align: right;
}

.clock-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

#current-time {
  font-size: clamp(1.15rem, 1.5vw, 1.55rem);
  letter-spacing: -0.05em;
}

.ghost-button {
  height: 46px;
  padding: 0 15px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(255, 255, 255, 0.95);
}

.dashboard-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 0.8vw, 16px);
}

.car-card {
  min-height: 0;
  padding: clamp(12px, 0.85vw, 16px);
  border-radius: 24px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, var(--card) 100%);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.car-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.car-card__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.car-card__icon {
  width: 36px;
  height: 36px;
}

.car-card__title {
  margin: 0;
  font-size: clamp(1.2rem, 1.5vw, 1.7rem);
  letter-spacing: -0.04em;
}

.car-card__subtitle {
  display: none;
}

.add-service-button {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 168px;
  height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.add-service-button:hover,
.add-service-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
}

.add-service-button__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 1.25rem;
  line-height: 1;
}

.services-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-content: stretch;
}

.services-grid.is-pulsing .service-tile {
  animation: pulse-focus 480ms ease;
}

@keyframes pulse-focus {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.service-tile {
  position: relative;
  min-height: clamp(88px, 10.5vh, 112px);
  padding: 10px 8px 8px;
  border-radius: 17px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: center;
  gap: 6px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.service-tile.is-active {
  border-color: rgba(22, 163, 74, 0.42);
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.98) 0%, var(--green-soft) 100%);
}

.service-tile__status {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 160ms ease, transform 160ms ease;
}

.service-tile.is-active .service-tile__status {
  opacity: 1;
  transform: scale(1);
}

.service-tile__icon {
  width: 28px;
  height: 28px;
  color: #1f2937;
}

.service-tile__icon svg {
  width: 100%;
  height: 100%;
}

.service-tile__name {
  margin: 0;
  font-size: clamp(0.82rem, 0.9vw, 0.97rem);
  line-height: 1.05;
  font-weight: 800;
  text-align: center;
}

.service-controls {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 6px;
  align-items: center;
}

.step-button,
.quantity-display {
  height: 31px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-button {
  background: #fff;
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease;
}

.step-button:hover,
.step-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.36);
  color: var(--blue);
}

.quantity-display {
  background: rgba(248, 250, 252, 0.9);
  font-size: 0.95rem;
  font-weight: 900;
}

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

.summary-pill {
  min-width: 118px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.summary-pill__label {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-pill__value {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
  letter-spacing: -0.05em;
}

.finalize-button {
  flex: 1;
  height: 44px;
  border-radius: 15px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 255, 0.94) 100%);
  color: var(--blue);
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.finalize-button:hover,
.finalize-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.5);
}

@media (max-width: 1280px) {
  .topbar h1 {
    font-size: 1.2rem;
  }

  .brand-icon {
    width: 46px;
    height: 46px;
  }

  .car-card {
    padding: 10px;
    gap: 8px;
  }

  .services-grid {
    gap: 7px;
  }

  .service-tile {
    min-height: 84px;
    padding: 8px 6px 7px;
  }

  .service-tile__icon {
    width: 24px;
    height: 24px;
  }

  .service-tile__name {
    font-size: 0.77rem;
  }

  .step-button,
  .quantity-display {
    height: 28px;
  }

  .service-controls {
    grid-template-columns: 31px 1fr 31px;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar {
    gap: 10px;
  }

  .clock-card {
    min-width: 112px;
    padding: 8px 12px;
  }

  .ghost-button,
  .add-service-button,
  .finalize-button {
    height: 40px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

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

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}

@media (max-width: 680px) {
  .topbar,
  .status-area,
  .car-card__header,
  .car-card__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .add-service-button,
  .ghost-button,
  .finalize-button {
    width: 100%;
  }

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