/* Autopflege — atelier técnico comercial */
:root {
  --bg: #081014;
  --bg-elevated: #0d161c;
  --surface: #121c24;
  --surface-2: #18242d;
  --surface-3: #1e2e38;
  --primary: #1fb5a4;
  --primary-dark: #0f7f74;
  --primary-light: #3ad0bf;
  --primary-soft: rgba(31, 181, 164, 0.14);
  --copper: #d4a054;
  --copper-soft: rgba(212, 160, 84, 0.16);
  --danger: #e25b4a;
  --danger-soft: rgba(226, 91, 74, 0.14);
  --success: #4fd18b;
  --success-soft: rgba(79, 209, 139, 0.14);
  --warning: #e8b45a;
  --text: #e8f1f4;
  --text-main: #e8f1f4;
  --text-muted: #8aa0a8;
  --text-dark: #102027;
  --border: rgba(154, 184, 190, 0.14);
  --border-light: rgba(154, 184, 190, 0.24);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-light: 0 8px 24px rgba(0, 0, 0, 0.22);
  --glow: 0 0 28px rgba(31, 181, 164, 0.22);
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 268px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Oxanium", "Source Sans 3", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gradient-primary: linear-gradient(135deg, #12897d 0%, #1fb5a4 52%, #5ee0d0 100%);
  --gradient-secondary: linear-gradient(135deg, #c8922a 0%, #e8b45a 100%);
  --gradient-accent: linear-gradient(135deg, #0f7f74 0%, #1fb5a4 100%);
  --accent: #1fb5a4;
  --secondary: #d4a054;
  --background: #081014;
  --surface-light: #18242d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(31, 181, 164, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 181, 164, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(31, 181, 164, 0.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(212, 160, 84, 0.1), transparent 50%);
}

h1, h2, h3, h4, .page-heading h1, .sidebar-brand strong {
  font-family: var(--display);
  letter-spacing: 0.02em;
}

a { color: var(--primary-light); }

.animated-bg { display: none; }

/* ===== Shell ===== */
.app-shell,
.container {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 12, 0.62);
  backdrop-filter: blur(6px);
  z-index: 30;
}

.nav-backdrop.is-visible { display: block; }

.app-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 25;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(8, 16, 20, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.nav-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
}

.topbar-logo { height: 28px; width: auto; }
.topbar-title {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  background:
    linear-gradient(180deg, rgba(18, 32, 38, 0.96), rgba(10, 18, 22, 0.98));
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 46px;
  height: auto;
  filter: drop-shadow(0 0 16px rgba(31, 181, 164, 0.28));
}

.sidebar-brand strong {
  display: block;
  font-size: 1.05rem;
  color: #fff;
}

.sidebar-brand span {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-label {
  margin: 18px 12px 8px;
  color: var(--copper);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 4px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: 180ms ease;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.sidebar-nav a.active {
  color: #06211e;
  background: var(--gradient-primary);
  box-shadow: var(--glow);
}

.sidebar-nav svg,
.sidebar-nav i {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-footer { margin-top: auto; padding-top: 16px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-light);
  font-family: var(--display);
  font-weight: 700;
}

.sidebar-user strong { display: block; font-size: 0.92rem; }
.sidebar-user span { color: var(--text-muted); font-size: 0.75rem; }

.logout-form { margin-top: 0; }

.logout-btn {
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logout-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #fff;
}

.main-content-wrapper {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 56px;
}

.page-heading,
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.page-kicker {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--primary-light);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.page-heading h1,
.app-header h1,
.main-content h2,
main > h2 {
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-heading p,
.app-header p {
  color: var(--text-muted);
  max-width: 52ch;
}

.page-heading .heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Motion ===== */
.ui-enter {
  animation: rise 520ms cubic-bezier(.2,.8,.2,1) both;
  animation-delay: var(--enter-delay, 0ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

body.is-ready .main-content-wrapper > main {
  animation: rise 480ms ease both;
}

/* ===== Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card,
.chart-container,
.recent-budgets-section,
.table-container,
.budget-form-section,
.budget-summary,
.budget-totals,
.filter-panel,
.dash-panel {
  background: linear-gradient(180deg, rgba(24, 38, 46, 0.92), rgba(14, 22, 28, 0.94));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-light);
}

.stat-card {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  isolation: isolate;
  transition: transform 180ms ease, border-color 180ms ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -36px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--primary-soft);
  pointer-events: none;
  z-index: 0;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 181, 164, 0.45);
}

.stat-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--gradient-primary);
  color: #06211e;
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.stat-info {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1;
}

.stat-info h3 {
  font-family: var(--display);
  font-size: clamp(1rem, 1.15vw, 1.45rem);
  color: #fff;
  line-height: 1.2;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-info p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.dash-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 420px;
}

.dash-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.dash-panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #fff;
}

.dash-table-wrap {
  overflow: auto;
  flex: 1;
}

.dash-table-wrap table {
  margin: 0;
}

.dash-table-wrap th,
.dash-table-wrap td {
  padding: 12px 14px;
  white-space: nowrap;
}

.dash-table-wrap td:nth-child(2) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-chart {
  flex: 1;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.dash-empty {
  margin: auto;
  color: var(--text-muted);
  text-align: center;
  padding: 32px 12px;
}

.month-bar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
}

.month-bar-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.month-bar-body { min-width: 0; }

.month-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.month-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-primary);
  min-width: 4px;
  max-width: 100%;
}

.month-bar-value {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--primary-light);
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

.month-bar-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn,
.quick-action-btn,
.report-action,
.btn-primary-large,
.btn-secondary-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: 160ms ease;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary,
.report-action.primary,
.btn-primary-large {
  background: var(--gradient-primary);
  color: #06211e;
  box-shadow: var(--glow);
}

.btn-primary:hover,
.report-action.primary:hover,
.btn-primary-large:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-secondary,
.report-action.secondary,
.btn-secondary-large {
  background: transparent;
  color: var(--text);
  border-color: var(--border-light);
}

.btn-secondary:hover,
.report-action.secondary:hover,
.btn-secondary-large:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  background: var(--primary-soft);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { filter: brightness(0.92); }

.btn-sm { padding: 7px 12px; font-size: 0.8rem; }

/* ===== Tables ===== */
.table-container {
  overflow: auto;
  margin-top: 8px;
}

table { width: 100%; border-collapse: collapse; }

thead {
  background: rgba(31, 181, 164, 0.08);
}

th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: rgba(31, 181, 164, 0.05); }
tbody tr:last-child td { border-bottom: none; }

.actions-column { white-space: nowrap; }
.actions-column .dropdown {
  position: relative;
  display: inline-block;
  margin: 0 4px;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; position: relative; }

.form-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

::placeholder { color: #6d838b; }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ===== Modals ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  background: rgba(3, 8, 10, 0.72);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex !important; }

.modal-content {
  background: var(--surface);
  border-radius: 22px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  animation: rise 280ms ease;
}

.close-button,
.close-modal,
.modal .close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}

.close-button:hover,
.close-modal:hover { color: #fff; border-color: var(--primary); }

.modal h3 {
  padding: 24px 28px 0;
  font-size: 1.35rem;
  color: #fff;
}

.modal-body { padding: 8px 28px 28px; }

/* ===== Messages ===== */
.message {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-weight: 600;
}

.message.success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(79, 209, 139, 0.28); }
.message.error { background: var(--danger-soft); color: #ff8d80; border: 1px solid rgba(226, 91, 74, 0.28); }
.message.warning,
.message.info { background: var(--copper-soft); color: var(--copper); border: 1px solid rgba(212, 160, 84, 0.28); }

/* ===== Login ===== */
body:has(.login-stage) { display: grid; }

.login-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-visual {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 20% 20%, rgba(31, 181, 164, 0.18), transparent 30%),
    linear-gradient(160deg, #0b181d, #071015 60%);
  border-right: 1px solid var(--border);
}

.login-visual img {
  max-width: 220px;
  filter: drop-shadow(0 10px 30px rgba(31, 181, 164, 0.25));
}

.login-visual h2 {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  max-width: 8ch;
  color: #fff;
}

.login-visual p {
  max-width: 36ch;
  color: var(--text-muted);
  margin-top: 16px;
}

.login-container {
  max-width: none;
  margin: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  background: rgba(12, 20, 26, 0.78);
  border-radius: 0;
  box-shadow: none;
}

.login-header { margin-bottom: 28px; }
.login-header h1 { font-size: 2.1rem; color: #fff; }
.login-header p { color: var(--text-muted); }

.alert-error {
  background: var(--danger-soft);
  color: #ff8d80;
  border: 1px solid rgba(226, 91, 74, 0.28);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  text-align: center;
}

/* ===== Dropdown / status ===== */
.dropdown { position: relative; display: inline-block; }

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
  overflow: hidden;
}

.dropdown-content.show,
.dropdown .dropdown-content.show { display: block; }

.dropdown-content a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
}

.dropdown-content a:hover { background: var(--primary-soft); color: var(--primary-light); }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-aprovado { background: var(--success-soft); color: var(--success); }
.status-rejeitado { background: var(--danger-soft); color: #ff8d80; }
.status-pendente { background: var(--copper-soft); color: var(--copper); }
.status-concluído { background: var(--primary-soft); color: var(--primary-light); }

/* ===== Budget / search leftovers ===== */
.product-search-results,
.client-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
  display: none;
  box-shadow: var(--shadow);
}

.product-search-item,
.client-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.product-search-item:hover,
.client-search-item:hover { background: var(--surface-2); }

.budget-form-section { padding: 22px; margin-bottom: 18px; }
.budget-form-section h3 {
  color: var(--primary-light);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.budget-summary,
.budget-totals { padding: 22px; margin-top: 16px; }

.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-option {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.model-row { display: flex; gap: 8px; margin-bottom: 8px; }
.model-input, .year-input { flex: 1; }

.price-table-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.price-table-option {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.price-table-option:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.product-quantity-input { width: 72px; }
.remove-product-from-budget-btn { padding: 6px 10px; }

.recent-budgets-section,
.dashboard-charts { margin-top: 8px; }
.recent-budgets-section h3,
.chart-container h3 {
  padding: 18px 20px 0;
  font-size: 1.1rem;
  color: #fff;
}

.chart-container { padding-bottom: 20px; }

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.total-row:last-child { border: 0; color: var(--primary-light); font-weight: 700; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Hero leftovers (login still uses logo class) */
.hero-header { display: none; }
.hero-logo { max-width: 220px; }

/* Budget create extras */
.quick-budget-container { max-width: 1280px; margin: 0 auto; }
.quick-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.step {
  text-align: center;
  padding: 14px 10px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.step.active {
  background: var(--gradient-primary);
  color: #06211e;
  box-shadow: var(--glow);
}
.step.completed { background: var(--primary-dark); border-color: var(--primary); }
.step-number {
  width: 30px;
  height: 30px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  background: rgba(255,255,255,.12);
}
.step-title { font-size: 0.82rem; font-weight: 700; }

.product-search-hero {
  background: linear-gradient(135deg, #0f7f74, #1fb5a4 70%);
  padding: 22px;
  border-radius: 18px;
  margin-bottom: 18px;
  color: #06211e;
}
.product-search-hero h3 { color: #06211e; margin-bottom: 12px; }
.search-input-wrapper { position: relative; margin-bottom: 12px; }
.search-input-wrapper input {
  width: 100%;
  padding: 14px 48px 14px 16px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #102027;
}
.search-input-wrapper .search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #0f7f74;
}
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-action-btn {
  flex: 1;
  min-width: 150px;
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 16px;
  max-height: 380px;
  overflow: auto;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  transition: 160ms ease;
}
.product-card:hover,
.product-card.selected,
.product-card.in-budget { border-color: var(--primary); transform: translateY(-2px); }
.product-name { font-weight: 700; }
.product-price { color: var(--primary-light); font-family: var(--display); font-weight: 700; }
.product-ref { color: var(--text-muted); font-size: 0.8rem; margin: 6px 0; }
.product-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-add-quick {
  flex: 1;
  padding: 8px;
  background: var(--primary);
  color: #06211e;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.budget-items-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}
.items-table { width: 100%; }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}
.qty-input,
.price-input,
input.qty-input,
input.price-input {
  width: 72px;
  text-align: center;
}
.subtotal-cell { color: var(--primary-light); font-weight: 700; font-family: var(--mono); }
.btn-remove {
  background: var(--danger-soft);
  color: #ff8d80;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.empty-state { text-align: center; padding: 36px 12px; color: var(--text-muted); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; display: block; opacity: .5; }
.items-table tr.just-added { animation: justAddedFlash 1.1s ease; }
@keyframes justAddedFlash {
  from { background: rgba(31, 181, 164, .28); }
  to { background: transparent; }
}

.notes-section-simple {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}
.action-buttons { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.client-selected {
  background: var(--primary-soft);
  border: 1px solid rgba(31, 181, 164, .35);
  border-radius: 16px;
  padding: 16px;
}
.totals-panel-fixed {
  position: sticky;
  bottom: 16px;
  z-index: 12;
  background: rgba(12, 22, 28, 0.92);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 12px 16px;
  backdrop-filter: blur(12px);
}
.totals-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
.total-final .total-value { color: var(--primary-light); font-size: 1.3rem; font-family: var(--display); }
.client-list-item {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--bg-elevated);
}
.client-list-item:hover { border-color: var(--primary); }
.client-list-name { font-weight: 700; color: #fff; }
.client-list-details { color: var(--text-muted); font-size: 0.82rem; margin-top: 3px; }

.product-result-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.product-search-section,
.edit-item {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--primary) !important;
}

#custom-prices-modal .modal-content { max-width: 800px; }
.custom-price-input { width: 120px; }
.product-quantity-input,
input.product-quantity-input { width: 72px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-steps { grid-template-columns: 1fr 1fr; }
  .dashboard-panels { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app-topbar { display: flex; }
  .container, .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 220ms ease;
    height: 100vh;
  }
  .sidebar.is-open { transform: none; }
  .main-content-wrapper { padding: 18px 16px 40px; }
  .login-stage { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-container { padding: 32px 20px; min-height: 100vh; }
}

@media (max-width: 700px) {
  .stats-grid,
  .quick-steps,
  .totals-grid { grid-template-columns: 1fr; }
  .page-heading, .app-header, .form-actions, .action-buttons { flex-direction: column; align-items: stretch; }
  .btn { width: auto; }
}
