:root {
  --blue: #16a8dc;
  --blue-dark: #087da8;
  --ink: #3d3d42;
  --muted: #7d8288;
  --line: #e5e8eb;
  --soft: #f6f8fa;
  --white: #fff;
  --danger: #d94b4b;
  --success: #15976b;
  --shadow: 0 14px 34px rgba(25, 38, 50, .07);
  --title-font: "Nunito", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body.is-logged-out .sidebar,
body.is-logged-out .app-shell {
  display: none;
}

body:not(.is-logged-out) .login-screen {
  display: none;
}

body.mobile-menu-open {
  overflow: hidden;
}

.login-body {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background: #26383f;
}

.login-screen {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background: #26383f;
}

.login-card {
  width: min(430px, 100%);
  padding: 28px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.login-card img {
  width: 210px;
  filter: brightness(0) invert(1);
  padding: 16px;
  background: #26383f;
  border-radius: 12px;
}

.login-card h1 {
  margin: 0;
  font-family: var(--title-font);
  font-size: 42px;
  line-height: 1;
  text-transform: uppercase;
}

.forgot-password {
  justify-self: start;
}

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

button,
.primary-button,
.secondary-button,
.payment-button,
.icon-button,
.trash-button,
.status-link-button,
.call-icon {
  -webkit-appearance: none;
  appearance: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 28px 22px;
  background: #26383f;
  border-right: 1px solid #1f2f35;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar form {
  margin: 0;
}

.brand {
  display: block;
  width: 190px;
}

.brand img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.customer-hero img {
  filter: none;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: rgba(22, 168, 220, .16);
  color: var(--white);
}

.sidebar-card,
.panel,
.table-wrap,
.table-card,
.product-card,
.template-card,
.customer-status-card,
.info-band {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
  box-shadow: none;
  color: var(--white);
}

.sidebar-card p,
.helper-text,
.customer-hero p,
.info-band p {
  color: var(--muted);
  line-height: 1.55;
}

.sidebar-card p {
  color: rgba(255, 255, 255, .72);
}

.sidebar-user {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-user .secondary-button {
  width: 100%;
  color: var(--white);
  background: rgba(255, 255, 255, .12);
}

.sidebar-user form {
  width: 100%;
}

.app-shell {
  margin-left: 270px;
  padding: 32px;
}

.app {
  margin-left: 270px;
  padding: 32px;
}

.topbar,
.panel-heading,
.section-heading,
.toolbar,
.button-row,
.customer-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 54px;
  margin-bottom: 28px;
}

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

.topbar h1,
.section-heading h2,
.panel h2,
.customer-hero h2 {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
  text-transform: uppercase;
}

.topbar h1 {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.panel h2,
.section-heading h2,
.customer-hero h2 {
  font-size: 26px;
}

#request .panel h2 {
  font-size: 18px;
  line-height: 1.25;
}

.form-grid .panel h2 {
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.record-date {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.mobile-menu-button {
  display: none;
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 3px 0;
  border: 0;
  border-radius: 10px;
  background: #26383f;
  cursor: pointer;
  place-items: center;
}

.mobile-menu-button span {
  display: block;
  width: 19px;
  height: 3px;
  margin: 1.5px 0;
  background: var(--white);
  border-radius: 999px;
}

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: rgba(20, 31, 36, .48);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

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

.primary-button,
.secondary-button,
.payment-button,
.icon-button,
.whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

.primary-button {
  color: var(--white);
  background: var(--blue);
}

.secondary-button,
.icon-button {
  color: var(--ink);
  background: #eef2f5;
}

.payment-button.unpaid {
  color: var(--white);
  background: var(--danger);
}

.payment-button.paid {
  color: var(--white);
  background: var(--success);
}

.whatsapp-button {
  gap: 8px;
  justify-self: start;
  margin-top: 14px;
  color: var(--white);
  background: #15976b;
}

.whatsapp-button img {
  width: 21px;
  height: 21px;
  display: block;
  color: currentColor;
}

.whatsapp-button.is-disabled {
  opacity: .45;
  pointer-events: none;
}

.icon-button {
  display: inline-flex;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  align-items: center;
  justify-content: center;
  background-color: #eef2f5;
  border: 0;
  border-radius: 10px;
  line-height: 1;
}

#context-action-button[hidden] {
  display: none;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metrics article {
  display: block;
  min-width: 0;
  background: #fff;
  background: var(--white);
  border: 0;
  border-left: 5px solid #16a8dc;
  border-left-color: var(--blue);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(25, 38, 50, .07);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metrics small {
  display: block;
  min-height: 17px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.calendar-panel {
  margin-bottom: 18px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.calendar-panel h2 {
  margin: 0;
  font-family: var(--title-font);
  font-size: 22px;
  line-height: 1.1;
}

.calendar-range {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(14, minmax(118px, 1fr));
  gap: 10px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.calendar-day {
  display: grid;
  gap: 6px;
  min-height: 118px;
  min-width: 118px;
  padding: 12px;
  color: var(--ink);
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.calendar-day:hover,
.calendar-day.is-selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.calendar-day.is-today {
  background: #eef9fd;
}

.calendar-day span,
.calendar-day small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-day strong {
  font-size: 28px;
  line-height: 1;
}

.calendar-day em {
  justify-self: start;
  padding: 3px 7px;
  color: var(--white);
  background: var(--danger);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.legend-dot.pickup {
  background: var(--success);
}

.legend-dot.departure {
  background: var(--danger);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--white);
  color: var(--ink);
  font-weight: 400;
}

.toolbar label:first-child {
  width: 230px;
}

.toolbar label:last-child {
  flex: 1;
}

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

.table-card {
  overflow-x: auto;
}

td {
  vertical-align: middle;
}

td form {
  margin: 0;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px;
}

th,
td {
  padding: 15px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.request-row {
  cursor: pointer;
}

.request-row:hover {
  background: #f8fbfd;
}

.link-button {
  margin: 0;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.status-link-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--blue-dark);
  background: #eaf7fc;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf7fc;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.urgent {
  color: var(--danger);
  font-weight: 900;
}

.phone-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.call-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 42px;
  height: 42px;
  color: var(--white);
  background: #15976b;
  background: var(--success);
  border: 0;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  overflow: hidden;
}

.call-icon.is-disabled {
  opacity: .45;
}

td .call-icon {
  margin: 0 auto;
}

.trash-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 42px;
  height: 42px;
  padding: 0;
  color: var(--white);
  background: #d94b4b;
  background: var(--danger);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
}

.call-icon img,
.trash-button img,
.icon-button img {
  display: block;
  width: 23px !important;
  height: 23px !important;
  max-width: 23px !important;
  max-height: 23px !important;
  min-width: 23px !important;
  min-height: 23px !important;
  object-fit: contain;
  flex: 0 0 23px;
  filter: brightness(0) invert(1);
}

.icon-button img {
  filter: none;
}

.table-card,
.table-wrap,
.panel,
.toolbar,
.sidebar-card {
  background-clip: padding-box;
}

.table-card {
  border-radius: 12px;
  overflow: hidden;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 0;
}

.panel {
  padding: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.field-grid .span-2 {
  grid-column: 1 / -1;
}

.field-divider {
  grid-column: 1 / -1;
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.wide-label {
  margin: 18px 0;
}

.timeline,
.customer-steps {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 12px;
}

.timeline li,
.customer-steps li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
}

.timeline li::before,
.customer-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--white);
}

.timeline li.done,
.customer-steps li.done {
  color: var(--ink);
  font-weight: 800;
}

.timeline li.done::before,
.customer-steps li.done::before {
  border-color: var(--success);
  background: var(--success);
}

.mobile-followup-card {
  display: block;
  margin: 14px 0 18px;
  padding: 16px;
  background: #f5fbfd;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 12px;
}

.mobile-followup-card span,
.mobile-followup-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mobile-followup-card > strong {
  display: block;
  margin: 5px 0 14px;
  font-size: 20px;
}

.mobile-next-action {
  display: block;
  margin: 6px 0 12px;
  font-size: 22px;
  line-height: 1.15;
}

.mobile-message-preview {
  min-height: 92px;
  padding: 12px;
  background: #e9fbf2;
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}

.mobile-followup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.mobile-followup-actions .whatsapp-button {
  width: 100%;
}

.line-items {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.line-item {
  display: grid;
  grid-template-columns: 1fr 80px 110px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--soft);
  border-radius: 10px;
}

label.line-item {
  font-size: inherit;
  font-weight: inherit;
}

.line-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.editable-lines .line-item {
  grid-template-columns: 1fr 96px 110px;
}

.line-item input {
  width: 96px;
}

.line-item strong {
  display: block;
}

.line-item span {
  color: var(--muted);
  font-size: 13px;
}

.message-preview {
  min-height: 174px;
  margin: 16px 0;
  padding: 18px;
  background: #e9fbf2;
  border-radius: 12px;
  line-height: 1.6;
  white-space: pre-line;
}

.field-grid textarea {
  min-height: 92px;
  resize: vertical;
}

.template-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.product-row input,
.product-row select,
.customer-row input,
.user-row input,
.user-row select {
  width: 100%;
  min-width: 130px;
}

.product-row input[data-field="price"] {
  min-width: 100px;
}

.template-card {
  padding: 18px;
}

.template-card textarea {
  width: 100%;
  min-height: 92px;
  margin-top: 12px;
  resize: vertical;
}

.customer-page {
  max-width: 900px;
  margin: 0 auto;
}

.settings-grid {
  display: grid;
  gap: 18px;
  max-width: 920px;
}

.customer-status-body {
  min-height: 100vh;
  padding: 40px 24px;
}

.error {
  color: var(--danger);
  font-weight: 900;
}

.customer-hero {
  align-items: flex-start;
  margin-bottom: 22px;
}

.customer-brand-block {
  display: grid;
  gap: 20px;
}

.customer-brand-block img {
  width: 150px;
  height: auto;
}

.customer-contact {
  margin-top: 22px;
  display: grid;
  gap: 5px;
  text-align: left;
  line-height: 1.35;
}

.customer-contact h3 {
  margin: 0 0 4px;
  font-family: var(--title-font);
  font-size: 22px;
  line-height: 1.1;
}

.customer-contact a {
  color: var(--ink);
  text-decoration: none;
}

.customer-contact a:hover {
  color: var(--blue-dark);
}

.customer-summary {
  margin: -8px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.customer-status-card {
  padding: 24px;
  margin-bottom: 18px;
  border-top: 5px solid var(--blue);
}

.customer-status-card h3 {
  margin: 16px 0 8px;
  font-size: 32px;
}

.info-band {
  margin-top: 22px;
  padding: 18px;
  border-left: 5px solid var(--blue);
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(82vw, 300px);
    padding: 18px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-menu-open .mobile-menu-backdrop {
    display: block;
  }

  .app-shell {
    margin-left: 0;
    padding: 20px;
  }

  .app {
    margin-left: 0;
    padding: 20px;
  }

  .mobile-menu-button {
    display: grid;
  }

  .metrics,
  .detail-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .calendar-strip {
    grid-template-columns: repeat(14, minmax(112px, 1fr));
  }

  .toolbar,
  .topbar,
  .section-heading,
  .customer-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar label:first-child {
    width: auto;
  }

  .product-card {
    grid-template-columns: 1fr;
  }

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