/* TruSent — Dashboard */

:root {
    --blue: #1a56db; --blue-light: #eff6ff; --blue-dark: #1e40af;
    --green: #059669; --green-light: #ecfdf5;
    --red: #dc2626; --red-light: #fef2f2;
    --orange: #d97706; --orange-light: #fffbeb;
    --purple: #7c3aed; --purple-light: #f5f3ff;
    --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
    --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
    --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937;
    --radius: 12px; --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--gray-50); color: var(--gray-800);
    line-height: 1.6; -webkit-font-smoothing: antialiased;
}

.view { min-height: 100vh; }

/* ── Login ─────────────────────────────────────────── */
.login-container {
    max-width: 380px; margin: 0 auto; padding: 60px 24px;
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-header .logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-header h1 { font-size: 24px; font-weight: 800; color: var(--blue-dark); }
.login-header p { color: var(--gray-500); font-size: 14px; }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form input {
    padding: 12px 14px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 16px; font-family: inherit; background: white;
}
.login-form input:focus { outline: none; border-color: var(--blue); }
.login-error { color: var(--red); font-size: 13px; text-align: center; }
.login-register { text-align: center; margin-top: 16px; font-size: 13px; color: var(--gray-500); }
.login-register a { color: var(--blue); }

/* ── Nav ───────────────────────────────────────────── */
.nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: white; border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-logo { font-size: 24px; }
.nav-title { font-size: 16px; font-weight: 700; color: var(--blue-dark); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 13px; color: var(--gray-500); }
.nav-btn {
    padding: 6px 12px; font-size: 12px; border: 1px solid var(--gray-300);
    border-radius: 6px; background: white; cursor: pointer; font-family: inherit;
}

/* ── Tabs ──────────────────────────────────────────── */
.tabs {
    display: flex; gap: 0; background: white; border-bottom: 1px solid var(--gray-200);
    padding: 0 16px; overflow-x: auto;
}
.tab {
    padding: 12px 16px; font-size: 14px; font-weight: 500; border: none;
    background: none; color: var(--gray-500); cursor: pointer;
    border-bottom: 2px solid transparent; font-family: inherit; white-space: nowrap;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-content { display: none; padding: 20px 16px; max-width: 720px; margin: 0 auto; }
.tab-content.active { display: block; }

/* ── Stats Grid ────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card {
    padding: 16px; border-radius: var(--radius); text-align: center;
}
.stat-card.blue { background: var(--blue-light); }
.stat-card.green { background: var(--green-light); }
.stat-card.orange { background: var(--orange-light); }
.stat-card.purple { background: var(--purple-light); }

.stat-number { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-card.blue .stat-number { color: var(--blue); }
.stat-card.green .stat-number { color: var(--green); }
.stat-card.orange .stat-number { color: var(--orange); }
.stat-card.purple .stat-number { color: var(--purple); }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }

/* ── Sections ──────────────────────────────────────── */
.section {
    background: white; border-radius: var(--radius); padding: 18px;
    margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.section h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h2 { margin-bottom: 0; }

/* ── Global Stats ──────────────────────────────────── */
.global-stats { display: flex; gap: 20px; }
.gs-item { flex: 1; text-align: center; }
.gs-number { display: block; font-size: 24px; font-weight: 800; color: var(--blue); }
.gs-label { font-size: 12px; color: var(--gray-500); }

/* ── Alerts ────────────────────────────────────────── */
.alerts-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px;
    border-radius: var(--radius-sm); background: var(--gray-50); border: 1px solid var(--gray-100);
}
.alert-item.unread { background: var(--blue-light); border-color: #dbeafe; }
.alert-item.high { background: var(--red-light); border-color: #fee2e2; }

.alert-icon { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.alert-body { flex: 1; min-width: 0; }
.alert-domain { font-size: 14px; font-weight: 600; font-family: monospace; word-break: break-all; }
.alert-text { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.alert-meta { display: flex; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--gray-400); }
.alert-score { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.alert-score.safe { color: var(--green); }
.alert-score.high { color: var(--red); }
.alert-score.medium { color: var(--orange); }

.empty { color: var(--gray-400); font-size: 14px; text-align: center; padding: 20px; }

/* ── Family ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--gray-500); margin-bottom: 20px; }

.family-actions { max-width: 360px; margin: 0 auto; }
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.inline-form input { flex: 1; padding: 10px 12px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; }
.inline-form input:focus { outline: none; border-color: var(--blue); }
.divider { text-align: center; color: var(--gray-400); font-size: 13px; margin: 8px 0; }

.family-header { margin-bottom: 16px; }
.family-header h2 { font-size: 20px; }
.invite-code { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.invite-code code { background: var(--gray-100); padding: 2px 8px; border-radius: 4px; font-size: 14px; }

.members-list { display: flex; flex-direction: column; gap: 8px; }
.member-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: var(--gray-50); border-radius: var(--radius-sm);
}
.member-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-light); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.member-name { font-size: 14px; font-weight: 600; }
.member-role { font-size: 11px; color: var(--gray-400); }
.member-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--blue-light); color: var(--blue); font-weight: 500; margin-left: auto; }

/* ── Check ─────────────────────────────────────────── */
.check-form { display: flex; gap: 8px; margin-bottom: 16px; }
.check-form input { flex: 1; padding: 12px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 16px; font-family: inherit; }
.check-form input:focus { outline: none; border-color: var(--blue); }

.check-result-card { padding: 16px; border-radius: var(--radius); margin-top: 12px; }
.check-result-card.safe { background: var(--green-light); border: 1px solid #d1fae5; }
.check-result-card.danger { background: var(--red-light); border: 1px solid #fee2e2; }
.check-result-card.warning { background: var(--orange-light); border: 1px solid #fef3c7; }

/* ── Buttons ───────────────────────────────────────── */
.btn-primary {
    padding: 10px 18px; background: var(--blue); color: white; border: none;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary {
    padding: 10px 18px; background: var(--gray-100); color: var(--gray-700); border: none;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.btn-small { padding: 6px 12px; font-size: 12px; background: var(--gray-100); border: none; border-radius: 6px; cursor: pointer; font-family: inherit; color: var(--gray-600); }
.btn-tiny { padding: 2px 8px; font-size: 11px; background: var(--gray-200); border: none; border-radius: 4px; cursor: pointer; font-family: inherit; }
.btn-danger { padding: 8px 16px; font-size: 13px; background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; }

/* ── Family Stats ──────────────────────────────────── */
.family-stats { display: flex; gap: 16px; }
.fs-item { flex: 1; text-align: center; padding: 12px; background: var(--gray-50); border-radius: var(--radius-sm); }
.fs-number { display: block; font-size: 22px; font-weight: 800; color: var(--blue); }
.fs-label { font-size: 11px; color: var(--gray-500); }

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .check-form { flex-direction: column; }
    .inline-form { flex-direction: column; }
}
