/* ============================================================
   ChatLynk — SaaS Platform Styles
   ============================================================ */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #3730a3;
  --primary-light:  #eef2ff;
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --sidebar-bg:     #0f172a;
  --sidebar-text:   #cbd5e1;
  --sidebar-hover:  #1e293b;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.06);
  --shadow-lg:      0 20px 50px rgba(0,0,0,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
  color: #0f172a;
}
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; font-size: 14px; font-weight: 500; line-height: 1;
  transition: all .15s ease; white-space: nowrap;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn-lg      { padding: 12px 22px; font-size: 15px; }
.btn-full    { width: 100%; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 12px; font-size: 14px;
  border: 1px solid;
}
.alert-error   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.flash-stack { margin-bottom: 16px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-weight: 500; font-size: 13px; color: var(--text); }
.optional { color: var(--text-muted); font-weight: 400; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; background: var(--surface); color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.13);
}
.color-input { width: 60px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"] {
  padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; min-width: 180px;
}
.inline-form input.grow { flex: 1; min-width: 200px; }
.inline-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.13);
}
.vert-on-mobile { /* normal on desktop */ }
@media (max-width: 600px) {
  .vert-on-mobile { flex-direction: column; align-items: stretch; }
  .vert-on-mobile input { width: 100%; }
}

.stacked-form h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.form-actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.toggle-group { flex-direction: row; align-items: flex-start; gap: 12px; }
.toggle-group strong { display: block; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 26px;
  transition: .2s;
}
.slider:before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; top: 3px; background: #fff;
  border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-page { background: var(--surface); }

.top-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px; color: var(--text);
}
.brand-mark { font-size: 22px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a:not(.btn) { color: var(--text); font-weight: 500; font-size: 14px; }
.nav-links a:hover { color: var(--primary); }

.hero {
  padding: 80px 0 60px;
  background:
    radial-gradient(ellipse at top right, rgba(79,70,229,.10), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(168,85,247,.08), transparent 50%),
    var(--surface);
}
.hero-inner { text-align: center; max-width: 760px; margin: 0 auto; }
.eyebrow {
  display: inline-block; padding: 5px 12px;
  background: var(--primary-light); color: var(--primary);
  border-radius: 999px; font-size: 12px; font-weight: 600;
  margin-bottom: 18px; letter-spacing: .3px;
}
.hero h1 {
  font-size: 52px; font-weight: 800; line-height: 1.1;
  letter-spacing: -1.5px; margin-bottom: 18px;
}
.hero h1 em {
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; font-style: italic;
}
.hero-sub { font-size: 17px; color: var(--text-muted); margin-bottom: 28px; }
.hero-cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hero-hint { font-size: 13px; color: var(--text-muted); }

.features { padding: 70px 0; background: var(--bg); }
.section-title {
  text-align: center; font-size: 32px; font-weight: 700;
  letter-spacing: -.5px; margin-bottom: 40px;
}
.feature-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.feature-card {
  background: var(--surface); padding: 24px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.feature-card p { font-size: 14px; color: var(--text-muted); }

.how-section { padding: 70px 0; }
.how-steps { list-style: none; max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.how-steps li { display: flex; gap: 18px; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 38px; height: 38px;
  background: var(--primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.how-steps h3 { font-size: 17px; margin-bottom: 4px; }
.how-steps p { color: var(--text-muted); font-size: 14px; }
.how-cta { text-align: center; margin-top: 36px; }

.footer {
  padding: 28px 0; border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-muted); flex-wrap: wrap; gap: 12px;
}

@media (max-width: 720px) {
  .hero h1 { font-size: 36px; }
  .hero { padding: 50px 0 40px; }
  .nav-links a:not(.btn) { display: none; }
  .section-title { font-size: 24px; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at top, rgba(79,70,229,.10), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(168,85,247,.10), transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth-shell { width: 100%; max-width: 400px; }
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 24px; font-weight: 700; font-size: 18px; color: var(--text);
}
.auth-card {
  background: var(--surface);
  padding: 36px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.auth-hint {
  text-align: center; margin-top: 16px; font-size: 12px;
  color: var(--text-muted); padding: 10px; background: var(--bg);
  border-radius: var(--radius);
}

/* ============================================================
   APP / DASHBOARD
   ============================================================ */
.app-page { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 10;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  color: #fff; font-weight: 700; font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text); font-size: 14px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-hover); color: #fff;
  border-left-color: var(--primary);
}
.sidebar-foot {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 10px;
}
.user-pill { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
}
.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 13px; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-mail {
  font-size: 11px; color: var(--sidebar-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-foot .btn-ghost {
  background: transparent; color: var(--sidebar-text);
  border-color: rgba(255,255,255,.15);
}
.sidebar-foot .btn-ghost:hover { background: var(--sidebar-hover); color: #fff; }

/* Main */
.app-main {
  margin-left: 240px; flex: 1;
  padding: 28px 32px; max-width: 1200px;
}
.tab-panel { display: none; animation: fadeIn .2s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.page-head h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--text-muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.card-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }
.link { color: var(--primary); font-weight: 500; cursor: pointer; }

/* Stats */
.stat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-meta { font-size: 12px; color: var(--text-muted); }

.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }

.quick-steps { list-style: none; counter-reset: step; }
.quick-steps li {
  padding: 12px 14px; padding-left: 44px; position: relative;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; font-size: 14px; color: var(--text);
  counter-increment: step;
}
.quick-steps li::before {
  content: counter(step);
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; background: var(--primary-light);
  color: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.quick-steps li.done { background: #f0fdf4; border-color: #bbf7d0; }
.quick-steps li.done::before { background: var(--success); color: #fff; content: '✓'; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

.domain-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary);
  padding: 3px 10px; border-radius: 6px;
  font-weight: 500; font-size: 13px; font-family: monospace;
}
.kw-pill {
  background: #fef3c7; color: #92400e;
  padding: 3px 10px; border-radius: 6px;
  font-weight: 500; font-size: 13px;
}

.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 4px; }

/* Code blocks */
.code-wrap { position: relative; }
.code-block {
  background: #0f172a; color: #e2e8f0;
  padding: 16px; border-radius: var(--radius);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all;
  line-height: 1.5;
}
.copy-btn { position: absolute; top: 10px; right: 10px; }

/* ── Inbox ─────────────────────────────────────────────────── */
.inbox-layout {
  display: grid; grid-template-columns: 320px 1fr;
  gap: 16px; height: calc(100vh - 180px); min-height: 500px;
}
.inbox-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.inbox-item {
  display: flex; gap: 10px; padding: 12px 14px;
  cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.inbox-item:hover { background: var(--bg); }
.inbox-item.selected { background: var(--primary-light); }
.inbox-item.selected .inbox-name { color: var(--primary); }
.inbox-item.has-unread { background: #fff8e1; }
.inbox-item.has-unread .inbox-name { font-weight: 700; }
.inbox-avatar { position: relative; }
.dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.dot-online  { background: #22c55e; }
.dot-offline { background: #94a3b8; }
.unread-badge {
  display: inline-block; min-width: 20px; padding: 2px 6px;
  background: #ef4444; color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; margin-left: 6px;
  vertical-align: middle;
}
.inbox-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a855f7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
}
.inbox-meta { min-width: 0; flex: 1; }
.inbox-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.inbox-preview {
  font-size: 13px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inbox-domain { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: monospace; }

.inbox-thread {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.thread-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: var(--text-muted);
}
.thread-empty-icon { font-size: 48px; opacity: .4; }
.thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.thread-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a855f7); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.thread-name { font-weight: 600; font-size: 15px; }
.thread-domain { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.thread-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.msg { display: flex; flex-direction: column; max-width: 75%; }
.msg-bubble {
  padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.4;
  word-wrap: break-word;
}
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; padding: 0 6px; text-transform: capitalize; }
.msg-visitor { align-self: flex-start; }
.msg-visitor .msg-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-admin { align-self: flex-end; align-items: flex-end; }
.msg-admin .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-bot { align-self: flex-end; align-items: flex-end; }
.msg-bot .msg-bubble { background: #14b8a6; color: #fff; border-bottom-right-radius: 4px; }
.thread-reply {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.thread-reply input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 99px;
  font-size: 14px; outline: none;
}
.thread-reply input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.13);
}

/* ── Demo page ─────────────────────────────────────────────── */
.demo-page { background: var(--surface); }
.demo-hero { padding: 60px 0; }
.demo-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.5px; }
.demo-sub { color: var(--text-muted); font-size: 15px; max-width: 700px; margin-bottom: 18px; line-height: 1.6; }
.demo-page .code-block { max-width: 760px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .inbox-layout { grid-template-columns: 1fr; height: auto; min-height: auto; }
  .inbox-list { max-height: 320px; }
  .inbox-thread { min-height: 420px; }
}
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .app-main { margin-left: 200px; padding: 18px 16px; }
}
@media (max-width: 640px) {
  /* Stack the whole app — sidebar becomes a top bar */
  .app-page { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; left: 0; right: 0;
    width: 100%; height: auto;
    flex-direction: column; gap: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    z-index: 100;
  }
  .sidebar-brand {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    justify-content: space-between;
  }
  .sidebar-nav {
    display: flex; flex-direction: row;
    padding: 0; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-nav .nav-item {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 11px 14px; white-space: nowrap;
    font-size: 13px;
  }
  .sidebar-nav .nav-item.active {
    border-left: none;
    border-bottom-color: var(--primary);
    background: var(--sidebar-hover);
  }
  .sidebar-foot {
    flex-direction: row; align-items: center;
    padding: 10px 14px; gap: 10px;
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .sidebar-foot .user-pill { flex: 1; min-width: 0; }
  .sidebar-foot .btn-ghost { width: auto; flex-shrink: 0; }

  /* Main content takes full width */
  .app-main {
    margin-left: 0; padding: 16px;
    width: 100%; max-width: 100%;
    overflow-x: hidden;
  }

  /* Page headings stack */
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head h1 { font-size: 20px; }

  /* Cards a bit tighter */
  .card { padding: 16px; border-radius: var(--radius); }
  .card h3 { font-size: 15px; }

  /* Stats: 2 columns on mobile so they don't stretch huge */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  /* Forms — full width inputs */
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input,
  .inline-form input.grow,
  .inline-form button { width: 100%; min-width: 0; }

  /* Tables — let them scroll horizontally instead of overflowing the page */
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Inbox — full-screen feel */
  .inbox-layout { gap: 12px; }
  .inbox-list { max-height: 260px; }
  .inbox-thread { min-height: 60vh; }

  /* Code blocks: keep the copy button from overlapping the code */
  .code-block { padding: 14px; padding-top: 44px; font-size: 12px; }
  .copy-btn { top: 8px; right: 8px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .app-main { padding: 12px; }
}

/* ── Credit Package Grid ──────────────────────────────────────── */
/* ── Package Grid ───────────────────────────────────────────── */
.pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.pkg-card {
  cursor: pointer;
}

.pkg-card input[type="radio"] {
  display: none;
}

/* 🔥 Card base */
.pkg-inner {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 14px;
  text-align: center;
  position: relative;
  background: #ffffff;
  transition: all 0.25s ease;
}

/* 🔵 Hover effect */
.pkg-inner:hover {
  border-color: #60a5fa;
  box-shadow: 0 10px 25px rgba(96,165,250,0.25);
  transform: translateY(-4px);
}

/* 🟣 Selected effect */
.pkg-card input:checked + .pkg-inner {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.25),
              0 12px 30px rgba(124,58,237,0.3);
  transform: translateY(-4px) scale(1.02);
}

/* 🟡 Badge */
.pkg-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

/* 🔢 Credits */
.pkg-credits {
  font-size: 30px;
  font-weight: 800;
  color: #4f46e5;
}

/* 📌 Label */
.pkg-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

/* 🔥 Price box (separate color system) */
.pkg-price {
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 700;
  display: inline-block;
  font-size: 16px;
  transition: all 0.25s ease;
}

/* 💜 Selected হলে price change */
.pkg-card input:checked + .pkg-inner .pkg-price {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

/* 📊 Rate */
.pkg-rate {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

/* ── Payment Gateway Grid ───────────────────────────────────── */
.gw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.gw-card {
  cursor: pointer;
}

.gw-card input[type="radio"] {
  display: none;
}

/* 🔥 Gateway card */
.gw-inner {
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  transition: all 0.25s ease;
  background: #ffffff;
}

/* 🔵 Hover */
.gw-inner:hover {
  border-color: #60a5fa;
  box-shadow: 0 8px 20px rgba(96,165,250,0.25);
  transform: translateY(-3px);
}

/* 🟣 Selected */
.gw-card input:checked + .gw-inner {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.25),
              0 10px 25px rgba(124,58,237,0.3);
  transform: scale(1.02);
}

/* 🧾 Gateway text */
.gw-name {
  font-weight: 700;
  font-size: 15px;
}

.gw-type {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
}
/* ── Payment instruction box ─────────────────────────────────── */
.pay-instruction-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

/* ── Extra badge colours ─────────────────────────────────────── */
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

/* ── Alert info ──────────────────────────────────────────────── */
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: var(--radius);
  padding: 12px 16px;
}

/* ── Online / offline dot ────────────────────────────────────── */
.dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-left: 4px; vertical-align: middle;
}
.dot-online  { background: #16a34a; }
.dot-offline { background: #94a3b8; }
.unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  padding: 0 5px; vertical-align: middle; margin-left: 4px;
}
.inbox-item.has-unread { background: #f8f9ff; }

/* ── Pagination (Laravel default paginator) ──────────────────── */
nav[aria-label="Pagination Navigation"] {
  display: flex; justify-content: center; gap: 4px; padding: 8px 0;
}
nav[aria-label="Pagination Navigation"] span,
nav[aria-label="Pagination Navigation"] a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; text-decoration: none; color: var(--text);
}
nav[aria-label="Pagination Navigation"] a:hover { border-color: var(--primary); color: var(--primary); }
nav[aria-label="Pagination Navigation"] [aria-current="page"] span {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ── Admin Quick Actions ──────────────────────────────────── */
.quick-actions {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-top: 12px;
}
.qa-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.qa-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.qa-btn.qa-primary { border-color: #f59e0b; background: #fffbeb; }
.qa-icon  { font-size: 24px; flex-shrink: 0; }
.qa-label { font-weight: 600; font-size: 14px; }
.qa-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Payment card (admin payments page) ───────────────────── */
.pay-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 14px;
  overflow: hidden;
}
.pay-card-pending { border-color: #f59e0b; }
.pay-card-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: #fafbfc;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.pay-card-meta { display: flex; align-items: center; gap: 10px; }
.pay-card-user { font-size: 14px; }
.pay-card-body { padding: 18px 20px; }
.pay-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.pay-detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.pay-detail-val   { font-size: 14px; }
.txid { background: #f1f5f9; padding: 2px 8px; border-radius: 5px; font-size: 13px; }
.pay-card-actions { border-top: 1px solid var(--border); padding-top: 14px; }
.pay-note-input {
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; width: 220px;
}
.pay-note-input:focus { outline: none; border-color: var(--primary); }

/* ── Admin payments filter btn-group ─────────────────────── */
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── User table extras ────────────────────────────────────── */
.user-email-pill { display: flex; align-items: center; gap: 8px; }
.user-mini-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.credit-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
}
.credit-ok    { background: #dcfce7; color: #166534; }
.credit-low   { background: #fef9c3; color: #854d0e; }
.credit-empty { background: #fee2e2; color: #991b1b; }
.credit-form  { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Search form ──────────────────────────────────────────── */
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input {
  padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; min-width: 200px;
}
.search-form input:focus { outline: none; border-color: var(--primary); }

/* ── nav-credit-badge ─────────────────────────────────────── */
.nav-credit-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); color: #fff;
  border-radius: 12px; padding: 1px 8px; font-size: 11px; font-weight: 700;
  margin-left: 6px;
}
.nav-item-admin { color: #fbbf24 !important; margin-top: 4px; }

/* ── Sender label in messages ─────────────────────────────── */
.sender-lbl {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.sender-visitor { background: #dbeafe; color: #1e40af; }
.sender-admin   { background: #d1fae5; color: #065f46; }
.sender-bot     { background: #fef3c7; color: #92400e; }

/* ── Misc utility ─────────────────────────────────────────── */
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.text-danger  { color: var(--danger); }
.btn-success  { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }

