/* ── DESIGN TOKENS ────────────────────────────────────── */
:root {
  --bg:           #080f22;
  --bg-sidebar:   #060c19;
  --bg-card:      #111827;
  --bg-elevated:  #1a2236;
  --border:       rgba(255,255,255,0.06);
  --border-soft:  rgba(255,255,255,0.04);
  --accent:       #2563eb;
  --accent-2:     #4f46e5;
  --accent-dim:   rgba(37,99,235,0.14);
  --accent-hover: #1d4ed8;
  --text:         #e5e7eb;
  --text-strong:  #f3f4f6;
  --muted:        #4b5563;
  --muted-2:      #6b7280;
  --muted-3:      #9ca3af;
  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --sidebar-w:    220px;
  --topbar-h:     52px;
  --radius:       8px;
  --radius-sm:    6px;
  --radius-lg:    12px;
  --font-display: 'Hanken Grotesk', sans-serif;
  --font-body:    'Outfit', sans-serif;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.3);
}

/* ── RESET ────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }
::placeholder { color: var(--muted-2); }

/* ── SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* ── AUTH SCREEN ──────────────────────────────────────── */
.auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 999;
}

/* ── APP SHELL ────────────────────────────────────────── */
.app-shell {
  display: flex !important;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.22s ease;
  z-index: 100;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-logo-img {
  height: 24px;
  width: auto;
  display: block;
}

/* ── SIDEBAR NAV ──────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 6px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--muted-3);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted-2);
  transition: color 0.12s;
}
.nav-item:hover .nav-icon { color: var(--text); }

.nav-label { flex: 1; }

.nav-chevron {
  margin-left: auto;
  transition: transform 0.18s;
  color: var(--muted);
}
.nav-item-parent.open .nav-chevron { transform: rotate(180deg); }
.nav-item-parent.active-group { color: var(--text-strong); }
.nav-item-parent.active-group .nav-icon { color: var(--text-strong); }

/* Accounting sub-items */
.nav-subitems {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease;
}
.nav-subitems.open { max-height: 200px; }

.nav-subitem {
  display: block;
  padding: 6px 14px 6px 41px;
  font-size: 13px;
  color: var(--muted-3);
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background 0.12s, color 0.12s;
}
.nav-subitem:hover { background: var(--bg-elevated); color: var(--text); }
.nav-subitem.active { color: var(--accent); background: var(--accent-dim); }

/* ── SIDEBAR FOOTER ───────────────────────────────────── */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border-soft);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
}
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-org {
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-signout {
  color: var(--muted-2);
  padding: 4px;
  border-radius: 4px;
  display: flex; align-items: center;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.sidebar-signout:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* ── MAIN AREA ────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mobile-menu-btn {
  display: none;
  color: var(--muted-3);
  padding: 4px;
  border-radius: 4px;
}

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px;
  color: var(--muted-2);
}
.breadcrumb-item { color: var(--text-strong); font-weight: 500; }
.breadcrumb-sep { color: var(--muted); }
.breadcrumb a { color: var(--muted-2); }
.breadcrumb a:hover { color: var(--text); }

.topbar-action-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.topbar-action-btn:hover { background: var(--accent-hover); }
.topbar-action-btn svg { flex-shrink: 0; }

/* ── VIEW CONTENT ─────────────────────────────────────── */
.view-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* ── LOADING SPINNER ──────────────────────────────────── */
.loading-spinner-wrap {
  display: flex; align-items: center; justify-content: center;
  height: 240px;
}
.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── VIEW HEADER ──────────────────────────────────────── */
.view-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.view-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
}
.view-sub {
  font-size: 13px;
  color: var(--muted-3);
  margin-top: 2px;
}

/* ── FILTER BAR ───────────────────────────────────────── */
.filter-bar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-search {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  padding: 7px 12px;
  outline: none;
  transition: border-color 0.12s;
}
.filter-search:focus { border-color: var(--accent); }

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ── TABLE ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
tbody tr {
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:hover { background: var(--bg-elevated); }
tbody tr:last-child { border-bottom: none; }
tbody td {
  padding: 11px 14px;
  color: var(--muted-3);
  vertical-align: middle;
}
.td-primary {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-strong) !important;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-mono {
  font-size: 12px;
  color: var(--muted-2) !important;
  font-family: monospace;
}

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--muted-3);
}

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-icon {
  font-size: 32px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted-3);
  font-family: var(--font-display);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
}

/* ── DASHBOARD STATS ──────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}
.stat-sub {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 4px;
}

/* ── SECTION LABEL ────────────────────────────────────── */
.section-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  padding: 16px 24px 8px;
}

/* ── DETAIL VIEW (2-col layout) ───────────────────────── */
.detail-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.detail-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  padding: 0 0 40px;
}
.detail-panel {
  width: 300px;
  min-width: 300px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-card);
  padding-bottom: 40px;
}

.detail-title-area { padding: 20px 24px 16px; border-bottom: 1px solid var(--border-soft); }
.detail-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
}
.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Detail panel sections */
.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.panel-section:last-child { border-bottom: none; }
.panel-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 10px;
}
.panel-field { margin-bottom: 10px; }
.panel-field:last-child { margin-bottom: 0; }
.panel-field-label {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-bottom: 3px;
}
.panel-field-value {
  font-size: 13px;
  color: var(--text);
}
.panel-field-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 6px 9px;
  outline: none;
  cursor: pointer;
}
.panel-field-select:focus { border-color: var(--accent); }

/* ── TABS ─────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.tab-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-pane { padding: 16px 24px; }

/* ── NOTES / TIMELINE ─────────────────────────────────── */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.note-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.note-author { font-size: 12.5px; font-weight: 600; color: var(--text); }
.note-time { font-size: 11.5px; color: var(--muted-2); }
.note-body { font-size: 13.5px; color: var(--muted-3); line-height: 1.55; }
.note-pinned { border-color: rgba(37,99,235,0.3); background: rgba(37,99,235,0.04); }

.note-compose {
  margin-bottom: 14px;
}
.note-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.12s;
  font-family: var(--font-body);
}
.note-textarea:focus { border-color: var(--accent); }
.note-actions-row {
  display: flex; justify-content: flex-end; margin-top: 8px;
}

/* ── TASK ITEMS ───────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.task-item.done { opacity: 0.5; }
.task-check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0; margin-top: 1px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  transition: border-color 0.12s, background 0.12s;
}
.task-check:hover { border-color: var(--accent); }
.task-check.checked { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13.5px; color: var(--text); }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted-2); }
.task-due { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* ── ACCOUNTING TABS ──────────────────────────────────── */
.accounting-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.accounting-tab {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.accounting-tab:hover { color: var(--text); }
.accounting-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── SCHEDULE ─────────────────────────────────────────── */
.schedule-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.schedule-nav-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-3);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.schedule-nav-btn:hover { background: var(--bg-elevated); color: var(--text); }
.schedule-date-label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  flex: 1;
}
.schedule-today-btn {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  transition: background 0.12s, color 0.12s;
}
.schedule-today-btn:hover { background: var(--bg-elevated); color: var(--text); }

.week-grid {
  display: grid;
  grid-template-columns: 48px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}
.week-day-header {
  text-align: center;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-2);
  border-left: 1px solid var(--border-soft);
}
.week-day-header.today {
  color: var(--accent);
}
.week-day-date {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.week-day-header.today .week-day-date {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

.appt-block {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11.5px;
  color: var(--accent);
  margin: 1px 2px;
  overflow: hidden;
  cursor: pointer;
}
.appt-block:hover { background: rgba(37,99,235,0.2); }

/* ── SETTINGS ─────────────────────────────────────────── */
.settings-layout { display: flex; height: 100%; }
.settings-sidebar {
  width: 180px;
  border-right: 1px solid var(--border);
  padding: 16px 0;
}
.settings-nav-item {
  display: block;
  padding: 7px 18px;
  font-size: 13.5px;
  color: var(--muted-3);
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.settings-nav-item:hover { background: var(--bg-elevated); color: var(--text); }
.settings-nav-item.active { background: var(--accent-dim); color: var(--accent); }
.settings-content { flex: 1; overflow-y: auto; padding: 24px; }
.settings-section { max-width: 560px; }
.settings-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── FORM FIELDS ──────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-3);
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.12s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; font-family: var(--font-body); }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted-3);
}
.btn-secondary:hover { background: var(--bg-elevated); color: var(--text); }
.btn-ghost { color: var(--muted-3); }
.btn-ghost:hover { color: var(--text); background: var(--bg-elevated); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ── MODAL ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.18s;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-strong);
}
.modal-close {
  width: 26px; height: 26px;
  border-radius: 4px;
  color: var(--muted-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text); }

.modal-body { padding: 18px 20px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
}

.modal-alert {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: none;
}
.modal-alert.error { display: block; background: rgba(239,68,68,0.1); color: var(--danger); }
.modal-alert.success { display: block; background: rgba(34,197,94,0.1); color: var(--success); }

/* ── CARDS (for catalog etc) ──────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.card:hover { border-color: var(--accent); background: var(--bg-elevated); }
.card-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 4px;
}
.card-meta { font-size: 12.5px; color: var(--muted-2); }
.card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
}

/* ── USER ROW (settings) ──────────────────────────────── */
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}
.user-row:last-child { border-bottom: none; }
.user-row-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--muted-3);
  font-size: 12.5px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-row-info { flex: 1; min-width: 0; }
.user-row-name { font-size: 13.5px; color: var(--text); font-weight: 500; }
.user-row-email { font-size: 12px; color: var(--muted-2); }
.user-row-role {
  font-size: 12px;
  color: var(--muted-3);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ── CUSTOMER DETAIL ──────────────────────────────────── */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.contact-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.contact-meta { font-size: 12px; color: var(--muted-2); margin-top: 3px; }

.location-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: color 0.12s;
}
.location-item:hover .location-addr { color: var(--accent); }
.location-item:last-child { border-bottom: none; }
.location-icon { color: var(--muted-2); flex-shrink: 0; }
.location-addr { font-size: 13.5px; color: var(--text); }
.location-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* ── ALERT / INLINE ───────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-error { background: rgba(239,68,68,0.1); color: var(--danger); }
.alert-success { background: rgba(34,197,94,0.1); color: var(--success); }
.alert-info { background: var(--accent-dim); color: var(--accent); }

/* ── NUMBER TAG ───────────────────────────────────────── */
.num-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

/* ── PIPELINE BADGE ───────────────────────────────────── */
.pipeline-stage {
  font-size: 12px;
  color: var(--muted-3);
  display: flex; align-items: center; gap: 4px;
}
.pipeline-stage::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
}

/* ── MOBILE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .detail-layout { flex-direction: column; }
  .detail-panel { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
  .field-row-2 { grid-template-columns: 1fr; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; padding: 8px; }
  .settings-nav-item { white-space: nowrap; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  :root { --sidebar-w: 100vw; }
}
