/* Atlas Integro Client Portal — Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-alt:  #1c2128;
  --border:       #30363d;
  --accent:       #26CAC8;
  --accent-dim:   rgba(38,202,200,.15);
  --accent-glow:  rgba(38,202,200,.08);
  --text:         #e1ebf8;
  --text-muted:   #8b949e;
  --text-dim:     #6e7681;
  --success:      #3fb950;
  --warning:      #d29922;
  --danger:       #f85149;
  --sidebar-w:    240px;
  --header-h:     56px;
  --radius:       10px;
  --radius-sm:    6px;
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ─────────────────────────────────────────── */
.portal-wrapper {
  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; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-client {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-client-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.sidebar-client-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s;
  cursor: pointer;
  background: none;
  border-top: none; border-right: none; border-bottom: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover:not(.active) {
  color: var(--text);
  background: var(--surface-alt);
}
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}
.nav-item.coming-soon {
  opacity: .5;
  cursor: default;
}
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logout {
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  background: none; border: none;
  padding: 0;
  transition: color .15s;
}
.sidebar-logout:hover { color: var(--danger); }

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

/* ── Header ──────────────────────────────────────────── */
.portal-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bell-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
  position: relative;
}
.bell-btn:hover { border-color: var(--accent); color: var(--accent); }
.bell-count {
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
  display: none;
}
.bell-count.has-notifications { display: inline; }

/* ── Main content ─────────────────────────────────────── */
.portal-main {
  flex: 1;
  padding: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ── Hero Card ────────────────────────────────────────── */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 0% 50%, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}
.hero-left { flex: 1; min-width: 0; }
.hero-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.hero-number {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  transition: color .3s;
}
.hero-number.positive { color: var(--success); }
.hero-number.neutral  { color: var(--warning); }
.hero-number.negative { color: var(--danger); }
.hero-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.hero-sparkline {
  width: 200px;
  height: 56px;
  flex-shrink: 0;
}
.hero-sparkline svg { display: block; }

/* ── Cards Grid ────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-full { grid-column: 1 / -1; }
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.card-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Workflow list (Card 1) ────────────────────────────── */
.workflow-list { display: flex; flex-direction: column; gap: 8px; }
.workflow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.workflow-item:hover { background: #21262d; }
.workflow-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
}
.workflow-dot.active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.workflow-dot.active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--success);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.2); }
}
.workflow-label { flex: 1; font-size: 13px; color: var(--text); }
.workflow-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Activity feed (Card 2) ─────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-emoji { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.activity-text { flex: 1; min-width: 0; }
.activity-desc {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
}
.activity-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.activity-status {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}
.activity-status.success { background: rgba(63,185,80,.15); color: var(--success); }
.activity-status.failure { background: rgba(248,81,73,.15);  color: var(--danger); }

/* ── Calendar heatmap (Card 3) ──────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  padding: 0 0 4px;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  border: 1px solid transparent;
}
.cal-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 1;
  position: relative;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--accent); }
.cal-day-num {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1;
  display: block;
  padding: 2px 0 0 3px;
  pointer-events: none;
}

/* ── Day modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(8px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 14px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 0;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }

/* ── Reports page ───────────────────────────────────────── */
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.report-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.report-row:hover { border-color: var(--accent); background: #1c2128; }
.report-month {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
}
.report-delta {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.report-delta.positive { color: var(--success); }
.report-delta.negative { color: var(--danger); }
.report-delta.neutral  { color: var(--warning); }
.report-cta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}

/* ── Coming soon page ───────────────────────────────────── */
.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.coming-soon-icon { font-size: 48px; margin-bottom: 16px; }
.coming-soon-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.coming-soon-sub { font-size: 14px; color: var(--text-muted); max-width: 340px; }

/* ── Floating AI button ─────────────────────────────────── */
.ai-chat-btn {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 20px rgba(38,202,200,.4);
  transition: transform .2s, box-shadow .2s;
  z-index: 150;
}
.ai-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(38,202,200,.5);
}

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 40px; }
.login-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-dim); }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.login-message {
  text-align: center;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}
.login-message.error { color: var(--danger); }
.login-message.success { color: var(--success); }

/* ── Skeleton loading ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, #21262d 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.wide  { width: 80%; }
.skeleton-text.mid   { width: 55%; }
.skeleton-text.short { width: 35%; }
.skeleton-hero { height: 56px; width: 200px; border-radius: 4px; }

/* ── Utilities ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  font-size: 13px;
}
.empty-state .empty-icon { font-size: 28px; margin-bottom: 8px; }

/* ── Mobile responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 100%;
    max-width: 280px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.5); }

  .main-wrapper { margin-left: 0; }

  .portal-header {
    padding: 0 16px;
    position: sticky; top: 0;
  }
  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    background: none; border: none;
    padding: 4px;
  }
  .hamburger span {
    width: 20px; height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background .15s;
  }
  .hamburger:hover span { background: var(--text); }

  .portal-main { padding: 16px; }
  .hero-sparkline { display: none; }
  .cards-grid { grid-template-columns: 1fr; }
  .hero-number { font-size: 2rem; }

  .ai-chat-btn { bottom: 16px; right: 16px; width: 46px; height: 46px; }
}

@media (min-width: 769px) {
  .hamburger { display: none; }
  .sidebar-overlay { display: none; }
}

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.open { display: block; }

/* ── Demo mode UI ─────────────────────────────────────────── */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-dim);
  background: rgba(38,202,200,.1);
  border: 1px solid rgba(38,202,200,.25);
  border-radius: 20px;
  padding: 3px 10px;
  text-transform: uppercase;
}
.demo-reset-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.demo-reset-btn:hover { color: var(--accent); border-color: var(--accent); }
.demo-setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.demo-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 480px;
}
.demo-setup-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 20px;
}
.demo-setup-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.demo-setup-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}
.form-group { margin-bottom: 18px; }
.form-select {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }
.form-optional {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
}
.demo-setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
}
.demo-reset-link {
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}
.demo-reset-link:hover { color: var(--text-muted); }
