/* ==========================================================================
   MOBILE AUTO DETAILING & CLEANING INVOICE STYLESHEET
   Apple & Minimalist Luxury Design
   ========================================================================== */

:root {
  --uber-black: #000000;
  --uber-dark: #121212;
  --apple-text: #1d1d1f;
  --apple-subtext: #86868b;
  --apple-border: #e5e5ea;
  --apple-light-bg: #f5f5f7;
  --apple-card-bg: #ffffff;
  --apple-blue: #0071e3;
  --apple-green: #34c759;
  
  --bg-workspace: #09090b;
  --sidebar-bg: #111113;
  --sidebar-card: #18181b;
  --sidebar-border: #27272a;
  --sidebar-text: #f4f4f5;
  --sidebar-muted: #a1a1aa;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-workspace);
  color: var(--apple-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }

/* ==========================================================================
   TOP BAR (APPLE STYLE GLASS)
   ========================================================================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  background: rgba(17, 17, 19, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sidebar-border);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.detailing-badge {
  width: 32px;
  height: 32px;
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-info strong {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: block;
}

.brand-info .sub {
  font-size: 0.75rem;
  color: var(--sidebar-muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
}

.btn-primary:hover {
  background: #f4f4f5;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
}

.btn-secondary:hover {
  background: #3f3f46;
}

.btn-ghost {
  background: transparent;
  color: var(--sidebar-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 12px;
}

/* ==========================================================================
   APP LAYOUT (SPLIT SCREEN)
   ========================================================================== */
.app-layout {
  display: flex;
  max-width: 1520px;
  margin: 0 auto;
  min-height: calc(100vh - 58px);
}

/* Quick Form Panel */
.quick-form-panel {
  width: 470px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 18px;
  color: var(--sidebar-text);
  overflow-y: auto;
  max-height: calc(100vh - 58px);
  position: sticky;
  top: 58px;
}

/* Company Settings Accordion */
.company-settings-accordion {
  background: var(--sidebar-card);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.company-settings-accordion[open] {
  border-color: #52525b;
}

.company-settings-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e4e4e7;
  user-select: none;
  list-style: none;
}

.company-settings-summary::-webkit-details-marker {
  display: none;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chevron-icon {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
  color: #a1a1aa;
}

.company-settings-accordion[open] .chevron-icon {
  transform: rotate(180deg);
}

.company-settings-body {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  background: #141417;
}

.panel-header {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 10px;
}

.panel-header h2 {
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-header p {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.form-section {
  background: var(--sidebar-card);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e4e4e7;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 10px;
  flex: 1;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.mini-lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--sidebar-muted);
  margin-bottom: 3px;
  font-weight: 500;
}

/* Vehicle Quick Pills */
.vehicle-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.veh-pill {
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.veh-pill:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Enhanced Service Catalog */
.services-preset-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-group {
  background: #141416;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #222226;
}

.preset-group-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #a1a1aa;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.service-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.srv-pill {
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.srv-pill:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Service Item List Header & Rows */
.service-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 6px 2px;
  border-bottom: 1px solid #27272a;
  margin-bottom: 8px;
}

.sl-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sl-cols {
  display: flex;
  gap: 12px;
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  font-weight: 500;
}

.col-lbl-price {
  width: 90px;
  text-align: right;
  padding-right: 24px;
}

.service-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.service-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #111113;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #27272a;
  transition: border-color 0.15s ease;
}

.service-item-row:focus-within {
  border-color: #52525b;
}

.srv-desc-input {
  flex: 1;
}

.srv-price-input {
  width: 90px;
  text-align: right;
  font-weight: 600;
  color: #38bdf8;
}

.btn-remove-srv {
  background: transparent;
  border: none;
  color: #71717a;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-remove-srv:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-add-row {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 7px 9px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
  transition: all 0.15s ease;
}

.form-control:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.price-input {
  color: #38bdf8;
  font-size: 0.95rem;
  font-weight: 600;
}

.tax-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #e4e4e7;
  background: #09090b;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid #27272a;
  min-height: 35px;
}

.tax-status input {
  cursor: pointer;
}

/* ==========================================================================
   INVOICE SHEET (APPLE & UBER MINIMALIST LUXURY RECEIPT)
   ========================================================================== */
.invoice-container {
  flex: 1;
  padding: 28px 36px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #000000;
}

.invoice-sheet {
  width: 100%;
  max-width: 780px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  padding: 36px 40px;
  position: relative;
  overflow: hidden;
  color: var(--apple-text);
}

/* Contenteditable Elements */
[contenteditable="true"] {
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
  margin: -1px -3px;
  transition: background 0.15s ease;
}

[contenteditable="true"]:hover {
  background: #f4f4f5;
}

[contenteditable="true"]:focus {
  background: #ffffff;
  box-shadow: 0 0 0 1.5px #000000;
}

/* Header */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--apple-border);
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1 auto;
}

.logo-mark {
  width: 40px;
  height: 40px;
  background: #000000;
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-letter {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.comp-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #000000;
  line-height: 1.15;
}

.comp-addr, .comp-contact {
  font-size: 0.76rem;
  color: var(--apple-subtext);
  margin-top: 2px;
}

.inv-meta {
  text-align: right;
  flex: 0 0 auto;
  margin-left: auto;
}

.inv-badge {
  display: inline-block;
  background: #f4f4f5;
  color: #18181b;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid #e4e4e7;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.meta-rows {
  font-size: 0.8rem;
}

.meta-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 2px;
}

.meta-row .lbl {
  color: var(--apple-subtext);
  font-weight: 400;
}

.meta-row .val {
  font-weight: 600;
  color: #000000;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.info-card {
  background: var(--apple-light-bg);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.card-tag {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--apple-subtext);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.passenger-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.01em;
}

.p-detail, .v-detail {
  font-size: 0.78rem;
  color: #3f3f46;
  margin-top: 2px;
}

/* Service Location Box */
.service-loc-box {
  background: #ffffff;
  border: 1px solid var(--apple-border);
  border-radius: var(--radius-md);
  margin-top: 16px;
  padding: 12px 16px;
}

.loc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.loc-pin-icon {
  color: #000000;
  display: flex;
  align-items: center;
}

.loc-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--apple-subtext);
}

.loc-address {
  font-size: 0.88rem;
  font-weight: 600;
  color: #000000;
  margin-left: 20px;
}

/* Charges Table */
.charges-section {
  margin-top: 18px;
}

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

.charges-table thead th {
  border-bottom: 1px solid var(--apple-border);
  color: var(--apple-subtext);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 4px;
  text-align: left;
}

.charges-table tbody td {
  padding: 10px 4px;
  border-bottom: 1px solid #f2f2f7;
  font-size: 0.84rem;
  color: #18181b;
}

.charges-table tbody td strong {
  font-weight: 600;
}

/* Financial Summary & Payment Grid */
.summary-payment-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  margin-top: 16px;
  align-items: flex-start;
}

.payment-instructions {
  background: var(--apple-light-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.pay-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--apple-subtext);
  margin-bottom: 8px;
}

.methods-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.method-pill {
  background: #ffffff;
  border: 1px solid var(--apple-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #18181b;
  font-weight: 500;
}

.payment-card-pill {
  gap: 6px;
}

.card-logos-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 900;
  border-radius: 2px;
  height: 13px;
  padding: 0 3px;
  line-height: 1;
}

.chip-visa {
  background: #1434cb;
  color: #ffffff;
  font-style: italic;
}

.chip-mc {
  background: #000000;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
}

.mc-c1, .mc-c2 {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.mc-c1 {
  background: #eb001b;
  margin-right: -2px;
}

.mc-c2 {
  background: #f79e1b;
}

.chip-amex {
  background: #006fcf;
  color: #ffffff;
}

.card-text-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
}

.brand-badge-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.badge-cash-green {
  background: #000000;
  color: #ffffff;
}

.badge-v {
  background: #008cff;
  color: #ffffff;
}

.badge-cash {
  background: #00d632;
  color: #ffffff;
}

/* Totals Card */
.totals-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 3px 0;
  color: #3f3f46;
}

.tot-row .lbl { font-weight: 400; color: var(--apple-subtext); }
.tot-row .val { font-weight: 600; color: #000000; }

.total-highlight {
  border-top: 1.5px solid #000000;
  padding-top: 8px;
  margin-top: 4px;
}

.total-highlight .lbl {
  font-size: 0.88rem;
  font-weight: 700;
  color: #000000;
}

.total-amt {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #000000;
}

/* Footer */
.inv-footer {
  margin-top: 20px;
  border-top: 1px solid var(--apple-border);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.policy-block {
  font-size: 0.72rem;
  color: var(--apple-subtext);
  max-width: 480px;
  line-height: 1.35;
}

.policy-block strong {
  color: #18181b;
}

.thank-you-stamp {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #000000;
  white-space: nowrap;
}

/* ==========================================================================
   PRINT / PDF STYLESHEET (STRICT 1 SINGLE US LETTER PAGE)
   ========================================================================== */
@media print {
  @page {
    size: letter portrait;
    margin: 0.3in 0.35in !important;
  }

  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print {
    display: none !important;
  }

  .app-layout {
    display: block !important;
    max-width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice-container {
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    display: block !important;
  }

  .invoice-sheet {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 6px 0 0 0 !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Header 2-Column Force Fix */
  .inv-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #e5e5ea !important;
  }

  .brand-block {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    flex: 1 1 auto !important;
  }

  .inv-meta {
    display: block !important;
    flex: 0 0 auto !important;
    text-align: right !important;
    margin-left: auto !important;
  }

  .meta-row {
    display: flex !important;
    justify-content: flex-end !important;
  }

  /* Info Grid 2-Column Force Fix */
  .info-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-top: 12px !important;
  }

  .service-loc-box {
    margin-top: 12px !important;
    padding: 10px 12px !important;
  }

  .charges-section {
    margin-top: 12px !important;
  }

  /* Summary 2-Column Force Fix */
  .summary-payment-grid {
    display: grid !important;
    grid-template-columns: 1.15fr 0.85fr !important;
    gap: 16px !important;
    margin-top: 12px !important;
  }

  .inv-footer {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 14px !important;
    padding-top: 10px !important;
    border-top: 1px solid #e5e5ea !important;
  }

  .policy-block {
    display: block !important;
  }

  .thank-you-stamp {
    display: inline-block !important;
  }
}

/* Screen-only Responsive */
@media screen and (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }

  .quick-form-panel {
    width: 100%;
    position: static;
    max-height: none;
  }

  .invoice-container {
    padding: 20px 12px;
  }

  .invoice-sheet {
    padding: 24px 20px;
    border-radius: var(--radius-sm);
  }

  .inv-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inv-meta {
    text-align: left;
    margin-left: 0;
    margin-top: 10px;
  }

  .meta-row {
    justify-content: flex-start;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .summary-payment-grid {
    grid-template-columns: 1fr;
  }

  .inv-footer {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}
