/* ============================================================
   Pulse — IKATECH Design System
   Shared with Droplet. Same variables, same components, same feel.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy:        #16161f;
  --navy-light:  #1f1f2e;
  --primary:     #5865f2;
  --green:       #10b981;
  --red:         #ef4444;
  --amber:       #f59e0b;
  --violet:      #8b5cf6;

  --bg:          #1a1a2e;
  --surface:     #252538;
  --surface-2:   #2d2d45;
  --border:      #3a3a4e;

  --text:        #e8e8f5;
  --text-muted:  #b4b4d0;

  --primary-bg:  rgba(88,101,242,0.14);
  --primary-glow:rgba(88,101,242,0.28);
  --green-bg:    rgba(16,185,129,0.13);
  --red-bg:      rgba(239,68,68,0.13);
  --amber-bg:    rgba(245,158,11,0.13);
  --violet-bg:   rgba(139,92,246,0.13);

  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow:      0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 24px 60px rgba(0,0,0,0.6);

  --radius:      10px;
  --radius-lg:   14px;
}

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

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: linear-gradient(135deg, #16161f 0%, #1a1a2e 50%, #1e1e33 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────── */
.page-body {
  display: flex;
  min-height: 100vh;
}

.page-main {
  flex: 1;
  margin-left: 220px;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── Top Nav ─────────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: rgba(37,37,56,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  z-index: 300;
}

.topnav-brand {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.topnav-brand span {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topnav-sep { color: var(--border); margin: 0 2px; }
.topnav-page { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.topnav-divider { flex: 1; }

.topnav-user {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s;
}
.topnav-back:hover { color: var(--text); border-color: #555570; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 56px; left: 0; bottom: 0;
  width: 220px;
  background: linear-gradient(180deg, #1f1f2e 0%, #16161f 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 12px 8px;
}

.sidebar-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 8px 6px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: #a5b4fc; }
.nav-item.active .nav-icon { color: var(--primary); }

.nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4752c4 0%, #5558d9 100%);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: #555570; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; box-shadow: 0 4px 16px rgba(16,185,129,0.3); transform: translateY(-1px); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 16px rgba(239,68,68,0.3); transform: translateY(-1px); }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn-logout { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  color: var(--text);
  background: rgba(26,26,46,0.5);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #4a4a68; }

.form-group select option { background: var(--surface); }

.field-optional {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.form-grid-2 .span-2 { grid-column: 1 / -1; }

/* ── Metrics ─────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid transparent;
}

.metric-green { border-left-color: var(--green); }
.metric-red   { border-left-color: var(--red); }
.metric-amber { border-left-color: var(--amber); }
.metric-blue  { border-left-color: var(--primary); }

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.metric-green .metric-icon { background: var(--green-bg); color: var(--green); }
.metric-red   .metric-icon { background: var(--red-bg);   color: var(--red); }
.metric-amber .metric-icon { background: var(--amber-bg); color: var(--amber); }
.metric-blue  .metric-icon { background: var(--primary-bg); color: #a5b4fc; }

.metric-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Table card ─────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.table-card-title { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.table-card-sub   { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.table-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  padding: 11px 16px;
  text-align: left;
  background: linear-gradient(135deg, rgba(31,31,46,1) 0%, rgba(22,22,31,1) 100%);
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover td { background: rgba(88,101,242,0.08); }
.data-table tbody tr:hover td:first-child { border-left: 2px solid var(--primary); padding-left: 14px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; }

/* ── Status badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-active   { background: var(--green-bg);   color: var(--green); }
.badge-inactive { background: var(--red-bg);     color: var(--red); }
.badge-defect   { background: var(--amber-bg);   color: var(--amber); }
.badge-ok       { background: var(--green-bg);   color: var(--green); }
.badge-primary  { background: var(--primary-bg); color: #a5b4fc; border: 1px solid rgba(88,101,242,0.25); }

.badge-pill {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-bg);
  border: 1px solid rgba(88,101,242,0.25);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #a5b4fc;
}

/* ── Toggle switch (driver active/inactive) ─────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: var(--border);
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-track { background: var(--green); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

/* ── Subtoolbar ─────────────────────────────────────────────── */
.subtoolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.subtoolbar-left, .subtoolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  align-items: center;
  background: rgba(26,26,46,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab:hover { color: var(--text); background: rgba(88,101,242,0.08); }
.tab.active { background: rgba(88,101,242,0.15); color: #a5b4fc; }
.tab-green.active { background: rgba(16,185,129,0.18); color: var(--green); }
.tab-red.active   { background: rgba(239,68,68,0.18);  color: var(--red); }
.tab-amber.active { background: rgba(245,158,11,0.18); color: var(--amber); }

.tab-count {
  background: rgba(255,255,255,0.08);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

/* ── Date range ─────────────────────────────────────────────── */
.date-range-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(26,26,46,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
}

.date-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.date-input::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.date-range-sep { color: var(--text-muted); font-size: 0.75rem; }
.date-range-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }

/* ── Action buttons (in table rows) ────────────────────────── */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface-2);
  color: var(--text-muted);
}
.action-btn:hover { color: var(--text); }
.action-btn.action-green { background: var(--green-bg); color: var(--green); }
.action-btn.action-green:hover { background: rgba(16,185,129,0.25); }
.action-btn.action-red   { background: var(--red-bg);   color: var(--red); }
.action-btn.action-red:hover   { background: rgba(239,68,68,0.25); }
.action-btn.action-primary { background: var(--primary-bg); color: #a5b4fc; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  pointer-events: none;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, backdrop-filter 0.25s;
}

.modal.active {
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  pointer-events: all;
}

.modal-content {
  background: var(--surface);
  width: 96%;
  max-width: 860px;
  border-radius: 20px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--primary);
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
  transform: translateY(28px) scale(0.96);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), opacity 0.25s;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal.active .modal-content { transform: translateY(0) scale(1); opacity: 1; }
.modal-content.modal-sm { max-width: 480px; }
.modal-content.modal-md { max-width: 620px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.modal-header-sub { font-size: 0.75rem; color: var(--text-muted); }

.close-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.close-btn:hover { background: var(--red-bg); color: var(--red); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Checklist detail (in record view modal) ────────────────── */
.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
}

.checklist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.checklist-row.pass { border-left-color: var(--green); }
.checklist-row.fail { border-left-color: var(--red); background: rgba(239,68,68,0.06); }

.checklist-row-label { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.checklist-row-val   { font-size: 0.72rem; font-weight: 700; }
.checklist-row.pass .checklist-row-val { color: var(--green); }
.checklist-row.fail .checklist-row-val { color: var(--red); }

/* ── Info grid (submission header in modal) ─────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.info-cell-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.info-cell-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.page-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.875rem; font-weight: 500; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover { color: var(--text); }
.page-btn.active { background: var(--primary-bg); color: #a5b4fc; border-color: rgba(88,101,242,0.3); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.page-info {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 6px;
}

/* ── Toast notification ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
  max-width: 320px;
}

.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error   { border-left: 3px solid var(--red); }
.toast.toast-info    { border-left: 3px solid var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--primary);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

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

.login-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  font-size: 1.5rem;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(88,101,242,0.4);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.login-error {
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Defects section ─────────────────────────────────────────── */
.defects-box {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
}

.defects-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.defects-box-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── Dashboard quick-nav cards ──────────────────────────────── */
.dash-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.dash-nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.dash-nav-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(88,101,242,0.15);
  transform: translateY(-2px);
}

.dash-nav-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dash-nav-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.dash-nav-card p  { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* ── Search input ─────────────────────────────────────────────── */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap input {
  padding: 7px 12px 7px 34px;
  background: rgba(26,26,46,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  outline: none;
  width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-input-wrap input::placeholder { color: #4a4a68; }

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ── Modal underline tabs ───────────────────────────────────── */
.modal-tab-bar {
  display: flex;
  padding: 0 24px;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-tab {
  padding: 13px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
  white-space: nowrap;
}

.modal-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--text); }
.modal-tab.active::after { opacity: 1; }

/* ── Responsive: top nav offset ─────────────────────────────── */
.has-topnav .page-main { padding-top: calc(56px + 28px); }
.has-topnav .sidebar   { top: 56px; }

/* ── Hamburger button (hidden on desktop) ────────────────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.25s;
}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hamburger visible */
  .hamburger { display: flex; }

  /* Sidebar: off-screen by default, slides in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    top: 0;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Page main: full width */
  .page-main {
    margin-left: 0;
    padding: calc(56px + 20px) 16px 32px;
  }

  /* Topnav: hide company name */
  .topnav-user > span { display: none; }

  /* Metrics: 2 columns */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-card  { padding: 16px; gap: 12px; }
  .metric-value { font-size: 1.4rem; }
  .metric-icon  { width: 36px; height: 36px; font-size: 0.95rem; }

  /* Quick nav: stack */
  .dash-nav-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Tables: full width, scroll inside */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 540px; width: 100%; }

  /* Subtoolbar: wrap */
  .subtoolbar { gap: 10px; }
  .subtoolbar-left, .subtoolbar-right { flex-wrap: wrap; }

  /* Forms: single column */
  .form-grid-2 { grid-template-columns: 1fr; gap: 0; }
  .form-grid-2 .span-2 { grid-column: 1; }

  /* Modals: slide up from bottom */
  .modal { align-items: flex-end; }
  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    max-height: 92vh;
  }

  /* Tabs: horizontal scroll */
  .tab-group { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
}

/* ============================================================
   Ease — Additional Styles
   ============================================================ */

/* ── Calendar week view ──────────────────────────────────────── */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.calendar-week-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  min-width: 260px;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.cal-header {
  display: contents;
}
.cal-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #1f1f2e, #16161f);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.cal-header-cell.today {
  color: var(--primary);
}
.cal-time-col { border-right: 1px solid var(--border); }
.cal-time-cell {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(58,58,78,0.4);
}
.cal-day-col {
  position: relative;
  border-right: 1px solid var(--border);
}
.cal-day-col.today-col {
  background: rgba(88,101,242,0.04);
}
.cal-slot {
  height: 48px;
  border-bottom: 1px solid rgba(58,58,78,0.4);
}
.cal-booking {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.15s;
  z-index: 1;
  line-height: 1.3;
}
.cal-booking:hover { filter: brightness(1.15); }
.cal-booking.status-scheduled { background: var(--primary-bg); border-left: 3px solid var(--primary); color: #a5b4fc; }
.cal-booking.status-done      { background: var(--green-bg);   border-left: 3px solid var(--green);   color: var(--green); }
.cal-booking.status-cancelled { background: rgba(58,58,78,0.4); border-left: 3px solid var(--border); color: var(--text-muted); }

/* ── Invoice print view ──────────────────────────────────────── */
.invoice-print-wrap {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
}
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.inv-company-name { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.inv-company-details { font-size: 0.8rem; color: var(--text-muted); line-height: 1.7; }
.inv-logo { max-height: 80px; max-width: 180px; object-fit: contain; }
.inv-meta { text-align: right; }
.inv-number { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.inv-dates { font-size: 0.8rem; color: var(--text-muted); line-height: 1.7; }
.inv-bill-to {
  margin-bottom: 32px;
}
.inv-bill-to-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.inv-bill-to-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.inv-bill-to-addr { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.inv-items-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.inv-items-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.inv-items-table th:last-child, .inv-items-table td:last-child { text-align: right; }
.inv-items-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text); }
.inv-totals { margin-left: auto; width: 260px; }
.inv-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem; color: var(--text-muted); }
.inv-total-row.grand { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 12px; font-size: 1rem; font-weight: 800; color: var(--text); }
.inv-bank-details {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.inv-bank-title { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.inv-bank-row { display: flex; gap: 32px; font-size: 0.82rem; }
.inv-bank-item label { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.inv-bank-item span { font-weight: 700; color: var(--text); }

/* ── Status chips ────────────────────────────────────────────── */
.badge-pending   { background: var(--amber-bg); color: var(--amber); }
.badge-paid-cash { background: var(--green-bg); color: var(--green); }
.badge-paid-card { background: var(--primary-bg); color: #a5b4fc; }
.badge-scheduled { background: var(--primary-bg); color: #a5b4fc; }
.badge-done      { background: var(--green-bg);   color: var(--green); }
.badge-cancelled { background: rgba(58,58,78,0.6); color: var(--text-muted); }
.badge-recurring { background: var(--violet-bg);  color: #c4b5fd; }

/* ── Summary page ────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Line items editor ───────────────────────────────────────── */
.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table th { padding: 8px 10px; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.line-items-table td { padding: 6px 4px; }
.line-items-table input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
}
.line-items-table input:focus { outline: none; border-color: var(--primary); }

/* ── Settings logo preview ───────────────────────────────────── */
.logo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.logo-preview-img { max-height: 60px; max-width: 160px; object-fit: contain; }
.logo-placeholder { width: 60px; height: 60px; background: var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.5rem; }

/* ── Recurrence rule UI ──────────────────────────────────────── */
.recurrence-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
}
.day-checkboxes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.day-chip.selected { background: var(--primary-bg); border-color: var(--primary); color: #a5b4fc; }

/* ── Print styles ────────────────────────────────────────────── */
@media print {
  .topnav, .sidebar, .sidebar-overlay, #toastContainer,
  .print-hide, .btn, .page-header { display: none !important; }
  body { background: white !important; color: #111 !important; }
  .page-main { margin-left: 0 !important; padding: 0 !important; }
  .invoice-print-wrap {
    border: none; box-shadow: none; padding: 0;
    background: white;
    color: #111;
  }
  .inv-company-name { color: #111; }
  .inv-company-details, .inv-dates, .inv-bill-to-addr, .inv-bank-title { color: #555; }
  .inv-bill-to-name { color: #111; }
  .inv-items-table td { color: #111; }
  .inv-total-row.grand { color: #111; }
}
