:root {
    --ink: #202b3c;
    --muted: #8290a1;
    --line: #e9edf2;
    --paper: #ffffff;
    --canvas: #f7f8fb;
    --purple: #6d64d8;
    --purple-dark: #5950c4;
    --green: #238a6b;
    --shadow: 0 8px 26px rgba(32, 43, 60, .045);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: "DM Sans", "Segoe UI", sans-serif; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; display: flex; width: 246px; flex-direction: column; padding: 29px 19px 21px; background: var(--paper); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font: 800 20px Manrope, sans-serif; letter-spacing: -.7px; }
.brand small { display: block; margin-top: 1px; color: #a0a9b5; font: 500 11px "DM Sans", sans-serif; letter-spacing: .2px; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 12px; background: var(--purple); color: white; font: 800 18px Manrope, sans-serif; }
.main-nav { display: grid; gap: 7px; margin-top: 56px; }
.main-nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 10px; color: #798596; font-size: 14px; font-weight: 600; transition: .18s ease; }
.main-nav a span { width: 20px; color: #a0aabb; font-size: 19px; text-align: center; }
.main-nav a:hover, .main-nav a.active { background: #f0efff; color: var(--purple-dark); }
.main-nav a.active span { color: var(--purple); }
.sidebar-bottom { margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 13px 8px 17px; color: var(--ink); font-weight: 700; }
.user-chip small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #ecebff; color: var(--purple); font-weight: 700; }
.logout-button { display: flex; width: 100%; justify-content: space-between; padding: 13px 10px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: #8792a0; cursor: pointer; }
.logout-button:hover { color: #c45b64; }
.main-content { max-width: 1540px; min-height: 100vh; margin-left: 246px; padding: 0 48px 56px; }
.topbar { display: flex; min-height: 119px; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 5px 0 0; font: 800 27px Manrope, sans-serif; letter-spacing: -.8px; }
.eyebrow { color: #a0a9b5; font-size: 10px; font-weight: 700; letter-spacing: 1.35px; }
.topbar-user { color: #8994a2; font-size: 13px; }
.topbar-user strong { color: var(--ink); }
.welcome-banner { display: flex; min-height: 182px; align-items: center; justify-content: space-between; gap: 20px; padding: 32px 38px; border-radius: 17px; background: linear-gradient(110deg, #6d64d8 0%, #8579e6 100%); color: #fff; box-shadow: 0 14px 28px rgba(109, 100, 216, .14); }
.welcome-banner .eyebrow { color: rgba(255,255,255,.7); }
.welcome-banner h2 { margin: 10px 0 7px; font: 700 24px Manrope, sans-serif; letter-spacing: -.5px; }
.welcome-banner p { margin: 0; color: rgba(255,255,255,.76); font-size: 13px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: .18s ease; }
.button-primary { background: var(--purple); color: white; }
.button-primary:hover { background: var(--purple-dark); transform: translateY(-1px); }
.button-light { background: #fff; color: var(--purple-dark); }
.button-light:hover { background: #f5f4ff; }
.button-quiet { border-color: var(--line); background: white; color: #637083; }
.button-quiet:hover { border-color: #c9c6f4; color: var(--purple-dark); }
.button-wide { width: 100%; margin-top: 6px; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 23px 0; }
.stat-card { display: grid; min-height: 150px; grid-template-columns: 39px 1fr; align-content: start; align-items: center; column-gap: 12px; padding: 21px 19px; border: 1px solid #f0f1f5; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.stat-icon { display: grid; width: 37px; height: 37px; grid-row: span 2; place-items: center; border-radius: 11px; font-size: 18px; font-weight: 700; }
.icon-lilac { background: #f0efff; color: #7168d8; }
.icon-green { background: #e8f7f1; color: #269675; }
.icon-peach { background: #fff1e8; color: #d98a50; }
.icon-blue { background: #eaf3ff; color: #5e8bc5; }
.stat-label { color: #8591a0; font-size: 12px; }
.stat-card strong { grid-column: 2; margin-top: 10px; font: 800 27px Manrope, sans-serif; letter-spacing: -.7px; }
.stat-card strong.stat-time { font-size: 19px; }
.stat-card small { grid-column: 2; margin-top: 4px; color: #adb5c0; font-size: 11px; }
.panel { margin-top: 22px; padding: 25px 27px; border: 1px solid #f0f1f5; border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2, .section-heading h3 { margin: 5px 0 0; font: 750 19px Manrope, sans-serif; letter-spacing: -.4px; }
.section-heading h3 { font-size: 16px; }
.section-heading p { margin: 6px 0 0; }
.text-link { color: var(--purple); font-size: 12px; font-weight: 700; }
.text-link span { padding-left: 6px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 12px 13px; border-bottom: 1px solid var(--line); color: #a0a9b5; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
td { padding: 14px 13px; border-bottom: 1px solid #f1f3f6; color: #737f8f; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.table-title { color: var(--ink); font-size: 12px; font-weight: 700; }
.table-title:hover { color: var(--purple); }
.status, .priority { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.status-completed { background: #eaf7f1; color: #258366; }
.status-in_progress { background: #fff4e6; color: #b7792f; }
.status-planned { background: #eef2fa; color: #657b9b; }
.priority-high { background: #fff0ef; color: #cc6661; }
.priority-normal { background: #f2f1ff; color: #7168c7; }
.priority-low { background: #f0f2f5; color: #8691a0; }
.icon-link { color: #9da7b4; font-size: 17px; }
.icon-link:hover { color: var(--purple); }
.table-footnote { margin: 12px 0 0; color: #a0a9b5; font-size: 11px; }
.empty-state { padding: 42px 15px 32px; text-align: center; }
.empty-state h3 { margin: 12px 0 6px; font: 700 16px Manrope, sans-serif; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.empty-icon { color: #b3aff0; font-size: 30px; }
.compact-empty { padding: 30px 12px 23px; }
.alert { margin: 0 0 18px; padding: 12px 15px; border-radius: 9px; font-size: 13px; }
.alert-error { border: 1px solid #f5d6d3; background: #fff5f4; color: #a4433e; }
.alert-success { border: 1px solid #cceadd; background: #f0fbf5; color: #287353; }
.filter-bar { display: flex; align-items: end; gap: 11px; margin: 6px 0 22px; padding: 16px; border: 1px solid #eff0f4; border-radius: 11px; background: #fafbfc; }
.filter-bar label { min-width: 130px; }
.filter-bar .filter-search { flex: 1; min-width: 180px; }
label { display: block; color: #596679; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid #e3e7ed; border-radius: 8px; outline: none; background: white; color: var(--ink); font-size: 13px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #9b94e8; box-shadow: 0 0 0 3px rgba(109,100,216,.1); }
input::placeholder, textarea::placeholder { color: #b0b8c2; }
.filter-bar input, .filter-bar select { min-height: 39px; padding: 8px 10px; font-size: 12px; }
.filter-bar .button { min-height: 39px; padding: 0 14px; font-size: 12px; }
.form-panel { max-width: 900px; }
.form-stack { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 18px; }
.span-2 { grid-column: span 2; }
.required { color: #d76b65; }
.label-hint { margin-left: 4px; color: #a7b0bb; font-size: 10px; font-weight: 400; }
textarea { resize: vertical; line-height: 1.6; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.delete-form { margin-top: 23px; padding-top: 16px; border-top: 1px solid var(--line); text-align: right; }
.delete-button { border: 0; background: transparent; color: #c2605c; font-size: 12px; font-weight: 700; cursor: pointer; }
.delete-button:hover { color: #9e3b37; }
.report-period { display: flex; align-items: center; gap: 10px; margin: 5px 0 18px; color: #8490a0; font-size: 12px; }
.report-period strong { color: var(--ink); }
.period-icon { color: var(--purple); font-size: 17px; }
.report-period .button { margin-left: auto; }
.report-filter { max-width: 900px; }
.report-stats { margin-top: 0; }
.report-columns { display: grid; grid-template-columns: 1.2fr 1fr; gap: 17px; margin: 3px 0 29px; }
.sub-panel { min-height: 210px; padding: 20px; border: 1px solid #f0f1f5; border-radius: 12px; background: #fff; }
.sub-panel .section-heading { margin-bottom: 17px; }
.category-list { display: grid; gap: 14px; }
.category-meta { display: flex; justify-content: space-between; margin-bottom: 7px; color: #657184; font-size: 11px; }
.category-meta strong { color: var(--ink); }
.progress-track { height: 6px; overflow: hidden; border-radius: 10px; background: #f0efff; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8279e5, #b3adf5); }
.report-note { color: #8390a0; font-size: 12px; line-height: 1.7; }
.empty-inline { margin: 25px 0; text-align: center; }
.report-table-heading { margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.65; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 10% 5%, #eeedff 0, transparent 34%), var(--canvas); }
.auth-card { width: min(100%, 440px); padding: 37px; border: 1px solid #f0f1f5; border-radius: 17px; background: white; box-shadow: 0 18px 55px rgba(32,43,60,.08); }
.auth-brand { margin-bottom: 35px; }
.auth-card h1 { margin: 7px 0 8px; font: 800 25px Manrope, sans-serif; letter-spacing: -.7px; }
.auth-card > .muted { margin: 0 0 24px; }
.auth-card .form-stack { margin-top: 22px; }
.auth-note { margin: 22px 0 0; color: #96a0ae; font-size: 11px; text-align: center; }
.auth-note a { color: var(--purple); font-weight: 700; }
.auth-note code { padding: 2px 4px; border-radius: 4px; background: #f4f3ff; color: #6960c9; }

@media (max-width: 1100px) {
    .main-content { padding-right: 28px; padding-left: 28px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar { flex-wrap: wrap; }
    .filter-bar .filter-search { flex-basis: 100%; }
}
@media (max-width: 700px) {
    .sidebar { position: static; width: auto; height: auto; padding: 15px 18px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { font-size: 18px; }
    .brand-mark { width: 34px; height: 34px; }
    .main-nav { display: flex; gap: 5px; margin-top: 15px; }
    .main-nav a { flex: 1; justify-content: center; gap: 7px; padding: 9px 5px; font-size: 11px; }
    .main-nav a span { width: auto; font-size: 15px; }
    .sidebar-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
    .user-chip { padding: 6px 0; }
    .user-chip small { display: none; }
    .avatar { width: 29px; height: 29px; }
    .sidebar-bottom form { width: auto; }
    .logout-button { width: auto; gap: 10px; padding: 10px 4px; border: 0; font-size: 12px; }
    .main-content { min-height: auto; margin: 0; padding: 0 16px 35px; }
    .topbar { min-height: 92px; }
    .topbar h1 { font-size: 23px; }
    .topbar-user { display: none; }
    .welcome-banner { min-height: 0; align-items: flex-start; flex-direction: column; padding: 24px; }
    .welcome-banner h2 { font-size: 20px; }
    .stats-grid { gap: 10px; margin: 14px 0; }
    .stat-card { min-height: 127px; grid-template-columns: 33px 1fr; gap: 0 8px; padding: 15px 11px; }
    .stat-icon { width: 31px; height: 31px; border-radius: 9px; font-size: 15px; }
    .stat-label { font-size: 10px; }
    .stat-card strong { margin-top: 10px; font-size: 23px; }
    .stat-card strong.stat-time { font-size: 15px; }
    .stat-card small { font-size: 9px; }
    .panel { margin-top: 14px; padding: 19px 14px; }
    .section-heading { align-items: flex-start; }
    .section-heading h2 { font-size: 17px; }
    .section-heading > .button { min-height: 37px; padding: 0 10px; font-size: 11px; }
    .filter-bar { align-items: stretch; gap: 10px; padding: 12px; }
    .filter-bar label { flex: 1 1 calc(50% - 6px); min-width: 0; font-size: 11px; }
    .filter-bar .filter-search { flex-basis: 100%; }
    .filter-bar .button { flex: 1; }
    .form-grid { grid-template-columns: 1fr; gap: 15px; }
    .span-2 { grid-column: auto; }
    .report-columns { grid-template-columns: 1fr; }
    .report-period { flex-wrap: wrap; }
    .report-period .button { margin-left: auto; }
    .auth-card { padding: 27px 22px; }
}
