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

:root {
    --bg: #08080f;
    --surface: #111118;
    --surface2: #1a1a24;
    --surface3: #222230;
    --border: #2a2a3a;
    --border-subtle: #1f1f2e;
    --accent: #4f9cf9;
    --accent2: #a78bfa;
    --accent-dim: rgba(79, 156, 249, 0.1);
    --accent-glow: rgba(79, 156, 249, 0.2);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.1);
    --purple: #a78bfa;
    --purple-dim: rgba(167, 139, 250, 0.1);
    --orange: #fb923c;
    --orange-dim: rgba(251, 146, 60, 0.1);
    --pink: #f472b6;
    --pink-dim: rgba(244, 114, 182, 0.1);
    --red: #f87171;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --header-bg: rgba(8, 8, 15, 0.85);
    --dot-color: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --surface3: #f1f5f9;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --accent-dim: rgba(79, 156, 249, 0.08);
    --accent-glow: rgba(79, 156, 249, 0.15);
    --green-dim: rgba(52, 211, 153, 0.08);
    --purple-dim: rgba(167, 139, 250, 0.08);
    --orange-dim: rgba(251, 146, 60, 0.08);
    --pink-dim: rgba(244, 114, 182, 0.08);
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --header-bg: rgba(241, 245, 249, 0.9);
    --dot-color: rgba(0, 0, 0, 0.025);
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
    background-size: 32px 32px;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 80px;
    position: relative;
}

.app::before {
    content: '';
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 500px;
    background: radial-gradient(ellipse at 50% 0%, rgba(79, 156, 249, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app > * { position: relative; z-index: 1; }

/* HEADER */
header {
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    background: var(--header-bg);
    z-index: 300;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    text-decoration: none;
}

.logo-icon { font-size: 20px; }

.tabs {
    display: flex;
    gap: 0;
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
    height: 64px;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0 15px;
    height: 64px;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    margin-bottom: -1px;
}

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

.tab.active {
    background: none;
    color: var(--text);
    border-bottom-color: var(--accent);
    box-shadow: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-signout {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-signout:hover {
    color: var(--text);
    border-color: var(--accent);
}

/* VIEWS */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* SECTION HEADER */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* PERIOD SELECTOR */
.period-selector {
    display: flex;
    gap: 4px;
    background: var(--surface);
    padding: 4px;
    border-radius: 8px;
}

.period-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

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

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

/* DASHBOARD GREETING */
.dashboard-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 22px 26px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--accent-dim) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 16px;
    flex-wrap: wrap;
}

.greeting-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.greeting-date {
    font-size: 13px;
    color: var(--text-muted);
}

.greeting-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.greeting-streak {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.streak-icon { font-size: 20px; }

.streak-info {
    display: flex;
    flex-direction: column;
}

.streak-count {
    font-size: 20px;
    font-weight: 800;
    color: var(--orange);
    line-height: 1;
}

.streak-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* TODAY SNAPSHOT */
.today-snapshot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.snapshot-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.snapshot-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.snapshot-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.snapshot-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.snapshot-key {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.snapshot-sep {
    color: var(--border);
    font-size: 16px;
    padding-bottom: 6px;
}

/* KPI GRID */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s;
}

.kpi-card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.kpi-card.color-blue::before  { background: var(--accent); }
.kpi-card.color-purple::before { background: var(--purple); }
.kpi-card.color-green::before  { background: var(--green); }
.kpi-card.color-orange::before { background: var(--orange); }
.kpi-card.color-pink::before   { background: var(--pink); }

.kpi-card.color-blue  { background: linear-gradient(135deg, var(--surface) 0%, var(--accent-dim) 100%); }
.kpi-card.color-purple { background: linear-gradient(135deg, var(--surface) 0%, var(--purple-dim) 100%); }
.kpi-card.color-green  { background: linear-gradient(135deg, var(--surface) 0%, var(--green-dim) 100%); }
.kpi-card.color-orange { background: linear-gradient(135deg, var(--surface) 0%, var(--orange-dim) 100%); }
.kpi-card.color-pink   { background: linear-gradient(135deg, var(--surface) 0%, var(--pink-dim) 100%); }

.kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -1px;
}

.kpi-card.color-blue   .kpi-value { color: var(--accent); }
.kpi-card.color-purple .kpi-value { color: var(--purple); }
.kpi-card.color-green  .kpi-value { color: var(--green); }
.kpi-card.color-orange .kpi-value { color: var(--orange); }
.kpi-card.color-pink   .kpi-value { color: var(--pink); }

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* CHARTS */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 220px;
}

/* CONVERSION SECTION */
.conversion-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.conversion-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.conversion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.conversion-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.conv-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conv-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
    letter-spacing: -0.5px;
}

/* FORM */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 560px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}

input[type="date"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: var(--accent);
}

input[type="number"]::-webkit-inner-spin-button {
    opacity: 0.5;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.5);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:hover {
    opacity: 0.88;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background: var(--surface2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}

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

.btn-danger-sm {
    background: rgba(248, 113, 113, 0.1);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: 7px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger-sm:hover {
    background: rgba(248, 113, 113, 0.2);
}

/* HISTORY TABLE */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: var(--surface);
}

th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

tbody tr {
    background: var(--surface);
    transition: background 0.1s;
}

tbody tr:nth-child(even) {
    background: #1d1d1d;
}

tbody tr:hover {
    background: var(--surface2);
}

.td-date {
    font-weight: 600;
    white-space: nowrap;
}

.td-notes {
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 14px;
    transition: background 0.15s;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--surface2);
    color: var(--text);
}

.btn-icon.delete:hover {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── WELCOME OVERLAY ───────────────────────────────────────────────────────── */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    padding: 20px;
    overflow-y: auto;
}

.welcome-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 44px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    margin: auto;
}

.welcome-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.welcome-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.welcome-trial-box {
    background: var(--accent-dim);
    border: 1px solid rgba(79,156,249,0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.welcome-trial-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.welcome-trial-days {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.welcome-trial-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.welcome-features {
    text-align: left;
    margin-bottom: 24px;
}

.welcome-feature {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 5px 0;
    color: var(--green);
}

.welcome-terms {
    margin-bottom: 20px;
    text-align: left;
}

.terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.terms-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.welcome-cta {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: opacity 0.15s;
}

.welcome-cta:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.welcome-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── MODALS ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,10,0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 700;
    padding: 20px;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--surface2);
    color: var(--text);
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding-right: 4px;
    margin-bottom: 20px;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-body h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 6px;
}

.modal-accept {
    width: 100%;
    padding: 12px;
    flex-shrink: 0;
}

/* ── TRIAL BANNER ──────────────────────────────────────────────────────────── */
.trial-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(90deg, #1a3a5c 0%, #1e4a7a 100%);
    border-bottom: 1px solid rgba(79, 156, 249, 0.3);
    padding: 10px 20px;
    font-size: 14px;
    color: #c8deff;
    position: sticky;
    top: 0;
    z-index: 200;
    flex-wrap: wrap;
    text-align: center;
}

.trial-banner-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.trial-banner-btn:hover {
    opacity: 0.88;
}

.trial-banner-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.trial-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.trial-banner-dismiss {
    background: none;
    border: none;
    color: rgba(200, 222, 255, 0.5);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.trial-banner-dismiss:hover {
    color: #c8deff;
}

/* ── PAYWALL OVERLAY ───────────────────────────────────────────────────────── */
.paywall-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
}

.paywall-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.paywall-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 28px;
}

.paywall-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.paywall-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

.paywall-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 24px;
}

.paywall-amount {
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.paywall-period {
    font-size: 18px;
    color: var(--text-secondary);
}

.paywall-features {
    list-style: none;
    margin-bottom: 28px;
    text-align: left;
    display: inline-block;
}

.paywall-features li {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 5px 0;
    padding-left: 22px;
    position: relative;
}

.paywall-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--green);
    font-weight: 700;
}

.paywall-cta {
    width: 100%;
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.paywall-cancel-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.paywall-signout {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

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

/* ── AUTH PAGE ─────────────────────────────────────────────────────────────── */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 12px;
}

.auth-back {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 28px;
    transition: color 0.15s;
}
.auth-back:hover { color: var(--accent); }

.auth-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--red);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.auth-submit {
    width: 100%;
    margin-top: 8px;
    padding: 13px;
    font-size: 15px;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-toggle .link-btn {
    margin-left: 6px;
    font-size: 14px;
}

/* ── DISABLED INPUTS ───────────────────────────────────────────────────────── */
input:disabled,
textarea:disabled {
    background: var(--surface2);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 1;
}

/* ── SETTINGS ──────────────────────────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  max-width: 560px;
}

.settings-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.settings-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.billing-status {
  background: var(--surface2);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.billing-status .plan-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.billing-status .plan-detail {
  color: var(--text-secondary);
  font-size: 13px;
}

.theme-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.theme-btn:hover {
  border-color: var(--accent);
}

.theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── LOG MY DAY BUTTON ───────────────────────────────────────────────────────── */
.btn-log-day {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    box-shadow: 0 0 24px rgba(79, 156, 249, 0.25);
}
.btn-log-day:hover {
    opacity: 0.9;
    box-shadow: 0 0 32px rgba(79, 156, 249, 0.4);
    transform: translateY(-1px);
}

/* ── QUICK LOG WIZARD ────────────────────────────────────────────────────────── */
.quicklog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.quicklog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 40px 36px;
    width: 100%;
    max-width: 520px;
    position: relative;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.quicklog-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s;
}
.quicklog-close:hover { color: var(--text); }

.quicklog-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 44px;
}

.ql-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.25s;
}
.ql-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 4px;
}
.ql-dot.done {
    background: var(--green);
}

.quicklog-slides {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ql-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: ql-in 0.25s ease;
}
.ql-slide.active { display: flex; }
.ql-slide.slide-back { animation: ql-in-back 0.25s ease; }

@keyframes ql-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes ql-in-back {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.ql-emoji {
    font-size: 48px;
    margin-bottom: 20px;
    line-height: 1;
}

.ql-question {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 28px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.ql-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid rgba(79, 156, 249, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
}

.ql-input {
    width: 180px;
    text-align: center;
    font-size: 52px;
    font-weight: 800;
    color: var(--text);
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    outline: none;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
    letter-spacing: -2px;
}
.ql-input::-webkit-outer-spin-button,
.ql-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ql-input:focus { border-color: var(--accent); }

.ql-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

.ql-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.ql-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 80px;
}

.ql-summary-val {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
    line-height: 1;
}

.ql-summary-key {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.quicklog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 36px;
}

.ql-btn-back {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.ql-btn-back:hover { color: var(--text); border-color: var(--text-muted); }

.ql-btn-next {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 0 20px rgba(79, 156, 249, 0.25);
    margin-left: auto;
}
.ql-btn-next:hover {
    background: #3d8ef0;
    box-shadow: 0 0 28px rgba(79, 156, 249, 0.4);
}

/* ── QUICK NOTE BUTTON ───────────────────────────────────────────────────────── */
.btn-quick-note {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    box-shadow: 0 0 20px rgba(79, 156, 249, 0.2);
}
.btn-quick-note:hover {
    background: #3d8ef0;
    box-shadow: 0 0 28px rgba(79, 156, 249, 0.35);
}

.quick-note-card {
    max-width: 480px;
}

/* ── TAG SYSTEM ──────────────────────────────────────────────────────────────── */
.tag-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tag-preset {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tag-preset:hover {
    border-color: var(--accent);
    color: var(--text);
}

.tag-preset.active[data-tag="win"]   { background: var(--green-dim);  border-color: var(--green);  color: var(--green); }
.tag-preset.active[data-tag="loss"]  { background: rgba(248,113,113,0.1); border-color: var(--red); color: var(--red); }
.tag-preset.active[data-tag="funny"] { background: rgba(251,191,36,0.1);  border-color: #fbbf24; color: #fbbf24; }
.tag-preset.active[data-tag="upset"] { background: var(--orange-dim); border-color: var(--orange); color: var(--orange); }

.custom-tag-input {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.custom-tag-input input {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

.custom-tag-input button {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.custom-tag-input button:hover {
    color: var(--text);
    border-color: var(--accent);
}

.custom-tags-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.custom-tag-pill {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 20px;
    color: var(--accent);
    padding: 3px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-tag-pill button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.custom-tag-pill button:hover { opacity: 1; }

/* ── JOURNAL ─────────────────────────────────────────────────────────────────── */
.journal-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-tag {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-tag:hover { color: var(--text); }
.filter-tag.active { background: var(--surface2); color: var(--text); border-color: var(--accent); }
.filter-tag.filter-win.active   { border-color: var(--green);  color: var(--green); }
.filter-tag.filter-loss.active  { border-color: var(--red);    color: var(--red); }
.filter-tag.filter-funny.active { border-color: #fbbf24; color: #fbbf24; }
.filter-tag.filter-upset.active { border-color: var(--orange); color: var(--orange); }

.journal-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
}

#journal-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.journal-entry-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.15s, transform 0.15s;
    cursor: default;
}

.journal-entry-card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.journal-entry-card.has-win    { border-left: 3px solid var(--green); }
.journal-entry-card.has-loss   { border-left: 3px solid var(--red); }
.journal-entry-card.has-funny  { border-left: 3px solid #fbbf24; }
.journal-entry-card.has-upset  { border-left: 3px solid var(--orange); }

.journal-entry-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.journal-entry-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.journal-entry-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.journal-entry-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.journal-entry-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.journal-entry-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.journal-entry-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-pill {
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
}

.tag-pill.tag-win    { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green); }
.tag-pill.tag-loss   { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid var(--red); }
.tag-pill.tag-funny  { background: rgba(251,191,36,0.1);  color: #fbbf24; border: 1px solid #fbbf24; }
.tag-pill.tag-upset  { background: var(--orange-dim); color: var(--orange); border: 1px solid var(--orange); }
.tag-pill.tag-custom { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }

.tag-pill .tag-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    padding: 0 0 0 4px;
    opacity: 0.7;
    line-height: 1;
}

.journal-entry-actions {
    display: flex;
    gap: 6px;
}

/* Day stats linked to journal entry */
.journal-day-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid var(--border-subtle);
}

.journal-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.journal-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.journal-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* RESPONSIVE — TABLET */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

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

    .table-wrap {
        border-radius: 10px;
        font-size: 13px;
    }

    th, td {
        padding: 11px 10px;
    }
}

/* RESPONSIVE — MOBILE */
@media (max-width: 640px) {
    .app {
        padding: 0 12px 60px;
    }

    /* Header */
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 0;
    }

    .tabs {
        width: 100%;
        justify-content: space-between;
    }

    .tab {
        flex: 1;
        padding: 8px 6px;
        font-size: 13px;
        text-align: center;
    }

    .btn-signout {
        align-self: flex-end;
        margin-top: -8px;
    }

    /* Section header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .section-header h2 {
        font-size: 19px;
    }

    .period-selector {
        width: 100%;
        justify-content: space-between;
    }

    .period-btn {
        flex: 1;
        text-align: center;
    }

    /* KPI grid */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-card {
        padding: 16px 14px;
    }

    .kpi-value {
        font-size: 28px;
    }

    /* Conversion */
    .conversion-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .conversion-section {
        padding: 18px 16px;
    }

    /* Form */
    .form-card {
        padding: 20px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* History table — hide notes column on mobile */
    .td-notes {
        display: none;
    }

    th:nth-child(7) {
        display: none;
    }

    th, td {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Trial banner */
    .trial-banner {
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .trial-banner-btn {
        width: 100%;
        text-align: center;
    }

    /* Paywall */
    .paywall-card {
        padding: 32px 20px;
    }

    .paywall-amount {
        font-size: 40px;
    }

    /* Auth */
    .auth-card {
        padding: 28px 20px;
    }
}

/* RESPONSIVE — SMALL MOBILE */
@media (max-width: 400px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 32px;
    }
}
