/* ============================================================
   CARBOTURA AGENT PORTAL — portal.css
   Shared design system for all /agents/ pages
   Brand: CRBT-BRAND-2025 v2.1 · Dark palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Audiowide&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette */
  --bg:          #0A0C10;
  --surface:     #121418;
  --surface2:    #1A1D24;
  --surface3:    #21252F;
  --border:      #2A2F3A;
  --border-l:    #363C4A;
  --text:        #F8FAFC;
  --muted:       #94A3B8;
  --muted2:      #64748B;

  --emerald:     #059669;
  --emerald-l:   #34D399;
  --emerald-d:   #065F46;
  --emerald-bg:  rgba(5,150,105,0.10);
  --emerald-bg2: rgba(5,150,105,0.18);

  --blue:        #007FFF;
  --blue-l:      #4D9FFF;
  --blue-bg:     rgba(0,127,255,0.10);

  --violet:      #7C3AED;
  --violet-l:    #A78BFA;
  --violet-bg:   rgba(124,58,237,0.12);

  --mustard:     #CA8A04;
  --mustard-l:   #EAB308;
  --mustard-bg:  rgba(202,138,4,0.12);

  --magenta:     #FF007F;
  --magenta-bg:  rgba(255,0,127,0.10);

  --danger:      #EF4444;
  --danger-bg:   rgba(239,68,68,0.10);

  --success:     #10B981;
  --success-bg:  rgba(16,185,129,0.10);

  --warning:     #F59E0B;
  --warning-bg:  rgba(245,158,11,0.10);

  /* Typography */
  --font-display: 'Audiowide', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Layout */
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --radius:      8px;
  --radius-l:    12px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Login Screen ─────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 40px 36px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-brand span {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .14em;
  color: var(--text);
}

.login-brand em {
  color: var(--emerald);
  font-style: normal;
}

.login-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--emerald);
  margin-bottom: 6px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 24px;
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #FCA5A5;
  margin-bottom: 16px;
  display: none;
}

.login-error.visible { display: block; }

/* ── Portal Shell ─────────────────────────────────── */
.portal-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-brand span {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--text);
}

.sidebar-brand em {
  color: var(--emerald);
  font-style: normal;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted2);
  padding: 20px 20px 6px;
}

.sidebar-nav {
  list-style: none;
  padding: 0 10px;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: background .15s, color .15s;
}

.sidebar-nav li a:hover {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-nav li a.active {
  background: var(--emerald-bg);
  color: var(--emerald-l);
}

.sidebar-nav li a .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .7;
}

.sidebar-nav li a.active .nav-icon { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--emerald-bg2);
  border: 1px solid var(--emerald-d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--emerald-l);
  flex-shrink: 0;
}

.agent-chip-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.agent-chip-role {
  font-size: 11px;
  color: var(--muted2);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  width: 100%;
  transition: border-color .15s, color .15s;
}

.logout-btn:hover {
  border-color: var(--border-l);
  color: var(--text);
}

/* Main content area */
.portal-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.portal-topbar-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text);
  letter-spacing: .05em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.status-badge.active   { background: var(--success-bg); color: #6EE7B7; border: 1px solid rgba(16,185,129,.25); }
.status-badge.pending  { background: var(--warning-bg); color: #FCD34D; border: 1px solid rgba(245,158,11,.25); }
.status-badge.review   { background: var(--blue-bg);    color: var(--blue-l); border: 1px solid rgba(0,127,255,.25); }
.status-badge.inactive { background: var(--surface2);   color: var(--muted);  border: 1px solid var(--border); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Page content */
.portal-content {
  padding: 32px;
  flex: 1;
}

.page-header {
  margin-bottom: 28px;
}

.page-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--emerald);
  margin-bottom: 6px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ── Stat Cards ───────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.c-emerald::before { background: var(--emerald); }
.stat-card.c-blue::before    { background: var(--blue); }
.stat-card.c-violet::before  { background: var(--violet); }
.stat-card.c-mustard::before { background: var(--mustard); }

.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ── Cards / Panels ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text);
  letter-spacing: .04em;
}

.card-body {
  padding: 22px;
}

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

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

/* ── Form Elements ────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .03em;
}

.form-label .req {
  color: var(--emerald);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-bg);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted2);
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: 11.5px;
  color: var(--muted2);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* Radio group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-option {
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option label {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.radio-option input:checked + label {
  background: var(--emerald-bg2);
  border-color: var(--emerald-d);
  color: var(--emerald-l);
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--emerald);
  color: #fff;
}

.btn-primary:hover { background: var(--emerald-l); color: #0A0C10; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover { border-color: var(--border-l); background: var(--surface3); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover { border-color: var(--border-l); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Table ────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--surface2); }

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── Empty state ──────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  opacity: .3;
}

.empty-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-text {
  font-size: 13px;
  color: var(--muted2);
}

/* ── Alert / Notice ───────────────────────────────── */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.alert-emerald { background: var(--emerald-bg); border: 1px solid rgba(5,150,105,.3); color: #6EE7B7; }
.alert-blue    { background: var(--blue-bg);    border: 1px solid rgba(0,127,255,.3); color: var(--blue-l); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(245,158,11,.3); color: #FCD34D; }

/* ── Toast ────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface3);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 320px;
}

#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { border-left: 3px solid var(--emerald); }
#toast.error   { border-left: 3px solid var(--danger); }

/* ── Divider ──────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Referral code display ────────────────────────── */
.ref-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.ref-code-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--emerald-l);
  letter-spacing: .1em;
  flex: 1;
}

/* ── Agreement ────────────────────────────────────── */
.agreement-text {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-height: 360px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 20px;
}

.agreement-text h3 {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text);
  letter-spacing: .05em;
  margin: 20px 0 8px;
}

.agreement-text h3:first-child { margin-top: 0; }

.agreement-text p { margin-bottom: 12px; }

.sign-block {
  background: var(--emerald-bg);
  border: 1px solid rgba(5,150,105,.25);
  border-radius: var(--radius);
  padding: 20px;
}

.sign-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  cursor: pointer;
}

.sign-checkbox input[type=checkbox] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--emerald);
  flex-shrink: 0;
  cursor: pointer;
}

.sign-checkbox span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Literature cards ─────────────────────────────── */
.lit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.lit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}

.lit-card:hover { border-color: var(--border-l); }

.lit-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lit-icon.blue   { background: var(--blue-bg); }
.lit-icon.emerald { background: var(--emerald-bg); }
.lit-icon.violet { background: var(--violet-bg); }
.lit-icon.mustard { background: var(--mustard-bg); }

.lit-card-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.lit-card-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.lit-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted2);
}

/* ── Meeting request ──────────────────────────────── */
.date-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.date-slot-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted2);
  width: 60px;
  flex-shrink: 0;
}

.date-slot input[type=datetime-local] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  color-scheme: dark;
}

/* ── Activity feed ────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-dot.emerald { background: var(--emerald); }
.activity-dot.blue    { background: var(--blue); }
.activity-dot.violet  { background: var(--violet); }
.activity-dot.mustard { background: var(--mustard); }

.activity-body {
  flex: 1;
}

.activity-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.activity-time {
  font-size: 11.5px;
  color: var(--muted2);
  margin-top: 2px;
}

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 99px; }

/* ── Utility ──────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-muted { color: var(--muted); }
.text-muted2 { color: var(--muted2); }
.text-emerald { color: var(--emerald-l); }
.text-sm { font-size: 12.5px; }
.mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.text-center { text-align: center; }
