/* Keystone AI — Client & Admin portal styles
   Shares the dark theme + tokens from the marketing site (index.html). */

:root {
  --bg:      #0a0c10;
  --surface: #0f1218;
  --card:    #141820;
  --rule:    #1c2028;
  --rule2:   #252c38;
  --white:   #f4f6fa;
  --dim:     #8892a0;
  --ghost:   #3d4450;
  --accent:  #4f8bff;
  --accent2: #a8c4ff;
  --good:    #3ddc97;
  --warn:    #f5b95a;
  --bad:     #f56a6a;
  --head:    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono:    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --navbg:   rgba(10,12,16,0.92);
}

/* Light theme — toggled via data-theme="light" on <html>, persisted in localStorage. */
html[data-theme="light"] {
  --bg:      #f4f5f8;
  --surface: #ffffff;
  --card:    #ffffff;
  --rule:    #e3e6ec;
  --rule2:   #d5d9e1;
  --white:   #11131a;
  --dim:     #5c6675;
  --ghost:   #8a93a3;
  --accent:  #2f66e0;
  --accent2: #1c47ad;
  --navbg:   rgba(255,255,255,0.92);
}
html[data-theme="light"] .card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .auth-card {
  box-shadow: 0 1px 3px rgba(20,24,32,0.06);
}
html[data-theme="light"] .form-field input,
html[data-theme="light"] .form-field textarea,
html[data-theme="light"] .form-field select {
  background: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--head);
  background: var(--bg);
  color: var(--white);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }

/* NAV */
nav.portal-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--navbg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  padding: 0 clamp(16px, 4vw, 40px);
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
  text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.nav-logo::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.nav-tag {
  font-family: var(--mono); font-size: 0.7rem; color: var(--ghost);
  letter-spacing: 0.08em; margin-left: 4px;
}
.portal-nav-links { display: flex; align-items: center; gap: 22px; }
.portal-nav-links a { font-size: 0.85rem; color: var(--dim); text-decoration: none; transition: color .15s; }
.portal-nav-links a:hover, .portal-nav-links a.active { color: var(--white); }
.portal-nav-links .btn-ghost {
  border: 1px solid var(--rule2); padding: 6px 14px; border-radius: 6px; font-size: 0.82rem;
}
.theme-toggle {
  background: none; border: 1px solid var(--rule2); color: var(--white);
  border-radius: 6px; width: 32px; height: 32px; font-size: 0.95rem;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }

/* HAMBURGER MENU */
.nav-menu-wrap { position: relative; display: flex; align-items: center; }
.hamburger-btn {
  background: none; border: 1px solid var(--rule2); border-radius: 6px;
  width: 32px; height: 32px; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; cursor: pointer;
  transition: border-color .15s;
}
.hamburger-btn:hover { border-color: var(--accent); }
.hamburger-btn span { display: block; width: 15px; height: 2px; background: var(--white); border-radius: 1px; }
.hamburger-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 8px; min-width: 190px;
  display: none; flex-direction: column; gap: 2px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
  z-index: 200;
}
.hamburger-menu.open { display: flex; }
.hamburger-menu a {
  padding: 9px 12px; border-radius: 6px; font-size: 0.9rem;
  color: var(--dim); text-decoration: none;
  transition: background .12s, color .12s;
}
.hamburger-menu a:hover, .hamburger-menu a.active { background: var(--surface); color: var(--white); }
.hamburger-divider { height: 1px; background: var(--rule); margin: 6px 4px; }

/* LAYOUT */
main.portal-main { max-width: 1320px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 40px) 80px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-head p { color: var(--dim); font-size: 0.95rem; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* CARD */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 24px;
}
.card + .card { margin-top: 16px; }

/* AUTH SCREEN */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 32px; }
.auth-card .nav-logo { justify-content: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--dim); font-size: 0.9rem; margin-bottom: 24px; }

/* FORM (matches marketing site's modal form) */
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ghost); margin-bottom: 6px;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--rule2); border-radius: 5px;
  font-family: var(--head); font-size: 1rem;
  background: var(--surface); color: var(--white); outline: none;
  transition: border-color 0.15s;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus { border-color: var(--accent); }
.form-field textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.btn-submit, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--bg);
  border: none; padding: 11px 20px; font-size: 0.98rem; font-weight: 700;
  border-radius: 6px; cursor: pointer; text-decoration: none;
  transition: opacity 0.15s;
  font-family: var(--head);
}
.btn-submit { width: 100%; padding: 13px; margin-top: 6px; }
.btn-submit:hover, .btn:hover { opacity: 0.88; }
.btn-secondary { background: transparent; color: var(--white); border: 1px solid var(--rule2); }
.btn-danger { background: var(--bad); color: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 18px; }
.alert-error { background: rgba(245,106,106,0.1); border: 1px solid rgba(245,106,106,0.35); color: #ff9b9b; }
.alert-success { background: rgba(61,220,151,0.1); border: 1px solid rgba(61,220,151,0.35); color: #7cf0bf; }

/* TABLE */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th {
  text-align: left; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ghost); padding: 10px 14px; border-bottom: 1px solid var(--rule);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table th:last-child, .data-table td:last-child { padding-right: 24px; }
.data-table tr.clickable { cursor: pointer; transition: background .1s; }
.data-table tr.clickable:hover { background: var(--surface); }
.empty-state { color: var(--dim); font-size: 0.92rem; padding: 24px 0; text-align: center; }

/* BADGES */
.badge {
  display: inline-block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 20px; text-transform: uppercase; white-space: nowrap;
}
.badge-lead       { background: rgba(168,196,255,0.12); color: var(--accent2); }
.badge-contacted  { background: rgba(245,185,90,0.12);  color: var(--warn); }
.badge-proposal   { background: rgba(79,139,255,0.15);  color: var(--accent); }
.badge-customer   { background: rgba(61,220,151,0.14);  color: var(--good); }
.badge-lost       { background: rgba(136,146,160,0.14); color: var(--dim); }
.badge-open        { background: rgba(245,185,90,0.14); color: var(--warn); }
.badge-in_progress { background: rgba(79,139,255,0.15); color: var(--accent); }
.badge-closed       { background: rgba(61,220,151,0.14); color: var(--good); }

/* Priority tier badges (Fort Lauderdale lead list, etc.) */
.badge-high        { background: rgba(61,220,151,0.14);  color: var(--good); }
.badge-medium-high  { background: rgba(79,139,255,0.15); color: var(--accent); }
.badge-medium       { background: rgba(245,185,90,0.14); color: var(--warn); }
.badge-low-medium   { background: rgba(136,146,160,0.14); color: var(--dim); }
.badge-low          { background: rgba(136,146,160,0.14); color: var(--dim); }
.badge-skip         { background: rgba(245,106,106,0.12); color: var(--bad); }

/* Invoice status badges */
.badge-draft    { background: rgba(136,146,160,0.14); color: var(--dim); }
.badge-sent     { background: rgba(245,185,90,0.14);  color: var(--warn); }
.badge-paid     { background: rgba(61,220,151,0.14);  color: var(--good); }
.badge-void     { background: rgba(136,146,160,0.14); color: var(--ghost); text-decoration: line-through; }
.badge-overdue  { background: rgba(245,106,106,0.14); color: var(--bad); }

/* STAT CARDS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 18px 20px; border-top: 3px solid var(--rule2);
}
.stat-card .num { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; color: var(--white); line-height: 1.15; }
.stat-card .label { font-size: 0.8rem; color: var(--dim); margin-top: 4px; }
.stat-card--pipeline    { border-top-color: var(--accent); }
.stat-card--customers   { border-top-color: var(--good); }
.stat-card--outstanding { border-top-color: var(--warn); }
.stat-card--tickets     { border-top-color: var(--bad); }
.stat-card--total       { border-top-color: var(--ghost); }

/* DASHBOARD TWO-COLUMN LAYOUT */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dashboard-grid .card { margin-top: 0; }
@media (max-width: 860px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* MISC */
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.section-title { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ghost); font-family: var(--mono); margin-bottom: 12px; }
.activity-item { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 0.92rem; }
.activity-item:last-child { border-bottom: none; }
.activity-item .meta { color: var(--ghost); font-size: 0.75rem; font-family: var(--mono); margin-top: 4px; }
