/* ============================================================
   DidItIndex.com - Design System
   style.css
   
   Aesthetic: Professional SaaS. clean, cool-toned neutrals with
   editorial typography. Slate on cool white. Confident and modern.
   Every element earns its place.
   
   Font pairing:
   - Display: DM Serif Display (characterful, editorial authority)
   - Body: DM Sans (clean, modern, highly legible)
   
   Sections:
   01. Google Fonts Import
   02. CSS Variables (design tokens)
   03. Reset & Base
   04. Typography
   05. Layout & Grid
   06. Navigation
   07. Buttons
   08. Forms & Inputs
   09. Cards
   10. Score & Status Indicators
   11. Token UI
   12. Scan Progress
   13. Toast Notifications
   14. Tables (admin)
   15. Admin Layout
   16. Dashboard Stats
   17. Badges & Pills
   18. Modals
   19. Empty States
   20. Loading States
   21. Footer
   22. Utilities
   23. Animations
   24. Media Queries (mobile-first responsive)
   25. Accessibility
   ============================================================ */


/* ============================================================
   01. GOOGLE FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap');


/* ============================================================
   02. CSS VARIABLES. DESIGN TOKENS
   Change these to retheme the entire app.
   ============================================================ */
:root {
    /* --- Core Palette --- */
    /* Cool blue-slate neutrals. professional B2B SaaS feel */
    --color-bg:           #F5F7FA;   /* Cool blue-white */
    --color-bg-alt:       #EDF0F5;   /* Inset/recessed areas */
    --color-surface:      #FFFFFF;   /* Card/panel surfaces */
    --color-border:       #DCE1E8;   /* Subtle cool borders */
    --color-border-dark:  #B8C0CC;   /* Stronger borders */

    --color-text:         #0F172A;   /* Slate-900. near black with blue undertone */
    --color-text-secondary: #475569; /* Slate-600. body/secondary text */
    --color-text-tertiary:  #64748B; /* Slate-500. labels, captions */

    --color-accent:       #1E3A5F;   /* Deep navy. primary CTAs */
    --color-accent-hover: #2B4F7E;   /* Lighter navy on hover */

    /* --- Semantic Colors --- */
    /* Confident but not loud. clear status signals */
    --color-pass:         #15803D;   /* Green-700. trustworthy success */
    --color-pass-bg:      #F0FDF4;
    --color-pass-border:  #BBF7D0;

    --color-warn:         #A16207;   /* Amber-700. attention without alarm */
    --color-warn-bg:      #FFFBEB;
    --color-warn-border:  #FDE68A;

    --color-fail:         #B91C1C;   /* Red-700. clear problem signal */
    --color-fail-bg:      #FEF2F2;
    --color-fail-border:  #FECACA;

    --color-info:         #1D4ED8;   /* Blue-700. informational */
    --color-info-bg:      #EFF6FF;
    --color-info-border:  #BFDBFE;

    /* --- Admin Surface --- */
    --color-admin-bg:     #F0F2F7;
    --color-admin-sidebar:#0F172A;   /* Slate-900 sidebar */
    --color-admin-sidebar-text: #94A3B8;
    --color-admin-sidebar-active: #FFFFFF;

    /* --- Typography --- */
    --font-display: 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, sans-serif;

    --text-xs:    0.75rem;    /* 12px */
    --text-sm:    0.875rem;   /* 14px */
    --text-base:  1rem;       /* 16px */
    --text-md:    1.125rem;   /* 18px */
    --text-lg:    1.25rem;    /* 20px */
    --text-xl:    1.5rem;     /* 24px */
    --text-2xl:   1.875rem;   /* 30px */
    --text-3xl:   2.25rem;    /* 36px */
    --text-4xl:   3rem;       /* 48px */

    --leading-tight:  1.25;
    --leading-normal: 1.6;
    --leading-loose:  1.8;

    /* --- Spacing --- */
    --space-1:  0.25rem;   /* 4px */
    --space-2:  0.5rem;    /* 8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */

    /* --- Borders & Radius --- */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-full: 999px;

    /* --- Shadows --- */
    --shadow-xs:  0 1px 2px rgba(17, 24, 39, 0.05);
    --shadow-sm:  0 1px 4px rgba(17, 24, 39, 0.07), 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-md:  0 4px 12px rgba(17, 24, 39, 0.08), 0 1px 4px rgba(17, 24, 39, 0.05);
    --shadow-lg:  0 8px 24px rgba(17, 24, 39, 0.10), 0 2px 8px rgba(17, 24, 39, 0.05);
    --shadow-xl:  0 16px 40px rgba(17, 24, 39, 0.12), 0 4px 12px rgba(17, 24, 39, 0.06);

    /* --- Transitions --- */
    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow:   400ms ease;

    /* --- Layout --- */
    --container-max:    1100px;
    --container-narrow: 720px;
    --nav-height:       64px;
    --admin-sidebar-w:  240px;
}


/* ============================================================
   03. RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

blockquote {
    border: none;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-border-dark);
    text-underline-offset: 3px;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
    text-decoration-color: var(--color-accent);
}

ul, ol {
    list-style: none;
}

button {
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: var(--font-body);
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-8) 0;
}


/* ============================================================
   04. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;  /* DM Serif Display looks best at regular weight */
    line-height: var(--leading-tight);
    color: var(--color-text);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-normal);
}

p:last-child {
    margin-bottom: 0;
}

.text-display {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.text-display-italic {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--color-text-secondary);
}

.text-label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.text-muted  { color: var(--color-text-secondary); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-center { text-align: center; }
.text-right  { text-align: right; }

strong { font-weight: 600; }
code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    background: var(--color-bg-alt);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}


/* ============================================================
   05. LAYOUT & GRID
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.container--narrow {
    max-width: var(--container-narrow);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding-top: calc(var(--nav-height) + var(--space-4));
    padding-bottom: var(--space-16);
}

.page-header {
    margin-bottom: var(--space-10);
}

.page-header__eyebrow {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
}

.page-header__title {
    margin-bottom: var(--space-3);
}

.page-header__subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-weight: 300;
}

/* Grid helpers */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.flex        { display: flex; }
.flex--center { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--gap-2  { gap: var(--space-2); }
.flex--gap-4  { gap: var(--space-4); }
.flex--gap-6  { gap: var(--space-6); }


/* ============================================================
   06. NAVIGATION
   ============================================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(248, 249, 251, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--space-6);
}

.nav__logo {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;        /* Never compress the logo */
    white-space: nowrap;
}

.nav__logo span {
    font-style: italic;
    color: var(--color-text-secondary);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex: 1;               /* Take up remaining space in the middle */
    justify-content: center;
}

.nav__link {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast), background var(--transition-fast);
    padding: 4px 12px;
    border-radius: 6px;
}

.nav__link:hover {
    color: var(--color-text);
    text-decoration: none;
    background: rgba(0,0,0,0.04);
}

.nav__link--active {
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
    background: #1e293b !important;
    border-radius: 6px;
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;        /* Never compress the actions area */
}

/* Account name in nav button. truncate if long */
.nav__account-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Token balance pill in nav */
.nav__token-pill {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.nav__token-pill:hover {
    background: var(--color-border);
    text-decoration: none;
}

.nav__token-pill i {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* Mobile nav toggle */
.nav__hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    cursor: pointer;
    padding: var(--space-2);
    background: none;
    border: none;
}

.nav__hamburger span {
    display: block;
    height: 1.5px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform var(--transition-normal), opacity var(--transition-fast);
}

/* ============================================================
   MOBILE NAV DRAWER
   ============================================================ */

/* Full-screen overlay container */
.nav-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
}

.nav-drawer.is-open {
    display: block;
}

/* Semi-transparent backdrop */
.nav-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

/* Slide-in panel from right */
.nav-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    animation: slideInRight 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: -4px 0 24px rgba(17, 24, 39, 0.12);
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* Drawer header row */
.nav-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.nav-drawer__close {
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-drawer__close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

/* User info strip */
.nav-drawer__user {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.nav-drawer__user-avatar {
    font-size: 2rem;
    color: var(--color-text-tertiary);
    line-height: 1;
}

.nav-drawer__user-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.nav-drawer__tokens {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.nav-drawer__tokens i {
    font-size: 10px;
}

/* Nav links list */
.nav-drawer__links {
    flex: 1;
    padding: var(--space-3) 0;
}

.nav-drawer__link {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-drawer__link i {
    width: 16px;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.nav-drawer__link:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
    text-decoration: none;
}

.nav-drawer__link:hover i {
    color: var(--color-text-secondary);
}

.nav-drawer__link--active {
    color: var(--color-text);
    background: var(--color-bg-alt);
    font-weight: 600;
}

.nav-drawer__link--active i {
    color: var(--color-text);
}

/* Sign out at bottom */
.nav-drawer__footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.nav-drawer__signout {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-fail);
    text-decoration: none;
    padding: var(--space-3) 0;
}

.nav-drawer__signout:hover {
    text-decoration: none;
    opacity: 0.8;
}


/* ============================================================
   07. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast), box-shadow var(--transition-fast),
                opacity var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

/* Primary. charcoal fill */
.btn--primary {
    background: var(--color-accent);
    color: #FFFFFF;
    border-color: var(--color-accent);
}

.btn--primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #FFFFFF;
    text-decoration: none;
    box-shadow: var(--shadow-md);
}

/* Secondary. outlined */
.btn--secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-dark);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--color-bg-alt);
    border-color: var(--color-text);
    text-decoration: none;
}

/* Ghost. no border, subtle hover */
.btn--ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
    background: var(--color-bg-alt);
    color: var(--color-text);
    text-decoration: none;
}

/* Danger */
.btn--danger {
    background: var(--color-fail-bg);
    color: var(--color-fail);
    border-color: var(--color-fail-border);
}

.btn--danger:hover:not(:disabled) {
    background: var(--color-fail);
    color: #FFFFFF;
    border-color: var(--color-fail);
    text-decoration: none;
}

/* Sizes */
.btn--sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn--lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn--full { width: 100%; }

/* CRITICAL: Disabled state. prevents spam clicking */
.btn:disabled,
.btn--loading {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading state with spinner */
.btn--loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: var(--space-2);
}


/* ============================================================
   08. FORMS & INPUTS
   ============================================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-label--required::after {
    content: ' *';
    color: var(--color-fail);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-fail);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.input,
.textarea,
.select {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--color-text-tertiary);
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.input--error,
.textarea--error {
    border-color: var(--color-fail);
}

.input--error:focus,
.textarea--error:focus {
    box-shadow: 0 0 0 3px rgba(155, 44, 44, 0.10);
}

.textarea {
    min-height: 140px;
    resize: vertical;
    line-height: var(--leading-normal);
}

/* URL list textarea. monospace for URL lists */
.textarea--urls {
    font-family: 'Courier New', Courier, monospace;
    font-size: var(--text-sm);
    min-height: 200px;
}

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6860' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
    padding-right: var(--space-10);
    cursor: pointer;
}

/* File upload area */
.upload-zone {
    border: 2px dashed var(--color-border-dark);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    background: var(--color-surface);
}

.upload-zone:hover,
.upload-zone--active {
    border-color: var(--color-accent);
    background: var(--color-bg-alt);
}

.upload-zone__icon {
    font-size: 1.4rem;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.upload-zone__label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}

.upload-zone__hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

/* Toggle / switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input { display: none; }

.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--color-border-dark);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle__slider {
    background: var(--color-accent);
}

.toggle input:checked + .toggle__slider::before {
    transform: translateX(20px);
}


/* ============================================================
   09. CARDS
   ============================================================ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-xs);
}

.card--elevated {
    box-shadow: var(--shadow-md);
}

.card--flat {
    box-shadow: none;
    background: var(--color-bg-alt);
}

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.card__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 400;
}

.card__subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-1);
}

.card__footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}


/* ============================================================
   10. SCORE & STATUS INDICATORS
   ============================================================ */

/* Large circular score ring. used on report pages */
.score-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
}

.score-ring__svg {
    position: absolute;
    top: 0; left: 0;
    transform: rotate(-90deg);
}

.score-ring__track {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 6;
}

.score-ring__fill {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 251;  /* 2 * pi * 40 (radius) */
    stroke-dashoffset: 251;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-ring__fill--pass { stroke: var(--color-pass); }
.score-ring__fill--warn { stroke: var(--color-warn); }
.score-ring__fill--fail { stroke: var(--color-fail); }

.score-ring__value {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Status pill. pass/warn/fail */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-pass {
    background: var(--color-pass-bg);
    color: var(--color-pass);
    border: 1px solid var(--color-pass-border);
}

.status-warn {
    background: var(--color-warn-bg);
    color: var(--color-warn);
    border: 1px solid var(--color-warn-border);
}

.status-fail {
    background: var(--color-fail-bg);
    color: var(--color-fail);
    border: 1px solid var(--color-fail-border);
}

.status-unknown {
    background: var(--color-bg-alt);
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-border);
}

/* Old check-row styles removed - see report-specific styles below */


/* ============================================================
   11. TOKEN UI
   ============================================================ */

/* Token balance display. used on dashboard */
.token-balance {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
}

.token-balance__count {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    line-height: 1;
}

.token-balance__label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* Token cost preview. shown before scan starts */
.token-preview {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
}

.token-preview__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
}

.token-preview__row--total {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    font-weight: 600;
}

.token-preview__warning {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-warn-bg);
    border: 1px solid var(--color-warn-border);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--color-warn);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

/* Token pack cards. pricing page */
.pack-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.pack-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.pack-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.pack-card--featured {
    border-color: #1E3A5F;
    border-width: 2px;
    box-shadow: 0 8px 30px rgba(30, 58, 95, 0.12);
    position: relative;
    transform: scale(1.03);
}

.pack-card__badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.pack-card__name {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-4);
}

.pack-card__price {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-1);
}


/* ============================================================
   12. SCAN PROGRESS
   The most important UX component. user must feel safe to wait.
   ============================================================ */
.scan-progress {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.scan-progress__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto var(--space-6);
}

.scan-progress__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.scan-progress__subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

/* Progress bar */
.progress-bar {
    background: var(--color-bg-alt);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.progress-bar__fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
    width: 0%;
}

.scan-progress__counter {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-6);
}

/* The "don't go anywhere" message */
.scan-progress__stay {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
}

/* Current URL being scanned */
.scan-progress__current-url {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-family: 'Courier New', Courier, monospace;
    margin-top: var(--space-4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}


/* ============================================================
   13. TOAST NOTIFICATIONS
   Appears bottom-right, auto-dismisses, never jarring.
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    background: var(--color-text);
    color: var(--color-bg);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    max-width: 360px;
    box-shadow: var(--shadow-xl);
    pointer-events: all;
    animation: toast-in var(--transition-normal) ease forwards;
}

.toast--success { background: var(--color-pass); }
.toast--warn    { background: var(--color-warn); }
.toast--error   { background: var(--color-fail); }

.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__body { flex: 1; line-height: 1.5; }

.toast--out {
    animation: toast-out var(--transition-normal) ease forwards;
}


/* ============================================================
   14. TABLES (admin data)
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    background: var(--color-bg-alt);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: var(--color-bg-alt);
}

.table .table__actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}


/* ============================================================
   15. ADMIN LAYOUT
   Sidebar + main content area
   ============================================================ */
body.admin-body {
    background: var(--color-admin-bg);
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--admin-sidebar-w);
    background: var(--color-admin-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.admin-sidebar__logo {
    padding: var(--space-6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar__logo-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    color: var(--color-admin-sidebar-active);
    text-decoration: none;
}

.admin-sidebar__section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(200, 197, 187, 0.4);
    padding: var(--space-5) var(--space-6) var(--space-2);
}

.admin-nav {
    padding: var(--space-3) 0;
    flex: 1;
}

.admin-nav__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    color: var(--color-admin-sidebar-text);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    border-radius: 0;
}

.admin-nav__link i {
    width: 16px;
    text-align: center;
    font-size: var(--text-sm);
    opacity: 0.7;
}

.admin-nav__link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--color-admin-sidebar-active);
    text-decoration: none;
}

.admin-nav__link--active {
    background: rgba(255,255,255,0.10);
    color: var(--color-admin-sidebar-active);
}

.admin-nav__link--active i {
    opacity: 1;
}

.admin-sidebar__footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: var(--text-xs);
    color: rgba(200, 197, 187, 0.4);
}

.admin-main {
    margin-left: var(--admin-sidebar-w);
    flex: 1;
    padding: var(--space-8);
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.admin-topbar__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 400;
}


/* ============================================================
   16. DASHBOARD STATS
   ============================================================ */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
}

.stat-card__label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.stat-card__value {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 400;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-card__delta {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.stat-card__delta--up   { color: var(--color-pass); }
.stat-card__delta--down { color: var(--color-fail); }


/* ============================================================
   17. BADGES & PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge--neutral {
    background: var(--color-bg-alt);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.badge--admin {
    background: var(--color-text);
    color: white;
}

.badge--active {
    background: var(--color-pass-bg);
    color: var(--color-pass);
    border: 1px solid var(--color-pass-border);
}

.badge--inactive {
    background: var(--color-bg-alt);
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-border);
}


/* ============================================================
   18. MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay--open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    transform: translateY(16px);
    transition: transform var(--transition-normal);
}

.modal-overlay--open .modal {
    transform: translateY(0);
}

.modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.modal__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
}

.modal__close {
    color: var(--color-text-tertiary);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--transition-fast);
}

.modal__close:hover { color: var(--color-text); }

.modal__footer {
    margin-top: var(--space-6);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}


/* ============================================================
   19. EMPTY STATES
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
}

.empty-state__icon {
    font-size: 2.5rem;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-5);
}

.empty-state__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
}

.empty-state__body {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    max-width: 360px;
    margin: 0 auto var(--space-6);
    line-height: var(--leading-loose);
}


/* ============================================================
   20. LOADING STATES
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg,
        var(--color-bg-alt) 25%,
        var(--color-border) 50%,
        var(--color-bg-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton--text { height: 14px; margin-bottom: var(--space-2); }
.skeleton--title { height: 24px; width: 60%; }
.skeleton--card { height: 120px; border-radius: var(--radius-lg); }


/* ============================================================
   21. FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) 0;
    margin-top: auto;
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer__copy {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.footer__links {
    display: flex;
    gap: var(--space-6);
}

.footer__link {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-decoration: none;
}

.footer__link:hover {
    color: var(--color-text-secondary);
}


/* ============================================================
   22. UTILITIES
   ============================================================ */
.hidden       { display: none !important; }
.sr-only      { /* Screen reader only. visually hidden but accessible */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.mt-0  { margin-top: 0; }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

.divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-6) 0;
}

/* Inline alert / notice (static, not a toast) */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-5);
}

.alert--info    { background: var(--color-info-bg); color: var(--color-info); border: 1px solid var(--color-info-border); }
.alert--success { background: var(--color-pass-bg); color: var(--color-pass); border: 1px solid var(--color-pass-border); }
.alert--warn    { background: var(--color-warn-bg); color: var(--color-warn); border: 1px solid var(--color-warn-border); }
.alert--error   { background: var(--color-fail-bg); color: var(--color-fail); border: 1px solid var(--color-fail-border); }

.alert i { flex-shrink: 0; margin-top: 2px; }


/* ============================================================
   23. ANIMATIONS
   ============================================================ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(12px);
    }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in 0.4s ease forwards;
}

/* Staggered children. add to parent, children get delays */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }


/* ============================================================
   23. REPORT PAGE
   ============================================================ */

/* ---- Report header ---- */
.report-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-8);
    padding: var(--space-8) var(--space-8);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
}

.report-header__score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.report-header__score-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
}

.report-header__meta {
    flex: 1;
    min-width: 0;
}

.report-header__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 400;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.report-header__date {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

.report-header__counts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.report-header__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* ---- Module score strip ---- */
.module-scores {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.module-score-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.module-score-card:hover {
    border-color: var(--color-text-tertiary);
    box-shadow: var(--shadow-sm);
}

.module-score-card__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    color: var(--color-text-secondary);
}

.module-score-card__label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    line-height: 1.3;
}

/* ---- Status pills. distinct colours ---- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pass {
    background: #d1fae5;
    color: #065f46;
    border: 1.5px solid #6ee7b7;
}

.status-warn {
    background: #fef3c7;
    color: #92400e;
    border: 1.5px solid #fcd34d;
}

.status-fail {
    background: #fee2e2;
    color: #991b1b;
    border: 1.5px solid #fca5a5;
}

.status-unknown {
    background: var(--color-bg-alt);
    color: var(--color-text-tertiary);
    border: 1.5px solid var(--color-border);
}

/* ---- URL accordion cards ---- */
.url-accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-10);
}

.url-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.url-card--failed {
    border-color: var(--color-fail-border);
}

.url-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.url-card__header:hover {
    background: var(--color-bg-alt);
}

.url-card__score-badge {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.url-card__score-badge--pass { background: #d1fae5; color: #065f46; }
.url-card__score-badge--warn { background: #fef3c7; color: #92400e; }
.url-card__score-badge--fail { background: #fee2e2; color: #991b1b; }
.url-card__score-badge--unknown { background: var(--color-bg-alt); color: var(--color-text-tertiary); }

.url-card__url {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--color-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.url-card__module-pills {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.module-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.module-pill--pass    { background: #d1fae5; color: #065f46; }
.module-pill--warn    { background: #fef3c7; color: #92400e; }
.module-pill--fail    { background: #fee2e2; color: #991b1b; }
.module-pill--unknown { background: var(--color-bg-alt); color: var(--color-text-tertiary); }
.module-pill--null    { background: var(--color-bg-alt); color: var(--color-text-tertiary); }

.url-card__toggle {
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

.url-card__toggle.open {
    transform: rotate(180deg);
}

/* Collapsible body */
.url-card__body {
    display: none;
    border-top: 1px solid var(--color-border);
}

.url-card__body.open {
    display: block;
}

/* ---- Module sections inside URL card ---- */
.module-section {
    border-bottom: 1px solid var(--color-border);
}

.module-section:last-child {
    border-bottom: none;
}

.module-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
}

.module-section__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.module-section__title i {
    color: var(--color-text-secondary);
    width: 14px;
    text-align: center;
}

/* ---- Check rows ---- */
.check-row {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 6px var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}

.check-row:last-child {
    border-bottom: none;
}

.check-row__icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
}

.check-row__icon--pass { background: #d1fae5; color: #065f46; }
.check-row__icon--warn { background: #fef3c7; color: #92400e; }
.check-row__icon--fail { background: #fee2e2; color: #991b1b; }

.check-row__body {
    min-width: 0;
}

.check-row__label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

/* Bold failed check labels for emphasis */
.check-row--fail .check-row__label {
    font-weight: 700;
    color: var(--color-fail);
}

.check-row__note {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.check-row__value {
    grid-column: 1 / -1;
    font-size: var(--text-xs);
    font-family: var(--font-mono, ui-monospace, monospace);
    color: var(--color-text-secondary);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    line-height: 1.4;
    display: block;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

/* Fix-tip spans full width of the grid */
.check-row__fix-wrap {
    grid-column: 1 / -1;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .module-scores {
        grid-template-columns: repeat(3, 1fr);
    }

    .report-header {
        flex-wrap: wrap;
        gap: var(--space-5);
    }

    .report-header__actions {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }

    .url-card__module-pills {
        display: none;
    }
}

@media (max-width: 640px) {
    .module-scores {
        grid-template-columns: repeat(2, 1fr);
    }

    .report-header__score {
        display: none;
    }
}


/* ============================================================
   24. MEDIA QUERIES. Mobile First
   ============================================================ */

/* Tablet and below */
@media (max-width: 900px) {
    :root {
        --text-4xl: 2.25rem;
        --text-3xl: 1.875rem;
    }

    .grid--3,
    .grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .pack-cards {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .admin-sidebar--open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding: var(--space-5);
    }
}

/* Mobile */
@media (max-width: 640px) {
    :root {
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }

    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .nav__links { display: none; }
    .nav__hamburger { display: flex; }

    /* Hide desktop-only nav elements on mobile */
    .nav__token-pill { display: none; }
    .nav__account-wrap { display: none; }
    .nav__username { display: none; }
    #account-menu-btn { display: none; }

    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .card {
        padding: var(--space-5) var(--space-4);
    }

    .footer__inner {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    .table-wrapper {
        font-size: var(--text-xs);
    }

    .scan-progress {
        padding: var(--space-8) var(--space-5);
    }

    .modal {
        padding: var(--space-6) var(--space-5);
    }

    .toast-container {
        bottom: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
    }

    .toast {
        max-width: 100%;
    }

    /* Stack token preview rows on mobile */
    .token-preview__row {
        flex-direction: column;
        gap: var(--space-1);
    }

    /* Hide non-essential table columns on mobile */
    .td-hide-mobile,
    .th-hide-mobile {
        display: none;
    }

    /* Admin dashboard: stack two-column sections on mobile */
    .admin-two-col {
        grid-template-columns: 1fr !important;
    }

    /* Admin: tighten stat card values */
    .stat-card__value {
        font-size: var(--text-xl);
    }

    /* Admin: tighten page header */
    .page-header__title {
        font-size: var(--text-lg) !important;
    }

    /* Admin topbar title smaller on mobile */
    .admin-topbar__title {
        font-size: var(--text-lg);
    }

    /* Admin: table cells tighter */
    .table td, .table th {
        padding: var(--space-2);
    }
}


/* ============================================================
   25. ACCESSIBILITY
   ============================================================ */

/* Focus rings. visible and on-brand */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* Remove focus ring for mouse users (only show for keyboard) */
:focus:not(:focus-visible) {
    outline: none;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scan-progress__spinner {
        animation: none;
        border-top-color: var(--color-accent);
        opacity: 0.8;
    }
}

/* High contrast mode support */
@media (forced-colors: active) {
    .btn--primary {
        border: 2px solid ButtonText;
    }
    .status-pass,
    .status-warn,
    .status-fail {
        border: 1px solid ButtonText;
    }
}

/* Ensure touch targets are large enough on mobile */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }
    .input,
    .textarea,
    .select {
        min-height: 44px;
    }
    .admin-nav__link {
        min-height: 44px;
    }
}

/* ============================================================
   NAV. USERNAME TRUNCATION (desktop)
   ============================================================ */
.nav__username {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* ============================================================
   REUSABLE CONFIRM MODAL
   Generic modal overlay used by AppModal.confirm() in main.js.
   Replaces browser confirm() dialogs across the entire app.
   ============================================================ */
.app-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.app-modal-overlay--visible {
    display: flex;
}

.app-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    padding: var(--space-6);
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.app-modal__title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-2) 0;
}

.app-modal__message {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-5) 0;
    line-height: 1.5;
}

.app-modal__actions {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
}

.app-modal__btn {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: background 0.12s, color 0.12s;
}

.app-modal__btn--cancel {
    background: var(--color-surface);
    color: var(--color-text-secondary);
}

.app-modal__btn--cancel:hover {
    background: var(--color-bg-alt);
}

.app-modal__btn--confirm {
    background: var(--color-text);
    color: var(--color-surface);
    border-color: var(--color-text);
}

.app-modal__btn--confirm:hover {
    opacity: 0.9;
}

.app-modal__btn--danger {
    background: var(--color-fail);
    border-color: var(--color-fail);
    color: #fff;
}

.app-modal__btn--danger:hover {
    opacity: 0.9;
}
