:root {
  --primary: #635bff;
  --primary-strong: #5147e5;
  --primary-soft: #eeedff;
  --ink: #0a2540;
  --muted: #425466;
  --muted-2: #8796a8;
  --line: #e3e8ee;
  --surface: #ffffff;
  --canvas: #f6f9fc;
  --navy: #0a2540;
  --green: #00a878;
  --green-soft: #e6f8f2;
  --amber: #d79000;
  --amber-soft: #fff8e6;
  --red: #ef4444;
  --red-soft: #fff1f0;
  --shadow: 0 1px 2px rgba(10, 37, 64, .04), 0 10px 28px rgba(10, 37, 64, .06);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line); min-height: 100vh;
  display: flex; flex-direction: column; padding: 20px 12px 16px; position: sticky; top: 0; height: 100vh; z-index: 20;
}
.brand-row { height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--primary); font-weight: 700; letter-spacing: -.04em; font-size: 23px; }
.brand-mark { font-size: 33px; line-height: 1; font-weight: 700; }
.collapse-btn { color: var(--navy); background: none; border: 0; padding: 7px; border-radius: 8px; }
.collapse-btn:hover { background: var(--primary-soft); color: var(--primary); }
.nav-label { padding: 0 12px 8px; text-transform: none; font-size: 12px; letter-spacing: 0; color: var(--muted-2); font-weight: 600; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; border-radius: 6px; padding: 9px 12px; color: var(--navy); font-weight: 500; border: 1px solid transparent; transition: .15s ease; }
.nav-item svg { width: 21px; height: 21px; stroke-width: 1.8; }
.nav-item:hover { background: #f6f9fc; color: var(--primary); }
.nav-item.active { color: var(--ink); background: #e9edf3; font-weight: 600; }
.nav-item .nav-count { margin-left: auto; color: var(--primary); font-size: 12px; background: var(--primary-soft); padding: 2px 7px; border-radius: 999px; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.sidebar-mini { color: var(--navy); font-size: 14px; }
.sidebar-mini svg { width: 19px; height: 19px; }
.support-pill { margin: 14px 0 0; padding: 12px 14px; display: flex; align-items: center; gap: 10px; background: #f3f2ff; border: 1px solid #d9d6ff; border-radius: 12px; color: var(--primary-strong); font-size: 13px; }
.support-pill svg { width: 17px; }

.content-wrap { min-width: 0; }
.topbar { height: 68px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); padding: 0 40px 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 300px; }
.progress-copy { font-weight: 700; font-size: 13px; color: var(--navy); }
.progress-track { height: 8px; width: 183px; background: #e6e8ed; border-radius: 99px; margin-top: 7px; overflow: hidden; }
.progress-fill { height: 100%; width: 64%; background: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; color: var(--navy); position: relative; }
.icon-btn:hover { border-color: #b9b4ff; color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }
.notification-dot { position: absolute; width: 7px; height: 7px; background: var(--primary); border: 2px solid white; top: 8px; right: 8px; border-radius: 50%; }
.profile-btn { border: 1px solid var(--line); background: white; display: flex; align-items: center; gap: 11px; border-radius: 999px; padding: 6px 12px 6px 7px; font-weight: 700; color: var(--navy); }
.avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: #dcd9ff; color: var(--primary-strong); font-weight: 800; font-size: 12px; }
.profile-btn svg { width: 16px; margin-left: 4px; }
.main { padding: 40px 48px 72px; max-width: 1440px; margin: 0 auto; width: 100%; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0 0 32px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--primary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 10px; }
h1, h2, h3, p { margin: 0; }
h1 { letter-spacing: -.035em; font-size: clamp(26px, 3vw, 35px); line-height: 1.12; color: var(--ink); font-weight: 650; }
h2 { letter-spacing: -.03em; font-size: 21px; color: var(--ink); }
h3 { font-size: 16px; color: var(--ink); }
.subheading { color: var(--muted); margin-top: 9px; line-height: 1.5; max-width: 680px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 11px 16px; min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: .15s ease; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 5px 12px rgba(99, 91, 255, .2); }
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-1px); }
.btn-dark { color: white; background: #16171c; }
.btn-dark:hover { background: #30323a; }
.btn-secondary { color: var(--navy); background: white; border-color: #d9dce2; }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-quiet { color: var(--navy); background: transparent; border-color: transparent; }
.btn-quiet:hover { background: #f4f5f7; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecdd3; }
.btn-sm { min-height: 36px; padding: 8px 12px; font-size: 13px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding: 11px 36px 11px 13px; min-height: 43px; border: 1px solid #d9dce2; background: white; color: var(--navy); border-radius: 10px; outline: none; }
.select-wrap svg { pointer-events: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 15px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main-aside { grid-template-columns: minmax(0, 1.72fr) minmax(300px, .8fr); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: none; }
.card-pad { padding: 24px; }
.kpi { min-height: 132px; padding: 22px 25px; }
.kpi-label { color: var(--muted); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.kpi-label svg { width: 15px; color: var(--muted-2); }
.kpi-value { margin-top: 13px; font-size: 26px; letter-spacing: -.04em; color: var(--ink); }
.kpi-note { margin-top: 9px; font-size: 12px; color: var(--muted); }
.kpi-note.good { color: #079669; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.section-title .muted { font-size: 13px; font-weight: 500; color: var(--muted); }
.section-body { padding: 24px; }

.chart-card { height: 390px; }
.bar-chart { height: 270px; display: flex; align-items: flex-end; gap: 13px; padding: 26px 18px 0; position: relative; border-bottom: 1px solid #e8e9ec; background: linear-gradient(to bottom, transparent 24%, #f3f4f6 25%, transparent 25%, transparent 49%, #f3f4f6 50%, transparent 50%, transparent 74%, #f3f4f6 75%, transparent 75%); }
.bar-set { flex: 1; height: 100%; display: flex; align-items: flex-end; gap: 4px; min-width: 10px; }
.bar { width: 50%; background: var(--primary); min-height: 5px; transition: height .3s; }
.bar.alt { background: #a6a1ff; }
.chart-axis { display: flex; justify-content: space-between; padding: 12px 20px 0; color: #9aa0aa; font-size: 12px; }
.legend { display: flex; justify-content: center; gap: 17px; font-size: 12px; color: var(--muted); padding: 15px 0 0; }
.legend-item { display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.legend-dot.alt { background: #a6a1ff; }
.donut-wrap { display: grid; place-items: center; padding: 23px 10px 16px; }
.donut { width: 205px; height: 205px; border-radius: 50%; background: conic-gradient(#00a878 0 60%, #3f83ef 60% 81%, #635bff 81% 92%, #a6a1ff 92% 99%, #f5a000 99% 100%); position: relative; }
.donut::after { content: ''; position: absolute; inset: 25px; background: white; border-radius: 50%; }
.donut-label { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.donut-legend { display: flex; justify-content: center; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: 11px; padding-bottom: 4px; }
.donut-legend span { display: inline-flex; align-items: center; gap: 5px; }
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
@media (max-width: 760px) {
  .table-wrap { margin: 0 -17px; padding: 0 17px; }
  table { min-width: 680px; }
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 16px 20px; border-bottom: 1px solid #eef0f2; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: #f8fafc; }
td { color: #303642; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fff9fc; }
.right { text-align: right; }
.muted { color: var(--muted); }
.tiny { color: var(--muted-2); font-size: 12px; }
.strong { font-weight: 700; color: #242832; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-green { color: #079669; background: var(--green-soft); }
.status-pink { color: var(--primary-strong); background: var(--primary-soft); }
.status-amber { color: #aa7000; background: var(--amber-soft); }
.status-red { color: #d83045; background: var(--red-soft); }
.status-gray { color: #687080; background: #f1f3f5; }

.toolbar { padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 13px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search { min-width: 230px; height: 40px; border: 1px solid #dfe2e7; border-radius: 9px; padding: 0 13px 0 37px; outline: none; color: var(--ink); background: white; }
.search:focus, input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 91, 255, .14); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; width: 16px; left: 12px; top: 12px; color: var(--muted-2); }
.filter { height: 40px; padding: 0 12px; border: 1px solid #dfe2e7; background: white; border-radius: 9px; color: var(--navy); }
.tabs { display: flex; gap: 8px; padding: 15px 20px 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px 12px 13px; border-bottom: 2px solid transparent; font-weight: 700; }
.tab.active { color: var(--primary); border-color: var(--primary); }
.pagination { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.pagination-actions { display: flex; gap: 7px; }
.page-number { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: white; color: var(--navy); }
.page-number.active { color: var(--primary); background: var(--primary-soft); border-color: #b9b4ff; }

.notice { display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px; border: 1px solid #f5df9f; background: var(--amber-soft); border-radius: 11px; color: #8a6300; }
.notice svg { width: 19px; flex: 0 0 auto; margin-top: 1px; }
.notice strong { color: #5d4300; }
.callout { padding: 17px 19px; border-radius: 11px; background: #faf5ff; border: 1px solid #eadbff; color: #6840a8; }
.callout strong { color: #4c2b87; }
.empty-state { padding: 62px 22px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 13px; border-radius: 16px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.empty-icon svg { width: 22px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr); gap: 17px; align-items: start; }
.detail-list { display: grid; gap: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid #eef0f2; }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--muted); }
.detail-row dd { text-align: right; margin: 0; font-weight: 700; color: #252a34; }
.money-big { font-size: 29px; letter-spacing: -.05em; }
.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 20px 1fr; gap: 13px; position: relative; padding-bottom: 22px; }
.timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 9px; top: 20px; bottom: 0; width: 1px; background: #e4e6e9; }
.timeline-dot { width: 19px; height: 19px; border-radius: 50%; background: var(--primary-soft); border: 5px solid #b9b4ff; z-index: 1; }
.timeline-dot.done { background: var(--green-soft); border-color: #81ddb9; }
.timeline-title { font-weight: 700; color: #252a34; }
.timeline-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.link-box { display: flex; align-items: center; gap: 10px; padding: 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; margin-top: 13px; }
.link-box code { overflow: hidden; text-overflow: ellipsis; flex: 1; color: #5e6878; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #3d4552; font-weight: 700; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #dfe2e7; border-radius: 9px; min-height: 44px; padding: 10px 12px; color: var(--ink); outline: none; background: white; }
.field textarea { min-height: 102px; resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.form-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid #eef0f2; }
.switch { width: 42px; height: 24px; background: #d7dae0; border: 0; border-radius: 99px; padding: 3px; transition: .15s; }
.switch::before { content: ''; display: block; width: 18px; height: 18px; background: white; border-radius: 50%; transition: .15s; }
.switch.on { background: var(--primary); }
.switch.on::before { transform: translateX(18px); }
.mini-stat { padding: 18px 20px; }
.mini-stat .label { color: var(--muted); font-size: 13px; }
.mini-stat .value { font-size: 21px; margin-top: 8px; }
.progress-line { height: 7px; background: #eceef1; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-line span { display: block; height: 100%; background: var(--primary); }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth-art { background: #635bff; padding: 45px; color: white; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; right: -130px; bottom: -130px; box-shadow: 0 0 0 35px rgba(255,255,255,.04), 0 0 0 70px rgba(255,255,255,.04); }
.auth-brand { color: white; }
.auth-quote { position: relative; z-index: 1; max-width: 490px; }
.auth-quote h1 { color: white; font-size: clamp(34px, 4vw, 55px); line-height: 1.06; }
.auth-quote p { margin-top: 18px; color: rgba(255,255,255,.78); font-size: 17px; line-height: 1.55; }
.auth-art-footer { color: rgba(255,255,255,.75); font-size: 13px; position: relative; z-index: 1; }
.auth-panel { display: grid; place-items: center; padding: 40px 25px; }
.auth-form { width: min(430px, 100%); }
.auth-form .brand { margin-bottom: 47px; }
.auth-form h2 { font-size: 30px; }
.auth-form .subheading { margin-bottom: 29px; }
.auth-form .field { margin-bottom: 18px; }
.auth-form .btn { width: 100%; margin-top: 8px; }
.auth-form .helper-row { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0 12px; font-size: 13px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.checkbox-line input { accent-color: var(--primary); margin-top: 2px; }
.auth-link { color: var(--primary); font-weight: 700; }

.overlay { position: fixed; inset: 0; background: rgba(16, 18, 25, .35); z-index: 50; display: none; }
.overlay.show { display: block; }
.drawer { position: fixed; z-index: 60; right: 0; top: 0; height: 100vh; width: min(560px, 100%); background: white; transform: translateX(100%); transition: transform .25s ease; box-shadow: -10px 0 40px rgba(18, 24, 40, .16); overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 26px 27px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 25px 27px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; background: #20232b; color: white; border-radius: 10px; padding: 13px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 9px 25px rgba(0,0,0,.2); transform: translateY(100px); transition: .2s; font-size: 14px; }
.toast.show { transform: translateY(0); }
.toast svg { color: #72e5b8; width: 18px; }
.mobile-menu { display: none; }
.mobile-bottom { display: none; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 235px 1fr; }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-aside, .detail-grid { grid-template-columns: 1fr; }
  .main { padding: 28px 22px 50px; }
  .topbar { padding-right: 22px; }
  .main { max-width: 100%; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; width: 285px; box-shadow: 12px 0 30px rgba(18,24,40,.12); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; place-items: center; border: 0; background: none; color: var(--navy); padding: 4px; }
  .mobile-menu svg { width: 23px; }
  .topbar { height: 70px; padding: 0 16px; }
  .topbar-left { min-width: 0; }
  .topbar-left .badge-progress { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .help-btn { display: none; }
  .profile-btn { padding-right: 8px; }
  .profile-btn span:not(.avatar) { display: none; }
  .main { padding: 24px 15px 88px; }
  .page-header { display: block; }
  .header-actions { justify-content: flex-start; margin-top: 18px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .kpi { min-height: auto; }
  .chart-card { height: auto; }
  .bar-chart { height: 215px; gap: 5px; padding-left: 8px; padding-right: 8px; }
  .bar-set { gap: 2px; }
  .section-title, .section-body { padding-left: 17px; padding-right: 17px; }
  .toolbar { align-items: stretch; padding: 13px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-wrap, .search { width: 100%; }
  .filter { flex: 1; }
  th, td { padding: 14px; }
  .mobile-bottom { display: flex; position: fixed; left: 12px; right: 12px; bottom: 11px; height: 62px; background: rgba(255,255,255,.96); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(18,24,40,.13); border-radius: 17px; z-index: 30; align-items: center; justify-content: space-around; }
  .mobile-bottom a { color: var(--muted); display: grid; place-items: center; gap: 3px; font-size: 10px; font-weight: 700; }
  .mobile-bottom a.active { color: var(--primary); }
  .mobile-bottom svg { width: 19px; height: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { padding: 30px 20px; min-height: 100vh; }
  .auth-form .brand { margin-bottom: 65px; }
  .donut { width: 180px; height: 180px; }
  .card-pad { padding: 18px; }
  .detail-row { gap: 12px; flex-wrap: wrap; }
  .detail-row dd { margin-left: auto; max-width: 65%; overflow-wrap: anywhere; }
  .link-box { min-width: 0; }
  .link-box code { min-width: 0; }
  .notice, .callout { overflow-wrap: anywhere; }
  .auth-form { width: 100%; max-width: 430px; }
}

@media (max-width: 480px) {
  .topbar { height: 62px; }
  .main { padding: 20px 12px 88px; }
  .page-header { margin-bottom: 24px; }
  h1 { font-size: 27px; }
  .header-actions { gap: 8px; }
  .header-actions > * { max-width: 100%; }
  .btn, .select-wrap, .select-wrap select { max-width: 100%; }
  .btn { padding-left: 12px; padding-right: 12px; }
  .section-title, .section-body { padding-left: 14px; padding-right: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .toolbar { padding: 11px; }
  .toolbar-left, .toolbar-right { gap: 7px; }
  .profile-btn { border: 0; background: transparent; padding: 4px; }
  .icon-btn { width: 38px; height: 38px; }
  .mobile-bottom { left: 8px; right: 8px; bottom: 8px; }
}
