:root {
    --color-primary: #d7263d;
    --color-primary-dark: #a81d2f;
    --color-accent: #1b3a6b;
    --color-bg: #f6f7f9;
    --color-surface: #ffffff;
    --color-text: #1f2430;
    --color-muted: #6b7280;
    --color-border: #e3e6ec;
    --color-success: #1f8a4c;
    --color-danger: #c0392b;
    --color-warning: #b8860b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .04);
    --space: 16px;
    --maxw: 1080px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.55;
}

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--space); }

.page { padding-top: 28px; padding-bottom: 48px; }

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--color-accent); text-decoration: none; }
.brand span { color: var(--color-primary); }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: var(--color-text); font-size: .95rem; }
.nav-user { color: var(--color-muted); font-size: .9rem; }
.notif-link { position: relative; }
.notif-count { background: var(--color-primary); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; margin-left: 2px; }
.notif.unread { background: #f3f7fd; }
.notif .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); margin-right: 6px; }

/* Buttons */
.btn {
    display: inline-block; cursor: pointer; border: 1px solid transparent;
    padding: 9px 16px; border-radius: var(--radius); font-size: .95rem; font-weight: 600;
    text-decoration: none; transition: background .15s, border-color .15s; background: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-ghost { border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { background: #f1f2f5; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Cards */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Forms */
.form-group { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: .95rem; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; }
.form-narrow { max-width: 420px; margin: 0 auto; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .92rem; }
.alert-success { background: #e7f6ed; color: var(--color-success); border: 1px solid #b9e3c9; }
.alert-error { background: #fdecea; color: var(--color-danger); border: 1px solid #f5c6c0; }
.alert-info { background: #eaf1fb; color: var(--color-accent); border: 1px solid #c5d8f3; }
.alert-warning { background: #fdf6e3; color: var(--color-warning); border: 1px solid #efe0ad; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-verified { background: #e7f6ed; color: var(--color-success); }
.badge-flagged { background: #fdecea; color: var(--color-danger); }
.badge-route { background: #eaf1fb; color: var(--color-accent); margin-right: 4px; }
.badge-premium { background: #fdf3d6; color: #8a6d1b; margin-left: 4px; }

/* Pricing */
.plan-card { display: flex; flex-direction: column; }
.plan-card .price { font-size: 1.8rem; font-weight: 800; color: var(--color-accent); }
.plan-card ul { padding-left: 18px; color: var(--color-muted); flex: 1; }
.plan-card.featured { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary) inset; }

/* Progress bar */
.progress { background: #eef0f4; border-radius: 999px; height: 12px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-success); transition: width .3s; }
.progress-lg { height: 18px; }

/* Hero */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { font-size: 2.2rem; margin: 0 0 12px; color: var(--color-accent); }
.hero p { color: var(--color-muted); max-width: 640px; margin: 0 auto 22px; font-size: 1.05rem; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Phase / journey */
.phase { border-left: 4px solid var(--color-accent); }
.phase-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.phase-order { font-size: .8rem; color: var(--color-muted); }
.item-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.item-row:first-of-type { border-top: none; }
.item-row.done .item-title { text-decoration: line-through; color: var(--color-muted); }
.item-row input[type=checkbox] { width: auto; margin-top: 4px; }
.item-title { font-weight: 600; }
.item-desc { font-size: .85rem; color: var(--color-muted); }

/* Tables / lists */
.list-meta { color: var(--color-muted); font-size: .85rem; }
.muted { color: var(--color-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-center { text-align: center; }

/* CBT */
.cbt-bar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0;
    background: var(--color-surface); padding: 14px 16px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 18px; }
.timer { font-weight: 800; font-size: 1.2rem; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.timer.warn { color: var(--color-danger); }
.question-card { margin-bottom: 16px; }
.question-card .q-no { color: var(--color-muted); font-size: .85rem; }
.option { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--color-border);
    border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.option:hover { background: #f6f7f9; }
.option.correct { background: #e7f6ed; border-color: #b9e3c9; }
.option.wrong { background: #fdecea; border-color: #f5c6c0; }
.option input { width: auto; }
.score-big { font-size: 3rem; font-weight: 800; color: var(--color-accent); }

/* Data table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
table.data th { background: #f6f7f9; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-muted); }
table.data tr:hover td { background: #fafbfc; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--color-accent); }
.stat .lbl { color: var(--color-muted); font-size: .9rem; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: flex-start; justify-content: center; z-index: 50; overflow-y: auto; padding: 40px 16px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 620px; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal h3 { margin-top: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.option-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.option-edit input[type=text] { flex: 1; }
.option-edit label { display: flex; align-items: center; gap: 4px; margin: 0; white-space: nowrap; font-weight: 500; }

@media (max-width: 640px) {
    .header-inner { flex-direction: column; height: auto; padding: 10px 0; gap: 8px; }
    .hero h1 { font-size: 1.7rem; }
}
