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

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e4e7f0;
  --text: #1a1d2e;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --folder: #f59e0b;
  --folder-bg: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.bc-item {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.bc-item:hover { color: var(--accent); }
.bc-item.active { color: var(--text); font-weight: 500; cursor: default; }
.bc-sep { color: var(--border); }

/* ── Main ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

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

.view-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.btn-refresh, .btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-refresh:hover, .btn-back:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── PAN grid ── */
/* ── Stats bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Setup banner ── */
.setup-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #ede9fe 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.setup-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.setup-banner-body {
  flex: 1;
  min-width: 0;
}
.setup-banner-body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.setup-banner-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}
.setup-banner-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.setup-banner-close:hover { color: var(--text); }

/* ── Tour button ── */
.btn-tour {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-tour:hover { border-color: var(--accent); color: var(--accent); }

/* ── Feature tour overlay ── */
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.tour-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 32px 80px rgba(0,0,0,.22);
  text-align: center;
}
.tour-icon {
  font-size: 2.6rem;
  margin-bottom: 12px;
  line-height: 1;
}
.tour-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.tour-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 24px;
}
.tour-step-pills {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.tour-pill {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--border);
  transition: background .2s, width .2s;
}
.tour-pill.active {
  background: var(--accent);
  width: 22px;
}
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tour-skip {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tour-skip:hover { color: var(--text); }
.tour-prev { color: var(--text-muted); }

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

.folder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  box-shadow: var(--shadow);
}
.folder-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(79,70,229,.12);
  transform: translateY(-2px);
}

.folder-icon {
  color: var(--folder);
  margin-bottom: 12px;
}

.folder-pan {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.folder-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.folder-badge {
  display: inline-block;
  margin-top: 10px;
  background: var(--folder-bg);
  color: var(--folder);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Files list ── */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.file-icon.pdf  { background: #fef2f2; color: #dc2626; }
.file-icon.img  { background: #f0fdf4; color: #16a34a; }
.file-icon.txt  { background: #f0f9ff; color: #0284c7; }
.file-icon.other { background: var(--bg); color: var(--muted); }

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

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.file-size {
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

.badge-onedrive {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f0fe;
  color: #0078d4;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s;
}
.badge-onedrive:hover { background: #c7dffe; }

/* ── Empty + loading ── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty svg { margin-bottom: 16px; opacity: .4; }
.empty p { font-size: 0.9rem; line-height: 1.6; }

.loading {
  display: flex;
  justify-content: center;
  padding: 48px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ── Landing page ── */

/* Nav */
.land-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  height: 60px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.land-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

/* Hero */
.land-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 5% 80px;
  background: linear-gradient(160deg, #f5f6fa 0%, #eef2ff 60%, #e0e7ff 100%);
}
.land-hero-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.land-h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -.02em;
}
.land-hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 36px;
}
.land-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 60px;
}

/* Mockup */
.land-mockup {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(79,70,229,.12), 0 4px 16px rgba(0,0,0,.06);
  overflow: hidden;
}
.mockup-bar {
  background: #f5f6fa;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mockup-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.mockup-dot:nth-child(1) { background: #ff5f57; }
.mockup-dot:nth-child(2) { background: #ffbd2e; }
.mockup-dot:nth-child(3) { background: #28ca42; }
.mockup-title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.mockup-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mockup-folder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}
.mf-icon { font-size: 1.1rem; }
.mf-badge {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 500;
}
.mockup-folder-new { border-color: var(--accent); background: var(--accent-light); }
.mf-badge-new { background: var(--accent); color: #fff; }

/* Sections */
.land-section {
  padding: 96px 5%;
  background: var(--surface);
}
.land-section-alt { background: var(--bg); }
.land-section-inner { max-width: 1100px; margin: 0 auto; }
.land-section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -.02em;
}
.land-section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 56px;
}

/* Steps */
.steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  justify-content: center;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  text-align: center;
  padding: 0 16px;
}
.step-num {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.step-icon {
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}
.step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: 0.875rem; color: var(--muted); line-height: 1.6; }
.step-arrow {
  font-size: 1.5rem;
  color: var(--border);
  padding-top: 48px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .step-arrow { display: none; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .tour-card { padding: 28px 20px 22px; max-width: calc(100vw - 32px); }
  .setup-banner { flex-wrap: wrap; }
}

/* Feature cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.fi-purple { background: #ede9fe; color: #7c3aed; }
.fi-blue   { background: #dbeafe; color: #2563eb; }
.fi-green  { background: #dcfce7; color: #16a34a; }
.fi-amber  { background: #fef3c7; color: #d97706; }
.fi-rose   { background: #ffe4e6; color: #e11d48; }
.fi-teal   { background: #ccfbf1; color: #0d9488; }
.feature-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feature-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

.badge-soon {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

/* CTA */
.land-cta {
  background: var(--accent);
  padding: 80px 5%;
  text-align: center;
  color: #fff;
}
.land-cta h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -.02em;
}
.land-cta p { font-size: 1rem; opacity: .85; margin-bottom: 32px; }
.land-cta .btn-primary { background: #fff; color: var(--accent); }
.land-cta .btn-primary:hover { background: #eef2ff; }

/* Footer */
.land-footer {
  background: var(--text);
  color: rgba(255,255,255,.45);
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
}

/* Button variants */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 32px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: #4338ca; transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-sm { padding: 7px 18px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 14px 36px; font-size: 1rem; border-radius: 12px; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Login modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* ── Auth tabs ── */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ── Invite chip ── */
.invite-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0 4px;
}
.invite-chip #invite-chip-code {
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 0.05em;
  flex: 1;
}
.btn-copy {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.invite-code-text { font-family: monospace; font-size: 0.9rem; letter-spacing: 0.04em; }
.invite-badge {
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}
.invite-badge.unused   { background: #dcfce7; color: #166534; }
.invite-badge.used     { background: #f1f5f9; color: #64748b; }
.invite-badge.approved { background: #dcfce7; color: #166534; }
.invite-badge.rejected { background: #fee2e2; color: #991b1b; }
.invite-badge.pending  { background: #fef9c3; color: #854d0e; }

/* ── Request Invite form ── */
.req-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.req-form input[type="email"],
.req-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.req-form input[type="email"]:focus,
.req-select:focus { border-color: var(--accent); }

.req-field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.req-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 24px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 3px 0;
}
.check-item input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.check-item span { line-height: 1.3; }

.request-success {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 0;
}

/* Approve button in monitoring */
.btn-approve {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  margin-right: 4px;
}
.btn-approve:hover { opacity: 0.85; }

/* Pending count badge on tab header */
.req-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
}

.btn-refresh-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.btn-refresh-sm:hover { background: var(--bg); }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
}

.modal h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.modal-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 24px; }

#login-form,
#register-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form input,
#register-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s;
}
#login-form input:focus,
#register-form input:focus { border-color: var(--accent); }

.login-error {
  font-size: 0.82rem;
  color: #dc2626;
  margin: -4px 0;
}

/* ── Sign out button ── */
.btn-signout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-signout:hover { border-color: #dc2626; color: #dc2626; }

/* ── Unslotted folder ── */
.folder-unslotted {
  border-color: #fbbf24;
  background: #fffbeb;
}
.folder-unslotted .folder-icon { color: #d97706; }
.folder-unslotted .folder-badge { background: #fef3c7; color: #d97706; }

/* ── Assign PAN button ── */
.btn-slot {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-slot:hover { background: #4338ca; }
.btn-slot:disabled { background: var(--muted); cursor: default; }

/* ── Header right ── */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-user {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ── Destination badges ── */
.badge-dest {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: opacity .15s;
}
.badge-dest:hover { opacity: .8; }
.badge-onedrive, .badge-dest.badge-onedrive { background: #e8f0fe; color: #0078d4; }
.badge-dest.badge-s3 { background: #fef3c7; color: #d97706; }
.badge-dest.badge-github { background: #f0fdf4; color: #16a34a; }

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

.tab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: block; }
.tab-content.hidden { display: none !important; }

/* ── Settings cards ── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}

.source-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slack-icon { background: #4a154b; color: #fff; }
.wa-icon { background: #25d366; color: #fff; }
.od-icon { background: #0078d4; color: #fff; }
.s3-icon { background: #ff9900; color: #fff; }
.gh-icon { background: #24292e; color: #fff; }
.gd-icon { background: #f1f3f4; color: #000; }

.settings-fields {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 12px;
}
.field-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
.field-row input, .field-row select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
  background: var(--surface);
  transition: border-color .15s;
}
.field-row input:focus, .field-row select:focus { border-color: var(--accent); }

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.btn-save {
  margin-top: 8px;
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-save:hover { background: #4338ca; }

/* ── Toggle switch ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.small-toggle { width: 36px; height: 20px; }
.small-toggle .toggle-slider::before { width: 14px; height: 14px; }
.small-toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Rules list ── */
.rules-empty { margin-bottom: 16px; display: block; }

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.rule-info { flex: 1; min-width: 0; }
.rule-name { font-weight: 600; font-size: 0.9rem; }
.rule-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.rule-actions { display: flex; align-items: center; gap: 10px; }

.add-rule-form { display: flex; flex-direction: column; gap: 12px; }
.form-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }

.btn-delete {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-delete:hover { border-color: #dc2626; color: #dc2626; }

/* ── Users table ── */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.users-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.users-table tr:last-child td { border-bottom: none; }

.role-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.role-admin      { background: #eef2ff; color: var(--accent); }
.role-superuser  { background: #fef3c7; color: #92400e; }
.role-viewer     { background: var(--bg); color: var(--muted); }
.role-user       { background: #f0fdf4; color: #166534; }

/* Permission level badges */
.perm-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.perm-read     { background: #f1f5f9; color: #475569; }
.perm-write    { background: #ecfdf5; color: #065f46; }
.perm-maintain { background: #eff6ff; color: #1d4ed8; }
.perm-admin    { background: #eef2ff; color: var(--accent); }

/* Monitoring table */
.monitoring-badge { font-size: 0.72rem; font-weight: 600; }

/* Activity filters */
.activity-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.activity-filter-input {
  padding:6px 10px; font-size:13px; border-radius:8px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text); width:130px;
}
.activity-filter-select {
  padding:6px 10px; font-size:13px; border-radius:8px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text); cursor:pointer;
}
.activity-filter-input:focus, .activity-filter-select:focus { outline:none; border-color:var(--accent); }
.btn-ghost { background:transparent; border:1px solid var(--border); color:var(--text-muted); }
.btn-ghost:hover { border-color:var(--accent); color:var(--accent); }
.activity-empty { text-align:center; color:var(--text-muted); font-size:14px; padding:16px; }

/* Workspace config panel */
.ws-type-row { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--border); }
.ws-type-row:last-child { border-bottom:none; }
.ws-type-label { flex:1; font-size:13px; font-weight:500; text-transform:capitalize; }
.ws-status { font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px; }
.ws-on  { background:#d1fae5; color:#065f46; }
.ws-off { background:#f3f4f6; color:#6b7280; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1d2e;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 200;
  pointer-events: none;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-error { background: #dc2626; }
