/*
    style.css — Rewright Design System
    
    Light  → warm, editorial, subtle solar system
    Premium → dark, aurora glow, 3D panel tilt
*/


/* ═══════════════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg:              #f8f4ef;
    --bg-gradient:     linear-gradient(135deg, #f9f6f0 0%, #f0ebe0 40%, #f5f0e6 70%, #ede7da 100%);
    --bg-secondary:    #efe9e1;
    --surface:         #ffffff;
    --border:          #e0dcd4;
    --border-focus:    #ccc7bc;

    --text-primary:    #1a1714;
    --text-secondary:  #6b655c;
    --text-tertiary:   #a09888;

    --accent:          #c2660a;
    --accent-hover:    #a3540a;
    --accent-soft:     rgba(194, 102, 10, 0.08);
    --accent-glow:     rgba(194, 102, 10, 0);

    --shadow:          0 1px 3px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.03);
    --shadow-hover:    0 8px 40px rgba(0,0,0,0.08);

    --radius:          14px;
    --aurora-opacity:  0.5;
    --grain-opacity:   0.015;

    --panel-input-transform:  perspective(1200px) rotateY(0deg);
    --panel-output-transform: perspective(1200px) rotateY(0deg);

    --font-body:       'DM Sans', -apple-system, sans-serif;
    --font-display:    'Playfair Display', Georgia, serif;
}


/* ═══════════════════════════════════════════════════════════════════
   PREMIUM (DARK) THEME
   ═══════════════════════════════════════════════════════════════════ */

body.premium {
    --bg:              #0a0908;
    --bg-secondary:    #151210;
    --surface:         #1a1714;
    --border:          #2a2520;
    --border-focus:    #3d3630;

    --text-primary:    #f5f3ee;
    --text-secondary:  #a09888;
    --text-tertiary:   #6b655c;

    --accent:          #f0a030;
    --accent-hover:    #f5b84d;
    --accent-soft:     rgba(240, 160, 48, 0.1);
    --accent-glow:     rgba(240, 160, 48, 0.25);

    --shadow:          0 2px 8px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.2);
    --shadow-hover:    0 8px 40px rgba(0,0,0,0.5), 0 0 60px rgba(240,160,48,0.05);

    --aurora-opacity:  1;
    --grain-opacity:   0.03;

    --panel-input-transform:  perspective(1200px) rotateY(0deg);
    --panel-output-transform: perspective(1200px) rotateY(0deg);
}


/* ═══════════════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════════════ */

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

html {
    overflow-y: scroll;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #fcfaf7 0%, #f4efe7 40%, #f8f4ef 70%, #efe9e1 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s ease;
}

body.premium {
    background: var(--bg);
}


/* ═══════════════════════════════════════════════════════════════════
   BACKGROUNDS
   ═══════════════════════════════════════════════════════════════════ */

#solar-system {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}

.bg-aurora {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
    opacity: var(--aurora-opacity);
    transition: opacity 1s ease;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(240,160,48,0.07), transparent),
        radial-gradient(ellipse 60% 60% at 80% 30%, rgba(194,102,10,0.05), transparent),
        radial-gradient(ellipse 70% 40% at 50% 80%, rgba(180,80,0,0.04), transparent);
    animation: none;
}

@keyframes auroraDrift {
    0%   { transform: scale(1) translate(0, 0); }
    33%  { transform: scale(1.05) translate(15px, -10px); }
    66%  { transform: scale(0.98) translate(-10px, 15px); }
    100% { transform: scale(1.02) translate(5px, -5px); }
}

.bg-grain {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
    opacity: var(--grain-opacity);
    transition: opacity 0.8s ease;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}


/* ═══════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════ */

header {
    padding: 1rem 2.5rem 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; z-index: 10;
}

.logo {
    position: absolute;
    right: 2.5rem;
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.6s ease;
}

.logo-mark svg { display: block; transition: filter 0.6s ease; }
body.premium .logo-mark svg { filter: drop-shadow(0 0 8px var(--accent-glow)); }

.logo-planet {
    transform-origin: 16px 16px;
    animation: logoOrbit 3s linear infinite;
}

@keyframes logoOrbit {
    from { transform: rotate(0deg) translateX(12px) rotate(0deg); }
    to   { transform: rotate(360deg) translateX(12px) rotate(-360deg); }
}

.logo-text { font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; }


/* ═══════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════ */

main {
    flex: 1;
    padding: 1.75rem 2.5rem 3rem;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    position: relative; z-index: 1;
}

.hero { text-align: center; margin-bottom: 1.75rem; }

.hero-eyebrow {
    display: inline-block;
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.9rem;
    border: 1px solid var(--accent-soft);
    border-radius: 999px;
    background: var(--accent-soft);
    transition: all 0.6s ease;
}

body.premium .hero-eyebrow {
    border-color: rgba(240,160,48,0.2);
    box-shadow: 0 0 20px rgba(240,160,48,0.08);
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 3rem; font-weight: 400;
    color: var(--text-primary);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
    transition: color 0.6s ease;
}

.hero h1 em {
    font-style: italic;
    color: var(--accent);
    transition: color 0.6s ease, text-shadow 0.6s ease;
}

body.premium .hero h1 em { text-shadow: 0 0 40px var(--accent-glow); }

.hero p {
    color: var(--text-secondary);
    font-size: 1rem; line-height: 1.6;
    transition: color 0.6s ease;
}


/* ═══════════════════════════════════════════════════════════════════
   MODE TOGGLE
   ═══════════════════════════════════════════════════════════════════ */

.mode-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; margin-bottom: 1.75rem;
}

.mode-btn {
    display: flex; align-items: center; gap: 0.35rem;
    font-family: var(--font-body);
    font-size: 0.78rem; font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.mode-btn.active {
    color: var(--text-primary);
    background: var(--accent-soft);
    border-color: var(--border);
}

.mode-btn-icon { font-size: 0.85rem; }

.toggle-switch {
    position: relative; display: inline-block;
    width: 52px; height: 28px; cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute; inset: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.toggle-glow {
    position: absolute; inset: -2px;
    border-radius: 999px;
    background: radial-gradient(circle at 70% 50%, var(--accent-glow), transparent 70%);
    opacity: 0; transition: opacity 0.6s ease;
}

.toggle-switch input:checked ~ .toggle-track .toggle-glow { opacity: 1; }

.toggle-knob {
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: white; border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}

.knob-icon {
    font-size: 0.55rem; opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    transition: all 0.4s ease;
    color: var(--accent);
}

.toggle-switch input:checked ~ .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.toggle-switch input:checked ~ .toggle-track .toggle-knob {
    transform: translateX(24px);
    box-shadow: 0 0 12px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.2);
}

.toggle-switch input:checked ~ .toggle-track .toggle-knob .knob-icon {
    opacity: 1; transform: rotate(0deg) scale(1);
}


/* ═══════════════════════════════════════════════════════════════════
   PANELS — CLEAN, SYNCED, NO FOOTERS

   Both panels: header + body. That's it.
   Grid with align-items: stretch makes them identical height.
   ═══════════════════════════════════════════════════════════════════ */

.panels-wrapper { perspective: 1200px; }

.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
    display: flex;
    flex-direction: column;
}

#panel-input  { transform: var(--panel-input-transform); }
#panel-input .panel-body { overflow: hidden; }
#panel-output { transform: var(--panel-output-transform); }

.panel:hover { box-shadow: var(--shadow-hover); }

body.premium .panel {
    border-color: var(--border-focus);
    box-shadow: var(--shadow), 0 0 80px rgba(240,160,48,0.02);
}

/* ─── Panel header ─── */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.15rem;
    border-bottom: 1px solid var(--border);
    min-height: 40px;
    transition: all 0.6s ease;
}

.panel-label {
    font-size: 0.68rem; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    transition: color 0.6s ease;
}

.panel-meta {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    transition: color 0.6s ease;
}

/* Right side of output header: meta + copy icon */
.panel-header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ─── Panel body — fills remaining space ─── */
.panel-body {
    flex: 1;
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    overflow-y: auto;
}

.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Textarea fills body completely — no gap */
#input-text {
    width: 100%;
    height: 100%;
    padding: 1.15rem;
    border: none; outline: none; resize: none;
    font-size: 0.9rem; line-height: 1.8;
    color: var(--text-primary);
    font-family: var(--font-body);
    background: transparent;
    transition: color 0.6s ease;
}

#input-text::placeholder { color: var(--text-tertiary); }
/* Match textarea scrollbar to panel-body scrollbar */
#input-text::-webkit-scrollbar { width: 5px; }
#input-text::-webkit-scrollbar-track { background: transparent; }
#input-text::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
#input-text::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Output area fills body */
#output-area { height: 100%; }

#output-text {
    padding: 1.15rem;
    font-size: 0.9rem; line-height: 1.8;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre-wrap;
    transition: color 0.6s ease;
}

/* Placeholder */
.output-placeholder {
    height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-tertiary);
}

.placeholder-orb {
    position: relative;
    width: 48px; height: 48px;
}

.placeholder-orb span {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.12;
    animation: orbFloat 3s ease-in-out infinite;
}

.placeholder-orb span:nth-child(1) { width: 10px; height: 10px; top: 8px; left: 4px; }
.placeholder-orb span:nth-child(2) { width: 14px; height: 14px; top: 16px; left: 20px; animation-delay: 0.5s; }
.placeholder-orb span:nth-child(3) { width: 8px; height: 8px; top: 28px; left: 10px; animation-delay: 1s; }

@keyframes orbFloat {
    0%, 100% { transform: translateY(0); opacity: 0.12; }
    50%      { transform: translateY(-6px); opacity: 0.25; }
}

.output-placeholder p {
    font-size: 0.82rem; text-align: center; line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════════
   COPY BUTTON — ICON ONLY
   ═══════════════════════════════════════════════════════════════════ */

.btn-copy {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-copy.copied {
    color: #16a34a;
    border-color: #16a34a;
    background: rgba(22,163,74,0.08);
}

/* Try again button — same style as copy */
.btn-retry {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-retry:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* Spin animation when re-rolling */
.btn-retry.spinning svg {
    animation: retrySpin 0.6s ease;
}

@keyframes retrySpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

/* ═══════════════════════════════════════════════════════════════════
   DOWNLOAD BUTTON WITH DROPDOWN
   ═══════════════════════════════════════════════════════════════════ */

.download-wrapper {
    position: relative;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* Dropdown menu */
.download-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 100;
    min-width: 160px;
}

body.premium .download-menu {
    box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 20px rgba(240,160,48,0.05);
}

.download-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.download-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font-body);
    text-align: left;
    transition: background 0.15s ease;
}

.download-option:last-child {
    border-bottom: none;
}

.download-option:hover {
    background: var(--accent-soft);
}

.download-ext {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 36px;
}

.download-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}


/* ═══════════════════════════════════════════════════════════════════
   ACTION BAR — REWRITE BUTTON (SEPARATED FROM PANELS)
   ═══════════════════════════════════════════════════════════════════ */

.action-bar {
    display: flex;
    justify-content: center;
    padding: 1.25rem 0 0;
}

.btn-rewrite {
    position: relative;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.7rem 2.2rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 1;
}

.btn-shine {
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
    z-index: 0;
}

.btn-rewrite:hover:not(:disabled) .btn-shine { left: 100%; }

.btn-rewrite:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(194,102,10,0.25);
}

body.premium .btn-rewrite {
    box-shadow: 0 0 28px var(--accent-glow);
}

body.premium .btn-rewrite:hover:not(:disabled) {
    box-shadow: 0 0 40px var(--accent-glow), 0 8px 24px rgba(0,0,0,0.3);
}

.btn-rewrite:active:not(:disabled) { transform: translateY(0); }
.btn-rewrite:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-icon, .btn-text { position: relative; z-index: 1; }
.btn-icon { font-size: 0.95rem; transition: transform 0.4s ease; }
.btn-rewrite:hover:not(:disabled) .btn-icon { transform: rotate(72deg); }


/* ═══════════════════════════════════════════════════════════════════
   RESULT STATS — SUBTLE INLINE
   ═══════════════════════════════════════════════════════════════════ */

.result-stats {
    text-align: center;
    padding: 0.6rem 0 0;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    transition: color 0.6s ease;
}

.result-stats span {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Dot separator between stat items */
.stat-dot {
    display: inline-block;
    margin: 0 0.5rem;
    opacity: 0.4;
}


/* ═══════════════════════════════════════════════════════════════════
   LOADING — ORBITAL SPINNER
   ═══════════════════════════════════════════════════════════════════ */

.loading-state {
    height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    color: var(--text-secondary);
}

.orbital-spinner {
    position: relative;
    width: 52px; height: 52px;
}

.orbital-spinner .ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.orbital-spinner .ring:nth-child(1) {
    inset: 0;
    border-top-color: var(--accent);
    animation: spin 1.2s linear infinite;
}

.orbital-spinner .ring:nth-child(2) {
    inset: 7px;
    border-right-color: var(--accent);
    opacity: 0.6;
    animation: spin 1.8s linear infinite reverse;
}

.orbital-spinner .ring:nth-child(3) {
    inset: 14px;
    border-bottom-color: var(--accent);
    opacity: 0.3;
    animation: spin 2.4s linear infinite;
}

.orbital-spinner .core {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: corePulse 1.2s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes corePulse {
    0%, 100% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    50%      { opacity: 0.4; transform: translate(-50%,-50%) scale(0.6); }
}

.loading-state p { font-size: 0.8rem; letter-spacing: 0.02em; }

.loading-bar {
    width: 120px; height: 2px;
    background: var(--border);
    border-radius: 999px; overflow: hidden;
}

.loading-bar-fill {
    width: 40%; height: 100%;
    background: var(--accent);
    border-radius: 999px;
    animation: loadSlide 1.5s ease-in-out infinite;
}

@keyframes loadSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}


/* ═══════════════════════════════════════════════════════════════════
   CHANGES REPORT — COLLAPSIBLE, BELOW OUTPUT PANEL
   ═══════════════════════════════════════════════════════════════════ */

.changes-report {
    border-top: 1px solid var(--border);
    transition: all 0.6s ease;
}

.changes-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.15rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.changes-toggle:hover { background: var(--accent-soft); }

.changes-toggle-text {
    font-size: 0.66rem; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.changes-toggle-arrow {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.changes-report.open .changes-toggle-arrow { transform: rotate(180deg); }

.changes-list {
    max-height: 0; overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.changes-report.open .changes-list { max-height: 600px; overflow-y: auto; }

.change-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.35rem 1.15rem;
    border-top: 1px solid var(--border);
}

.change-badge {
    font-size: 0.58rem; font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    white-space: nowrap;
    margin-top: 0.15rem;
}

.change-content { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.change-content strong { font-size: 0.72rem; font-weight: 600; color: var(--text-primary); }
.change-detail { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.4; word-break: break-word; }


/* ═══════════════════════════════════════════════════════════════════
   WARNING / TOAST
   ═══════════════════════════════════════════════════════════════════ */

.warning-bar {
    padding: 0.6rem 1.15rem;
    background: rgba(245,158,11,0.08);
    color: var(--accent);
    font-size: 0.72rem;
    border-top: 1px solid rgba(245,158,11,0.15);
    line-height: 1.5;
}

.toast {
    position: fixed;
    bottom: 2rem; right: 2rem;
    background: var(--text-primary);
    color: var(--bg);
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 9999;
}

.toast.show { opacity: 1; transform: translateY(0) scale(1); }


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   MOBILE — TABLETS AND SMALL SCREENS (max-width: 860px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 860px) {

    /* ── Layout ── */
    main { padding: 1.5rem 1.25rem 2.5rem; }

    /* ── Header: stack logo above nav ── */
    header {
        padding: 0.6rem 1.25rem 0;
        height: auto;
        flex-direction: column;
        gap: 1.5rem;
    }

    .logo {
        position: static;
    }

    /* ── Hero ── */
    .hero { margin-bottom: 1.75rem; }
    .hero h1 { font-size: 2.2rem; }

    /* ── Mode toggle ── */
    .mode-bar { gap: 0.5rem; margin-bottom: 1.5rem; }
    .mode-btn { padding: 0.35rem 0.6rem; font-size: 0.72rem; }

    /* ── Panels ── */
    .panels { grid-template-columns: 1fr; gap: 1rem; }
    #panel-input, #panel-output { transform: none !important; }

    /* ── Voice section ── */
    .voice-section { margin-bottom: 1.25rem; }

    /* ── Hide solar system on mobile ── */
    #solar-system { display: none; }

    /* ── Auth pages — top-aligned on mobile ── */
    .auth-main {
        min-height: auto;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0.75rem 1rem 2rem;
        display: block;
    }

    .auth-card {
        margin: 0 auto;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   MOBILE — PHONES (max-width: 480px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {

    /* ── Layout — generous padding ── */
    main { padding: 1.25rem 1rem 2rem; }

    /* ── Header — breathing room ── */
    header {
        padding: 0.5rem 1rem 0;
        gap: 1.5rem;
    }

    .logo-mark svg {
        width: 38px;
        height: 38px;
    }

    .logo-text {
        font-size: 1.3rem;
    }

    /* ── Hero — keep two lines, proper spacing ── */
    .hero { margin-bottom: 1.5rem; }

    .hero-eyebrow {
        font-size: 0.6rem;
        padding: 0.2rem 0.65rem;
        margin-bottom: 0.6rem;
    }

    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 0.85rem;
        margin-top: 0.4rem;
    }

    /* ── Mode toggle ── */
    .mode-bar {
        gap: 0.4rem;
        margin-bottom: 1.25rem;
    }

    .mode-btn {
        font-size: 0.68rem;
        padding: 0.3rem 0.55rem;
        gap: 0.25rem;
    }

    .mode-btn-icon { font-size: 0.78rem; }

    .toggle-switch {
        width: 46px;
        height: 25px;
    }

    .toggle-knob {
        width: 18px;
        height: 18px;
        top: 2.5px;
        left: 2.5px;
    }

    .toggle-switch input:checked ~ .toggle-track .toggle-knob {
        transform: translateX(21px);
    }

    .knob-icon { font-size: 0.5rem; }

    /* ── Tone bar — horizontally scrollable ── */
    .tone-bar {
        gap: 0.5rem;
        margin-bottom: 1rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tone-bar::-webkit-scrollbar { display: none; }

    .tone-label {
        flex-shrink: 0;
        font-size: 0.62rem;
    }

    .tone-buttons {
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .tone-btn {
        flex-shrink: 0;
        font-size: 0.65rem;
        padding: 0.28rem 0.55rem;
        white-space: nowrap;
    }

    /* ── Voice section — compact but readable ── */
    .voice-section { margin-bottom: 1rem; }

    .voice-toggle {
        padding: 0.6rem 0.85rem;
    }

    .voice-icon { font-size: 0.9rem; }
    .voice-title { font-size: 0.74rem; }
    .voice-subtitle { font-size: 0.6rem; }
    .voice-arrow { font-size: 0.65rem; }

    .voice-input-wrapper {
        padding: 0 0.85rem 0.7rem;
    }

    #voice-sample {
        height: 110px;
        font-size: 0.8rem;
        padding: 0.7rem;
        line-height: 1.6;
    }

    #voice-sample::placeholder { font-size: 0.74rem; }

    .voice-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .voice-count { font-size: 0.62rem; }
    .voice-min { font-size: 0.58rem; }

    /* ── Panels — comfortable height ── */
    .panels { gap: 0.85rem; }

    .panel-body { height: 300px; min-height: 300px; max-height: 300px; }
    .loading-state { height: 300px; }
    .output-placeholder { height: 300px; }

    .panel-header {
        padding: 0.55rem 0.9rem;
        min-height: 38px;
    }

    .panel-label { font-size: 0.65rem; }
    .panel-meta { font-size: 0.62rem; }

    #input-text {
        padding: 0.9rem;
        font-size: 0.85rem;
        line-height: 1.7;
    }

    #input-text::placeholder { font-size: 0.8rem; }

    #output-text {
        padding: 0.9rem;
        font-size: 0.85rem;
        line-height: 1.7;
    }

    .output-placeholder p { font-size: 0.78rem; }

    .placeholder-orb {
        width: 42px;
        height: 42px;
    }

    /* ── Action bar ── */
    .action-bar { padding: 1.25rem 0 0; }

    .btn-rewrite {
        padding: 0.65rem 1.8rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .btn-icon { font-size: 0.88rem; }

    /* ── Result stats ── */
    .result-stats { font-size: 0.68rem; padding: 0.5rem 0 0; }
    .stat-dot { margin: 0 0.35rem; }

    /* ── Usage counter ── */
    .usage-counter {
        gap: 1rem;
        font-size: 0.62rem;
        flex-wrap: wrap;
    }

    .usage-bar { width: 32px; }

    /* ── Guest remaining ── */
    .guest-remaining {
        font-size: 0.8rem;
        margin-top: 0.85rem;
    }

    /* ── Loading spinner ── */
    .orbital-spinner {
        width: 46px;
        height: 46px;
    }

    .loading-state p { font-size: 0.75rem; }
    .loading-bar { width: 100px; }

    /* ── Changes report ── */
    .changes-toggle { padding: 0.4rem 0.9rem; }
    .changes-toggle-text { font-size: 0.62rem; }
    .change-item { padding: 0.3rem 0.9rem; gap: 0.5rem; }
    .change-badge { font-size: 0.55rem; }
    .change-content strong { font-size: 0.68rem; }
    .change-detail { font-size: 0.64rem; }

    /* ── Warning bar ── */
    .warning-bar {
        padding: 0.5rem 0.9rem;
        font-size: 0.7rem;
    }

    /* ── Copy/retry/download buttons ── */
    .btn-copy, .btn-retry, .btn-download {
        width: 26px;
        height: 26px;
    }

    .btn-copy svg, .btn-retry svg, .btn-download svg {
        width: 12px;
        height: 12px;
    }

    .panel-header-right { gap: 0.4rem; }

    .download-menu { min-width: 140px; }
    .download-option { padding: 0.45rem 0.75rem; }
    .download-ext { font-size: 0.68rem; }
    .download-desc { font-size: 0.64rem; }

    /* ── Guest modal ── */
    .guest-modal {
        padding: 2rem 1.5rem;
        max-width: 340px;
    }

    .guest-modal-icon { font-size: 2rem; margin-bottom: 0.75rem; }
    .guest-modal-title { font-size: 1.2rem; }
    .guest-modal-text { font-size: 0.85rem; margin-bottom: 1.5rem; }
    .guest-modal-btn { padding: 0.6rem 1.25rem; font-size: 0.85rem; }
    .guest-modal-dismiss { font-size: 0.75rem; }

    /* ── Toast — above FAB ── */
    .toast {
        bottom: 4.5rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
        font-size: 0.78rem;
    }

    /* ── Feedback FAB ── */
    .feedback-fab {
        bottom: 1rem;
        right: 1rem;
    }

    .fab-btn {
        width: 44px;
        height: 44px;
    }

    .fab-popup {
        width: calc(100vw - 2rem);
        right: -0.5rem;
        max-height: 70vh;
        overflow-y: auto;
    }

    .fab-group textarea {
        min-height: 120px;
        max-height: 180px;
    }

    /* ── Language warning ── */
    .language-warning p { font-size: 0.78rem; }

    .btn-switch-deep {
        font-size: 0.8rem;
        padding: 0.45rem 1rem;
    }

    /* ── Aurora — subtler on phones ── */
    .bg-aurora { opacity: 0.3; }

    /* ── Auth pages — login, signup ── */
    .auth-main {
        padding: 0.25rem 0.75rem 2rem;
        min-height: auto;
        display: block;
    }

    .auth-card {
        margin: 0 auto;
    }

    .auth-card {
        padding: 1.25rem 1.25rem 1.75rem;
        border-radius: 14px;
        max-width: 100%;
    }

    .auth-title {
        font-size: 1.3rem;
        margin-bottom: 0.15rem;
    }

    .auth-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .auth-form {
        gap: 1rem;
    }

    .form-group label {
        font-size: 0.75rem;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"] {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .field-hint {
        font-size: 0.68rem;
    }

    .field-error {
        font-size: 0.72rem;
    }

    .auth-submit {
        padding: 0.65rem;
        font-size: 0.88rem;
    }

    .auth-divider {
        margin: 1.25rem 0;
    }

    .auth-divider span {
        font-size: 0.72rem;
    }

    .btn-google {
        padding: 0.6rem;
        font-size: 0.82rem;
    }

    .google-terms-note {
        font-size: 0.68rem;
        margin-top: 0.5rem;
    }

    .auth-switch {
        font-size: 0.78rem;
        margin-top: 1.25rem;
    }

    .auth-error-box {
        padding: 0.6rem 0.85rem;
    }

    .auth-error-box p {
        font-size: 0.78rem;
    }

    .forgot-password-link a {
        font-size: 0.72rem;
    }

    /* ── Terms checkbox ── */
    .terms-label {
        font-size: 0.78rem;
    }

    .terms-checkbox {
        width: 15px;
        height: 15px;
    }

    .terms-group .field-error {
        font-size: 0.68rem;
    }

    /* ── Password toggle on mobile ── */
    .password-toggle svg {
        width: 16px;
        height: 16px;
    }

    /* ── Analytics page ── */
    .analytics-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-grid-2 {
        grid-template-columns: 1fr;
    }

    .analytics-card {
        padding: 1rem 0.85rem;
    }

    .analytics-number {
        font-size: 1.4rem;
    }

    .analytics-number-sm {
        font-size: 0.95rem;
    }

    .analytics-label {
        font-size: 0.68rem;
    }

    .analytics-section-title {
        font-size: 0.95rem;
    }

    .analytics-bar-wrapper {
        gap: 0.35rem;
    }

    .analytics-pct {
        font-size: 0.68rem;
        min-width: 28px;
    }

    .admin-page-title {
        font-size: 1.4rem;
    }

    /* ── Analytics empty state ── */
    .analytics-empty {
        padding: 2rem 1rem;
    }

    .analytics-empty-title {
        font-size: 1.1rem;
    }

    .analytics-empty-text {
        font-size: 0.82rem;
    }
}

/* Button pulse — draws attention when toggle changes */
@keyframes btnPulse {
    0%   { box-shadow: 0 0 0 0 var(--accent); }
    50%  { box-shadow: 0 0 0 10px rgba(194,102,10,0); }
    100% { box-shadow: 0 0 0 0 rgba(194,102,10,0); }
}

.btn-rewrite.pulse {
    animation: btnPulse 0.8s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════
   VOICE CALIBRATION SECTION
   ═══════════════════════════════════════════════════════════════════ */

.voice-section {
    max-width: 1320px;
    margin: 0 auto 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.6s ease;
}

/* Toggle bar */
.voice-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.15rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.voice-toggle:hover {
    background: var(--accent-soft);
}

.voice-toggle-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.voice-icon {
    font-size: 1rem;
}

.voice-toggle-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.voice-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.6s ease;
}

.voice-subtitle {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    transition: color 0.6s ease;
}

.voice-arrow {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.voice-section.open .voice-arrow {
    transform: rotate(180deg);
}

/* Collapsible body */
.voice-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-section.open .voice-body {
    max-height: 300px;
}

.voice-input-wrapper {
    padding: 0 1.15rem 0.85rem;
}

/* Textarea */
#voice-sample {
    width: 100%;
    height: 140px;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    resize: none;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    font-family: var(--font-body);
    background: var(--bg);
    transition: border-color 0.2s ease, background 0.6s ease, color 0.6s ease;
}

#voice-sample:focus {
    border-color: var(--accent);
}

#voice-sample::placeholder {
    color: var(--text-tertiary);
    font-size: 0.82rem;
}

#voice-sample::-webkit-scrollbar { width: 5px; }
#voice-sample::-webkit-scrollbar-track { background: transparent; }
#voice-sample::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* Meta line below textarea */
.voice-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.1rem 0;
}

.voice-count {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

/* Turns accent color when minimum is met */
.voice-count.valid {
    color: var(--accent);
    font-weight: 600;
}

.voice-min {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    opacity: 0.6;
}

/* Warning when sample is too short and user tries to rewrite */
.voice-warning {
    font-size: 0.72rem;
    color: #dc2626;
    padding: 0.3rem 0.1rem 0;
    display: none;
}

.voice-warning.show {
    display: block;
}

/* Voice section hidden by default, shown only in premium/deep mode */
.voice-section {
    display: none;
}

body.premium .voice-section {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   PROFANITY HIGHLIGHTING
   ═══════════════════════════════════════════════════════════════════ */

/* Overlay div that replaces textarea temporarily */
.highlight-overlay {
    width: 100%;
    height: 100%;
    padding: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.8;
    font-family: var(--font-body);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    cursor: text;
    background: transparent;
}

.highlight-overlay::-webkit-scrollbar { width: 5px; }
.highlight-overlay::-webkit-scrollbar-track { background: transparent; }
.highlight-overlay::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* The flagged word highlight */
.flagged-word {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
    border-radius: 3px;
    padding: 1px 3px;
    border-bottom: 2px solid #dc2626;
    font-weight: 600;
}

/* Red border on the panel containing errors */
.input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   USAGE COUNTER
   ═══════════════════════════════════════════════════════════════════ */

.usage-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.5rem 0 0;
    font-size: 0.68rem;
    color: var(--text-tertiary);
    transition: color 0.6s ease;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.usage-label {
    color: var(--text-tertiary);
}

.usage-value {
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

/* Turns amber when usage is above 70% */
.usage-value.warning {
    color: #d97706;
}

/* Turns red when usage is above 90% */
.usage-value.danger {
    color: #dc2626;
}

/* Bar visualization */
.usage-bar {
    width: 40px;
    height: 3px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.4s ease, background 0.3s ease;
}

.usage-bar-fill.warning {
    background: #d97706;
}

.usage-bar-fill.danger {
    background: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════════
   TONE SELECTOR
   ═══════════════════════════════════════════════════════════════════ */

/* Hidden by default, shown only in deep rewrite mode */
.tone-bar {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

body.premium .tone-bar {
    display: flex;
}

.tone-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-right: 0.25rem;
}

.tone-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tone-btn {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.tone-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.tone-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(194, 102, 10, 0.2);
}

body.premium .tone-btn.active {
    box-shadow: 0 2px 12px var(--accent-glow);
}


/* ═══════════════════════════════════════════════════════════════════
   HISTORY PANEL — COLLAPSIBLE SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */

.history-panel {
    position: fixed;
    top: 120px;
    right: 2rem;
    width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 50;
    transition: all 0.6s ease;
}

body.premium .history-panel {
    box-shadow: var(--shadow), 0 0 40px rgba(240,160,48,0.03);
}

/* Toggle header — always visible */
.history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.2s ease;
}

.history-toggle:hover {
    background: var(--accent-soft);
}

.history-label {
    font-size: 0.63rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.history-arrow {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.history-panel.open .history-arrow {
    transform: rotate(180deg);
}

/* Collapsible body */
.history-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-panel.open .history-body {
    max-height: 400px;
}

/* Scrollable list */
.history-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 320px;
    padding: 0.3rem 0.4rem;
    gap: 0.25rem;
}

.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* Compact history card */
.history-item {
    padding: 0.4rem 0.55rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

body.premium .history-item {
    background: var(--bg-secondary);
}

.history-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.history-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.history-preview {
    font-size: 0.65rem;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    transition: color 0.6s ease;
}

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

.history-mode {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-time {
    font-size: 0.55rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* Clear button at bottom of expanded list */
.history-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: calc(100% - 0.8rem);
    margin: 0.25rem 0.4rem 0.4rem;
    padding: 0.35rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: all 0.2s ease;
}

.history-clear:hover {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.06);
}

/* History clear confirmation */
.history-confirm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.4rem 0.45rem;
    margin: 0 0.4rem 0.4rem;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 6px;
    background: rgba(220, 38, 38, 0.04);
}

.confirm-text {
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.confirm-buttons {
    display: flex;
    gap: 0.4rem;
}

.confirm-yes,
.confirm-no {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid;
}

.confirm-yes {
    color: white;
    background: #dc2626;
    border-color: #dc2626;
}

.confirm-yes:hover {
    background: #b91c1c;
}

.confirm-no {
    color: var(--text-secondary);
    background: none;
    border-color: var(--border);
}

.confirm-no:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
}

/* Empty history message */
.history-empty {
    padding: 1rem 0.5rem;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-tertiary);
}

@media (max-width: 1200px) {
    .history-panel {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   LANGUAGE WARNING
   Friendly amber warning when non-English text is used in Quick Fix.
   Includes a button to switch to Deep Rewrite mode.
   ═══════════════════════════════════════════════════════════════════ */

.language-warning {
    color: #92400e !important;
}

.language-warning p {
    color: #92400e;
    max-width: 360px;
    text-align: center;
    line-height: 1.5;
}

.btn-switch-deep {
    margin-top: 1rem;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-switch-deep:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Dark mode override */
body.premium .language-warning {
    color: #fbbf24 !important;
}

body.premium .language-warning p {
    color: #fbbf24;
}


/* ═══════════════════════════════════════════════════════════════════
   HEADER NAV — Auth links in the top right
   ═══════════════════════════════════════════════════════════════════ */

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px;
    padding: 0.35rem;
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -1px 0 rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.header-nav:hover {
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.02);
}

.nav-greeting {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}


/* Logout button styled as a link */
.nav-logout-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.nav-logout {
    background: rgba(220, 38, 38, 0.08);
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: #dc2626 !important;
    font-weight: 500;
    border-radius: 8px;
}

.nav-logout:hover {
    background: #dc2626 !important;
    color: #fff !important;
}


/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGES — Signup and Login
   Centered card layout with form fields.
   ═══════════════════════════════════════════════════════════════════ */

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    z-index: 2;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.4rem 0;
    text-align: center;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 1.75rem 0;
}

/* ── Error box for non-field errors ── */
.auth-error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.auth-error-box p {
    color: #dc2626;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* ── Form layout ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

/* ── Input fields ── */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Error state ── */
.form-group.has-error input {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
    font-size: 0.8rem;
    color: #dc2626;
    line-height: 1.3;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* ── Submit button ── */
.auth-submit {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.auth-submit:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-soft);
}

.auth-submit:active {
    transform: translateY(0);
}

/* ── Switch link (Already have account? / Don't have account?) ── */
.auth-switch {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGES — Dark mode (premium) overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .auth-card {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .form-group input[type="text"],
body.premium .form-group input[type="email"],
body.premium .form-group input[type="password"] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.premium .form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

body.premium .form-group.has-error input {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

body.premium .field-error {
    color: #f87171;
}

body.premium .auth-error-box {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

body.premium .auth-error-box p {
    color: #f87171;
}

body.premium .header-nav {
    background: rgba(20, 18, 15, 0.5);
    border-color: rgba(240, 160, 48, 0.08);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

body.premium .header-nav:hover {
    background: rgba(20, 18, 15, 0.6);
    border-color: rgba(240, 160, 48, 0.12);
}

body.premium .nav-greeting {
    color: rgba(255, 255, 255, 0.6);
}

body.premium .nav-link {
    color: rgba(255, 255, 255, 0.6);
}

body.premium .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

body.premium .nav-active {
    background: var(--accent) !important;
    color: #fff !important;
}

body.premium .nav-logout {
    background: rgba(248, 113, 113, 0.1) !important;
    color: #f87171 !important;
}

body.premium .nav-logout:hover {
    background: #f87171 !important;
    color: #0f0f19 !important;
}

/* ── Nav icons ── */
.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: none;
}

/* Show icons on desktop */
@media (min-width: 861px) {
    .nav-icon {
        display: block;
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .nav-logout {
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }
}

/* Mobile: icons only, no text */
@media (max-width: 860px) {
    .nav-icon {
        display: block;
        width: 16px;
        height: 16px;
    }

    .nav-text {
        display: none;
    }

    .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.7rem;
        min-width: unset;
    }

    .nav-logout {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.7rem;
        min-width: unset;
    }

    .header-nav {
        gap: 0.5rem;
        padding: 0.25rem 0.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   GOOGLE SIGN-IN BUTTON & DIVIDER
   ═══════════════════════════════════════════════════════════════════ */

/* "or" divider between form and Google button */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Google button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-google svg {
    flex-shrink: 0;
}

/* Dark mode */
body.premium .btn-google {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.premium .btn-google:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.premium .auth-divider::before,
body.premium .auth-divider::after {
    background: rgba(255, 255, 255, 0.1);
}

body.premium .auth-divider span {
    color: rgba(255, 255, 255, 0.4);
}


/* ═══════════════════════════════════════════════════════════════════
   PROFILE PAGE
   Stacked cards layout for account info, edit, password, delete.
   ═══════════════════════════════════════════════════════════════════ */

.profile-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 3rem;
}

/* ── Individual card ── */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem 1.5rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.profile-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
}

/* ── Account info rows ── */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.profile-info-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.profile-info-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ── Profile forms ── */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-submit {
    align-self: flex-start;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.25rem;
}

.profile-submit:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-soft);
}

/* ── Success message ── */
.profile-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #166534;
}

/* ── Info note (for Google users, delete warning) ── */
.profile-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ── Active nav link ── */
.nav-active {
    color: #fff !important;
    font-weight: 600;
    background: var(--accent) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   DELETE ACCOUNT — Danger zone
   ═══════════════════════════════════════════════════════════════════ */

.profile-card-danger {
    border-color: rgba(220, 38, 38, 0.2);
}

.profile-card-danger .profile-card-title {
    color: #dc2626;
}

.profile-delete-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #dc2626;
    background: none;
    border: 1px solid #dc2626;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
}

.profile-delete-btn:hover {
    background: #dc2626;
    color: #fff;
}

/* ── Delete confirmation ── */
.delete-confirm {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.delete-confirm-text {
    font-size: 0.85rem;
    color: #991b1b;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.delete-confirm-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 6px;
    outline: none;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.delete-confirm-input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.delete-confirm-buttons {
    display: flex;
    gap: 0.5rem;
}

.delete-confirm-yes {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: #dc2626;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-confirm-yes:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.delete-confirm-yes:not(:disabled):hover {
    background: #b91c1c;
}

.delete-confirm-no {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-confirm-no:hover {
    background: var(--bg-secondary);
}


/* ═══════════════════════════════════════════════════════════════════
   PROFILE PAGE — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .profile-card {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .profile-info-row {
    border-color: rgba(255, 255, 255, 0.06);
}

body.premium .profile-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

body.premium .profile-card-danger {
    border-color: rgba(239, 68, 68, 0.2);
}

body.premium .profile-card-danger .profile-card-title {
    color: #f87171;
}

body.premium .profile-delete-btn {
    color: #f87171;
    border-color: #f87171;
}

body.premium .profile-delete-btn:hover {
    background: #f87171;
    color: #0f0f19;
}

body.premium .delete-confirm {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

body.premium .delete-confirm-text {
    color: #fca5a5;
}

body.premium .delete-confirm-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #e2e8f0;
}

body.premium .delete-confirm-input:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   ADMIN — User Management Page
   Custom admin interface matching the site's design.
   ═══════════════════════════════════════════════════════════════════ */

.admin-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 3rem;
}

.admin-page-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ── Stats cards row ── */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.admin-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-stat-active {
    color: #16a34a;
}

.admin-stat-restricted {
    color: #dc2626;
}

.admin-stat-staff {
    color: var(--accent);
}

.admin-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ── Search and filter toolbar ── */
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.admin-search-input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(20px);
}

.admin-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-search-input::placeholder {
    color: var(--text-secondary);
}

.admin-search-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-search-btn:hover {
    background: var(--accent-hover);
}

/* ── Filter buttons ── */
.admin-filters {
    display: flex;
    gap: 0.35rem;
}

.admin-filter-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(20px);
}

.admin-filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.admin-filter-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Users table ── */
.admin-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table thead {
    background: var(--bg-secondary);
}

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.admin-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Restricted user rows are slightly faded */
.row-restricted {
    opacity: 0.65;
}

.row-restricted:hover {
    opacity: 1;
}

/* ── User cell (username + full name + badge) ── */
.user-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-cell-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-cell-fullname {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Badges ── */
.user-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: fit-content;
    margin-top: 0.15rem;
}

.badge-admin {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ── Status pills ── */
.user-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
}

.status-active {
    background: #f0fdf4;
    color: #166534;
}

.status-restricted {
    background: #fef2f2;
    color: #991b1b;
}

/* ── Action buttons ── */
.admin-action-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
}

.btn-restrict {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-restrict:hover {
    background: #dc2626;
    color: #fff;
}

.btn-unrestrict {
    color: #16a34a;
    border-color: #16a34a;
}

.btn-unrestrict:hover {
    background: #16a34a;
    color: #fff;
}

/* ── Empty state ── */
.admin-table-empty {
    text-align: center;
    padding: 2rem 1rem !important;
    color: var(--text-secondary);
}

/* ── Muted text helper ── */
.text-muted {
    color: var(--text-secondary);
    font-size: 0.8rem;
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN MODAL — Confirmation dialog
   ═══════════════════════════════════════════════════════════════════ */

.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.admin-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.admin-modal-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
}

.admin-modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.admin-modal-confirm {
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-danger {
    background: #dc2626;
}

.modal-btn-danger:hover {
    background: #b91c1c;
}

.modal-btn-success {
    background: #16a34a;
}

.modal-btn-success:hover {
    background: #15803d;
}

.admin-modal-cancel {
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-modal-cancel:hover {
    background: var(--bg-secondary);
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .admin-stat-card {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .admin-stat-active {
    color: #4ade80;
}

body.premium .admin-stat-restricted {
    color: #f87171;
}

body.premium .admin-search-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.premium .admin-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

body.premium .admin-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

body.premium .admin-filter-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

body.premium .admin-filter-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

body.premium .admin-table-wrapper {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .admin-table thead {
    background: rgba(255, 255, 255, 0.03);
}

body.premium .admin-table th {
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.06);
}

body.premium .admin-table td {
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.06);
}

body.premium .admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.premium .status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

body.premium .status-restricted {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.premium .badge-admin {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

body.premium .admin-modal {
    background: rgba(15, 15, 25, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

body.premium .admin-modal-text {
    color: #e2e8f0;
}


/* ═══════════════════════════════════════════════════════════════════
   SETTINGS PAGE — Preferences & Feedback
   ═══════════════════════════════════════════════════════════════════ */

/* ── Settings group (label + inputs) ── */
.settings-group {
    margin-bottom: 1.25rem;
}

.settings-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: -0.25rem 0 0.6rem 0;
}

/* ── Mode radio buttons (two big cards) ── */
.settings-radio-group {
    display: flex;
    gap: 0.75rem;
}

.settings-radio {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-radio:hover {
    border-color: var(--text-secondary);
}

.settings-radio.selected,
.settings-radio:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Hide the actual radio input */
.settings-radio input[type="radio"] {
    display: none;
}

.settings-radio-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.settings-radio-icon {
    font-size: 1.1rem;
}

.settings-radio-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-radio-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ── Tone radio buttons (grid of pills) ── */
.settings-tone-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.settings-tone {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-tone:hover {
    border-color: var(--text-secondary);
}

.settings-tone.selected,
.settings-tone:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Hide the actual radio input */
.settings-tone input[type="radio"] {
    display: none;
}

.settings-tone-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ── Feedback select dropdown ── */
.feedback-select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

.feedback-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Feedback textarea ── */
.settings-form textarea,
.profile-form textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.settings-form textarea:focus,
.profile-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Past feedback history ── */
.feedback-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feedback-item {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.feedback-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.feedback-category-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-bug {
    background: #fef2f2;
    color: #991b1b;
}

.badge-feature {
    background: #eff6ff;
    color: #1e40af;
}

.badge-general {
    background: #f0fdf4;
    color: #166534;
}

.feedback-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feedback-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}


/* ═══════════════════════════════════════════════════════════════════
   SETTINGS — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .settings-radio {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .settings-radio:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

body.premium .settings-radio.selected,
body.premium .settings-radio:has(input:checked) {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

body.premium .settings-tone {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .settings-tone:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

body.premium .settings-tone.selected,
body.premium .settings-tone:has(input:checked) {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

body.premium .feedback-select {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

body.premium .feedback-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

body.premium .settings-form textarea,
body.premium .profile-form textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.premium .settings-form textarea:focus,
body.premium .profile-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

body.premium .feedback-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

body.premium .badge-bug {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.premium .badge-feature {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

body.premium .badge-general {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN TABS — Switch between Users and Feedback
   ═══════════════════════════════════════════════════════════════════ */

.admin-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.25rem;
    backdrop-filter: blur(20px);
}

.admin-tab {
    flex: 1;
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.admin-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.admin-tab.active {
    color: #fff;
    background: var(--accent);
    font-weight: 600;
}

.admin-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    border-radius: 10px;
}

.admin-tab.active .admin-tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ── Filter group label ── */
.filter-group-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN FEEDBACK LIST
   ═══════════════════════════════════════════════════════════════════ */

.feedback-admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feedback-admin-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(20px);
    transition: all 0.2s ease;
}

/* Unread items have a left accent border */
.feedback-unread {
    border-left: 3px solid var(--accent);
}

/* ── Header row ── */
.feedback-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.feedback-admin-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-admin-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Unread dot indicator */
.feedback-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.feedback-admin-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Preview (click to expand) ── */
.feedback-admin-preview {
    cursor: pointer;
    position: relative;
}

.feedback-admin-preview .feedback-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}

.feedback-expand-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    display: block;
}

/* Full message — hidden by default */
.feedback-admin-full {
    display: none;
}

.feedback-admin-full .feedback-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

/* When expanded: hide preview, show full */
.feedback-admin-item.expanded .feedback-admin-preview {
    display: none;
}

.feedback-admin-item.expanded .feedback-admin-full {
    display: block;
}

/* ── Action buttons ── */
.feedback-admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.feedback-action-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.feedback-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.feedback-action-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.feedback-action-primary:hover {
    background: var(--accent);
    color: #fff;
}

.feedback-action-danger {
    color: #dc2626;
    border-color: #dc2626;
}

.feedback-action-danger:hover {
    background: #dc2626;
    color: #fff;
}

/* ── Empty state ── */
.feedback-admin-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(20px);
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN FEEDBACK — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .admin-tabs {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .admin-tab {
    color: rgba(255, 255, 255, 0.5);
}

body.premium .admin-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

body.premium .admin-tab.active {
    color: #fff;
    background: var(--accent);
}

body.premium .admin-tab-badge {
    background: #f87171;
}

body.premium .admin-tab.active .admin-tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

body.premium .feedback-admin-item {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .feedback-unread {
    border-left-color: var(--accent);
}

body.premium .feedback-admin-user {
    color: #e2e8f0;
}

body.premium .feedback-admin-preview .feedback-message,
body.premium .feedback-admin-full .feedback-message {
    color: #e2e8f0;
}

body.premium .feedback-admin-actions {
    border-color: rgba(255, 255, 255, 0.06);
}

body.premium .feedback-action-btn {
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

body.premium .feedback-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

body.premium .feedback-action-primary {
    color: var(--accent);
    border-color: var(--accent);
}

body.premium .feedback-action-primary:hover {
    background: var(--accent);
    color: #fff;
}

body.premium .feedback-action-danger {
    color: #f87171;
    border-color: #f87171;
}

body.premium .feedback-action-danger:hover {
    background: #f87171;
    color: #0f0f19;
}

body.premium .feedback-admin-empty {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}


/* ═══════════════════════════════════════════════════════════════════
   ANALYTICS PAGE — User stats dashboard
   ═══════════════════════════════════════════════════════════════════ */

/* ── Section grouping ── */
.analytics-section {
    margin-bottom: 0.5rem;
}

.analytics-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

/* ── Card grids ── */
.analytics-grid {
    display: grid;
    gap: 0.75rem;
}

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

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

/* ── Individual stat card ── */
.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.analytics-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.analytics-number-sm {
    font-size: 1.1rem;
    font-weight: 600;
}

.analytics-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* ── Percentage bar ── */
.analytics-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.analytics-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.analytics-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 32px;
    text-align: right;
}

/* ── Empty state ── */
.analytics-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    backdrop-filter: blur(20px);
}

.analytics-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.analytics-empty-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.analytics-empty-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.analytics-empty-btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.analytics-empty-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-soft);
}


/* ═══════════════════════════════════════════════════════════════════
   ANALYTICS — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .analytics-card {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .analytics-number {
    color: #e2e8f0;
}

body.premium .analytics-bar {
    background: rgba(255, 255, 255, 0.08);
}

body.premium .analytics-pct {
    color: #a5b4fc;
}

body.premium .analytics-empty {
    background: rgba(15, 15, 25, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .analytics-empty-title {
    color: #e2e8f0;
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN ANALYTICS — Breakdown rows and growth cards
   ═══════════════════════════════════════════════════════════════════ */

/* ── Breakdown rows (mode split, top tones, top languages) ── */
.breakdown-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.breakdown-row:last-child {
    margin-bottom: 0;
}

.breakdown-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 80px;
    flex-shrink: 0;
}

.breakdown-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Growth cards ── */
.growth-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.growth-change {
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
}

.growth-positive {
    color: #166534;
    background: #f0fdf4;
}

.growth-negative {
    color: #991b1b;
    background: #fef2f2;
}

.growth-compare {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN ANALYTICS — Dark mode overrides
   ═══════════════════════════════════════════════════════════════════ */

body.premium .breakdown-name {
    color: #e2e8f0;
}

body.premium .breakdown-count {
    color: rgba(255, 255, 255, 0.5);
}

body.premium .growth-positive {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.15);
}

body.premium .growth-negative {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}

body.premium .growth-compare {
    color: rgba(255, 255, 255, 0.4);
}


/* ═══════════════════════════════════════════════════════════════════
   FLOATING FEEDBACK BUTTON (FAB)
   A chat-style button on the bottom-right corner of every page.
   Click to open a popup with category + message form.
   ═══════════════════════════════════════════════════════════════════ */

/* Container — positions everything in the bottom-right */
.feedback-fab {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* The round floating button */
.fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.fab-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* When popup is open, rotate the icon slightly */
.feedback-fab.open .fab-btn {
    background: var(--text-secondary);
}

/* ── The popup card ── */
.fab-popup {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 550px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.2s ease;
    overflow: hidden;
}

/* Show popup when container has .open class */
.feedback-fab.open .fab-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.fab-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.fab-popup-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.fab-popup-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}

.fab-popup-close:hover {
    color: var(--text-primary);
}

/* Body */
.fab-popup-body {
    padding: 1rem;
}

/* Form groups */
.fab-group {
    margin-bottom: 0.75rem;
}

.fab-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.fab-group select,
.fab-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg);
    transition: border-color 0.2s;
    resize: vertical;
}

.fab-group select:focus,
.fab-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.fab-group textarea {
    min-height: 160px;
    max-height: 240px;
}

.fab-char-count {
    display: block;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Submit button */
.fab-submit {
    width: 100%;
    padding: 0.55rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fab-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.fab-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Success state */
.fab-success {
    text-align: center;
    padding: 1.5rem 0.5rem;
}

.fab-success-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d1fae5;
    color: #065f46;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 auto 0.75rem;
}

.fab-success p {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.fab-success-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Error state */
.fab-error {
    padding: 0.6rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.fab-error p {
    font-size: 0.8rem;
    color: #991b1b;
    margin: 0;
}

/* Guest state */
.fab-guest {
    text-align: center;
    padding: 1rem 0.5rem;
}

.fab-guest p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.fab-login-link {
    display: inline-block;
    padding: 0.45rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.fab-login-link:hover {
    opacity: 0.9;
}

/* ── Dark mode overrides ── */
body.premium .fab-popup {
    background: rgba(15, 15, 25, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.premium .fab-popup-header {
    border-color: rgba(255, 255, 255, 0.08);
}

body.premium .fab-popup-title {
    color: #e2e8f0;
}

body.premium .fab-popup-close:hover {
    color: #fff;
}

body.premium .fab-group label {
    color: rgba(255, 255, 255, 0.6);
}

body.premium .fab-group select,
body.premium .fab-group textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.premium .fab-group select:focus,
body.premium .fab-group textarea:focus {
    border-color: var(--accent);
}

body.premium .fab-char-count {
    color: rgba(255, 255, 255, 0.3);
}

body.premium .fab-success-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

body.premium .fab-success p {
    color: #e2e8f0;
}

body.premium .fab-success-sub {
    color: rgba(255, 255, 255, 0.5);
}

body.premium .fab-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

body.premium .fab-error p {
    color: #f87171;
}

body.premium .fab-guest p {
    color: rgba(255, 255, 255, 0.6);
}

/* ── Mobile: slightly smaller popup ── */
@media (max-width: 480px) {
    .fab-popup {
        width: 340px;
        right: -0.5rem;
    }

    .feedback-fab {
        bottom: 1rem;
        right: 1rem;
    }

    /* ── Analytics page — compact for phones ── */
    .analytics-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }

    .analytics-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
    }

    .analytics-card {
        padding: 0.75rem 0.7rem;
    }

    .analytics-number {
        font-size: 1.2rem;
    }

    .analytics-number-sm {
        font-size: 0.85rem;
    }

    .analytics-label {
        font-size: 0.6rem;
        letter-spacing: 0.02em;
    }

    .analytics-section-title {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .analytics-section {
        margin-bottom: 0.25rem;
    }

    .analytics-bar-wrapper {
        gap: 0.3rem;
    }

    .analytics-bar {
        height: 4px;
    }

    .analytics-pct {
        font-size: 0.6rem;
        min-width: 24px;
    }

    .admin-page-title {
        font-size: 1.3rem;
    }

    .analytics-empty {
        padding: 1.5rem 1rem;
    }

    .analytics-empty-icon {
        font-size: 2rem;
    }

    .analytics-empty-title {
        font-size: 1rem;
    }

    .analytics-empty-text {
        font-size: 0.78rem;
    }

    /* ── Profile page ── */
    .profile-container {
        gap: 1rem;
    }

    .profile-card {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }

    .profile-card-title {
        font-size: 1.05rem;
        margin-bottom: 1rem;
    }

    .profile-info-label {
        font-size: 0.78rem;
    }

    .profile-info-value {
        font-size: 0.78rem;
    }

    .profile-note {
        font-size: 0.78rem;
    }

    .profile-submit {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    /* ── Admin pages ── */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .admin-stat-card {
        padding: 0.75rem 0.6rem !important;
    }

    .admin-stat-number {
        font-size: 1.2rem !important;
    }

    .admin-stat-label {
        font-size: 0.6rem !important;
    }

    .admin-page-title {
        font-size: 1.3rem !important;
    }

    .admin-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .admin-search-form {
        min-width: unset !important;
        width: 100% !important;
    }

    .admin-search-input {
        font-size: 0.78rem !important;
        padding: 0.5rem 0.7rem !important;
    }

    .admin-search-btn {
        font-size: 0.78rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    .admin-filters {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .admin-filters::-webkit-scrollbar { display: none; }

    .admin-filter-btn {
        font-size: 0.68rem !important;
        padding: 0.35rem 0.55rem !important;
        flex-shrink: 0;
    }

    .admin-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        font-size: 0.7rem !important;
        min-width: 550px !important;
    }

    .admin-table th {
        padding: 0.5rem 0.55rem !important;
        font-size: 0.6rem !important;
    }

    .admin-table td {
        padding: 0.5rem 0.55rem !important;
    }

    .admin-tabs {
        padding: 0.2rem !important;
    }

    .admin-tab {
        font-size: 0.72rem !important;
        padding: 0.4rem 0.5rem !important;
    }

    .admin-tab-badge {
        font-size: 0.58rem !important;
        min-width: 16px !important;
        height: 16px !important;
    }

    /* ── Admin modal ── */
    .admin-modal {
        padding: 1.25rem !important;
    }

    .admin-modal-text {
        font-size: 0.82rem !important;
    }

    /* ── Feedback admin ── */
    .feedback-admin-item {
        padding: 0.75rem 0.85rem;
    }

    .feedback-admin-user {
        font-size: 0.78rem;
    }

    .feedback-admin-preview .feedback-message,
    .feedback-admin-full .feedback-message {
        font-size: 0.78rem;
    }

    .feedback-action-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.55rem;
    }

    /* ── Settings page ── */
    .settings-radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .settings-radio {
        padding: 0.75rem;
    }

    .settings-radio-name {
        font-size: 0.82rem;
    }

    .settings-radio-desc {
        font-size: 0.68rem;
    }

    .settings-tone-grid {
        gap: 0.35rem;
    }

    .settings-tone {
        padding: 0.4rem 0.75rem;
    }

    .settings-tone-name {
        font-size: 0.78rem;
    }

    /* ── Legal pages — smaller text for mobile ── */
    .legal-container {
        padding: 1rem 0.85rem 2.5rem !important;
    }

    .legal-title {
        font-size: 1.3rem !important;
        margin-bottom: 0.2rem !important;
    }

    .legal-updated {
        font-size: 0.68rem !important;
        margin-bottom: 1.25rem !important;
    }

    .legal-content h2 {
        font-size: 0.85rem !important;
        margin-top: 1.5rem !important;
        margin-bottom: 0.35rem !important;
    }

    .legal-content h3 {
        font-size: 0.78rem !important;
        margin-top: 1rem !important;
    }

    .legal-content p {
        font-size: 0.75rem !important;
        line-height: 1.6 !important;
        margin-bottom: 0.6rem !important;
    }

    .legal-back {
        margin-top: 2rem !important;
        padding-top: 1rem !important;
    }

    .legal-back-link {
        font-size: 0.78rem !important;
    }

    /* ── Verify email / Forgot password — compact ── */
    .verify-card {
        padding: 1.25rem 1rem !important;
    }

    .verify-icon {
        font-size: 2rem !important;
        margin-bottom: 0.6rem !important;
    }

    .verify-subtitle {
        font-size: 0.78rem !important;
        margin-bottom: 1.25rem !important;
        line-height: 1.5 !important;
    }

    .verify-hint {
        font-size: 0.72rem !important;
    }

    .verify-resend-btn {
        font-size: 0.78rem !important;
    }

    .otp-input {
        font-size: 1.8rem !important;
        padding: 0.9rem !important;
        letter-spacing: 0.8rem !important;
    }

    .email-cancel-btn {
        font-size: 0.75rem !important;
    }

    .email-step-badge {
        font-size: 0.68rem !important;
    }

    /* ── Breakdown rows (admin analytics) ── */
    .breakdown-name {
        font-size: 0.72rem;
        min-width: 60px;
    }

    .breakdown-count {
        font-size: 0.68rem;
    }

    .growth-header {
        gap: 0.35rem;
    }

    .growth-change {
        font-size: 0.7rem;
    }

    .growth-compare {
        font-size: 0.68rem;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   GUEST LIMIT MODAL
   Shown after 3 free rewrites for unauthenticated users.
   ═══════════════════════════════════════════════════════════════════ */

.guest-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: guestFadeIn 0.3s ease forwards;
}

@keyframes guestFadeIn {
    to { opacity: 1; }
}

.guest-modal {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    animation: guestSlideUp 0.3s ease forwards;
}

@keyframes guestSlideUp {
    to { transform: translateY(0); }
}

.guest-modal-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.guest-modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.guest-modal-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.75rem;
}

.guest-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.guest-modal-btn {
    display: block;
    padding: 0.7rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.guest-modal-signup {
    background: var(--accent);
    color: #fff;
}

.guest-modal-signup:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.guest-modal-login {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.guest-modal-login:hover {
    background: var(--bg-secondary);
}

.guest-modal-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.4rem;
    transition: color 0.2s;
}

.guest-modal-dismiss:hover {
    color: var(--text-secondary);
}

/* ── Dark mode ── */
body.premium .guest-modal {
    background: rgba(15, 15, 25, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.premium .guest-modal-title {
    color: #e2e8f0;
}

body.premium .guest-modal-text {
    color: rgba(255, 255, 255, 0.6);
}

body.premium .guest-modal-login {
    border-color: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

body.premium .guest-modal-login:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.premium .guest-modal-dismiss {
    color: rgba(255, 255, 255, 0.3);
}

body.premium .guest-modal-dismiss:hover {
    color: rgba(255, 255, 255, 0.5);
}

/* ── Remaining count badge on rewrite button ── */
.guest-remaining {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 1rem;
    text-align: center;
}

body.premium .guest-remaining {
    color: rgba(255, 255, 255, 0.4);
}


/* ═══════════════════════════════════════════════════════════════════
   EMAIL VERIFICATION PAGE
   ═══════════════════════════════════════════════════════════════════ */

.verify-card {
    max-width: 420px;
    text-align: center;
}

.verify-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.verify-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.verify-subtitle strong {
    color: var(--text-primary);
}

.verify-form {
    margin-bottom: 1.5rem;
}

.otp-wrapper {
    margin-bottom: 1.25rem;
}

.otp-input {
    width: 100%;
    padding: 0.9rem;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.8rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

.otp-input:focus {
    outline: none;
    border-color: var(--accent);
}

.otp-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0.8rem;
    font-weight: 400;
}

.verify-footer {
    margin-top: 1rem;
}

.verify-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.verify-resend-form {
    display: inline;
}

.verify-resend-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    padding: 0;
    transition: opacity 0.2s;
}

.verify-resend-btn:hover {
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════
   UNVERIFIED EMAIL BANNER
   Shown at the top of every page for unverified users.
   ═══════════════════════════════════════════════════════════════════ */

.unverified-banner {
    background: #fef3c7;
    border-bottom: 1px solid #fde68a;
    padding: 0.6rem 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: #92400e;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1500;
}

.unverified-banner a {
    color: #92400e;
    font-weight: 600;
    text-decoration: underline;
    margin-left: 0.3rem;
}

.unverified-banner a:hover {
    color: #78350f;
}

/* Push the header down when banner is showing */
body.has-unverified-banner header {
    margin-top: 2.2rem;
}

/* Dark mode */
body.premium .unverified-banner {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

body.premium .unverified-banner a {
    color: #fbbf24;
}


/* ═══════════════════════════════════════════════════════════════════
   EMAIL CHANGE — Two-step verification on profile page
   ═══════════════════════════════════════════════════════════════════ */

.email-change-step {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 0.5rem;
}

.email-step-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.email-step-badge.step-2 {
    background: #d1fae5;
    color: #065f46;
}

.email-change-step .otp-wrapper {
    max-width: 280px;
}

.email-change-step .otp-input {
    font-size: 1.4rem;
    letter-spacing: 0.6rem;
    padding: 0.7rem;
}

.email-cancel-btn {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    padding: 0.3rem 0.6rem;
    transition: opacity 0.2s;
}

.email-cancel-btn:hover {
    opacity: 0.7;
}

/* Dark mode */
body.premium .email-change-step {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
}

body.premium .email-step-badge {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

body.premium .email-step-badge.step-2 {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

body.premium .email-cancel-btn {
    color: #f87171;
}


/* ═══════════════════════════════════════════════════════════════════
   FORGOT PASSWORD LINK — on login page
   ═══════════════════════════════════════════════════════════════════ */

.forgot-password-link {
    text-align: right;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.forgot-password-link a {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.forgot-password-link a:hover {
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════════════
   LEGAL PAGES — Terms and Privacy Policy
   ═══════════════════════════════════════════════════════════════════ */

.legal-container {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.legal-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.legal-updated {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

.legal-content h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.legal-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

.legal-content p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.legal-back {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.legal-back-link {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.legal-back-link:hover {
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════
   TERMS CHECKBOX — on signup form
   ═══════════════════════════════════════════════════════════════════ */

.terms-group {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.terms-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.5;
}

.terms-checkbox {
    margin-top: 0.2rem;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

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

.terms-text a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.terms-text a:hover {
    text-decoration: underline;
}

.terms-group .field-error {
    margin-left: 1.6rem;
}

/* ═══════════════════════════════════════════════════════════════════
   GOOGLE TERMS NOTE — below Google sign-in button
   ═══════════════════════════════════════════════════════════════════ */

.google-terms-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.6rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.google-terms-note a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.google-terms-note a:hover {
    color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════════════
   PASSWORD VISIBILITY TOGGLE
   Eye icon inside password fields to show/hide password.
   ═══════════════════════════════════════════════════════════════════ */

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 2.8rem !important;
}

.password-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

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

.password-toggle svg {
    width: 18px;
    height: 18px;
}


/* ═══════════════════════════════════════════════════════════════════
   PROFILE HISTORY — Mobile only
   Shows recent rewrite history on the profile page for mobile users
   who can't see the desktop sidebar.
   ═══════════════════════════════════════════════════════════════════ */

/* Hidden on desktop — the sidebar handles it */
.profile-history-mobile {
    display: none;
}

/* Shown on mobile */
@media (max-width: 1200px) {
    .profile-history-mobile {
        display: block;
    }
}

/* History items inside the profile card */
.profile-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.profile-history-item {
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-decoration: none;
    color: inherit;
}

body.premium .profile-history-item {
    background: var(--bg-secondary);
}

.profile-history-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.profile-history-preview {
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.profile-history-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-history-mode {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.profile-history-time {
    font-size: 0.65rem;
    color: var(--text-tertiary);
}

.profile-history-empty {
    text-align: center;
    padding: 1.25rem 0.5rem;
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════
   PROFILE HISTORY — Toggle, clear button, confirmation
   ═══════════════════════════════════════════════════════════════════ */

.profile-history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    padding: 0;
    transition: opacity 0.2s ease;
}

.profile-history-toggle:hover {
    opacity: 0.7;
}

.profile-history-arrow {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.profile-history-mobile.open .profile-history-arrow {
    transform: rotate(180deg);
}

/* Collapsible body */
.profile-history-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-history-mobile.open .profile-history-body {
    max-height: 800px;
}

/* Clear button — red accent */
.profile-history-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.45rem;
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: #dc2626;
    transition: all 0.2s ease;
}

.profile-history-clear-btn:hover {
    background: rgba(220, 38, 38, 0.12);
    border-color: #dc2626;
}

.profile-history-clear-btn svg {
    stroke: #dc2626;
}

/* Dark mode */
body.premium .profile-history-clear-btn {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

body.premium .profile-history-clear-btn:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: #f87171;
}

body.premium .profile-history-clear-btn svg {
    stroke: #f87171;
}

/* Confirmation dialog */
.profile-history-confirm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem;
    margin-top: 0.6rem;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.04);
}

.profile-history-confirm .confirm-text {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-history-confirm .confirm-buttons {
    gap: 0.6rem;
}

.profile-history-confirm .confirm-yes,
.profile-history-confirm .confirm-no {
    font-size: 0.78rem;
    padding: 0.4rem 1.25rem;
    border-radius: 6px;
}

body.premium .profile-history-confirm {
    background: rgba(248, 113, 113, 0.06);
    border-color: rgba(248, 113, 113, 0.15);
}