/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:        #f5f7fa;
    --surface:   #ffffff;
    --elevated:  #ffffff;
    --border:    #e2e6ee;
    --border-lt: #e8ecf2;
    --text:      #374151;
    --text-sec:  #6b7280;
    --text-mute: #9ca3af;
    --white:     #111827;
    --accent:    #2563eb;
    --accent-h:  #1d4ed8;
    --danger:    #b91c1c;
    --danger-lt: #dc2626;
    --danger-bg: #fef2f2;
    --success:   #15803d;
    --success-lt: #16a34a;
    --radius:    6px;
    --radius-lg: 10px;
    --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; color: var(--white); }
ul { padding-left: 20px; }
li { margin-bottom: 6px; }

/* ── Screens ────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Layout ─────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border-lt); border-color: var(--text-mute); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; }

/* ── Landing Header ─────────────────────────────────── */
.brand { font-weight: 700; font-size: 18px; color: var(--white); letter-spacing: -0.3px; }
.brand:hover { text-decoration: none; color: var(--white); }

.landing-header { padding: 20px 0; border-bottom: 1px solid var(--border); }
.landing-header .container { display: flex; justify-content: space-between; align-items: center; }
.landing-nav { display: flex; align-items: center; gap: 28px; }
.landing-nav a { color: var(--text-sec); font-size: 14px; font-weight: 500; }
.landing-nav a:hover { color: var(--white); text-decoration: none; }
.nav-cta { padding: 7px 18px; border: 1px solid var(--accent); border-radius: var(--radius); color: var(--accent) !important; }
.nav-cta:hover { background: var(--accent); color: #fff !important; text-decoration: none; }

/* ── Hero ───────────────────────────────────────────── */
.hero { padding: 100px 0 80px; }
.hero-content { max-width: 640px; }
.hero-tag { font-size: 13px; font-weight: 500; color: var(--accent); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 16px; }
.hero h1 { font-size: 44px; font-weight: 700; line-height: 1.15; color: var(--white); letter-spacing: -1px; margin-bottom: 20px; }
.hero-sub { font-size: 17px; line-height: 1.7; color: var(--text-sec); margin-bottom: 36px; max-width: 540px; }
.hero-actions { display: flex; gap: 12px; }
.hero-proof { font-size: 13px; color: var(--text-mute); margin-top: 20px; }

/* ── How it works ───────────────────────────────────── */
.how-it-works { padding: 64px 0; border-top: 1px solid var(--border); }
.how-it-works h2 { font-size: 24px; font-weight: 600; color: var(--white); margin-bottom: 36px; }
.steps-row { display: flex; align-items: flex-start; gap: 24px; }
.step { flex: 1; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--accent); background: #eff6ff; border-radius: 50%; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.step p { font-size: 14px; color: var(--text-sec); line-height: 1.6; }
.step-arrow { color: var(--text-mute); font-size: 20px; padding-top: 2px; }

/* ── Why SafeType (benefits) ─────────────────────────── */
.why-safetype { padding: 64px 0; border-top: 1px solid var(--border); }
.why-safetype h2 { font-size: 24px; font-weight: 600; color: var(--white); margin-bottom: 36px; }
.benefits-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.benefit-card { padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.benefit-card h3 { font-size: 16px; font-weight: 600; color: var(--white); margin-bottom: 8px; }
.benefit-card p { font-size: 14px; color: var(--text-sec); line-height: 1.7; margin: 0; }

/* ── Safety & transparency ───────────────────────────── */
.safety-transparency { padding: 64px 0; border-top: 1px solid var(--border); }
.safety-transparency h2 { font-size: 24px; font-weight: 600; color: var(--white); margin-bottom: 12px; }
.safety-lead { font-size: 16px; color: var(--text-sec); margin-bottom: 20px; max-width: 640px; }
.safety-list { list-style: none; padding-left: 0; max-width: 640px; }
.safety-list li { margin-bottom: 14px; font-size: 14px; color: var(--text-sec); line-height: 1.7; padding-left: 0; }

/* ── Duke research & model roadmap ──────────────────── */
.duke-research { padding: 64px 0; border-top: 1px solid var(--border); }
.duke-research h2 { font-size: 24px; font-weight: 600; color: var(--white); margin-bottom: 16px; }
.duke-lead { font-size: 16px; color: var(--text-sec); line-height: 1.7; margin-bottom: 28px; max-width: 720px; }
.model-roadmap { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.roadmap-item { padding: 16px 20px; background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.roadmap-label { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.roadmap-item p { font-size: 14px; color: var(--text-sec); line-height: 1.7; margin: 0; }

/* ── CTA strip ───────────────────────────────────────── */
.cta-strip { padding: 56px 0; border-top: 1px solid var(--border); }
.cta-strip h2 { font-size: 22px; font-weight: 600; color: var(--white); margin-bottom: 8px; }
.cta-strip-sub { font-size: 15px; color: var(--text-sec); margin-bottom: 24px; }
.cta-strip-actions { display: flex; gap: 12px; }

/* ── FAQ ─────────────────────────────────────────────── */
.faq-section { padding: 48px 0 64px; border-top: 1px solid var(--border); }
.faq-section h2 { font-size: 24px; font-weight: 600; color: var(--white); margin-bottom: 24px; }
.faq-list { margin: 0; }
.faq-list dt { font-size: 15px; font-weight: 600; color: var(--white); margin-top: 20px; margin-bottom: 6px; }
.faq-list dt:first-child { margin-top: 0; }
.faq-list dd { font-size: 14px; color: var(--text-sec); line-height: 1.7; margin: 0 0 0 0; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.faq-list dd:last-child { padding-bottom: 0; border-bottom: none; }

/* ── Footer ─────────────────────────────────────────── */
.landing-footer { padding: 32px 0; border-top: 1px solid var(--border); }
.landing-footer .container { display: flex; justify-content: space-between; align-items: center; }
.brand-sm { font-weight: 600; font-size: 14px; color: var(--text-sec); }
.footer-note { font-size: 13px; color: var(--text-mute); }

/* ── Page Header (setup, login) ─────────────────────── */
.page-header { padding: 16px 0; border-bottom: 1px solid var(--border); }
.page-header .container { display: flex; justify-content: space-between; align-items: center; }
.page-header-nav { display: flex; align-items: center; gap: 16px; }
.back-link { font-size: 14px; color: var(--text-sec); font-weight: 500; }
.back-link:hover { color: var(--white); text-decoration: none; }

/* ── Setup Guide ────────────────────────────────────── */
.setup-content { padding: 56px 0 80px; }
.setup-content h1 { font-size: 32px; font-weight: 700; color: var(--white); margin-bottom: 12px; }
.setup-intro { font-size: 16px; color: var(--text-sec); margin-bottom: 48px; max-width: 520px; }

.setup-steps { display: flex; flex-direction: column; gap: 0; }
.setup-step { display: flex; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.setup-step:first-child { padding-top: 0; }
.step-marker { flex-shrink: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--accent); background: #eff6ff; border-radius: 50%; font-size: 14px; font-weight: 600; color: var(--accent); }
.step-body h3 { font-size: 16px; font-weight: 600; color: var(--white); margin-bottom: 8px; }
.step-body p { font-size: 14px; color: var(--text-sec); line-height: 1.7; margin-bottom: 8px; }
.step-body ul { margin-top: 8px; margin-bottom: 12px; }
.step-body li { font-size: 14px; color: var(--text-sec); line-height: 1.6; }
.step-body .btn { margin-top: 8px; }

.setup-note { margin-top: 40px; padding: 16px 20px; background: #eff6ff; border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; font-size: 14px; color: var(--text-sec); line-height: 1.7; }

/* ── Model & research page ───────────────────────────── */
.model-page-content { padding: 48px 0 80px; }
.model-page-content h1 { font-size: 32px; font-weight: 700; color: var(--white); margin-bottom: 12px; }
.model-page-lead { font-size: 17px; color: var(--text-sec); line-height: 1.7; margin-bottom: 40px; }
.model-block { margin-bottom: 40px; }
.model-block h2 { font-size: 20px; font-weight: 600; color: var(--white); margin-bottom: 12px; }
.model-block h3 { font-size: 16px; font-weight: 600; color: var(--white); margin-top: 20px; margin-bottom: 8px; }
.model-block p { font-size: 15px; color: var(--text); line-height: 1.7; margin-bottom: 12px; }
.model-spec-list { list-style: none; padding-left: 0; margin: 12px 0; }
.model-spec-list li { margin-bottom: 8px; font-size: 14px; color: var(--text-sec); line-height: 1.6; padding-left: 0; }
.model-spec-list code { font-size: 13px; background: var(--border-lt); padding: 2px 6px; border-radius: 4px; color: var(--text); }
.model-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.model-table th, .model-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.model-table th { font-weight: 600; color: var(--white); background: var(--border-lt); }
.model-table td { color: var(--text-sec); }
.model-page-back { margin-top: 32px; }

/* ── Login ──────────────────────────────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 53px); padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.login-card h1 { font-size: 24px; font-weight: 700; color: var(--white); margin-bottom: 6px; }
.login-sub { color: var(--text-sec); font-size: 14px; margin-bottom: 28px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-sec); margin-bottom: 6px; }
.field input, .field select {
    width: 100%; padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--white);
    font-size: 14px; font-family: var(--font); outline: none;
    transition: border-color 0.15s;
}
.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-mute); }

.error-msg { margin-top: 16px; padding: 10px 14px; background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); font-size: 13px; }

/* ── Dashboard Nav ──────────────────────────────────── */
.dash-nav { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.dash-nav-left { display: flex; align-items: center; }
.dash-nav-right { display: flex; align-items: center; gap: 12px; }

.status-pill { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-pill.online { background: #dcfce7; color: var(--success); border: 1px solid #86efac; }
.status-pill.offline { background: #f3f4f6; color: var(--text-mute); border: 1px solid var(--border); }

/* ── Stats Strip ────────────────────────────────────── */
.stats-strip { display: flex; align-items: center; padding: 20px 24px; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.stat { padding: 0 28px; }
.stat:first-child { padding-left: 0; }
.stat-val { display: block; font-size: 28px; font-weight: 700; color: var(--white); line-height: 1.2; }
.stat-lbl { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.stat--danger .stat-val { color: var(--danger); }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* ── Controls Bar ───────────────────────────────────── */
.controls-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select {
    padding: 6px 10px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-size: 13px;
    font-family: var(--font); outline: none; cursor: pointer;
}
.filters select:focus { border-color: var(--accent); }
.control-actions { display: flex; align-items: center; gap: 8px; }
.analyze-status { font-size: 12px; padding: 2px 8px; }
.analyze-status.success { color: var(--success); }
.analyze-status.error { color: var(--danger); }

/* ── Settings Panel ─────────────────────────────────── */
.settings-panel {
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.settings-inner {
    max-width: 560px;
    padding: 20px 0;
}
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.settings-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    margin: 0;
}
.settings-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-mute);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.settings-close:hover { color: var(--white); }
.settings-body .field { margin-bottom: 14px; }
.settings-body input[type="url"] {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--white);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}
.settings-body input[type="url"]:focus { border-color: var(--accent); }
.field-hint {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 4px;
    margin-bottom: 0;
}
.settings-info {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.settings-info p {
    font-size: 13px;
    color: var(--text-sec);
    line-height: 1.6;
    margin: 0 0 6px;
}
.settings-info p:last-child { margin-bottom: 0; }
.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.settings-status { font-size: 12px; }
.settings-status.success { color: var(--success); }
.settings-status.error { color: var(--danger); }

/* ── Alerts ─────────────────────────────────────────── */
.alerts-section { padding: 20px 24px; }
.container-dash { max-width: 100%; }
.alerts-title { font-size: 14px; font-weight: 600; color: var(--danger); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.alerts-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--danger-bg); border-left: 3px solid var(--danger); border-radius: 0 var(--radius) var(--radius) 0; }
.alert-item .alert-text { flex: 1; font-size: 14px; color: var(--danger); }
.alert-item .alert-meta { font-size: 12px; color: var(--text-sec); text-align: right; min-width: 120px; }

/* ── Messages Table ─────────────────────────────────── */
.table-wrap { padding: 0 24px 24px; overflow-x: auto; }
.msg-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.msg-table th { text-align: left; padding: 12px 12px 12px 0; font-size: 11px; font-weight: 600; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.msg-table td { padding: 10px 12px 10px 0; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.msg-table tr:hover { background: #f8fafc; }
.msg-table .empty-state { text-align: center; color: var(--text-mute); padding: 48px 0; font-style: italic; font-size: 14px; }

/* ── App badges ─────────────────────────────────────── */
.app-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.2px; }
.app-badge.whatsapp { background: #dcfce7; color: #15803d; }
.app-badge.messages { background: #dbeafe; color: #1d4ed8; }
.app-badge.instagram { background: #f3e8ff; color: #7c3aed; }
.app-badge.snapchat { background: #fef9c3; color: #a16207; }
.app-badge.keyboard { background: #f3f4f6; color: var(--text-sec); }
.app-badge.other { background: #f3f4f6; color: var(--text-sec); }

/* Direction */
.dir-badge { font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.dir-badge.incoming { background: #dbeafe; color: #1d4ed8; }
.dir-badge.outgoing { background: #dcfce7; color: #15803d; }
.dir-badge.unknown { background: #f3f4f6; color: var(--text-mute); }

/* Source */
.source-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #f3f4f6; color: var(--text-sec); }

/* Flags */
.flag-safe { color: var(--success); font-size: 13px; }
.flag-danger { color: var(--danger); font-weight: 600; font-size: 13px; }
.flag-pending { color: var(--text-mute); font-size: 13px; }

/* Message text */
.msg-text { max-width: 380px; word-break: break-word; }
.msg-text.flagged-text { color: var(--danger); background: var(--danger-bg); padding: 4px 8px; border-radius: 4px; border-left: 2px solid var(--danger); }

/* Load More */
.load-more { text-align: center; padding: 16px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .hero { padding: 60px 0 48px; }
    .hero h1 { font-size: 30px; }
    .hero-sub { font-size: 15px; }
    .benefits-grid { grid-template-columns: 1fr; gap: 16px; }
    .why-safetype, .safety-transparency, .duke-research, .cta-strip { padding: 48px 0; }
    .steps-row { flex-direction: column; }
    .step-arrow { display: none; }
    .stats-strip { flex-wrap: wrap; gap: 16px; padding: 16px 24px; }
    .stat { padding: 0 16px; }
    .stat-divider { display: none; }
    .controls-bar { flex-direction: column; align-items: flex-start; }
    .msg-table { font-size: 13px; }
    .msg-text { max-width: 180px; }
    .setup-step { flex-direction: column; gap: 12px; }
    .landing-nav { gap: 16px; }
    .hero-actions { flex-direction: column; }
    .cta-strip-actions { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 26px; }
    .stat-val { font-size: 22px; }
    .landing-header .container { flex-direction: column; gap: 12px; align-items: flex-start; }
    .why-safetype h2, .safety-transparency h2, .duke-research h2, .faq-section h2 { font-size: 20px; }
    .faq-section { padding: 32px 0 48px; }
}
