/* ═══════════════════════════════════════════════════════════════════
   Sulla Desktop — authenticated app shell + shared widgets
   Used by: dashboard.html, calls.html, campaigns.html, etc.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg: #fafbfc;
  --surface-1: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e9ecf1;
  --surface-hover: #f0f3f7;
  --text: #1a1d23;
  --text-soft: #555a63;
  --text-dim: #8a8f99;
  --line: #e6e8ed;
  --line-soft: #f0f2f5;
  --line-strong: #d1d5db;
  --accent: #5096b3;
  --accent-bright: #4080a0;
  --accent-glow: rgba(80, 150, 179, 0.10);
  --green: #2ea043;
  --warning: #b6831e;
  --danger: #cf222e;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 18px;
  line-height: 1;
  user-select: none;
}
.hidden { display: none !important; }

/* App grid */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 52px 1fr;
  height: 100vh;
}
.app[aria-hidden="true"] { filter: blur(2px); pointer-events: none; user-select: none; }

/* Top bar */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center;
  padding: 0 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.topbar .logo {
  display: flex; align-items: center; gap: 10px;
  width: 232px;
  font-weight: 700; font-size: 14.5px;
  letter-spacing: -0.01em;
  text-decoration: none; color: inherit;
}
.topbar .logo .mark {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 5px;
  display: grid; place-items: center;
  color: white;
}
.topbar .logo .mark .material-symbols-outlined { font-size: 16px; }
.topbar-spacer { flex: 1; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  background: transparent; border: none;
}
.topbar .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-left: 4px;
  background: var(--surface-3);
}
.avatar-fallback {
  display: grid; place-items: center;
  color: white;
  font-weight: 700; font-size: 11px;
  font-family: var(--mono);
  border-color: rgba(0,0,0,0.08);
}

/* Sidebar */
.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .section-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 18px;
  margin: 14px 0 6px;
  font-weight: 500;
}
.sidebar .section-label:first-child { margin-top: 0; }
.sidebar .item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.sidebar .item:hover { background: var(--surface-hover); color: var(--text); }
.sidebar .item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}
.sidebar .item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar .item .material-symbols-outlined { font-size: 19px; color: inherit; }
.sidebar .item .badge {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 8px;
}
.sidebar .item.active .badge { background: var(--accent); color: white; }
.sidebar .spacer { flex: 1; }

/* Account card */
.account-card {
  margin: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex; gap: 10px; align-items: center;
}
.account-card .avatar { width: 36px; height: 36px; }
.account-card .info { flex: 1; min-width: 0; }
.account-card .name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card .plan { font-size: 11px; color: var(--text-dim); font-family: var(--mono); margin-top: 2px; }

/* Main */
.main {
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg);
}
.main h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.main h1 .accent { color: var(--accent); font-weight: 500; }
.main .subtitle {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 32px;
}
.main .page-actions {
  display: flex; gap: 8px; align-items: center; margin-left: auto;
}

/* Page header (h1 + actions on one line) */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-header .left h1 { margin-bottom: 4px; }
.page-header .right { display: flex; gap: 8px; }

/* Sections */
section.block { margin-bottom: 36px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head a {
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 2px;
}
.section-head a:hover { color: var(--accent-bright); }
.section-head a .material-symbols-outlined { font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  text-decoration: none;
  font-family: var(--body);
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 17px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: white;
}
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-ghost {
  background: var(--surface-1); border-color: var(--line-strong); color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: var(--surface-1); border-color: var(--line-strong); color: var(--danger);
}
.btn-danger:hover { background: rgba(207,34,46,0.06); }

/* Empty / loading rows */
.empty-row {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  background: var(--surface-1);
  border-radius: 10px;
  border: 1px dashed var(--line);
}

/* Error banner */
.error-banner {
  background: rgba(207,34,46,0.08);
  border: 1px solid rgba(207,34,46,0.3);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: center;
}
.error-banner::before { content: '⚠'; font-size: 16px; }

/* Backend-pending banner */
.pending-banner {
  background: rgba(182,131,30,0.08);
  border: 1px solid rgba(182,131,30,0.3);
  color: var(--warning);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.pending-banner .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }

/* ───────────── LOGIN OVERLAY ───────────── */
.login-overlay {
  position: fixed; inset: 0;
  background: rgba(250, 251, 252, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: grid; place-items: center;
  padding: 32px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px -12px rgba(80, 150, 179, 0.18);
  text-align: center;
}
.login-card .brand {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
  font-weight: 700; font-size: 16px;
}
.login-card .brand .mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: grid; place-items: center;
  color: white;
}
.login-card .brand .mark .material-symbols-outlined { font-size: 18px; }
.login-card h1 {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login-card p {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 24px;
}
.login-card .login-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  margin-bottom: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--body);
}
.login-card .login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-card .btn-apple { background: #000; border-color: #000; color: white; }
.login-card .btn-apple:hover { background: #1a1a1a; }
.login-card .divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px; align-items: center;
  margin: 18px 0 14px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.login-card .divider::before, .login-card .divider::after {
  content: ''; height: 1px; background: var(--line);
}
.login-card .alt-link {
  background: transparent; border: none;
  color: var(--accent);
  font-size: 13px; cursor: pointer;
  padding: 6px;
  text-decoration: underline;
  font-family: var(--body);
}
.login-card .alt-link:hover { color: var(--accent-bright); }
.login-card .footer-note {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
}
.login-card .footer-note a { color: var(--accent); text-decoration: none; }
.login-card .login-error {
  background: rgba(207,34,46,0.08);
  border: 1px solid rgba(207,34,46,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px; text-align: left;
}
.login-card .login-error:empty { display: none; }

/* Login tabs */
.login-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-bottom: 20px;
  background: var(--surface-2);
  padding: 4px; border-radius: 10px;
}
.login-tabs .tab {
  padding: 9px 12px;
  background: transparent; border: none; border-radius: 7px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--body); transition: all 0.15s;
}
.login-tabs .tab:hover { color: var(--text); }
.login-tabs .tab.active {
  background: var(--surface-1);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.login-tabs .tab .material-symbols-outlined { font-size: 16px; }

/* Login forms */
.login-form { display: none; text-align: left; }
.login-form.active { display: block; }
.login-form .field { display: block; margin-bottom: 14px; }
.login-form .field span {
  display: block;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.login-form .field input,
.login-form .field select,
.login-form .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-1);
  font-family: var(--body); font-size: 14px;
  color: var(--text);
}
.login-form .field input:focus,
.login-form .field select:focus,
.login-form .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-step { display: none; }
.login-step.active { display: block; }
.login-step .step-hint {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 14px;
  text-align: left;
}
.login-step .step-hint span { color: var(--text); font-weight: 600; }
.alt-link.inline {
  padding: 0; font-size: 12.5px; margin-left: 4px;
}
#phone-resend, #email-toggle {
  margin-top: 8px; width: 100%;
  text-align: center; text-decoration: none;
}
#phone-resend:hover, #email-toggle:hover { text-decoration: underline; }

.password-wrap { position: relative; }
.password-wrap .toggle-pw {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 6px;
}
.password-wrap .toggle-pw:hover { color: var(--text); background: var(--surface-2); }
.password-wrap input { padding-right: 42px; }

.badge-soon {
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.8);
  font-family: var(--mono); font-size: 9.5px;
  padding: 2px 6px; border-radius: 8px;
  margin-left: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}

@keyframes spin { from{transform:rotate(0)} to{transform:rotate(360deg)} }
.spin { animation: spin 0.8s linear infinite; }

/* Pulse for active call indicator */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(207,34,46,0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(207,34,46,0);    }
  100% { box-shadow: 0 0 0 0   rgba(207,34,46,0);    }
}
