:root {
  --blue: #1b3a7a;
  --blue-light: #d9e5ff;
  --bg: #eef3ff;
  --card-bg: #ffffff;
  --border: #cdd7f3;
  --text-main: #1d2640;
  --text-muted: #6c7593;
  --danger: #c0392b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------
   TOP BAR
-----------------------------------------------------*/
.top-bar {
  background: var(--blue);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-main {
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-sub {
  font-size: 0.8rem;
  color: #d0ddff;
}

/* ----------------------------------------------------
   NAVIGATION BAR
-----------------------------------------------------*/
.main-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-btn.active {
  background: #fff;
  color: var(--blue);
}

/* ----------------------------------------------------
   AUTH AREA
-----------------------------------------------------*/
.auth-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.auth-status {
  font-size: 0.8rem;
  color: #d0ddff;
}

/* ----------------------------------------------------
   BUTTONS
-----------------------------------------------------*/
.btn-primary,
.btn-secondary,
.btn-ghost {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 7px 14px;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--blue);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--blue);
}

/* ----------------------------------------------------
   LOGIN PANEL
-----------------------------------------------------*/
.login-panel {
  max-width: 420px;
  margin: 16px auto;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* ----------------------------------------------------
   MAIN CONTENT AREA
-----------------------------------------------------*/
.main-content {
  padding: 18px;
  max-width: 1300px;
  margin: 0 auto 20px;
}

.section-header h1 {
  margin: 0 0 4px;
}

.section-header p {
  margin: 0 0 16px;
  color: var(--text-muted);
}

/* ----------------------------------------------------
   CARD
-----------------------------------------------------*/
.card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

/* ----------------------------------------------------
   FORMS
-----------------------------------------------------*/
.form-row {
  margin-bottom: 12px;
}

.form-row.inline {
  display: flex;
  gap: 10px;
}

.form-row.inline > div,
.form-row.inline > input,
.form-row.inline > select {
  flex: 1;
}

label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 0.9rem;
}

textarea {
  resize: vertical;
}

.message {
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ----------------------------------------------------
   TAB VIEWS
-----------------------------------------------------*/
.tab-view {
  display: none;
}

/* ----------------------------------------------------
   SIMPLE LIST
-----------------------------------------------------*/
.simple-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.simple-list li {
  padding: 4px 0;
}

/* ----------------------------------------------------
   PARTS SHOP LAYOUT
-----------------------------------------------------*/
.parts-layout {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .parts-layout {
    grid-template-columns: 2fr 1.2fr;
  }
}

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

.parts-list-header {
  display: flex;
  margin-bottom: 10px;
}

.part-line {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #edf1ff;
  padding: 6px 0;
}

/* ----------------------------------------------------
   CART
-----------------------------------------------------*/
.cart-items {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.cart-line {
  display: flex;
  justify-content: space-between;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  padding: 8px 0;
}

.empty-state {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------
   DASHBOARD GRID
-----------------------------------------------------*/
.dashboard-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ----------------------------------------------------
   WHATSAPP FLOAT BUTTON
-----------------------------------------------------*/
.whatsapp-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #25d366;
  padding: 12px 18px;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 9999;
}

.whatsapp-float:hover {
  opacity: 0.9;
}

/* ----------------------------------------------------
   RESPONSIVE FIXES
-----------------------------------------------------*/
@media (max-width: 700px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-area {
    text-align: left;
    align-items: flex-start;
  }
}
/* =========================
   KPI DASHBOARD (BOLD)
========================= */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  border-radius: 14px;
  padding: 18px;
  color: #fff;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-4px);
}

.kpi-card h3 {
  font-size: 2.2rem;
  margin: 0;
}

.kpi-card p {
  margin: 6px 0 0;
  font-weight: 600;
  opacity: 0.9;
}

/* Colours */
.kpi-card.blue { background: linear-gradient(135deg, #2196f3, #1565c0); }
.kpi-card.orange { background: linear-gradient(135deg, #ff9800, #ef6c00); }
.kpi-card.green { background: linear-gradient(135deg, #4caf50, #2e7d32); }
.kpi-card.red { background: linear-gradient(135deg, #f44336, #c62828); }

/* Mobile safety */
@media (max-width: 768px) {
  .kpi-card h3 {
    font-size: 1.8rem;
  }
}



/* =========================
   SLIDE-IN JOB EDITOR
========================= */
.job-editor-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display:none; z-index:1000; }
.job-editor-panel { position:absolute; right:0; top:0; width:420px; max-width:95%; height:100%; background:#fff; padding:18px; overflow-y:auto; box-shadow:-6px 0 20px rgba(0,0,0,.2); transform:translateX(100%); transition:transform .3s ease; }
.job-editor-overlay.show { display:block; }
.job-editor-overlay.show .job-editor-panel { transform:translateX(0); }
@media (max-width:768px){ .job-editor-panel{ width:100%; } }
