@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* ---- Brand tokens ---- */
:root {
  --ra-deep-blue:   #2a2e58;
  --ra-pale-blue:   #5278bb;
  --ra-orange:      #f7a638;
  --ra-white:       #ffffff;
  --ra-surface:     #f4f5f9;
  --ra-border:      #dde0ee;
  --ra-text:        #1a1d36;
  --ra-text-muted:  #5a5f80;
  --ra-error:       #b00020;

  /* MD custom theme mapped to brand */
  --mdc-theme-primary:              #2a2e58;
  --mdc-theme-secondary:            #f7a638;
  --mdc-theme-background:           #f4f5f9;
  --mdc-theme-surface:              #ffffff;
  --mdc-theme-on-primary:           #ffffff;
  --mdc-theme-on-secondary:         #1a1d36;
  --mdc-theme-on-surface:           #1a1d36;
  --mdc-theme-error:                #b00020;
  --mdc-typography-font-family:     'Raleway', sans-serif;
  --mdc-shape-small:                6px;
  --mdc-shape-medium:               10px;
}

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

body {
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ra-text);
  background: var(--ra-surface);
  min-height: 100vh;
}

/* ---- App header ---- */
.app-header {
  background: var(--ra-deep-blue);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(42,46,88,0.25);
}

.app-header .logo img {
  height: 36px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-family: 'Raleway', sans-serif;
}

/* ---- Auth screen ---- */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--ra-surface);
}

.auth-card {
  background: var(--ra-white);
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(42,46,88,0.12);
}

.auth-logo {
  height: 60px;
  margin-bottom: 24px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ra-deep-blue);
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--ra-text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ra-white);
  color: var(--ra-text);
  border: 1px solid var(--ra-border);
  border-radius: 6px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.15s;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ---- Nav tabs ---- */
.nav-tabs {
  background: var(--ra-deep-blue);
  display: flex;
  padding: 0 24px;
  gap: 2px;
}

.nav-tab {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover { color: rgba(255,255,255,0.9); }
.nav-tab.active { color: var(--ra-orange); border-bottom-color: var(--ra-orange); }

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--ra-deep-blue);
  margin-bottom: 3px;
}

.page-header p { color: var(--ra-text-muted); font-size: 14px; }

/* ---- Cards ---- */
.card {
  background: var(--ra-white);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(42,46,88,0.08), 0 0 0 1px rgba(42,46,88,0.06);
}

.form-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ra-pale-blue);
  margin-bottom: 18px;
}

/* ---- MD-style form fields ---- */
.form-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.form-row > * { min-width: 0; }

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.report-info { grid-template-columns: 220px minmax(0, 1fr); }

.line-item-grid {
  display: grid;
  grid-template-columns: 170px minmax(160px, 1fr) 160px;
  gap: 16px;
  margin-bottom: 16px;
}

.mdc-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.mdc-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ra-pale-blue);
  margin-bottom: 4px;
  font-family: 'Raleway', sans-serif;
  letter-spacing: 0.02em;
}

.mdc-field input:not([type="checkbox"]),
.mdc-field select,
.mdc-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Raleway', sans-serif;
  color: var(--ra-text);
  background: var(--ra-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}

.mdc-field input:not([type="checkbox"]):focus,
.mdc-field select:focus,
.mdc-field textarea:focus {
  border-color: var(--ra-deep-blue);
  box-shadow: 0 0 0 3px rgba(42,46,88,0.12);
}

.mdc-field input::placeholder,
.mdc-field textarea::placeholder { color: #b0b4cc; }

.mdc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235278bb' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.mdc-field textarea { resize: vertical; min-height: 72px; }

/* ---- Checkbox ---- */
.billable-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  font-size: 14px;
  font-family: 'Raleway', sans-serif;
  color: var(--ra-text);
  width: fit-content;
  position: relative;
  z-index: 2;
}

.billable-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--ra-deep-blue);
  -webkit-appearance: auto !important;
  appearance: auto !important;
  opacity: 1 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--ra-deep-blue);
  color: var(--ra-white);
  box-shadow: 0 2px 6px rgba(42,46,88,0.3);
}
.btn-primary:hover { background: #363b6e; box-shadow: 0 3px 10px rgba(42,46,88,0.35); }

.btn-accent {
  background: var(--ra-orange);
  color: var(--ra-white);
  box-shadow: 0 2px 6px rgba(247,166,56,0.35);
}
.btn-accent:hover { background: #e8952a; }

.btn-secondary {
  background: var(--ra-white);
  color: var(--ra-deep-blue);
  border: 1.5px solid var(--ra-border);
}
.btn-secondary:hover { background: var(--ra-surface); }

.btn-danger {
  background: #fff0f0;
  color: var(--ra-error);
  border: 1px solid #ffd0d0;
}
.btn-danger:hover { background: #ffe0e0; }

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

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  font-size: 12px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

.btn-ghost-dark {
  background: transparent;
  color: var(--ra-text-muted);
  border: 1.5px solid transparent;
  padding: 6px 14px;
  font-size: 12px;
}
.btn-ghost-dark:hover { background: var(--ra-surface); color: var(--ra-deep-blue); }

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: -8px 0 16px;
}

.list-search {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
  padding: 7px 10px;
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  color: var(--ra-text);
  background: var(--ra-white);
  outline: none;
}

.list-search:focus,
.list-filter-select:focus {
  border-color: var(--ra-deep-blue);
  box-shadow: 0 0 0 3px rgba(42,46,88,0.1);
}

.list-filter-select {
  min-width: 160px;
  padding: 7px 10px;
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  color: var(--ra-text);
  background: var(--ra-white);
  outline: none;
}

.archive-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ra-text-muted);
  cursor: pointer;
  user-select: none;
}

.archive-toggle input {
  accent-color: var(--ra-deep-blue);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.li-customer-wrap { margin-top: 4px; max-width: 420px; }

.reject-banner {
  background: #fff5f5;
  border: 1px solid #ffd0d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--ra-error);
  font-size: 13px;
}
.reject-banner strong { display: block; margin-bottom: 4px; }

.draft-banner {
  background: #eef1f8;
  border: 1px solid var(--ra-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--ra-text);
  font-size: 13px;
}

.reject-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
}
.reject-box textarea {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
}

/* ---- Line items ---- */
.line-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.add-line-item-footer {
  display: flex;
  justify-content: flex-start;
  margin: 4px 0 8px;
}

.line-item {
  border: 1.5px solid var(--ra-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--ra-surface);
  position: relative;
  transition: border-color 0.15s;
}

.line-item:focus-within { border-color: var(--ra-pale-blue); }

.line-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.line-item-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--ra-pale-blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.line-item-total {
  font-size: 15px;
  font-weight: 600;
  color: var(--ra-deep-blue);
}

.mileage-fields { display: none; }
.mileage-fields.visible { display: grid; }

/* ---- File upload ---- */
.file-drop-zone {
  border: 2px dashed var(--ra-border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--ra-surface);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--ra-pale-blue);
  background: #eef1f9;
}

.file-drop-zone p { color: var(--ra-text-muted); font-size: 14px; }
.file-drop-zone strong { color: var(--ra-deep-blue); }

.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--ra-white);
  border: 1px solid var(--ra-border);
  border-radius: 6px;
  font-size: 13px;
}

.file-item-name { color: var(--ra-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-remove { cursor: pointer; color: #b0b4cc; font-size: 18px; line-height: 1; flex-shrink: 0; margin-left: 8px; }
.file-item-remove:hover { color: var(--ra-error); }

/* ---- Total bar ---- */
.total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ra-deep-blue);
  border-radius: 8px;
  padding: 14px 20px;
  margin-top: 16px;
}

.total-box .label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.7); }
.total-box .amount { font-size: 22px; font-weight: 600; color: var(--ra-orange); }

/* ---- Report list ---- */
.report-list { display: flex; flex-direction: column; gap: 10px; }

.report-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ra-white);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(42,46,88,0.08), 0 0 0 1px rgba(42,46,88,0.06);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.1s;
  cursor: pointer;
}

.report-card:hover {
  box-shadow: 0 4px 12px rgba(42,46,88,0.14), 0 0 0 1px var(--ra-pale-blue);
  transform: translateY(-1px);
}

.report-card-left h3 { font-size: 15px; font-weight: 600; margin-bottom: 3px; color: var(--ra-deep-blue); }
.report-card-left p { font-size: 13px; color: var(--ra-text-muted); }
.report-card-right { text-align: right; }
.report-card-right .amount { font-size: 18px; font-weight: 600; color: var(--ra-deep-blue); }
.report-card-right .date { font-size: 12px; color: var(--ra-text-muted); margin-top: 2px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-billable { background: #fff3e0; color: #c77700; }
.badge-pending { background: #fff8e8; color: #92400e; }
.badge-draft { background: #eef1f8; color: #3d4568; }
.badge-rejected { background: #fff0f0; color: #b00020; }
.badge-approved { background: #ecfdf5; color: #065f46; }
.badge-error { background: #fff0f0; color: #b00020; }
.badge-archived { background: #eef1f8; color: #5b6488; }

.report-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* ---- Report detail ---- */
.report-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.report-meta-item label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ra-pale-blue);
  display: block;
  margin-bottom: 4px;
}

.report-meta-item span { font-size: 15px; color: var(--ra-text); }

.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.line-items-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--ra-border);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ra-pale-blue);
}

.line-items-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--ra-border);
  vertical-align: middle;
}

.line-items-table tfoot td {
  border-bottom: none;
  border-top: 2px solid var(--ra-border);
  font-weight: 600;
  padding-top: 12px;
  color: var(--ra-deep-blue);
}

.billable-summary {
  margin-top: 28px;
  padding: 16px 18px 12px;
  background: #fff8ee;
  border: 1px solid #fde7c3;
  border-radius: 8px;
}

.billable-summary .form-section-title {
  margin-bottom: 10px;
}

.billable-summary .line-items-table th {
  color: #c77700;
  border-bottom-color: #fde7c3;
}

.billable-summary .line-items-table td {
  border-bottom-color: #fde7c3;
  background: transparent;
}

.billable-summary .line-items-table tfoot td {
  border-top-color: #f5d089;
}

.billable-summary-note {
  margin: 10px 2px 2px;
  font-size: 12px;
  color: var(--ra-text-muted);
}

.receipt-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.receipt-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ra-pale-blue);
  text-decoration: none;
}
.receipt-link:hover { color: var(--ra-deep-blue); text-decoration: underline; }

/* ---- QBO link box ---- */
.qbo-box {
  background: var(--ra-surface);
  border: 1.5px solid var(--ra-border);
  border-radius: 8px;
  padding: 16px;
}

.qbo-box p { font-size: 13px; color: var(--ra-text-muted); margin-bottom: 10px; }

.qbo-input-row { display: flex; align-items: center; gap: 8px; }

.qbo-input {
  flex: 1;
  font-size: 12px;
  font-family: monospace;
  background: var(--ra-white);
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ra-text-muted);
}

/* ---- Notices ---- */
.notice {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 600;
}

.notice-error { background: #fff0f0; color: var(--ra-error); border-left: 4px solid var(--ra-error); }
.notice-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.toast-stack {
  position: fixed !important;
  top: 20px;
  right: 20px;
  bottom: auto;
  left: auto;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: visible;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--ra-white);
  color: var(--ra-text);
  border-radius: 8px;
  padding: 14px 36px 14px 16px;
  box-shadow: 0 12px 40px rgba(26, 29, 54, 0.28);
  border-left: 4px solid var(--ra-pale-blue);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  position: relative;
  animation: toast-in 0.22s ease;
}

.toast-success { border-left-color: #2e7d32; }
.toast-info { border-left-color: var(--ra-orange); }
.toast-error { border-left-color: var(--ra-error); background: #fff7f7; }
.toast-out { animation: toast-out 0.2s ease forwards; }

.toast-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--ra-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.toast-dismiss:hover { color: var(--ra-text); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--ra-text-muted);
}

.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--ra-deep-blue); font-weight: 600; }
.empty-state p { font-size: 14px; }

/* ---- Loading ---- */
.loading {
  text-align: center;
  padding: 64px;
  color: var(--ra-text-muted);
  font-size: 14px;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-muted { color: var(--ra-text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ---- App layout with sidebar ---- */
.app-header {
  background: var(--ra-deep-blue);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(42,46,88,0.25);
}

.header-logo {
  height: 32px;
  width: auto;
  display: block;
}

.app-body {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--ra-deep-blue);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  color: var(--ra-orange);
  background: rgba(247,166,56,0.08);
  border-left-color: var(--ra-orange);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 10px 20px;
}

/* ---- Main content area ---- */
.main {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 28px 36px 48px;
  max-width: none;
}

.view { display: block; }
.view.hidden { display: none; }

/* ---- Settings ---- */
.qbo-status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1.5px solid var(--ra-border);
  background: var(--ra-surface);
}

.qbo-status-box.connected {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.qbo-status-box.disconnected {
  border-color: var(--ra-border);
  background: var(--ra-surface);
}

.qbo-status-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: #10b981; }
.status-dot.gray { background: #9ca3af; }

.qbo-status-sub {
  font-size: 12px;
  color: var(--ra-text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.mapping-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ra-border);
}

.mapping-row:last-child { border-bottom: none; }

.mapping-category {
  width: 200px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ra-text);
  flex-shrink: 0;
  padding-top: 22px;
}

.mapping-accts {
  display: flex;
  flex: 1;
  gap: 12px;
  flex-wrap: wrap;
}

.mapping-acct {
  flex: 1;
  min-width: 140px;
}

.mapping-acct-product {
  min-width: 200px;
  flex: 1.4;
}

.mapping-acct label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ra-text-muted);
  margin-bottom: 4px;
}

.mapping-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--ra-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  color: var(--ra-text);
  background: var(--ra-white);
  outline: none;
}

.mapping-input:focus {
  border-color: var(--ra-deep-blue);
  box-shadow: 0 0 0 3px rgba(42,46,88,0.1);
}

.mapping-resolved {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ra-pale-blue);
}

/* ---- QBO bill badge on report ---- */
.qbo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  margin-top: 4px;
}

.qbo-badge.pending {
  background: #fff3e0;
  color: #92400e;
  border-color: #fcd34d;
}
.qbo-badge.error {
  background: #fff0f0;
  color: #b00020;
  border-color: #ffd0d0;
}

.qbo-doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.qbo-doc-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--ra-pale-blue);
  text-decoration: none;
}

.qbo-doc-link:hover { text-decoration: underline; color: var(--ra-deep-blue); }

.qbo-status-box .qbo-doc-links {
  margin-top: 10px;
  margin-left: 20px;
}

@media (max-width: 900px) {
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.report-info,
  .line-item-grid { grid-template-columns: 1fr; }
  .report-meta { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .auth-card { padding: 32px 20px; }
}

@media (max-width: 800px) {
  .app-body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 12px 16px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--ra-orange);
  }
  .nav-divider { display: none; }
}

.auth-card .auth-legal {
  margin: 24px 0 0;
  font-size: 12px;
}

.auth-card .auth-legal a {
  color: var(--ra-pale-blue);
  text-decoration: none;
}

.auth-card .auth-legal a:hover { text-decoration: underline; }

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

.legal-page header {
  margin-bottom: 32px;
}

.legal-page .header-logo {
  height: 36px;
  margin-bottom: 24px;
}

.legal-page h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--ra-deep-blue);
  margin-bottom: 8px;
}

.legal-page .legal-updated {
  color: var(--ra-text-muted);
  font-size: 13px;
  margin-bottom: 0;
}

.legal-page h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ra-deep-blue);
  margin: 28px 0 8px;
}

.legal-page p,
.legal-page li {
  color: var(--ra-text);
  font-size: 14px;
  margin-bottom: 12px;
}

.legal-page ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-page a {
  color: var(--ra-pale-blue);
}

.legal-page footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--ra-border);
  font-size: 13px;
  color: var(--ra-text-muted);
}
