:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #e0e7ff;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0f172a;
  color: #f8fafc;
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: rgba(255, 255, 255, 0.78);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --secondary: rgba(14, 165, 233, 0.12);
  --border: rgba(148, 163, 184, 0.25);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --glass: rgba(255, 255, 255, 0.55);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  font-family: "SF Pro Display", "SF Pro Text", "Inter", system-ui, -apple-system, sans-serif;
}
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2563eb;
  font-weight: 700;
body {
  margin: 0;
  background: radial-gradient(circle at top, #ffffff 0%, #eef2f7 45%, #e9edf4 100%);
  color: var(--text);
}
}

.brand p {
  margin: 4px 0 0;
  color: #cbd5f5;
  font-size: 0.85rem;
}

.sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.85) 100%);
  color: #f8fafc;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  backdrop-filter: blur(14px);
}
  border: none;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9 60%, #0284c7);
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.35);
}
  background: rgba(255, 255, 255, 0.08);
  padding: 16px;
  border-radius: 16px;
  display: grid;
  gap: 12px;
.nav-item.active,
.nav-item:hover {
  background: rgba(14, 165, 233, 0.25);
  color: #f8fafc;
}
}

.mini-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #cbd5f5;
}
.sidebar-card {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  padding: 16px;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
  gap: 20px;
}

.main-header {
  display: flex;
.main {
  padding: 32px 40px 46px;
  display: grid;
  gap: 20px;
}
.main-header h2 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0;
.header-actions input,
.header-actions select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(10px);
}
  flex-wrap: wrap;
}

.header-actions input,
.header-actions select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
.btn {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9 60%, #0284c7);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.25);
}
  cursor: pointer;
}

.btn:hover {
.btn.secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  box-shadow: none;
}
  background: var(--secondary);
  color: var(--primary-dark);
}

.btn.danger {
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 6px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
  font-size: 0.85rem;
}

.stat-card h3 {
  margin: 0;
  font-size: 1.5rem;
.content {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 18px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.content {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 16px;
.table-row {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  backdrop-filter: blur(8px);
}
.view.active {
  display: block;
}

.table {
  display: grid;
  gap: 8px;
.modal-card {
  width: min(520px, 92vw);
  background: var(--panel);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(14px);
}
}

.table.projects .table-head,
.table.projects .table-row {
  grid-template-columns: 1.4fr 0.9fr 0.9fr 0.9fr 0.9fr 0.6fr 0.9fr;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}
  grid-template-columns: 1.2fr 0.8fr 1.2fr 0.9fr 0.8fr 0.8fr 0.9fr;
}

.table.site-visits .table-head,
.table.site-visits .table-row {
  grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr 1.2fr 0.9fr 0.8fr 0.9fr;
}

.detail-card {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
}

.table-head {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
.detail-tabs {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.table-row .title {
  font-weight: 600;
}

.table-row .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  width: fit-content;
}

.badge.status-Planned { background: #e0e7ff; color: #3730a3; }
.badge.status-Active { background: #dbeafe; color: #1d4ed8; }
.badge.status-In-Progress { background: #d1fae5; color: #065f46; }
.badge.status-On-Hold { background: #fde68a; color: #92400e; }
.badge.status-Blocked { background: #fee2e2; color: #991b1b; }
.badge.status-Completed { background: #f3f4f6; color: #374151; }

.badge.status-Draft { background: #e0e7ff; color: #3730a3; }
.badge.status-Sent { background: #fde68a; color: #92400e; }
.badge.status-Accepted { background: #d1fae5; color: #065f46; }
.badge.status-Declined { background: #fee2e2; color: #991b1b; }

.badge.status-Unpaid { background: #fee2e2; color: #991b1b; }
.badge.status-Partially-Paid { background: #fde68a; color: #92400e; }
.badge.status-Paid { background: #d1fae5; color: #065f46; }
.badge.status-Overdue { background: #fecaca; color: #7f1d1d; }

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #e2e8f0;
  color: #1f2937;
  font-size: 0.8rem;
}

.row-actions .danger {
  background: #fee2e2;
  color: #991b1b;
}

.link-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: #e0e7ff;
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid;
  place-items: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 92vw);
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-card {
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.detail-grid-inner {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.detail-row strong {
  color: var(--text);
}

.detail-quote {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #f9fafb;
}

.detail-quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-quote-invoices {
  display: grid;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-subrow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-tabs {
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 16px;
}

.tab-buttons {
  display: flex;
  gap: 8px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.detail-row-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #f9fafb;
}

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

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
}

.chip.active {
  background: var(--secondary);
  color: var(--primary-dark);
  border-color: transparent;
}

.form {
  display: grid;
  gap: 12px;
}

.form.hidden {
  display: none;
}

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

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

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

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar-card {
    display: none;
  }
}

@media (max-width: 720px) {
  .table-head,
  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
