:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ef;
  --blue: #0b4f9f;
  --blue-dark: #082f5f;
  --green: #0e9f6e;
  --yellow: #f4b740;
  --red: #d92d20;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(11, 79, 159, 0.08), transparent 280px),
    var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 12px;
  padding: 14px 14px 10px;
  background: rgba(244, 247, 251, 0.92);
  border-bottom: 1px solid rgba(217, 226, 239, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img,
.brand-fallback {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

.brand-fallback {
  display: none;
  place-items: center;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.role-switch,
.filter-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  overflow-x: auto;
}

.role-switch button,
.filter-row button,
.bottom-nav button,
.queue-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 10px;
  cursor: pointer;
}

.role-switch button.active,
.filter-row button.active,
.bottom-nav button.active,
.queue-actions button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.main-content {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px 14px 96px;
}

.hero-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  color: #fff;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(5, 18, 38, 0.92), rgba(8, 47, 95, 0.74)),
    url("esponja-para-lavagem-de-carros-1024x444.webp") center/cover;
  box-shadow: var(--shadow);
}

.hero-panel h1 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
  max-width: 680px;
}

.hero-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-actions,
.split-row {
  display: grid;
  gap: 10px;
}

.primary,
.secondary,
.danger,
.text-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.secondary {
  background: #eef5ff;
  color: var(--blue-dark);
  border: 1px solid #c9ddf8;
}

.danger {
  background: #fff1f0;
  color: var(--red);
  border: 1px solid #ffd0cc;
}

.text-button {
  justify-content: flex-start;
  padding: 0;
  min-height: 32px;
  color: var(--blue);
  background: transparent;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.service-highlights,
.cards-grid,
.quick-grid,
.metric-grid,
.booking-list,
.template-list,
.admin-table,
.insight-list {
  display: grid;
  gap: 12px;
}

.feature-card,
.service-card,
.client-card,
.queue-card,
.panel,
.metric-grid article,
.table-card,
.template-card,
.confirmation-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.feature-card,
.service-card,
.client-card,
.panel,
.table-card,
.template-card,
.confirmation-card,
.empty-state {
  padding: 16px;
}

.confirmation-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  color: #053321;
  background: #ecfdf3;
  border-color: #abefc6;
}

.confirmation-card p {
  margin: 0;
  color: #067647;
}

.feature-card h3,
.service-card h3,
.client-card h3,
.panel h3 {
  margin: 0 0 8px;
}

.feature-card p,
.service-card p,
.client-card p,
.template-card p,
.panel p,
.table-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  margin-bottom: 12px;
}

.quick-card {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.quick-card span {
  font-weight: 800;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  margin: 12px 0;
}

.booking-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.addons-box {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px dashed #adc4e4;
  border-radius: 8px;
}

.addons-box legend {
  padding: 0 6px;
  color: var(--blue-dark);
  font-weight: 900;
}

.check-row {
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  min-height: 38px;
  gap: 9px;
  color: var(--ink);
}

.check-row input {
  min-height: auto;
}

.booking-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 8px;
  background: #eef5ff;
}

.chat-window {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
}

.message {
  max-width: 88%;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.45;
}

.message.ai {
  background: #eef5ff;
  color: var(--blue-dark);
}

.message.user {
  justify-self: end;
  background: var(--blue);
  color: #fff;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.queue-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-left: 5px solid var(--blue);
}

.queue-card p,
.queue-card span {
  color: var(--muted);
}

.status-completed {
  border-left-color: var(--green);
}

.status-cancelled,
.status-no_show {
  border-left-color: var(--red);
}

.status-finishing {
  border-left-color: var(--yellow);
}

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

.whatsapp-link,
.client-card a,
.table-card a {
  color: var(--green);
  font-weight: 900;
  text-decoration: none;
}

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

.metric-grid article {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 14px;
}

.metric-grid span,
.panel.compact span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-grid strong,
.panel.compact strong {
  font-size: 1.35rem;
}

.insight-list article {
  padding: 14px;
  border-radius: 8px;
  background: #f7fbff;
  border: 1px solid #dbeafe;
}

.template-card {
  display: grid;
  gap: 10px;
}

.template-card p {
  margin: 0;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  min-width: 0;
  min-height: 52px;
  padding: 0 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 82px;
  z-index: 40;
  padding: 14px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (min-width: 560px) {
  .booking-form,
  .service-highlights,
  .cards-grid,
  .quick-grid,
  .template-list,
  .admin-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide {
    grid-column: 1 / -1;
  }

  .queue-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .app-header {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 16px 24px;
  }

  .role-switch {
    min-width: 340px;
  }

  .main-content {
    padding: 24px 24px 110px;
  }

  .hero-panel {
    grid-template-columns: 1fr 260px;
    align-items: end;
    min-height: 360px;
    padding: 32px;
  }

  .service-highlights,
  .metric-grid.admin {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-grid,
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .queue-card {
    grid-template-columns: 1fr minmax(320px, 420px);
    align-items: center;
  }

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

@media (min-width: 1040px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    width: min(740px, calc(100% - 48px));
    bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

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