:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #14213d;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #1f6feb;
    --primary-dark: #174ea6;
    --success: #0f9f6e;
    --warning: #f59e0b;
    --danger: #dc2626;
    --soft: #eef4ff;
    --sidebar: #0f172a;
    --sidebar-2: #111d35;
    --radius: 18px;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: inherit; text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 286px;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: #e5edf8;
    padding: 22px 18px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .2px; }
.brand span { display: block; color: #9fb0c8; font-size: 12px; margin-top: 2px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    font-weight: 900; color: white;
    background: linear-gradient(135deg, #1f6feb, #00b894);
    box-shadow: 0 12px 25px rgba(31,111,235,.32);
}
.brand-mark.big { width: 68px; height: 68px; border-radius: 22px; font-size: 24px; margin: 0 auto 14px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    color: #cbd5e1;
    font-size: 14px;
    transition: .18s ease;
}
.side-nav a:hover, .side-nav a.active { background: rgba(255,255,255,.10); color: white; }
.side-nav a.active { box-shadow: inset 3px 0 0 #22c55e; }
.side-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.side-footer small { color: #9fb0c8; }
.side-footer a { color: #fff; font-weight: 700; }
.main { width: calc(100% - 286px); margin-left: 286px; padding: 24px; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 22px;
}
.topbar h1 { margin: 2px 0 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.1; }
.eyebrow { margin: 0; color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; }
.user-pill { padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); box-shadow: 0 8px 18px rgba(15,23,42,.04); white-space: nowrap; }
.menu-toggle { display: none; border: 0; background: white; border-radius: 12px; padding: 10px 12px; font-size: 20px; box-shadow: var(--shadow); }
.hero-panel, .panel, .note-box, .accordion-card, .metric-card {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.hero-panel {
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
    margin-bottom: 22px;
    background:
        radial-gradient(circle at top right, rgba(31,111,235,.15), transparent 34%),
        linear-gradient(135deg, #ffffff, #f8fbff);
}
.hero-panel h2 { font-size: clamp(28px, 4vw, 44px); margin: 8px 0; }
.hero-panel p { color: var(--muted); max-width: 820px; line-height: 1.65; }
.hero-metric { min-width: 160px; aspect-ratio: 1; border-radius: 28px; background: var(--ink); color: white; display: grid; place-items: center; text-align: center; }
.hero-metric strong { font-size: 42px; line-height: 1; }
.hero-metric span { color: #cbd5e1; }
.grid { display: grid; gap: 18px; margin-bottom: 22px; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel { padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 20px; }
.panel p, .panel li { line-height: 1.65; }
.metric-card { padding: 20px; }
.metric-card span { font-size: 26px; }
.metric-card strong { display: block; margin-top: 12px; font-size: 30px; }
.metric-card p { margin: 4px 0 0; color: var(--muted); }
.progress { width: 100%; height: 9px; background: #e9eef7; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: inherit; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; padding: 7px 11px; border-radius: 999px; background: var(--soft); color: var(--primary); font-weight: 800; font-size: 13px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 8px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.account-pill { padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); box-shadow: 0 8px 18px rgba(15,23,42,.04); white-space: nowrap; font-weight: 700; }
.logout-btn { min-width: 82px; }
.logout-link { padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-weight: 800; }
.logout-link:hover { background: rgba(255,255,255,.2); }
.version-pill { color: #9fb0c8; font-size: 12px; padding: 7px 9px; border-radius: 999px; background: rgba(255,255,255,.08); }
.account-hero { align-items: center; }
.small-metric { min-width: 130px; width: 130px; height: 130px; aspect-ratio: auto; }
.small-metric strong { font-size: 34px; }

.clean-list { padding-left: 18px; }
.info-box { border-left: 4px solid var(--primary); background: var(--soft); padding: 14px 16px; border-radius: 12px; color: #1e3a8a; line-height: 1.6; }
.info-box.success { border-color: var(--success); background: #ecfdf5; color: #065f46; }
.danger-list { display: grid; gap: 10px; }
.danger-list p { margin: 0; padding: 12px 14px; border-radius: 12px; background: #fff1f2; color: #9f1239; border: 1px solid #ffe4e6; }
.timeline-list { margin: 0; padding-left: 20px; }
.timeline-list li { margin-bottom: 10px; }
.check-grid { display: grid; gap: 10px; margin: 16px 0; }
.check-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.checkline { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; cursor: pointer; }
.checkline:hover { border-color: #b8cef7; }
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--primary); cursor: pointer; }
.note-box { padding: 18px; width: 100%; }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.note-head span { color: var(--muted); font-size: 12px; }
textarea, input[type="text"], input[type="email"], input[type="password"], input[type="date"] {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; font: inherit; color: var(--ink); background: #fff;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
textarea:focus, input:focus { outline: 3px solid rgba(31,111,235,.14); border-color: var(--primary); }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #475569; }
tr:last-child td { border-bottom: 0; }
.center { text-align: center; }
.learning-table th:nth-child(1) { min-width: 240px; }
.learning-table th:nth-child(5), .learning-table th:nth-child(6) { min-width: 230px; }
.mini-textarea { min-height: 72px; font-size: 13px; padding: 9px; }
.accordion-list { display: grid; gap: 14px; }
.accordion-card { overflow: hidden; }
.accordion-toggle { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding: 18px; border: 0; background: white; text-align: left; cursor: pointer; color: var(--ink); }
.accordion-toggle span { width: 38px; height: 38px; border-radius: 12px; background: var(--soft); color: var(--primary); display: grid; place-items: center; font-weight: 900; }
.accordion-toggle em { color: var(--muted); font-size: 12px; font-style: normal; }
.accordion-content { display: none; padding: 0 18px 18px; }
.accordion-card.open .accordion-content { display: block; }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.feature-grid div { padding: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; }
.feature-grid b { color: var(--primary); }
.feature-grid p { margin: 7px 0 0; color: #334155; line-height: 1.55; }
.form-card { display: grid; gap: 12px; }
.form-card.compact { margin-top: 16px; }
.form-card label { font-weight: 800; color: #334155; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-list { display: grid; gap: 12px; max-height: 760px; overflow: auto; padding-right: 4px; }
.entry-card, .mini-entry { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fbfdff; }
.entry-card p, .mini-entry p { margin: 8px 0 0; color: #334155; line-height: 1.55; }
.flow-placeholder { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.flow-placeholder span { padding: 8px 10px; border-radius: 999px; background: var(--soft); color: var(--primary); font-weight: 800; font-size: 12px; }
.flow-placeholder i { color: var(--muted); font-style: normal; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; font-weight: 700; }
.alert.error { background: #fff1f2; color: #9f1239; border: 1px solid #ffe4e6; }
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #d1fae5; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 99; background: #0f172a; color: white; padding: 12px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(31,111,235,.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(16,185,129,.20), transparent 32%),
        #f4f6f9;
}
.login-card { width: min(480px, 100%); background: white; border-radius: 28px; padding: 32px; box-shadow: 0 30px 80px rgba(15,23,42,.14); border: 1px solid rgba(226,232,240,.9); }
.login-brand { text-align: center; }
.login-brand h1 { margin: 6px 0 8px; font-size: 32px; }
.login-brand p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.login-help { margin-top: 18px; padding: 14px; border-radius: 14px; background: #f8fafc; color: #475569; font-size: 13px; line-height: 1.55; }
.print-cover { border: 1px solid var(--line); border-radius: 20px; padding: 28px; background: white; margin-bottom: 20px; }
.print-cover h2 { font-size: 34px; margin: 6px 0 18px; }
.print-note { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; break-inside: avoid; }
.print-note h4 { margin: 0 0 8px; color: var(--primary); }
.saving { opacity: .65; }
@media (max-width: 1120px) {
    .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: .22s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { width: 100%; margin-left: 0; padding: 18px; }
    .menu-toggle { display: inline-block; }
    .topbar { align-items: flex-start; }
    .user-pill { display: none; }
    .topbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .hero-panel { flex-direction: column; align-items: flex-start; }
    .hero-metric { width: 140px; min-width: 140px; }
    .cards-4, .feature-grid, .check-grid.two, .form-row { grid-template-columns: 1fr; }
}
@media print {
    body { background: white; }
    .sidebar, .topbar, .no-print, .toast, .alert { display: none !important; }
    .main { margin: 0; width: 100%; padding: 0; }
    .panel, .hero-panel, .note-box, .accordion-card, .metric-card, .print-note, .print-cover { box-shadow: none; border-color: #bbb; }
    @page { size: A4; margin: 14mm; }
}
