/* ── Premara Group CRM — Global Stylesheet ── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@300;400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

/* ── Design tokens ── */
:root {
  --bg: #f5f1eb; --surface: #ffffff; --surface2: #f0ece4;
  --border: #e2dbd0; --border2: #d4cdc0;
  --text: #1a1814; --text2: #4a4540; --text3: #8a8278;
  --gold: #c9a84c; --gold2: #e8c97a; --gold-bg: rgba(201,168,76,0.08);
  --green: #3d9970; --green-bg: rgba(61,153,112,0.1);
  --blue: #4a7fa5; --blue-bg: rgba(74,127,165,0.1);
  --red: #a05050; --red-bg: rgba(160,80,80,0.1);
  --purple: #7a5fa5; --purple-bg: rgba(122,95,165,0.1);
  --amber: #c9823a; --amber-bg: rgba(201,130,58,0.1);
  --radius: 6px; --radius-lg: 10px;
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.5; min-height: 100vh; }
input::placeholder, textarea::placeholder { color: var(--text3) !important; }

/* ── Shell layout ── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar (always dark) ── */
.sidebar { width: 220px; min-width: 220px; background: #111318; border-right: 1px solid #1e2330; display: flex; flex-direction: column; }
.logo { padding: 24px 20px 20px; border-bottom: 1px solid #1e2330; }
.logo-mark { font-family: var(--font-display); font-size: 24px; font-weight: 500; color: #e8c97a; letter-spacing: 0.06em; line-height: 1.1; }
.logo-sub { font-size: 9px; color: #6b7290; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 4px; font-family: var(--font-mono); }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: #6b7290; font-family: var(--font-mono); padding: 0 10px; margin-bottom: 4px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); color: #a8aec0; cursor: pointer; transition: all 0.15s; font-size: 13px; border: 1px solid transparent; }
.nav-item:hover { background: #181c23; color: #f0f2f7; }
.nav-item.active { background: rgba(201,168,76,0.08); color: #e8c97a; border-color: rgba(201,168,76,0.15); }
.nav-item svg { opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.nav-badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px; font-family: var(--font-mono); margin-left: auto; }

/* ── Main area ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; background: var(--surface); flex-shrink: 0; }
.topbar-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: 0.04em; color: var(--text); flex: 1; line-height: 1; }
.topbar-title span { color: var(--text3); font-size: 13px; font-family: var(--font-mono); margin-left: 12px; font-weight: 400; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; outline: none; }
.btn-primary { background: var(--gold); color: #0a0c0f; }
.btn-primary:hover { background: var(--gold2); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-green { background: var(--green-bg); color: #6bbf99; border: 1px solid rgba(61,153,112,0.3); }
.btn-green:hover { background: rgba(61,153,112,0.2); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: var(--font-mono); white-space: nowrap; }
.badge-saas { background: var(--blue-bg); color: #7ab0d4; border: 1px solid rgba(74,127,165,0.2); }
.badge-services { background: var(--purple-bg); color: #b09fd4; border: 1px solid rgba(122,95,165,0.2); }
.badge-consumer { background: var(--green-bg); color: #6bbf99; border: 1px solid rgba(61,153,112,0.2); }
.badge-active { background: var(--green-bg); color: #6bbf99; }
.badge-closed { background: var(--surface2); color: var(--text3); border: 1px solid var(--border2); }
.badge-hold { background: var(--gold-bg); color: var(--gold2); }

/* ── Stats bar ── */
.stats-bar { display: flex; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.stat { padding: 10px 20px; border-right: 1px solid var(--border); }
.stat-val { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); font-family: var(--font-mono); margin-top: 2px; }

/* ── View toggle ── */
.view-toggle { display: flex; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 2px; gap: 2px; }
.view-btn { padding: 5px 12px; border-radius: 4px; font-size: 12px; font-family: var(--font-body); cursor: pointer; border: none; background: transparent; color: var(--text2); transition: all 0.15s; }
.view-btn.active { background: var(--surface); color: var(--text); }

/* ── Search ── */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-clear { position: absolute; right: 6px; background: none; border: none; cursor: pointer; color: var(--text3); font-size: 14px; padding: 2px 4px; display: none; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); font-family: var(--font-mono); }
.form-input { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; font-family: var(--font-body); color: var(--text); outline: none; transition: border-color 0.15s; width: 100%; }
.form-input:focus { border-color: var(--gold); background: var(--surface); }
.form-select { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; font-family: var(--font-body); color: var(--text); outline: none; cursor: pointer; width: 100%; }
.form-select:focus { border-color: var(--gold); }

/* ── Contact rows (modal) ── */
.contact-row { display: flex; gap: 6px; align-items: flex-end; margin-bottom: 6px; }
.contact-row .form-input { flex: 1; }
.contact-primary-btn { flex-shrink: 0; padding: 4px 8px; font-size: 13px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-lg); max-width: 92vw; max-height: 88vh; overflow-y: auto; padding: 28px; transform: translateY(8px); transition: transform 0.2s; box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin-bottom: 20px; color: var(--text); }
.modal-section { margin-bottom: 20px; }
.modal-section-title { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); font-family: var(--font-mono); margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ── Tables ── */
.table-wrap { flex: 1; overflow: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 0; background: var(--surface2) !important; color: var(--text3) !important; padding: 9px 12px; text-align: left; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font-mono); font-weight: 400; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 10; }
thead th:first-child { padding-left: 24px; }
tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 10px 12px; vertical-align: middle; }
tbody td:first-child { padding-left: 24px; }

/* ── Kanban shared ── */
.kanban-wrap { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 20px 24px; display: flex; gap: 14px; }
.kanban-wrap::-webkit-scrollbar { height: 4px; }
.kanban-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--surface); padding: 10px 20px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 1000; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ── Spinner ── */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border2); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile sidebar drawer — base element styles only, no media queries here.
   All responsive rules live in mobile.css (loaded after inline page styles)
   so they win the CSS cascade. ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: all; }

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text2);
  border-radius: var(--radius);
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.hamburger:hover { background: var(--surface2); color: var(--text); }

.sidebar-close {
  display: none;
  position: absolute;
  top: 18px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7290;
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.sidebar-close:hover { color: #a8aec0; background: rgba(255,255,255,0.06); }
