/* ============================================================
   ComplianceDesk – HTML/CSS/JS Theme
   Global Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS CUSTOM PROPERTIES ──────────────────────────────── */
:root {
  --background:          hsl(220, 53%, 97%);
  --foreground:          hsl(240, 28%, 14%);
  --card:                hsl(0, 0%, 100%);
  --card-foreground:     hsl(240, 28%, 14%);
  --popover:             hsl(0, 0%, 100%);
  --primary:             hsl(212, 67%, 33%);
  --primary-foreground:  hsl(0, 0%, 100%);
  --secondary:           hsl(196, 58%, 42%);
  --secondary-foreground:hsl(0, 0%, 100%);
  --muted:               hsl(220, 30%, 93%);
  --muted-foreground:    hsl(210, 7%, 46%);
  --accent:              hsl(38, 91%, 55%);
  --accent-foreground:   hsl(240, 28%, 14%);
  --destructive:         hsl(6, 78%, 57%);
  --destructive-foreground: hsl(0, 0%, 100%);
  --success:             hsl(145, 63%, 42%);
  --success-foreground:  hsl(0, 0%, 100%);
  --warning:             hsl(36, 90%, 51%);
  --warning-foreground:  hsl(240, 28%, 14%);
  --border:              hsl(220, 20%, 88%);
  --input:               hsl(220, 20%, 88%);
  --ring:                hsl(212, 67%, 33%);
  --radius:              0.5rem;

  /* Sidebar */
  --sidebar-bg:          hsl(215, 43%, 18%);
  --sidebar-fg:          hsl(220, 30%, 80%);
  --sidebar-primary:     hsl(0, 0%, 100%);
  --sidebar-accent:      hsl(215, 35%, 24%);
  --sidebar-accent-fg:   hsl(0, 0%, 95%);
  --sidebar-border:      hsl(215, 30%, 25%);

  /* Shadows */
  --shadow-soft:         0 2px 8px rgba(0,0,0,0.08);
  --shadow-card:         0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-elevated:     0 4px 16px rgba(0,0,0,0.1);
}

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

html { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,h2,h3,h4,h5,h6 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-display { font-family: 'DM Sans', sans-serif; }
.text-xs  { font-size: 12px; }
.text-sm  { font-size: 14px; }
.text-base{ font-size: 16px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; width: 100%; }

/* Top Navigation Header */
.top-nav {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  padding: 0 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: var(--secondary);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-icon svg { width: 16px; height: 16px; }

.brand-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
}

/* Desktop nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--foreground); background: var(--muted); }
.nav-link.active { color: var(--primary); background: hsl(212 67% 33% / 0.08); }
.nav-link svg { width: 14px; height: 14px; }

/* Search */
.search-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 400px;
  margin: 0 auto;
}
.search-inner {
  position: relative;
  width: 100%;
}
.search-inner svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.search-inner input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 34px;
  border: none;
  border-radius: var(--radius);
  background: hsl(220 30% 93% / 0.5);
  color: var(--foreground);
  outline: none;
  transition: box-shadow 0.15s;
}
.search-inner input:focus { box-shadow: 0 0 0 1px var(--primary); }
.search-inner input::placeholder { color: var(--muted-foreground); }

/* Right actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  position: relative;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground);
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--muted); color: var(--foreground); }
.btn-icon svg { width: 16px; height: 16px; }

.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--destructive);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* Mobile hamburger */
.btn-hamburger {
  display: none;
  width: 34px; height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  align-items: center; justify-content: center;
  cursor: pointer;
}
.btn-hamburger svg { width: 20px; height: 20px; }
.btn-hamburger:hover { background: var(--muted); }

/* Main content */
.main-content { flex: 1; padding: 12px 24px 24px 24px; overflow: visible; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.page-title { font-size: 20px; font-weight: 700; color: var(--foreground); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: hsl(212, 67%, 28%); }

.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--secondary); }
.btn-secondary:hover:not(:disabled) { background: hsl(196, 58%, 37%); }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--muted); }

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--foreground); }

.btn-danger { background: var(--destructive); color: #fff; border-color: var(--destructive); }
.btn-danger:hover:not(:disabled) { background: hsl(6, 78%, 50%); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-full { width: 100%; }

/* ── FORM CONTROLS ───────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 6px;
}
.form-label .required { color: var(--destructive); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 14px;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted-foreground); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(212 67% 33% / 0.1);
}

.form-input.has-icon-left { padding-left: 36px; }
.form-input.has-icon-right { padding-right: 36px; }

.input-wrap { position: relative; }
.input-wrap .input-icon-left {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-foreground); pointer-events: none;
}
.input-wrap .input-icon-right {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-foreground);
  background: none; border: none; cursor: pointer; display: flex;
}

.form-textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; cursor: pointer; }

.form-group { margin-bottom: 16px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.checkbox-wrap {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.checkbox-wrap input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer; flex-shrink: 0;
}
.checkbox-label { font-size: 14px; color: var(--muted-foreground); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600; }
.card-body { padding: 16px; }

/* Stat cards */
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-card); }
.stat-card-primary   { border-left: 4px solid var(--primary); }
.stat-card-warning   { border-left: 4px solid var(--warning); }
.stat-card-danger    { border-left: 4px solid var(--destructive); }
.stat-card-success   { border-left: 4px solid var(--success); }

.stat-card .stat-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.stat-card .stat-label { font-size: 13px; color: var(--muted-foreground); }
.stat-card .stat-icon { width: 18px; height: 18px; color: var(--muted-foreground); opacity: 0.6; }
.stat-card .stat-value { font-family: 'DM Sans', sans-serif; font-size: 30px; font-weight: 700; color: var(--foreground); line-height: 1; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }

/* ── GRIDS ───────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-5-3 { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 1px solid var(--border); background: hsl(220 30% 93% / 0.3); }
thead th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
thead th.text-right { text-align: right; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: hsl(220 30% 93% / 0.2); }
tbody td { padding: 10px 12px; vertical-align: middle; }

.row-overdue { border-left: 3px solid var(--destructive) !important; background: hsl(6 78% 57% / 0.04); }
.row-due-soon { border-left: 3px solid var(--warning) !important; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 2px;
  font-size: 12px; font-weight: 500; line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-primary   { background: hsl(212 67% 33% / 0.1); color: var(--primary); border-color: hsl(212 67% 33% / 0.2); }
.badge-secondary { background: hsl(196 58% 42% / 0.1); color: var(--secondary); border-color: hsl(196 58% 42% / 0.2); }
.badge-success   { background: hsl(145 63% 42% / 0.1); color: var(--success); border-color: hsl(145 63% 42% / 0.2); }
.badge-warning   { background: hsl(36 90% 51% / 0.1); color: var(--warning); border-color: hsl(36 90% 51% / 0.2); }
.badge-danger    { background: hsl(6 78% 57% / 0.1); color: var(--destructive); border-color: hsl(6 78% 57% / 0.2); }
.badge-muted     { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }
.badge-outline   { background: transparent; color: var(--foreground); border-color: var(--border); }

/* Status badges */
.status-completed  { background: hsl(145 63% 42% / 0.12); color: var(--success); border: 1px solid hsl(145 63% 42% / 0.25); }
.status-in-progress{ background: hsl(196 58% 42% / 0.12); color: var(--secondary); border: 1px solid hsl(196 58% 42% / 0.25); }
.status-pending    { background: hsl(38 91% 55% / 0.12); color: var(--accent-foreground); border: 1px solid hsl(38 91% 55% / 0.25); }
.status-overdue    { background: hsl(6 78% 57% / 0.12); color: var(--destructive); border: 1px solid hsl(6 78% 57% / 0.25); }
.status-on-hold    { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }
.status-not-applicable { background: transparent; color: var(--muted-foreground); border: 1px solid var(--border); }

/* Entity type badges */
.type-pvt    { background: hsl(212 67% 33% / 0.1); color: var(--primary); }
.type-prop   { background: hsl(38 91% 55% / 0.18); color: hsl(30, 80%, 35%); }
.type-partner{ background: hsl(196 58% 42% / 0.15); color: var(--secondary); }
.type-llp    { background: hsl(145 63% 42% / 0.1); color: var(--success); }
.type-indiv  { background: var(--muted); color: var(--muted-foreground); }

/* ── HEALTH INDICATOR ────────────────────────────────────── */
.health-dot {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-dot-sm { width: 8px; height: 8px; }
.health-dot-md { width: 10px; height: 10px; }
.health-healthy  { background: var(--success); }
.health-due-soon { background: var(--warning); }
.health-overdue  { background: var(--destructive); animation: pulse-red 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 hsl(6 78% 57% / 0.4); }
  50%       { box-shadow: 0 0 0 6px hsl(6 78% 57% / 0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-fade-in-1 { animation: fadeIn 0.4s ease-out 0.08s both; }
.animate-fade-in-2 { animation: fadeIn 0.4s ease-out 0.16s both; }
.animate-fade-in-3 { animation: fadeIn 0.4s ease-out 0.24s both; }
.animate-fade-in-4 { animation: fadeIn 0.4s ease-out 0.32s both; }

.spin { animation: spin 0.75s linear infinite; }

/* ── MOBILE NAV OVERLAY ──────────────────────────────────── */
.mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}
.mobile-overlay.open { display: block; }

.mobile-nav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 288px;
  background: var(--sidebar-bg);
  z-index: 51;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.mobile-nav.open { transform: translateX(0); }

.mobile-nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.mobile-nav-logo { display: flex; align-items: center; gap: 10px; }
.mobile-nav-logo .brand-icon { background: var(--secondary); }
.mobile-nav-logo .brand-name { color: #fff; font-size: 15px; }
.mobile-nav-close {
  width: 30px; height: 30px;
  border: none; background: transparent;
  color: var(--sidebar-fg); cursor: pointer;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.mobile-nav-close:hover { background: var(--sidebar-accent); }
.mobile-nav-close svg { width: 18px; height: 18px; }

.mobile-nav-links {
  flex: 1; overflow-y: auto;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.mobile-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-fg);
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav-link:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-fg); }
.mobile-nav-link.active { background: var(--sidebar-accent); color: #fff; }
.mobile-nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; flex-direction: column; gap: 0; }
.tab-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 10px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--muted-foreground);
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--foreground); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; padding-top: 20px; }
.tab-panel.active { display: block; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; font-size: 14px; color: var(--muted-foreground);
}
.pagination-btns { display: flex; gap: 8px; }

/* ── FAB ─────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; box-shadow: var(--shadow-elevated);
  display: flex; align-items: center; justify-content: center;
  z-index: 30; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.fab:hover { background: hsl(212, 67%, 28%); transform: scale(1.05); }
.fab svg { width: 24px; height: 24px; }

/* ── ACTIVITY FEED ───────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item { display: flex; gap: 12px; }
.activity-line { display: flex; flex-direction: column; align-items: center; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.activity-connector { width: 1px; flex: 1; background: var(--border); margin-top: 4px; }
.activity-content { padding-bottom: 16px; }
.activity-text { font-size: 14px; color: var(--foreground); line-height: 1.4; }
.activity-time { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }

/* ── TIMELINE DOT COLORS ─────────────────────────────────── */
.dot-success { background: var(--success); }
.dot-secondary { background: var(--secondary); }
.dot-destructive { background: var(--destructive); }
.dot-primary { background: var(--primary); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 24px; text-align: center;
}
.empty-state svg { width: 48px; height: 48px; color: var(--muted-foreground); opacity: 0.4; margin-bottom: 16px; }
.empty-state p { font-size: 14px; color: var(--muted-foreground); font-weight: 500; }
.empty-state .empty-sub { font-size: 12px; color: var(--muted-foreground); opacity: 0.7; margin-top: 4px; }

/* ── NOTIFICATION TOGGLE ─────────────────────────────────── */
.toggle-switch {
  position: relative; display: inline-block;
  width: 40px; height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 22px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── WIZARD STEPS ────────────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 32px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.wizard-steps::-webkit-scrollbar { display: none; }

.wizard-step {
  display: flex; align-items: center; flex-shrink: 0;
}
.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  border: 2px solid var(--border);
  background: var(--card); color: var(--muted-foreground);
  transition: all 0.2s;
}
.wizard-step.done .step-circle { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-step.active .step-circle { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-label {
  margin-left: 8px; font-size: 12px; font-weight: 500;
  color: var(--muted-foreground); white-space: nowrap;
}
.wizard-step.active .step-label { color: var(--primary); }
.wizard-step.done .step-label { color: var(--success); }
.step-connector { width: 40px; height: 2px; background: var(--border); margin: 0 8px; flex-shrink: 0; }
.wizard-step.done + .wizard-step .step-connector,
.step-connector.done { background: var(--success); }

/* ── SECTION CARD (in wizard) ────────────────────────────── */
.section-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.section-card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--foreground);
  background: hsl(220 30% 93% / 0.3); border-radius: var(--radius) var(--radius) 0 0;
}
.section-card-body { padding: 20px 16px; }

/* ── CALENDAR GRID ───────────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-header { background: var(--muted); padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; }
.cal-day {
  background: var(--card); min-height: 90px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-day.other-month { background: hsl(220 30% 93% / 0.3); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day-num {
  font-size: 12px; font-weight: 600; color: var(--muted-foreground);
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cal-day.today .cal-day-num { background: var(--primary); color: #fff; }
.cal-event {
  font-size: 10px; padding: 1px 4px; border-radius: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.cal-event-overdue    { background: hsl(6 78% 57% / 0.15); color: var(--destructive); }
.cal-event-pending    { background: hsl(38 91% 55% / 0.15); color: hsl(30, 80%, 35%); }
.cal-event-done       { background: hsl(145 63% 42% / 0.15); color: var(--success); }
.cal-event-progress   { background: hsl(196 58% 42% / 0.15); color: var(--secondary); }
.cal-more { font-size: 10px; color: var(--muted-foreground); padding: 1px 4px; }

/* ── REPORTS GRID ────────────────────────────────────────── */
.report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.report-card:hover { box-shadow: var(--shadow-elevated); transform: translateY(-2px); }
.report-icon-wrap {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.report-icon-wrap svg { width: 20px; height: 20px; }
.report-title { font-size: 15px; font-weight: 600; color: var(--foreground); }
.report-desc { font-size: 13px; color: var(--muted-foreground); line-height: 1.4; }
.report-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.report-last { font-size: 12px; color: var(--muted-foreground); }

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--muted-foreground);
  margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb-sep { opacity: 0.4; }

/* ── CLIENT IDENTITY CARD ────────────────────────────────── */
.identity-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-card); margin-bottom: 20px;
}
.identity-top {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap;
}
.identity-avatar {
  width: 52px; height: 52px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.identity-info { flex: 1; min-width: 0; }
.identity-name { font-size: 20px; font-weight: 700; color: var(--foreground); }
.identity-ids { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.identity-id-item { display: flex; align-items: center; gap: 4px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted-foreground); }
.copy-btn { border: none; background: transparent; cursor: pointer; padding: 2px; color: var(--muted-foreground); }
.copy-btn:hover { color: var(--primary); }
.copy-btn svg { width: 12px; height: 12px; }
.identity-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── DOCUMENT UPLOAD ZONE ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--background);
}
.upload-zone:hover { border-color: var(--primary); background: hsl(212 67% 33% / 0.03); }
.upload-zone svg { width: 32px; height: 32px; color: var(--muted-foreground); margin: 0 auto 8px; }
.upload-zone p { font-size: 14px; color: var(--muted-foreground); }
.upload-zone .upload-cta { color: var(--primary); font-weight: 500; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page { display: flex; min-height: 100vh; }
.login-left {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 48px; width: 45%;
  background: linear-gradient(135deg, hsl(215, 43%, 18%) 0%, hsl(212, 67%, 33%) 100%);
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,0.03) 35px, rgba(255,255,255,0.03) 70px);
}
.login-left-content { position: relative; z-index: 1; text-align: center; max-width: 380px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.login-logo-icon { width: 48px; height: 48px; background: var(--secondary); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.login-logo-icon svg { width: 28px; height: 28px; color: #fff; }
.login-logo-name { font-family: 'DM Sans', sans-serif; font-size: 28px; font-weight: 700; color: #fff; }
.login-tagline { font-size: 16px; color: rgba(255,255,255,0.75); margin-bottom: 40px; }
.login-features { display: flex; flex-direction: column; gap: 20px; text-align: left; }
.login-feature { display: flex; align-items: center; gap: 14px; }
.login-feature-icon { width: 40px; height: 40px; background: rgba(255,255,255,0.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-feature-icon svg { width: 20px; height: 20px; color: #fff; }
.login-feature-text { font-size: 14px; color: rgba(255,255,255,0.85); font-weight: 500; }

.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--card); }
.login-form-wrap { width: 100%; max-width: 400px; }
.login-mobile-logo { display: none; align-items: center; gap: 8px; margin-bottom: 32px; }
.login-mobile-logo .brand-icon { width: 36px; height: 36px; }
.login-mobile-logo .brand-icon svg { width: 18px; height: 18px; }
.login-mobile-logo .brand-name { font-size: 18px; }

.login-title { font-size: 24px; font-weight: 700; color: var(--foreground); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--muted-foreground); margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; color: var(--muted-foreground); }
.login-foot span { color: var(--secondary); }

/* Loading spinner in button */
.btn-spinner {
  display: inline-flex; align-items: center; gap: 8px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── SETTINGS TEAM TABLE ─────────────────────────────────── */
.role-badge-admin { background: hsl(212 67% 33% / 0.1); color: var(--primary); border: 1px solid hsl(212 67% 33% / 0.2); }
.role-badge-staff { background: hsl(196 58% 42% / 0.1); color: var(--secondary); border: 1px solid hsl(196 58% 42% / 0.2); }
.role-badge-viewer { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }
.status-active-badge { background: hsl(145 63% 42% / 0.1); color: var(--success); border: 1px solid hsl(145 63% 42% / 0.2); }

/* ── 404 PAGE ────────────────────────────────────────────── */
.notfound-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; text-align: center; gap: 16px; padding: 32px; }
.notfound-code { font-size: 96px; font-weight: 700; color: var(--primary); opacity: 0.15; line-height: 1; font-family: 'DM Sans', sans-serif; }
.notfound-title { font-size: 24px; font-weight: 700; }
.notfound-sub { font-size: 14px; color: var(--muted-foreground); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5-3 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hide-lg { display: none !important; }
}

@media (max-width: 768px) {
  .btn-hamburger { display: flex; }
  .nav-links { display: none; }
  .brand-name { display: none; }
  .search-wrap { max-width: none; }
  .main-content { padding: 16px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .login-mobile-logo { display: flex; }
  .hide-md { display: none !important; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-right { justify-content: flex-start; }
  .pagination { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* ── UTILITIES ───────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.w-full { width: 100%; }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--destructive); }
.text-warning { color: var(--warning); }
.text-secondary-color { color: var(--secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.rounded-full { border-radius: 9999px; }
.border-t { border-top: 1px solid var(--border); }
.pt-4 { padding-top: 16px; }
.relative { position: relative; }
.ms-auto { margin-left: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Dir card for AddClient */
.dir-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; background: var(--background); margin-bottom: 12px; }
.dir-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dir-card-title { font-size: 14px; font-weight: 600; color: var(--foreground); }

/* Service checkbox grid */
.services-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.service-checkbox {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.service-checkbox:hover { border-color: var(--primary); background: hsl(212 67% 33% / 0.03); }
.service-checkbox input:checked ~ span { color: var(--primary); font-weight: 500; }
.service-checkbox input { accent-color: var(--primary); }
.service-checkbox span { font-size: 14px; }

/* Collapsible review section */
.review-section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.review-section-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; background: hsl(220 30% 93% / 0.3); border-radius: var(--radius); font-size: 14px; font-weight: 600; }
.review-section-body { padding: 16px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.review-field label { font-size: 12px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em; }
.review-field p { font-size: 14px; color: var(--foreground); margin-top: 2px; font-weight: 500; }

/* Contact card */
.contact-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--card); box-shadow: var(--shadow-card); }
.contact-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Note card */
.note-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--card); }
.note-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

/* Calendar summary badges row */
.cal-summary { display: flex; gap: 12px; flex-wrap: wrap; }
.cal-summary-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 9999px; }

/* ── DIALOG / MODAL ──────────────────────────────────────────
   Used on any page that renders a modal popup.
   Open a dialog by adding class "open" to .dialog-overlay.
   ─────────────────────────────────────────────────────────── */
.dialog-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog-overlay.open { display: flex; }

.dialog-panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-elevated);
  position: relative;
  animation: fadeIn 0.18s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-title  { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--foreground); }
.dialog-desc   { font-size: 13px; color: var(--muted-foreground); margin-bottom: 20px; line-height: 1.5; }
.dialog-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── SHEET / SIDE PANEL ─────────────────────────────────────── */
.sheet-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 8000;
}
.sheet-overlay.open { display: block; }
.sheet-panel {
  position: fixed; top: 0; bottom: 0;
  background: var(--card); box-shadow: var(--shadow-elevated);
  z-index: 8001; display: flex; flex-direction: column;
  transition: transform 0.25s ease; overflow-y: auto; width: 320px;
}
.sheet-panel.right { right: 0; transform: translateX(100%); }
.sheet-panel.left  { left:  0; transform: translateX(-100%); }
.sheet-panel.open  { transform: translateX(0); }
.sheet-header { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
.sheet-title  { font-size: 16px; font-weight: 600; }
.sheet-desc   { font-size: 13px; color: var(--muted-foreground); margin-top: 4px; }
.sheet-body   { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.sheet-close  { position: absolute; top: 16px; right: 16px; background: none; border: none; cursor: pointer; color: var(--muted-foreground); }
.sheet-close:hover { color: var(--foreground); }

/* ── POPOVER ────────────────────────────────────────────────── */
.popover-wrap  { position: relative; display: inline-block; }
.popover-panel {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; width: 280px;
  box-shadow: var(--shadow-elevated); z-index: 50; display: none;
}
.popover-panel.open { display: block; }

/* ── DROPDOWN MENU ──────────────────────────────────────────── */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 160px;
  box-shadow: var(--shadow-elevated); z-index: 50;
  padding: 4px; display: none;
}
.dropdown-menu.open { display: block; animation: fadeIn 0.15s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: calc(var(--radius) - 2px);
  font-size: 13px; cursor: pointer; color: var(--foreground);
  transition: background 0.1s; border: none; background: none;
  width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--muted); }
.dropdown-item.danger { color: var(--destructive); }
.dropdown-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.dropdown-label { padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; }
.dropdown-sep   { height: 1px; background: var(--border); margin: 4px 0; }

/* ── ACCORDION ──────────────────────────────────────────────── */
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.accordion-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--card); border: none;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--foreground);
  text-align: left; transition: background 0.15s;
}
.accordion-trigger:hover { background: var(--muted); }
.accordion-trigger .chevron { transition: transform 0.2s; flex-shrink: 0; }
.accordion-trigger.open .chevron { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.accordion-content.open { max-height: 300px; }
.accordion-content-inner { padding: 0 16px 14px; font-size: 13px; color: var(--muted-foreground); line-height: 1.6; }

/* ── TOOLTIP ────────────────────────────────────────────────── */
.tooltip-wrap  { position: relative; display: inline-flex; }
.tooltip-box   {
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--foreground);
  color: var(--background); font-size: 12px; padding: 5px 10px;
  border-radius: var(--radius); white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 100;
}
.tooltip-wrap:hover .tooltip-box { opacity: 1; }

textarea { padding: 8px 12px !important; }
