/* dashboard.css — mailai.in dashboard styles [OPTIMIZED & COMPACT] */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800;900&family=DM+Mono:wght@400;500&display=swap');

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

:root {
    --brand:      #4f46e5;
    --brand-dark: #3730a3;
    --brand-lt:   #eef2ff;
    --teal:       #0d9488;
    --green:      #16a34a;
    --amber:      #d97706;
    --red:        #dc2626;
    --slate-9:    #0f172a;
    --slate-7:    #334155;
    --slate-5:    #64748b;
    --slate-3:    #cbd5e1;
    --slate-1:    #f8fafc;
    --slate-2:    #f1f5f9;
    --border:     #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
    --card-shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --radius:     12px;
    --font:       'DM Sans', system-ui, sans-serif;
    --mono:       'DM Mono', monospace;
}

body { font-family: var(--font); background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); min-height: 100vh; }

/* ── Main Layout ────────────────────────────────────────── */
.dash-wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; }

/* ── Navigation pill ────────────────────────────────────── */
.site-nav {
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    margin-bottom: 32px;
}
.site-nav-inner {
    max-width: 1200px; margin: 0 auto;
    padding: 0 20px;
    display: flex; align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand { font-weight: 900; font-size: 1.05rem; color: var(--brand); letter-spacing: -0.5px; text-decoration: none; }
.site-nav-pill {
    display: flex; align-items: center;
    background: var(--slate-2); border-radius: 10px;
    padding: 4px; gap: 2px;
}
.snav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    border: none; background: transparent;
    font-size: 0.85rem; font-weight: 700; color: var(--slate-5);
    text-decoration: none; font-family: var(--font);
    transition: all .2s; white-space: nowrap;
    letter-spacing: -.05px; cursor: pointer;
}
.snav-btn:hover { background: #fff; color: var(--slate-9); }
.snav-btn.active {
    background: linear-gradient(135deg, var(--brand), #6366f1);
    color: #fff;
}
@media(max-width:540px){ .snav-btn { padding: 8px 12px; font-size: 0.8rem; gap: 4px; } }
@media(max-width:400px){ .snav-btn span.nav-lbl { display: none; } }

/* ── Compact Hero ───────────────────────────────────────── */
.dash-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    color: #fff; 
    position: relative; 
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(79,70,229,.12);
}
.dash-hero::before {
    content: ''; position: absolute; top: -50px; right: -50px;
    width: 200px; height: 200px; background: rgba(255,255,255,.06); border-radius: 50%;
}
.dash-hero::after {
    content: ''; position: absolute; bottom: -70px; right: 60px;
    width: 150px; height: 150px; background: rgba(255,255,255,.04); border-radius: 50%;
}
.hero-badge {
    display: inline-flex; align-items: center;
    padding: 4px 12px; border-radius: 20px;
    font-weight: 800; letter-spacing: 0.5px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
}
.hero-badge.free  { background: rgba(255,255,255,.16); color: rgba(255,255,255,.9); }
.hero-badge.solo  { background: #3b82f6; border-color: #2563eb; color: #fff; }
.hero-badge.pro   { background: linear-gradient(135deg,#7c3aed,#4f46e5); border-color: #6d28d9; color: #fff; }
.hero-badge.trial { background: #16a34a; border-color: #15803d; color: #fff; }
.compact-topup:hover { background: #fff !important; color: var(--brand-dark) !important; }

/* ── Section Label ──────────────────────────────────────── */
.section-label {
    font-size: 1.05rem; font-weight: 700; text-transform: none; letter-spacing: -0.1px;
    color: var(--slate-9); margin: 20px 0 12px; padding-left: 2px;
    display: flex; align-items: center; gap: 6px;
}

/* ── Card Base ──────────────────────────────────────────– */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 18px;
    transition: all .25s ease;
}
.card:hover {
    border-color: rgba(79,70,229,.1);
    box-shadow: var(--card-shadow-md);
}
.card-body { padding: 20px 24px; }

/* ── Plan Banner ────────────────────────────────────────– */
.plan-banner {
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, var(--brand-lt) 0%, rgba(79,70,229,.05) 100%);
    border: 1.5px solid var(--brand);
    border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.plan-banner-l { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.plan-pill {
    display: inline-flex; align-items: center; padding: 6px 14px;
    background: var(--brand); color: #fff; border-radius: 20px; font-size: 0.7rem; font-weight: 800; white-space: nowrap;
}
.plan-title { font-size: 1rem; font-weight: 800; color: var(--slate-9); margin: 0; }
.plan-sub { font-size: 0.85rem; color: var(--slate-5); margin: 4px 0 0; }
.btn-plan {
    padding: 10px 20px; background: linear-gradient(135deg, var(--brand), #6366f1);
    color: #fff; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 700;
    cursor: pointer; transition: all .25s; white-space: nowrap; box-shadow: 0 2px 8px rgba(79,70,229,.2);
}
.btn-plan:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(79,70,229,.3); }

/* ── Missed Alert ────────────────────────────────────────– */
.missed-alert {
    display: none; background: #fff7ed; border: 1.5px solid #fed7aa;
    border-radius: 10px; padding: 14px 18px; margin-bottom: 18px;
    font-size: 0.875rem; color: #9a3412; font-weight: 500; line-height: 1.6;
}
.missed-alert a { color: #c2410c; font-weight: 700; }

/* ── Compact Inbox Cards ────────────────────────────────── */
.ic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.ic-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 8px 12px; background: linear-gradient(135deg, var(--slate-2) 0%, #fff 100%);
    border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .25s ease; text-align: center;
}
.ic-tab:hover { border-color: var(--brand); background: linear-gradient(135deg, var(--brand-lt) 0%, #fff 100%); transform: translateY(-2px); }
.ic-label { font-size: 0.75rem; color: var(--slate-5); font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
.ic-count { font-size: 1.3rem; font-weight: 900; color: var(--brand); line-height: 1; }
.ic-badge-new { font-size: 0.65rem; color: #fff; background: #dc2626; padding: 2px 6px; border-radius: 12px; margin-top: 6px; font-weight: 700; }
.inbox-nopro {
    display: none; padding: 20px; background: #fef2f2; border: 1.5px solid #fee2e2;
    border-radius: 10px; color: #991b1b; text-align: center; font-size: 0.875rem; margin-bottom: 18px;
}
.inbox-nopro a { color: #dc2626; font-weight: 700; }

/* ── 1-Row Certificates View ────────────────────────────── */
.cert-grid { display: flex; flex-direction: column; gap: 10px; }
.cert-item {
    display: flex; flex-direction: row; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; transition: all .25s ease;
}
.cert-item:hover { border-color: var(--brand); box-shadow: 0 4px 12px rgba(79,70,229,.08); transform: translateY(-2px); }
.cert-item > div:first-child { display: flex; flex-direction: row; align-items: center; gap: 16px; flex-wrap: wrap; }
.cert-medal { font-size: 1.5rem; margin: 0; }
.cert-month { font-size: 0.95rem; font-weight: 700; color: #1e293b; min-width: 100px; margin: 0; }
.cert-rank { font-size: 0.8rem; color: #64748b; background: #e2e8f0; padding: 3px 8px; border-radius: 6px; font-weight: 600; margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.cert-bp { font-size: 0.8rem; font-weight: 700; color: var(--brand); background: var(--brand-lt); padding: 3px 8px; border-radius: 6px; margin: 0; }
.cert-actions { display: flex; gap: 8px; }
.cert-btn {
    padding: 6px 12px; font-size: 0.8rem; border-radius: 7px; font-weight: 700; margin: 0;
    border: 1.5px solid var(--border); background: #fff; color: var(--slate-7); cursor: pointer;
    text-decoration: none; transition: all .2s; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.cert-btn:hover { border-color: var(--brand); background: var(--brand-lt); color: var(--brand); }
.cert-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.cert-btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.cert-empty { text-align: center; padding: 40px 20px; background: #f8fafc; border: 1.5px dashed var(--border); border-radius: 10px; color: var(--slate-5); }
.cert-empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.6; }
.cert-empty-title { font-weight: 800; color: var(--slate-7); margin-bottom: 6px; }
.cert-empty-sub { font-size: 0.85rem; line-height: 1.5; }

/* ── Alert Box & Modals ─────────────────────────────────── */
.alert-box { display: none; padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 0.875rem; font-weight: 500; line-height: 1.6; }
.alert-box.error { background: #fef2f2; border: 1.5px solid #fee2e2; color: #991b1b; }
.alert-box.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #15803d; }
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.modal-bg.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 32px; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-box h2 { font-size: 1.15rem; font-weight: 900; margin: 0 0 6px; color: var(--slate-9); }
.modal-box .modal-sub { color: var(--slate-5); font-size: 0.85rem; margin: 0 0 20px; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-btn { flex: 1; padding: 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.8rem; font-weight: 700; cursor: pointer; font-family: var(--font); background: #fff; color: var(--slate-5); transition: all .2s; text-align: center; }
.tab-btn.active { background: var(--slate-9); color: #fff; border-color: var(--slate-9); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Trial Banner ───────────────────────────────────────– */
#trialBanner { margin-bottom: 18px; }
.trial-cta { border-radius: 12px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.trial-cta.warn-2  { background: linear-gradient(135deg,#fffbeb,#fef3c7); border: 1.5px solid #f59e0b; }
.trial-cta.warn-1  { background: linear-gradient(135deg,#fff7ed,#ffedd5); border: 1.5px solid #ea580c; }
.trial-cta.warn-0  { background: linear-gradient(135deg,#fef2f2,#fee2e2); border: 1.5px solid #dc2626; animation: pulse-border 2s ease-in-out infinite; }
.trial-cta.expired-extend  { background: linear-gradient(135deg,#f0fdf4,#dcfce7); border: 1.5px solid #16a34a; }
.trial-cta.expired-upgrade { background: linear-gradient(135deg,#fef2f2,#fee2e2); border: 1.5px solid #dc2626; }
@keyframes pulse-border { 0%,100%{box-shadow:0 4px 16px rgba(220,38,38,.15)} 50%{box-shadow:0 4px 24px rgba(220,38,38,.35)} }
.tcta-left { flex: 1; min-width: 220px; }
.tcta-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.warn-2 .tcta-badge { background: #f59e0b; color: #fff; }
.warn-1 .tcta-badge { background: #ea580c; color: #fff; }
.warn-0 .tcta-badge { background: #dc2626; color: #fff; }
.expired-extend .tcta-badge  { background: #16a34a; color: #fff; }
.expired-upgrade .tcta-badge { background: #dc2626; color: #fff; }
.tcta-heading { font-size: 1.05rem; font-weight: 900; color: var(--slate-9); letter-spacing: -0.3px; margin: 0 0 4px; }
.warn-0 .tcta-heading, .expired-upgrade .tcta-heading { color: #991b1b; }
.tcta-sub { font-size: 0.85rem; color: var(--slate-5); margin: 0; line-height: 1.5; }
.warn-0 .tcta-sub, .warn-1 .tcta-sub { font-weight: 600; }
.tcta-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; flex-shrink: 0; }
.trial-progress-wrap { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.trial-progress-bar  { flex: 1; height: 5px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.trial-progress-fill { height: 100%; border-radius: 5px; transition: width .5s; }
.trial-progress-lbl  { font-size: 0.7rem; font-weight: 700; color: #94a3b8; white-space: nowrap; }
.btn-upgrade-now { display: inline-block; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 800; font-family: var(--font); text-decoration: none; text-align: center; transition: all 0.25s; white-space: nowrap; background: linear-gradient(135deg, var(--brand), #6366f1); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.25); }
.btn-upgrade-now:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(79,70,229,.35); }
.warn-0 .btn-upgrade-now, .expired-upgrade .btn-upgrade-now { background: linear-gradient(135deg,#dc2626,#ef4444); box-shadow: 0 2px 8px rgba(220,38,38,.25); }
.expired-extend .btn-upgrade-now { background: linear-gradient(135deg,#15803d,#16a34a); box-shadow: 0 2px 8px rgba(22,163,74,.2); }

/* ── Setup Hub ──────────────────────────────────────────── */
.setup-hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.setup-card { display: flex; align-items: flex-start; gap: 14px; padding: 20px 18px; background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--slate-9); box-shadow: var(--card-shadow); transition: all .22s ease; position: relative; overflow: hidden; }
.setup-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border); transition: background .22s; }
.setup-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-md); border-color: rgba(79,70,229,.2); }
.setup-card.sc-warn { border-color: #fca5a5; background: #fff9f9; }
.setup-card.sc-warn::before { background: #dc2626; }
.setup-card.sc-warn:hover { border-color: #dc2626; }
.setup-card.sc-done { border-color: #86efac; background: #f6fef8; }
.setup-card.sc-done::before { background: #16a34a; }
.setup-card.sc-done:hover { border-color: #16a34a; }
.sc-icon { font-size: 1.6rem; flex-shrink: 0; margin-top: 1px; }
.sc-body { flex: 1; min-width: 0; }
.sc-title { font-size: 0.9rem; font-weight: 800; color: var(--slate-9); margin-bottom: 4px; }
.sc-sub { font-size: 0.8rem; color: var(--slate-5); line-height: 1.5; margin-bottom: 6px; }
.sc-progress-wrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.sc-progress-bg { flex: 1; height: 6px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.sc-progress-fill { height: 100%; border-radius: 6px; background: var(--brand); transition: width .4s ease, background .4s; }
.sc-pct { font-size: 0.72rem; font-weight: 800; color: var(--slate-5); white-space: nowrap; }
.sc-badge { flex-shrink: 0; display: flex; align-items: flex-start; padding-top: 2px; }
.sc-badge-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 0.68rem; font-weight: 800; white-space: nowrap; }
.sc-badge-chip.warn { background: #fee2e2; color: #b91c1c; }
.sc-badge-chip.done { background: #dcfce7; color: #15803d; }
.sc-email-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.sc-email-tag { font-size: 0.68rem; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: #f1f5f9; color: var(--slate-5); font-family: var(--mono); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Fixed Top Toast & Forms ────────────────────────────── */
.top-toast { position: fixed; top: 68px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 9999; padding: 12px 28px; border-radius: 50px; font-size: 0.9rem; font-weight: 700; box-shadow: 0 8px 32px rgba(0,0,0,.15); display: none; white-space: nowrap; max-width: 90vw; text-align: center; transition: opacity .25s, transform .25s; pointer-events: none; }
.top-toast.visible { display: block; animation: toastSlideIn .22s cubic-bezier(.34,1.56,.64,1) forwards; }
.top-toast.success { background: #d1fae5; color: #065f46; border: 1.5px solid #6ee7b7; }
.top-toast.error   { background: #fee2e2; color: #991b1b; border: 1.5px solid #fca5a5; }
@keyframes toastSlideIn { from { opacity: 0; transform: translateX(-50%) translateY(-16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; color: #374151; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.875rem; font-family: var(--font); outline: none; transition: border-color .2s; }
.form-group input:focus { border-color: var(--brand); }

/* ── Responsive Mobile ──────────────────────────────────── */
@media(max-width:760px) { .setup-hub { grid-template-columns: 1fr; } }
@media(max-width:640px) {
    .dash-wrap { padding: 0 16px 60px; }
    .dash-hero { padding: 20px 16px; margin-bottom: 20px; }
    .plan-banner { padding: 16px; flex-direction: column; }
    .btn-plan { width: 100%; }
    .tcta-actions { width: 100%; align-items: stretch; }
    .btn-upgrade-now { display: block; width: 100%; }
    .section-label { font-size: 0.95rem; margin-top: 24px; margin-bottom: 12px; }
}
@media(max-width: 600px) {
    .cert-item { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
    .cert-actions { width: 100%; justify-content: flex-end; }
}