:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --line: #e5e7eb;
  --success: #166534;
  --success-bg: #f0fdf4;
  --error: #991b1b;
  --error-bg: #fef2f2;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f3f4f6; color: var(--text); }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg); color: #fff; padding: 24px; }
.brand { font-size: 22px; font-weight: 700; margin-bottom: 28px; color: #fff; letter-spacing: -0.3px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar a { color: #94a3b8; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; display: block; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: rgba(37,99,235,.3); color: #fff; }
.main { display: grid; grid-template-rows: auto 1fr; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.content { padding: 24px; display: grid; gap: 20px; align-content: start; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.userbox span { color: var(--muted); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.card-header h2, .card-header h3 { margin: 0; }

/* Grid helpers */
.grid { display: grid; gap: 20px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 20px; align-content: start; }

/* Stats */
.big-number { font-size: 32px; font-weight: 700; margin-top: 8px; }
.muted { color: var(--muted); }

/* Buttons */
.button, button[type="submit"] {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 16px; text-decoration: none; cursor: pointer; font-size: 14px;
  font-weight: 600; display: inline-block;
}
.button:hover, button[type="submit"]:hover { background: var(--accent-dark); }
.btn-secondary {
  background: #fff; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; text-decoration: none;
  font-size: 14px; font-weight: 600; display: inline-block; cursor: pointer;
}
.btn-secondary:hover { background: #f9fafb; }
.btn-clear { color: var(--muted); text-decoration: none; font-size: 14px; padding: 10px 8px; }
.btn-clear:hover { color: var(--text); }
.btn-danger-sm {
  background: none; border: 1px solid #fca5a5; color: #dc2626;
  border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.btn-danger-sm:hover { background: #fef2f2; }

/* Page actions bar */
.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-actions a + a, .page-actions a + button { margin-left: 8px; }

/* Inputs */
input[type="text"], input[type="email"], input[type="url"], input[type="tel"],
input[type="password"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px;
  font-size: 14px; color: var(--text); background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { resize: vertical; }

/* Forms */
.form-card { max-width: 860px; }
.form-grid { display: grid; gap: 24px; }
.form-section { display: grid; gap: 16px; }
.form-section h3 { margin: 0 0 4px; font-size: 15px; color: var(--text); border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.form-row { display: grid; gap: 16px; }
.field-group { display: grid; gap: 6px; }
.field-group label { font-size: 13px; font-weight: 600; color: #374151; }
.form-actions { display: flex; gap: 12px; align-items: center; padding-top: 8px; }
.required { color: #dc2626; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 4px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f9fafb; }
.row-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.row-link:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 12px; }
.row-actions a { color: var(--muted); font-size: 13px; text-decoration: none; }
.row-actions a:hover { color: var(--accent); }

/* List header (customers index) */
.list-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.list-header h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar input { width: 220px; }
.search-bar select { width: 140px; }
.count-badge { background: #e0e7ff; color: #3730a3; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
.empty-state { padding: 24px 0; text-align: center; }

/* Badges */
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; display: inline-block; }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-lead     { background: #fef9c3; color: #854d0e; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-primary  { background: #dbeafe; color: #1e40af; }

/* Detail page */
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.detail-list dt { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; align-self: start; padding-top: 2px; }
.detail-list dd { margin: 0; }
.notes-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }
.notes-block strong { display: block; margin-bottom: 6px; }

/* Contacts */
.contact-list { display: grid; gap: 1px; margin-bottom: 16px; }
.contact-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.contact-info { display: grid; gap: 2px; font-size: 14px; }
.contact-info strong { font-size: 15px; }
.contact-info span, .contact-info a { color: var(--muted); font-size: 13px; text-decoration: none; }
.contact-info a:hover { color: var(--accent); }
.add-contact-form { margin-top: 12px; }
.add-contact-form summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 600; user-select: none; }

/* Checkboxes */
.checkbox-group { display: grid; gap: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Auth */
.guest-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* Responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid, .two-col { grid-template-columns: 1fr; }
  .search-bar input, .search-bar select { width: 100%; }
  .list-header { flex-direction: column; align-items: flex-start; }
}


/* Import module */
.import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.import-card { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: start; text-decoration: none; color: inherit; }
.import-card:hover { border-color: #bfdbfe; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
.import-card h3 { margin: 0 0 6px; }
.import-card p { margin: 0; }
.import-card-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: #dbeafe; color: #1d4ed8; }
.import-order { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.note-block { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.review-card { display: grid; gap: 16px; }
.review-row { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  .import-grid { grid-template-columns: 1fr; }
}

.badge-draft { background: #e5e7eb; color: #374151; }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-accepted { background: #dcfce7; color: #166534; }
.badge-lost { background: #fee2e2; color: #b91c1c; }
.quote-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.quote-summary-grid.single-col { grid-template-columns: 1fr; }
.mini-stat { padding: 18px; display: grid; gap: 8px; }
.mini-stat strong { font-size: 24px; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 900px) {
  .quote-summary-grid { grid-template-columns: 1fr; }
}
