/* ========================================================
   MotoService - Android Material Design 3 CSS
   ======================================================== */

:root {
  --primary: #1565C0;
  --primary-dark: #003c8f;
  --primary-light: #5e92f3;
  --secondary: #FF6F00;
  --secondary-dark: #c43e00;
  --success: #2E7D32;
  --warning: #E65100;
  --error: #C62828;
  --surface: #FFFFFF;
  --surface2: #F5F5F5;
  --surface3: #EEEEEE;
  --on-surface: #212121;
  --on-surface-medium: #757575;
  --on-surface-light: #BDBDBD;
  --border: #E0E0E0;
  --shadow: rgba(0,0,0,0.12);
  --shadow-md: rgba(0,0,0,0.20);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --navbar-height: 60px;
  --bottom-nav-height: 68px;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--surface2);
  color: var(--on-surface);
  font-size: 14px;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ===== SPLASH ===== */
.splash-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s;
}
.splash-content { text-align: center; color: white; }
.splash-content h1 { font-size: 28px; font-weight: 700; margin: 16px 0 8px; }
.splash-content p { font-size: 14px; opacity: 0.8; margin-bottom: 24px; }
.splash-progress { width: 200px; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; overflow: hidden; margin: 0 auto; }
.splash-progress-bar { height: 100%; background: white; border-radius: 2px; animation: progress 2s ease-in-out; }
@keyframes progress { from { width: 0; } to { width: 100%; } }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 60%, #1a237e 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: white; border-radius: 24px; padding: 32px 28px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .material-icons { font-size: 64px; color: var(--primary); }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--primary); margin-top: 8px; }
.login-logo p { color: var(--on-surface-medium); font-size: 13px; }

/* ===== TOP APP BAR ===== */
.top-bar {
  height: var(--navbar-height);
  background: var(--primary);
  color: white;
  display: flex; align-items: center;
  padding: 0 8px 0 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px var(--shadow-md);
  flex-shrink: 0;
}
.top-bar-title { flex: 1; font-size: 20px; font-weight: 500; margin-left: 8px; }
.top-bar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px;
  border: none; background: transparent; color: inherit; cursor: pointer;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.icon-btn:hover, .icon-btn:active { background: rgba(255,255,255,0.15); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  height: var(--bottom-nav-height);
  background: white;
  display: flex; align-items: stretch;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px var(--shadow);
  flex-shrink: 0;
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; border: none; background: transparent; color: var(--on-surface-medium);
  font-size: 10px; font-weight: 500; padding: 8px 4px;
  position: relative; transition: color 0.2s;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.nav-item.active { color: var(--primary); }
.nav-item.active .material-icons { background: var(--primary-light); border-radius: 16px; padding: 4px 16px; color: var(--primary-dark); }
.nav-item .material-icons { font-size: 24px; transition: all 0.2s; }
.nav-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--error); color: white;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.page { display: none; padding-bottom: 16px; }
.page.active { display: block; }

/* ===== CARDS ===== */
.card {
  background: white; border-radius: var(--radius); margin: 12px;
  box-shadow: 0 1px 4px var(--shadow); overflow: hidden;
}
.card-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--on-surface); }
.card-subtitle { font-size: 13px; color: var(--on-surface-medium); margin-top: 2px; }
.card-body { padding: 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 16px;
  box-shadow: 0 1px 4px var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-card.full { grid-column: 1 / -1; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon .material-icons { font-size: 22px; color: white; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--on-surface-medium); }
.stat-change { font-size: 11px; display: flex; align-items: center; gap: 2px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ===== LIST ITEMS ===== */
.list-item {
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s; background: white;
}
.list-item:last-child { border-bottom: none; }
.list-item:active, .list-item:hover { background: var(--surface2); }
.list-item-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-weight: 700; font-size: 16px; color: white;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-subtitle { font-size: 13px; color: var(--on-surface-medium); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-meta { font-size: 12px; color: var(--on-surface-medium); text-align: right; flex-shrink: 0; }
.list-item-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; display: inline-block; }

/* ===== STATUS BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-aberta { background: #E3F2FD; color: #1565C0; }
.badge-em_andamento { background: #FFF3E0; color: #E65100; }
.badge-aguardando_peca { background: #F3E5F5; color: #6A1B9A; }
.badge-aguardando_aprovacao { background: #FFF9C4; color: #F57F17; }
.badge-concluida { background: #E8F5E9; color: #2E7D32; }
.badge-cancelada { background: #FFEBEE; color: #C62828; }
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-error { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-normal { background: #F5F5F5; color: #616161; }
.badge-urgente { background: #FFEBEE; color: #C62828; }
.badge-alta { background: #FFF3E0; color: #E65100; }
.badge-baixa { background: #F5F5F5; color: #9E9E9E; }

/* ===== SEARCH BAR ===== */
.search-bar {
  padding: 12px; background: var(--primary); padding-top: 8px; padding-bottom: 8px;
}
.search-input {
  display: flex; align-items: center; background: rgba(255,255,255,0.15);
  border-radius: 28px; padding: 0 16px; gap: 8px;
  border: 1px solid rgba(255,255,255,0.3);
}
.search-input input {
  flex: 1; background: transparent; border: none; outline: none;
  color: white; font-size: 15px; height: 44px;
}
.search-input input::placeholder { color: rgba(255,255,255,0.6); }
.search-input .material-icons { color: rgba(255,255,255,0.7); font-size: 20px; }

/* ===== FAB ===== */
.fab {
  position: fixed; right: 20px; bottom: calc(var(--bottom-nav-height) + 16px);
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--secondary); color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(255,111,0,0.4);
  z-index: 50; transition: transform 0.2s, box-shadow 0.2s;
}
.fab:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(255,111,0,0.3); }
.fab .material-icons { font-size: 24px; }
.fab-extended {
  width: auto; padding: 0 20px; gap: 8px; border-radius: 16px;
  font-size: 14px; font-weight: 600; letter-spacing: 0.5px;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--on-surface-medium); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: block; }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--on-surface);
  background: white; outline: none; transition: border-color 0.2s;
  font-family: inherit;
}
.form-control:focus { border-color: var(--primary); }
.form-control:disabled { background: var(--surface2); color: var(--on-surface-medium); }
select.form-control { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23757575' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group { position: relative; }
.input-group .form-control { padding-left: 42px; }
.input-group .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--on-surface-medium); font-size: 18px; }
.input-prefix { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.input-prefix span { background: var(--surface2); padding: 12px; color: var(--on-surface-medium); font-size: 13px; border-right: 1px solid var(--border); }
.input-prefix .form-control { border: none; border-radius: 0; }
.form-hint { font-size: 11px; color: var(--on-surface-medium); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--error); margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit; letter-spacing: 0.3px;
  transition: all 0.2s; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(21,101,192,0.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; box-shadow: 0 2px 8px rgba(255,111,0,0.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-text { background: transparent; color: var(--primary); padding: 8px 12px; }
.btn-danger { background: var(--error); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 10px; border-radius: 50%; min-width: 40px; }
.btn-icon .material-icons { font-size: 20px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== MODAL / BOTTOM SHEET ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: white; width: 100%; max-width: 600px;
  border-radius: 20px 20px 0 0; max-height: 92vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.3s ease-out;
}
.modal-dialog {
  border-radius: 20px; max-height: 90vh; margin: auto; width: calc(100% - 32px);
}
/* Modal genérico usado nos formulários dinâmicos (JS) */
.modal {
  background: var(--surface, #ffffff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 0; }
.modal-header {
  padding: 16px 16px 12px; display: flex; align-items: center;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { flex: 1; font-size: 18px; font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ===== TABS ===== */
.tabs { display: flex; overflow-x: auto; background: white; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 14px 20px; font-size: 13px; font-weight: 600;
  color: var(--on-surface-medium); border: none; background: transparent; cursor: pointer;
  border-bottom: 3px solid transparent; text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== CHIP / FILTER ===== */
.chips { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; background: white; border-bottom: 1px solid var(--border); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); background: white; color: var(--on-surface-medium);
  cursor: pointer; white-space: nowrap; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.3px;
}
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== SECTION HEADER ===== */
.section-header {
  padding: 16px 16px 8px; display: flex; align-items: center; justify-content: space-between;
}
.section-title { font-size: 13px; font-weight: 700; color: var(--on-surface-medium); text-transform: uppercase; letter-spacing: 0.8px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--on-surface-medium);
}
.empty-state .material-icons { font-size: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--on-surface); }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 0; }
.divider-text { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--on-surface-medium); font-size: 12px; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ===== KM INDICATOR ===== */
.km-indicator {
  background: linear-gradient(135deg, #1565C0, #0D47A1);
  border-radius: var(--radius); padding: 16px; color: white; margin: 12px;
}
.km-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.km-value { font-size: 32px; font-weight: 700; }
.km-label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.km-progress { height: 6px; background: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; }
.km-progress-bar { height: 100%; border-radius: 3px; background: #69F0AE; transition: width 0.5s; }
.km-progress-bar.warning { background: #FFD740; }
.km-progress-bar.danger { background: #FF5252; }

/* ===== OS DETAIL ===== */
.os-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; padding: 16px;
}
.os-number { font-size: 22px; font-weight: 700; }
.os-vehicle { font-size: 15px; opacity: 0.9; margin: 4px 0; }
.os-meta { font-size: 12px; opacity: 0.75; }
.detail-row { display: flex; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 12px; color: var(--on-surface-medium); text-transform: uppercase; letter-spacing: 0.4px; min-width: 100px; padding-top: 1px; }
.detail-value { flex: 1; font-size: 14px; font-weight: 500; }

/* ===== CHART ===== */
.chart-container { padding: 16px; position: relative; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ===== PRICE HIGHLIGHT ===== */
.price { font-size: 18px; font-weight: 700; color: var(--primary); }
.price-sm { font-size: 14px; font-weight: 600; color: var(--on-surface); }
.price-muted { font-size: 13px; color: var(--on-surface-medium); }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.total-row.main { border-top: 2px solid var(--border); padding-top: 14px; margin-top: 4px; }
.total-row.main .price { font-size: 24px; }

/* ===== REPORT ===== */
.report-header { background: white; padding: 16px; border-bottom: 1px solid var(--border); }
.report-period { display: flex; gap: 12px; }
.report-period .form-control { flex: 1; }
.report-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); }
.report-summary-item { background: white; padding: 16px; text-align: center; }
.report-summary-item .value { font-size: 20px; font-weight: 700; color: var(--primary); }
.report-summary-item .label { font-size: 11px; color: var(--on-surface-medium); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }
.category-bar { display: flex; align-items: center; padding: 10px 16px; gap: 12px; border-bottom: 1px solid var(--border); }
.category-bar-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.category-bar-label { flex: 1; font-size: 14px; }
.category-bar-value { font-size: 14px; font-weight: 600; }
.category-bar-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.category-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }

/* ===== COMBOBOX CATEGORIA DE PEÇA ===== */
.peca-cat-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  display: flex;
  align-items: center;
}
.peca-cat-item:last-child { border-bottom: none; }
.peca-cat-item:hover, .peca-cat-item.peca-cat-active {
  background: var(--primary-light, #E3F2FD);
  color: var(--primary);
}
.peca-cat-custom { color: var(--primary); font-style: italic; }


.snackbar {
  position: fixed; bottom: calc(var(--bottom-nav-height) + 16px); left: 16px; right: 16px;
  background: #323232; color: white; padding: 14px 16px;
  border-radius: var(--radius-sm); z-index: 300;
  display: none; align-items: center; justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3); animation: slideUpSnack 0.3s ease-out;
  max-width: 568px; margin: 0 auto;
}
.snackbar.show { display: flex; }
.snackbar.success { background: #2E7D32; }
.snackbar.error { background: #C62828; }
.snackbar.warning { background: #E65100; }
@keyframes slideUpSnack { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.8);
  z-index: 400; display: none; align-items: center; justify-content: center;
}
.loading-overlay.show { display: flex; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface3) 25%, var(--surface2) 50%, var(--surface3) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== STOCK ALERT ===== */
.stock-alert { background: #FFF3E0; border-left: 4px solid var(--warning); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.stock-critical { background: #FFEBEE; border-left-color: var(--error); }
.stock-ok { background: #E8F5E9; border-left-color: var(--success); }

/* ===== MISC ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--on-surface-medium); }
.text-small { font-size: 12px; }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.overflow-hidden { overflow: hidden; }
.rounded { border-radius: var(--radius); }
.text-green { color: var(--success); }
.text-red { color: var(--error); }
.text-orange { color: var(--warning); }
.text-blue { color: var(--primary); }
hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* ===== SWIPE ACTIONS ===== */
.swipe-container { position: relative; overflow: hidden; }

/* ===== OS STATUS STEPPER ===== */
.stepper { display: flex; align-items: center; gap: 0; padding: 16px; overflow-x: auto; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 60px; }
.step-circle { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); background: white; z-index: 1; }
.step-circle.done { background: var(--success); border-color: var(--success); color: white; }
.step-circle.current { background: var(--primary); border-color: var(--primary); color: white; }
.step-line { flex: 1; height: 2px; background: var(--border); margin-top: -16px; }
.step-line.done { background: var(--success); }
.step-label { font-size: 9px; text-align: center; color: var(--on-surface-medium); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.2px; }

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-sheet { max-width: 500px; border-radius: 20px; margin: auto; }
}

/* ===== PRINT ===== */
@media print {
  .top-bar, .bottom-nav, .fab, .snackbar { display: none !important; }
  .page { display: block !important; }
  .main-content { overflow: visible; }
}

/* ===== VEÍCULO AUTOCOMPLETE ===== */
.veiculo-autocomplete {
  position: relative;
}
/* botão ×  dentro do input */
.veiculo-clear-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--on-surface-medium); display: flex; align-items: center;
  border-radius: 50%; transition: background 0.15s;
  z-index: 2;
}
.veiculo-clear-btn:hover { background: var(--surface3); }
.veiculo-clear-btn .material-icons { font-size: 18px; }
/* ajuste no padding do input quando o botão × está visível */
.veiculo-autocomplete .form-control { padding-right: 40px; }

/* dropdown de resultados */
.veiculo-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 500; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border);
  animation: dropdownFade 0.15s ease-out;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.veiculo-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.veiculo-dropdown-item:last-child { border-bottom: none; }
.veiculo-dropdown-item:hover,
.veiculo-dropdown-item.focused { background: #E3F2FD; }
.veiculo-dropdown-item.focused { outline: none; }
.vdd-plate {
  flex-shrink: 0; background: var(--primary); color: white;
  font-weight: 700; font-size: 14px; letter-spacing: 1.5px;
  padding: 5px 10px; border-radius: 6px; font-family: monospace;
  min-width: 90px; text-align: center;
}
.vdd-info { flex: 1; min-width: 0; }
.vdd-model {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vdd-client {
  font-size: 12px; color: var(--on-surface-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vdd-km {
  flex-shrink: 0; text-align: right;
  font-size: 12px; font-weight: 600; color: var(--primary);
}
/* highlight do trecho digitado */
.vdd-highlight { background: #FFF176; border-radius: 2px; padding: 0 1px; }
/* mensagem de "nenhum resultado" */
.veiculo-dropdown-empty {
  padding: 20px 16px; text-align: center;
  color: var(--on-surface-medium); font-size: 13px;
}
.veiculo-dropdown-empty .material-icons { font-size: 36px; display: block; margin-bottom: 6px; opacity: 0.4; }

/* card do veículo selecionado */
.veiculo-selected-card {
  margin-top: 10px; background: #E3F2FD;
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.vsc-plate {
  background: var(--primary); color: white;
  font-weight: 700; font-size: 15px; letter-spacing: 2px;
  padding: 6px 12px; border-radius: 6px; font-family: monospace;
  flex-shrink: 0;
}
.vsc-info { flex: 1; min-width: 0; }
.vsc-model { font-size: 14px; font-weight: 600; }
.vsc-detail { font-size: 12px; color: var(--primary-dark); margin-top: 2px; }
.vsc-km { font-size: 13px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ─── Toggle Switch ──────────────────────────────────────────── */
.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--on-surface-light); border-radius: 24px;
  transition: .25s;
}
.toggle-slider:before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: .25s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ─── Serviços CRUD helpers ──────────────────────────────────── */
.cat-color-dot {
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; transition: border .15s, transform .1s;
}
.cat-color-dot:hover { transform: scale(1.15); }

/* ═══ AUTOCOMPLETE DE ITENS (Serviço / Peça) ═════════════════ */

/* Wrapper geral */
.item-search-wrap { position: relative; }

/* Linha do input */
.item-search-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .18s;
  overflow: hidden;
}
.item-search-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}

/* Ícone à esquerda */
.item-search-icon {
  font-size: 20px;
  color: var(--on-surface-medium);
  padding: 0 10px;
  flex-shrink: 0;
  pointer-events: none;
}

/* Input de texto */
.item-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 11px 4px;
  font-size: 15px;
  background: transparent;
  color: var(--on-surface);
  min-width: 0;
}
.item-search-input:disabled {
  color: var(--on-surface);
  opacity: 1;
  -webkit-text-fill-color: var(--on-surface);
}

/* Botão de limpar (X) */
.item-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--on-surface-medium);
  flex-shrink: 0;
  border-radius: 50%;
  margin: 2px 2px 2px 0;
  transition: background .15s, color .15s;
}
.item-search-clear:hover { background: var(--surface3); color: var(--error); }
.item-search-clear .material-icons { font-size: 18px; }

/* Dropdown de resultados */
.item-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  z-index: 1200;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Item da lista */
.isd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface3);
  transition: background .12s;
}
.isd-item:last-child { border-bottom: none; }
.isd-item:hover, .isd-item:active { background: #E3F2FD; }

/* Bolinha de cor (serviços) */
.isd-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Bloco central de informação */
.isd-info { flex: 1; min-width: 0; }
.isd-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.isd-code {
  font-size: 11px;
  color: var(--on-surface-medium);
  background: var(--surface3);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
}
.isd-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.isd-cat {
  font-size: 11px;
  color: var(--on-surface-medium);
}

/* Preço à direita */
.isd-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mensagem de resultado vazio */
.isd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px;
  color: var(--on-surface-medium);
  font-size: 13px;
  text-align: center;
}
.isd-empty .material-icons { font-size: 32px; opacity: .4; }

/* Card de item selecionado */
.item-selected-card {
  margin-top: 10px;
  background: #E8F5E9;
  border: 1.5px solid #66BB6A;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Bolinha maior para serviço selecionado */
.isd-sel-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Highlight da busca */
mark.isd-hl {
  background: #FFF176;
  border-radius: 2px;
  padding: 0 1px;
  color: inherit;
}

/* Grade de thumbs dentro do card */
.fotos-grid {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.fotos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px;
  width: 100%;
  color: var(--on-surface-medium);
  font-size: 13px;
}
.fotos-empty .material-icons { font-size: 40px; opacity: 0.4; }

/* Wrapper de cada thumb */
.foto-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 96px;
}
.foto-thumb {
  width: 90px; height: 90px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid var(--border);
  background: var(--surface3);
  flex-shrink: 0;
  transition: transform .15s, box-shadow .15s;
}
.foto-thumb:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.foto-thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.foto-thumb-badge {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 9px;
  background: rgba(0,0,0,.55);
  color: white;
  border-radius: 4px;
  padding: 1px 4px;
  pointer-events: none;
}
.foto-thumb-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--on-surface-medium);
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Área de drag/drop / seleção de arquivo */
.foto-drop-zone {
  border: 2px dashed var(--primary-light);
  border-radius: 14px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  background: #E3F2FD;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background .15s, border-color .15s;
}
.foto-drop-zone:hover,
.foto-drop-zone:active {
  background: #BBDEFB;
  border-color: var(--primary);
}

/* Card de preview antes do upload */
.foto-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
}
.foto-preview-img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.foto-preview-info { flex: 1; min-width: 0; }

/* Visualizador full-screen */
.foto-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  display: flex;
  flex-direction: column;
}
.foto-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: white;
  background: rgba(0,0,0,.5);
  flex-shrink: 0;
}
.foto-viewer-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}
.foto-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  cursor: pointer;
}
.foto-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  cursor: default;
}
.foto-viewer-meta {
  padding: 8px 16px;
  display: flex;
  gap: 16px;
  justify-content: center;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  flex-shrink: 0;
}


/* ─── Usuários: cards de tipo ────────────────────────────────────────────── */
.usr-tipo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.usr-tipo-card .material-icons {
  font-size: 28px;
  color: var(--on-surface-medium);
  transition: color .2s;
}
.usr-tipo-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.usr-tipo-card.active .material-icons {
  color: var(--primary);
}

/* ─── Despesa Reembolsável ────────────────────────────────────────────────── */
.reembolsavel-check {
  border: 2px solid var(--border);
  border-radius: 14px;
  margin: 4px 0 12px;
  transition: border-color .2s, background .2s;
  overflow: hidden;
}
.reembolsavel-check.active {
  border-color: var(--warning);
  background: #FFF8E1;
}
.reembolsavel-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.reembolsavel-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.reembolsavel-icon .material-icons {
  font-size: 22px;
  color: white;
}
.reembolsavel-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reembolsavel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}
.reembolsavel-desc {
  font-size: 11px;
  color: var(--on-surface-medium);
}
.reembolsavel-toggle {
  display: flex;
  align-items: center;
}
.reembolsavel-toggle input[type="checkbox"] {
  display: none;
}
.reembolsavel-checkmark {
  font-size: 28px;
  color: var(--on-surface-medium);
  transition: color .2s;
}
.reembolsavel-check.active .reembolsavel-checkmark {
  color: var(--warning);
}
.reembolsavel-check.active .reembolsavel-title {
  color: #E65100;
}

/* Badge reembolsável */
.badge-reembolsavel {
  background: #FFF8E1;
  color: #E65100;
  border: 1px solid #FFB74D;
  font-weight: 600;
}

/* ─── WhatsApp Config ─────────────────────────────────────────────────── */
.wa-provider-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  flex: 1;
  text-align: center;
  min-width: 80px;
  transition: border-color .2s, background .2s;
}
.wa-provider-card.active {
  border-color: #25D366;
  background: #E8F5E9;
}
.wa-provider-info {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #E3F2FD;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #1565C0;
  margin-bottom: 12px;
  line-height: 1.5;
}
.wa-tpl-hint {
  font-size: 12px;
  color: var(--on-surface-medium);
  background: var(--surface2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  line-height: 1.8;
}
.wa-tpl-hint code {
  background: var(--surface3);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  color: var(--primary);
}
.badge-success {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

/* ── Botões de fonte de foto (Câmera / Galeria) ────────────────────── */
.foto-source-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 12px;
  border: 2px solid var(--surface-variant);
  border-radius: 16px;
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
  min-height: 110px;
  color: var(--on-surface);
}
.foto-source-btn:active {
  transform: scale(0.96);
  background: var(--surface-variant);
}
.foto-source-btn:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface2));
}
