/* ============================================================
   FRIGHTL — Main Stylesheet
   Professional Black / White Theme
   ============================================================ */

:root {
  --primary:       #111111;
  --primary-dark:  #000000;
  --primary-light: #2a2a2a;
  --accent:        #111111;
  --accent-hover:  #000000;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --bg:            #f7f7f7;
  --surface:       #ffffff;
  --border:        #e4e4e4;
  --text:          #111111;
  --text-muted:    #666666;
  --text-light:    #999999;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.14);
  --transition:    0.2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

h1,h2,h3,h4,h5,h6 { font-weight: 600; color: var(--text); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex; flex-direction: column;
}

.sidebar-brand .brand-name {
  font-size: 15px; font-weight: 700;
  color: #fff; letter-spacing: .5px;
}

.sidebar-brand .brand-subtitle {
  font-size: 11px; color: rgba(255,255,255,.5);
  font-weight: 400;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: 1px;
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  border-radius: 0;
  font-size: 13.5px; font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.sidebar-nav .nav-link i {
  font-size: 16px; width: 20px; text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  text-decoration: none;
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #fff;
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-footer .nav-link {
  color: rgba(255,255,255,.55);
  font-size: 13px;
  padding: 8px 0;
  display: flex; align-items: center; gap: 8px;
}

.sidebar-footer .nav-link:hover { color: #fff; background: none; text-decoration: none; }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 100;
}

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 20px; cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-search {
  flex: 1; max-width: 400px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: 7px 12px 7px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.topbar-search input:focus { border-color: var(--text); background: #fff; }

.topbar-search i {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px;
}

.topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 12px;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
}

.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

/* ---- Page Content ---- */
.page-content {
  padding: 28px 28px 40px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--text); margin: 0;
}

.page-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin: 4px 0 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px; font-weight: 600;
  color: var(--text); margin: 0;
}

.card-subtitle {
  font-size: 12px; color: var(--text-muted);
  margin: 3px 0 0;
}

.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
}

.stat-card-header {
  display: flex; align-items: center; justify-content: space-between;
}

.stat-card-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
}

.stat-card-icon {
  width: 34px; height: 34px;
  background: rgba(0,0,0,.06);
  color: var(--text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.stat-card-icon.success { background: rgba(22,163,74,.1); color: var(--success); }
.stat-card-icon.warning { background: rgba(217,119,6,.1);  color: var(--warning); }
.stat-card-icon.danger  { background: rgba(220,38,38,.1);  color: var(--danger); }

.stat-card-value {
  font-size: 24px; font-weight: 700; color: var(--text);
}

.stat-card-meta {
  font-size: 12px; color: var(--text-muted);
}

/* ============================================================
   SAVINGS LEVEL BAR
   ============================================================ */
.savings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.savings-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 12px;
}

.savings-level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  margin-left: 8px;
}

.badge-bronze { background: #fef3c7; color: #92400e; }
.badge-silver { background: #f1f5f9; color: #475569; }
.badge-gold   { background: #fefce8; color: #854d0e; }

.savings-progress-wrap {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px;
}

.savings-progress {
  flex: 1;
  height: 8px; background: var(--border);
  border-radius: 999px; overflow: hidden;
}

.savings-progress-bar {
  height: 100%; background: var(--primary);
  border-radius: 999px;
  transition: width .6s ease;
}

.savings-progress-label {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: rgba(0,0,0,.02); }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}

.status-in-transit    { background: #f0f0f0; color: #111; }
.status-in-transit::before { background: #555; }

.status-delivered     { background: #dcfce7; color: #15803d; }
.status-delivered::before { background: #15803d; }

.status-pending       { background: #fef9c3; color: #92400e; }
.status-pending::before { background: #d97706; }

.status-overdue       { background: #fee2e2; color: #b91c1c; }
.status-overdue::before { background: #b91c1c; }

.status-paid          { background: #dcfce7; color: #15803d; }
.status-paid::before  { background: #15803d; }

.status-cancelled     { background: #f1f5f9; color: #64748b; }
.status-cancelled::before { background: #94a3b8; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 7px; border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1.4;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

.btn-navy {
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary);
}
.btn-navy:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); color: var(--text); border-color: #bbb; }

.btn-danger-outline {
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-outline:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

.btn i { font-size: 15px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}

.form-help {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 4px;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px; color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-control::placeholder { color: var(--text-light); }

.form-control:focus, .form-select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.invalid-feedback {
  font-size: 12px; color: var(--danger);
  margin-top: 4px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-select-wrap { position: relative; }
.form-select-wrap::after {
  content: '\F282';
  font-family: 'bootstrap-icons';
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
  font-size: 14px;
}
.form-select-wrap .form-select { padding-right: 36px; }

.input-group {
  display: flex;
}
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); flex: 1; }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.upload-area:hover { border-color: var(--text); background: rgba(0,0,0,.02); }
.upload-area i { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; display: block; }
.upload-area p { font-size: 13px; color: var(--text-muted); margin: 0; }
.upload-area small { font-size: 11px; color: var(--text-light); }

/* Section card for forms */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 15px; font-weight: 600;
  color: var(--text); margin-bottom: 4px;
}

.form-section-subtitle {
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 20px;
}

/* ============================================================
   QUOTE CALCULATOR
   ============================================================ */
.piece-type-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.piece-type-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.piece-type-title {
  font-size: 13px; font-weight: 600;
  color: var(--text);
}

.remove-piece-btn {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 2px;
  border-radius: 4px; line-height: 1;
  transition: color var(--transition);
}
.remove-piece-btn:hover { color: var(--danger); }

.piece-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

/* Quote result */
.quote-result {
  background: var(--primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
  display: none;
  margin-top: 20px;
}

.quote-result.show { display: block; }

.quote-result-header {
  font-size: 13px; color: rgba(255,255,255,.6);
  margin-bottom: 4px; font-weight: 500;
}

.quote-total {
  font-size: 36px; font-weight: 700;
  margin-bottom: 20px;
}

.quote-breakdown {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 16px;
}

.quote-breakdown-row {
  display: flex; justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px; color: rgba(255,255,255,.75);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

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

.quote-breakdown-row strong { color: #fff; }

.quote-actions {
  display: flex; gap: 10px; margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 16px;
}

.btn-white {
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.btn-white:hover { background: rgba(255,255,255,.25); color: #fff; }

/* ============================================================
   VESSEL MAP & TRACKING
   ============================================================ */
#vessel-map {
  height: 380px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.milestone-timeline {
  list-style: none; padding: 0; margin: 0;
}

.milestone-item {
  display: flex; gap: 14px;
  padding-bottom: 20px;
  position: relative;
}

.milestone-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px; top: 28px;
  width: 2px; bottom: 0;
  background: var(--border);
}

.milestone-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  flex-shrink: 0; z-index: 1;
}

.milestone-dot.done {
  background: var(--success); color: #fff;
}

.milestone-dot.active {
  background: var(--primary); color: #fff;
}

.milestone-body { padding-top: 2px; }
.milestone-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.milestone-date  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.milestone-desc  { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   INVOICES / PAYMENT
   ============================================================ */
.invoice-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.invoice-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.invoice-stat-label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500; margin-bottom: 8px;
}

.invoice-stat-value {
  font-size: 22px; font-weight: 700;
  color: var(--text);
}

.invoice-stat-value.danger-text { color: var(--danger); }

/* Stripe payment */
#stripe-card-element {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
  background: var(--surface);
}

.payment-method-icons {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
}

.pm-badge {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  display: flex; align-items: center; gap: 4px;
}

/* ============================================================
   CALENDAR (Dashboard)
   ============================================================ */
.mini-calendar {
  width: 100%;
  font-size: 13px;
}

.mini-calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.mini-calendar-header .month-label {
  font-weight: 600; color: var(--text);
}

.cal-nav-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 3px 6px;
  border-radius: 5px;
  transition: background var(--transition);
}
.cal-nav-btn:hover { background: var(--bg); color: var(--text); }

.mini-calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; text-align: center;
}

.cal-day-name {
  font-size: 10px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  cursor: default;
  font-size: 12.5px; color: var(--text);
}

.cal-day.other-month { color: var(--text-light); }
.cal-day.today {
  background: var(--primary); color: #fff;
  font-weight: 700;
}
.cal-day.has-delivery {
  background: rgba(0,0,0,.07);
  color: var(--text); font-weight: 600;
}

/* ============================================================
   PAY YOUR BILL (Dashboard widget)
   ============================================================ */
.pay-bill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  height: 100%;
  box-shadow: var(--shadow-sm);
}

.pay-bill-balance {
  font-size: 28px; font-weight: 700;
  color: var(--text); margin: 12px 0 4px;
}

.pay-bill-meta {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   ADMIN PANEL SPECIFICS
   ============================================================ */
.admin-topbar-badge {
  background: rgba(220,38,38,.1); color: var(--danger);
  border: 1px solid rgba(220,38,38,.2);
  border-radius: 5px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
}

.client-row-active { border-left: 3px solid var(--success); }
.client-row-inactive { border-left: 3px solid var(--border); }

/* Pricing page */
.pricing-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}

/* Webhooks */
.webhook-log-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 13px;
}

.webhook-log-meta {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-bottom: 6px;
}

.webhook-log-payload {
  background: var(--bg);
  border-radius: 5px; padding: 10px;
  font-family: monospace; font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto;
  display: none;
}

.webhook-log-payload.show { display: block; }

/* Settings page */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-size: 16px; font-weight: 600;
  margin-bottom: 4px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%; max-width: 420px;
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}

.login-logo .logo-box {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin: 0;
}

.login-logo p {
  font-size: 13px; color: var(--text-muted); margin: 4px 0 0;
}

.login-footer {
  text-align: center; margin-top: 20px;
  font-size: 12px; color: var(--text-muted);
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert-bar {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #f3f4f6; color: #111;    border: 1px solid #d1d5db; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; }
.empty-state h5 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ============================================================
   MODAL OVERRIDE
   ============================================================ */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}

.modal-body { padding: 22px; }

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb-bar {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb-bar a { color: var(--text-muted); }
.breadcrumb-bar a:hover { color: var(--text); }
.breadcrumb-bar .sep { color: var(--border); }
.breadcrumb-bar .current { color: var(--text); font-weight: 500; }

/* ============================================================
   UTILITY
   ============================================================ */
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.fw-600 { font-weight: 600; }
.gap-8  { gap: 8px; }
.d-flex-center { display: flex; align-items: center; }
.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ============================================================
   HISTORY DRAWER
   ============================================================ */
.history-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1099;
}
.history-overlay.show { display: block; }

.history-drawer {
  position: fixed; top: 0; right: 0;
  width: 640px; max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0,0,0,.14);
  z-index: 1100;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s ease;
}
.history-drawer.open { transform: translateX(0); }

.history-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-drawer-header h3 {
  font-size: 16px; font-weight: 600; margin: 0; color: var(--text);
}
.history-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; padding: 6px 8px;
  border-radius: 6px; line-height: 1;
  transition: color .15s, background .15s;
}
.history-close-btn:hover { color: var(--text); background: var(--bg); }

.history-drawer-body {
  flex: 1; overflow-y: auto; padding: 16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }

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

  .piece-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .page-content { padding: 20px 16px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .quote-total { font-size: 28px; }
  .login-card { padding: 28px 20px; }
  .topbar-search { max-width: 180px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .piece-grid { grid-template-columns: 1fr 1fr; }
}
