/* ─── Design Tokens: Light ─── */
:root, [data-theme="light"] {
--primary: #1e3a5f;
--primary-light: #2a5080;
--primary-rgb: 30,58,95;
--accent: #f97316;
--accent-dark: #ea580c;
--bg: #ffffff;
--bg-alt: #f1f5f9;
--bg-card: #ffffff;
--text: #1e293b;
--text-muted: #64748b;
--border: #e2e8f0;
--shadow: rgba(0,0,0,0.08);
--input-bg: #f8fafc;
--success: #22c55e;
--success-bg: #f0fdf4;
--success-border: #bbf7d0;
--error: #ef4444;
--error-bg: #fef2f2;
--error-border: #fecaca;
--footer-bg: #1e3a5f;
--footer-text: rgba(255,255,255,.9);
--footer-border: rgba(255,255,255,.15);
}
/* ─── Design Tokens: Dark ─── */
[data-theme="dark"] {
--primary: #60a5fa;
--primary-light: #93c5fd;
--primary-rgb: 96,165,250;
--accent: #fb923c;
--accent-dark: #f97316;
--bg: #0f172a;
--bg-alt: #1e293b;
--bg-card: #1e293b;
--text: #f1f5f9;
--text-muted: #94a3b8;
--border: #334155;
--shadow: rgba(0,0,0,0.3);
--input-bg: #1e293b;
--footer-bg: #0f172a;
--footer-text: rgba(255,255,255,.8);
--footer-border: rgba(255,255,255,.08);
--success: #4ade80;
--success-bg: #14532d;
--success-border: #166534;
--error: #f87171;
--error-bg: #450a0a;
--error-border: #7f1d1d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Montserrat', sans-serif; background: var(--bg); color: var(--text); transition: background 0.3s, color 0.3s; min-height: 100vh; display: flex; flex-direction: column; }

/* ─── Header ─── */
.header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo img { height: 40px; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.875rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.header-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ─── Theme Toggle ─── */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.5rem; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; transition: all 0.2s; }
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: inline; }

/* ─── Buttons ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1.5rem; border-radius: 0.5rem; font-weight: 600; font-size: 0.875rem; text-decoration: none; border: none; cursor: pointer; transition: all 0.2s; font-family: 'Montserrat', sans-serif; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: white; }
[data-theme="dark"] .btn-primary { color: #0f172a; }
.btn-primary:hover { opacity: 0.9; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-muted); }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 0.95rem; }
.btn-white { background: white; color: var(--primary); }
.btn-white:hover { background: #f0f4f8; }
.btn-outline-white { border: 1px solid rgba(255,255,255,0.4); color: white; background: transparent; }
.btn-outline-white:hover { background: rgba(255,255,255,0.1); }
.btn-full { width: 100%; }
.btn-xl { padding: 1rem 2rem; font-size: 1.125rem; height: 3.5rem; }

/* ─── Cards ─── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 1rem; overflow: hidden; box-shadow: 0 4px 20px var(--shadow); }
.card-header { padding: 1.5rem 1.5rem 0; }
.card-content { padding: 1.5rem; }
.card-footer { padding: 0 1.5rem 1.5rem; }
.card-title { font-family: 'Comfortaa', cursive; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ─── Forms ─── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.375rem; color: var(--text); }
.form-input, .form-select { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.9rem; font-family: 'Montserrat', sans-serif; background: var(--input-bg); color: var(--text); transition: border-color 0.2s; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); }

/* ─── Sections ─── */
.section { max-width: 1200px; margin: 0 auto; padding: 4rem 1.5rem; }
.section-alt { background: var(--bg-alt); }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 3rem; }
.section-title { font-family: 'Comfortaa', cursive; font-size: 1.7rem; font-weight: 700; color: var(--text); margin-bottom: 0.75rem; line-height: 1.15; }
.section-subtitle { color: var(--text-muted); font-size: 0.98rem; line-height: 1.6; }

/* ─── SVG Icons ─── */
.icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 32px; height: 32px; }
.icon-sm { width: 20px; height: 20px; }

/* ─── Auth page layout ─── */
.auth-layout { display: flex; min-height: 100vh; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 1.5rem; }

/* ─── Footer ─── */
.footer { background: var(--footer-bg); border-top: 1px solid var(--footer-border); color: var(--footer-text); padding: 1.35rem 1rem 1.6rem; text-align: center; font-size: 0.85rem; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin-top: auto; width: 100%; }
.footer-inner { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; }
.footer-copy { margin: 0; line-height: 1.6; }
.footer-links-row { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; justify-content: center; line-height: 1.6; }
.footer-link { color: rgba(255,255,255,.9); text-decoration: none; font-size: 0.82rem; }
.footer-link:hover { opacity: 0.8; }
.footer-sep { opacity: 0.28; }
.footer-sep-bar { margin: 0 0.3rem; opacity: 0.2; }
.footer-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 0.55rem; padding: 0.24rem 0.56rem; cursor: pointer; color: inherit; font-size: 0.75rem; display: inline-flex; align-items: center; }
.footer-btn:hover { background: rgba(255,255,255,.15); }

/* ─── Legal Pages (shared terms/privacy) ─── */
.legal-page { max-width: 800px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.legal-page-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; letter-spacing: -0.03em; }
.legal-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 2rem; opacity: 0.7; }
.legal-section { margin-bottom: 2rem; }
.legal-section h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.legal-section p, .legal-section li { color: var(--text-muted); font-size: 0.9rem; line-height: 1.8; margin-bottom: 0.5rem; }
.legal-section ul { padding-left: 1.5rem; }
@media (max-width: 768px) { .legal-page { padding: 2rem 1rem 4rem; } .legal-page-title { font-size: 1.5rem; } }

/* ─── Logo text fallback ─── */
.logo-text { font-weight: 800; letter-spacing: 0.05em; color: var(--text); }

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
a.link { color: var(--primary); text-decoration: underline; font-weight: 500; }
a.link:hover { opacity: 0.8; }

/* ─── Alert boxes ─── */
.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 0.5rem; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-error { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error); }

/* ─── Memo Chat Widget ─── */
.memo-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 60px; height: 60px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); cursor: pointer; border: none; z-index: 1000; transition: transform 0.2s; }
.memo-fab:hover { transform: scale(1.05); }
.memo-fab img { width: 35px; height: 35px; object-fit: contain; }
.memo-fab svg { width: 32px; height: 32px; fill: currentColor; }

.memo-widget { position: fixed; bottom: 5rem; right: 1.5rem; width: 350px; max-height: 500px; height: 60vh; background: var(--bg-card); border-radius: 1rem; box-shadow: 0 8px 30px rgba(0,0,0,0.15); display: flex; flex-direction: column; overflow: hidden; z-index: 1000; transition: opacity 0.3s, transform 0.3s; transform-origin: bottom right; border: 1px solid var(--border); }
.memo-widget.closed { opacity: 0; transform: scale(0.8); pointer-events: none; }

.memo-header { background: var(--primary); padding: 1rem; color: white; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.memo-avatar { width: 40px; height: 40px; border-radius: 50%; background: white; padding: 4px; object-fit: contain; }
.memo-title { display: flex; flex-direction: column; flex-grow: 1; }
.memo-title strong { font-family: 'Comfortaa', cursive; font-size: 1.1rem; }
.memo-close-btn { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; opacity: 0.8; }
.memo-close-btn:hover { opacity: 1; }

.memo-body { flex-grow: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; background: var(--bg-alt); }
.memo-msg { max-width: 85%; padding: 0.75rem 1rem; border-radius: 1rem; font-size: 0.9rem; line-height: 1.4; word-wrap: break-word; }
.memo-msg-assistant { background: white; color: var(--text); border-bottom-left-radius: 0.25rem; align-self: flex-start; border: 1px solid var(--border); }
[data-theme="dark"] .memo-msg-assistant { background: var(--bg-card); color: var(--text); }
.memo-msg-user { background: var(--primary); color: white; border-bottom-right-radius: 0.25rem; align-self: flex-end; }
.memo-typing { font-style: italic; color: var(--text-muted); font-size: 0.8rem; align-self: flex-start; display: none; margin-left: 0.5rem; }

.memo-footer { padding: 0.75rem; background: var(--bg-card); border-top: 1px solid var(--border); display: flex; gap: 0.5rem; }
.memo-input { flex-grow: 1; padding: 0.6rem 1rem; border: 1px solid var(--border); border-radius: 2rem; font-family: inherit; font-size: 0.9rem; background: var(--input-bg); color: var(--text); outline: none; transition: border-color 0.2s; }
.memo-input:focus { border-color: var(--primary); }
.memo-send-btn { background: var(--primary); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; flex-shrink: 0; }
.memo-send-btn:hover { opacity: 0.9; }

@media (max-width: 768px) {
.nav-links { display: none; }
.header-inner { padding: 0 1rem; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 0.9rem; }
.section { padding: 3rem 1.25rem; }
.section-title { font-size: 1.45rem; }
.section-subtitle { font-size: 0.93rem; }
.memo-widget { width: calc(100% - 2rem); right: 1rem; bottom: 5rem; max-height: 60vh; }
.memo-fab { bottom: 1rem; right: 1rem; }
}

