/* ══════════════════════════════════════════════════════════
   SocialHub – Main Stylesheet  |  Dark SaaS Theme
   ══════════════════════════════════════════════════════════ */

:root {
  --bg-base:      #0f0f13;
  --bg-surface:   #16161d;
  --bg-card:      #1c1c26;
  --bg-hover:     #232330;
  --border:       #2a2a3a;
  --border-light: #32324a;
  --accent:       #6366f1;
  --accent-dark:  #4f46e5;
  --accent-glow:  rgba(99,102,241,.18);
  --purple:       #8b5cf6;
  --pink:         #ec4899;
  --cyan:         #06b6d4;
  --green:        #10b981;
  --yellow:       #f59e0b;
  --red:          #ef4444;
  --text-primary: #f1f1f5;
  --text-muted:   #8888aa;
  --text-subtle:  #555570;
  --sidebar-w:    240px;
  --topbar-h:     60px;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
}

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

html { font-size: 15px; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--purple); }

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 999px; }

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 12px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text-primary);
}

.sidebar-logo .logo-badge {
  font-size: .6rem;
  background: var(--accent);
  color: #fff;
  padding: 1px 5px;
  border-radius: 99px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Workspace switcher */
.ws-switcher {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.ws-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  color: var(--text-primary);
}
.ws-btn:hover { background: var(--bg-hover); }

.ws-avatar {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ws-name {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: left;
}

.ws-caret {
  color: var(--text-subtle);
  font-size: .75rem;
}

/* Workspace dropdown */
.ws-dropdown {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ws-dropdown.open { display: block; }

.ws-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: .82rem;
  color: var(--text-primary);
  transition: background .12s;
}
.ws-dropdown a:hover { background: var(--bg-hover); }
.ws-dropdown a.active { color: var(--accent); }
.ws-dropdown .ws-new {
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 500;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
  padding: 8px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 1px;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-link .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-link .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 700;
}

/* Sidebar bottom */
.sidebar-bottom {
  padding: 10px 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.user-info .user-email {
  font-size: .72rem;
  color: var(--text-subtle);
}

/* ── Main Content ────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Page content */
.page-content {
  padding: 28px 28px;
  flex: 1;
}

/* ═══════════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-sub {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-icon {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  opacity: .08;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.1); }

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-lg { padding: 11px 24px; font-size: .95rem; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-subtle); }

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

select.form-control {
  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 fill='%23666688' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  appearance: none;
}

.form-hint {
  font-size: .75rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

/* Input with icon */
.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: .9rem;
  pointer-events: none;
}
.input-group .form-control { padding-left: 34px; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-success  { background: rgba(16,185,129,.15);  color: #10b981; }
.badge-error    { background: rgba(239,68,68,.15);   color: #ef4444; }
.badge-warning  { background: rgba(245,158,11,.15);  color: #f59e0b; }
.badge-info     { background: rgba(6,182,212,.15);   color: #06b6d4; }
.badge-purple   { background: rgba(139,92,246,.15);  color: #8b5cf6; }
.badge-default  { background: var(--bg-hover);       color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 11px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-subtle);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

tbody tr:hover { background: var(--bg-hover); }

/* ── Platform Pills ─────────────────────────────────────── */
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Avatar / Platform icon ─────────────────────────────── */
.platform-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Social brand colours */
.pi-twitter   { background: #e7e7e7; color: #000; }
.pi-facebook  { background: #e8f0fe; color: #1877F2; }
.pi-instagram { background: #fce4ec; color: #E1306C; }
.pi-linkedin  { background: #e3f2fd; color: #0A66C2; }
.pi-tiktok    { background: #f5f5f5; color: #010101; }

/* ── Alerts / Flashes ───────────────────────────────────── */
.alerts { margin-bottom: 18px; }

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.alert-success { background: rgba(16,185,129,.1);  border-color: rgba(16,185,129,.25); color: #10b981; }
.alert-error   { background: rgba(239,68,68,.1);   border-color: rgba(239,68,68,.25); color: #ef4444; }
.alert-warning { background: rgba(245,158,11,.1);  border-color: rgba(245,158,11,.25); color: #f59e0b; }
.alert-info    { background: rgba(6,182,212,.1);   border-color: rgba(6,182,212,.25); color: #06b6d4; }

.alert .alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  font-size: 1rem;
  padding: 0 2px;
}
.alert .alert-close:hover { opacity: 1; }

/* ── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header-text p {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Compose Box ────────────────────────────────────────── */
.compose-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.compose-textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .95rem;
  line-height: 1.6;
  padding: 14px;
  resize: vertical;
  min-height: 130px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.compose-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.char-counter {
  font-size: .75rem;
  color: var(--text-subtle);
}

.char-counter.warn { color: var(--yellow); }
.char-counter.over { color: var(--red); }

/* Account checkboxes */
.account-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.acc-check {
  display: none;
}

.acc-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
  user-select: none;
}

.acc-label:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.acc-check:checked + .acc-label {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.acc-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Media upload */
.media-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-muted);
  font-size: .85rem;
}

.media-upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── Account Cards ──────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}

.account-card:hover { border-color: var(--border-light); }

.account-card.inactive { opacity: .55; }

.account-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-card-avatar {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.account-card-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.account-card-info {
  flex: 1;
  min-width: 0;
}

.account-card-name {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card-platform {
  font-size: .75rem;
  color: var(--text-muted);
}

.account-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Connect Platform Grid ──────────────────────────────── */
.connect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.connect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}

.connect-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.connect-card.connected {
  border-color: rgba(16,185,129,.4);
  background: rgba(16,185,129,.05);
}

.connect-card-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

.connect-card-name {
  font-size: .85rem;
  font-weight: 600;
}

.connect-card-status {
  font-size: .72rem;
  color: var(--text-subtle);
}
.connect-card.connected .connect-card-status {
  color: var(--green);
}

/* ── Schedule Timeline ──────────────────────────────────── */
.post-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.post-row:last-child { border-bottom: none; }

.post-time {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
  padding-top: 2px;
}

.post-content {
  flex: 1;
  min-width: 0;
}

.post-text {
  font-size: .875rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Analytics Charts ───────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 220px;
}

.platform-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.platform-bar-label {
  width: 90px;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: right;
}

.platform-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-base);
  border-radius: 99px;
  overflow: hidden;
}

.platform-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width .6s ease;
}

.platform-bar-count {
  width: 30px;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: right;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .4;
}

.empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: .85rem;
  margin-bottom: 20px;
}

/* ── Grid Helpers ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.font-bold { font-weight: 700; }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }

/* ═══════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 3px 16px var(--accent-glow);
}

.auth-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ─── Divider ───────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-subtle);
  font-size: .75rem;
  margin: 16px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Workspace Select ───────────────────────────────────── */
.ws-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.ws-select-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.ws-select-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.ws-select-avatar {
  width: 52px; height: 52px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.ws-select-name {
  font-weight: 700;
  font-size: .9rem;
}

.ws-select-role {
  font-size: .72rem;
  color: var(--text-subtle);
  text-transform: capitalize;
}

/* ── Toggle switch ──────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 99px;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Settings Tabs ──────────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.settings-tab {
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-section { display: none; }
.settings-section.active { display: block; }

/* ── Shimmer loading ────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}

/* ── Tooltip ────────────────────────────────────────────── */
[data-tip] {
  position: relative;
  cursor: pointer;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: .72rem;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 999;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Fade-in animation ──────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .3s ease forwards; }
