:root {
  --blue: #0d1b38;
  --blue-dark: #071328;
  --yellow: #ffc72c;
  --yellow-dark: #e4a900;
  --green: #22a06b;
  --ink: #13233f;
  --muted: #66758c;
  --line: #dce3ed;
  --bg: #f2f5fa;
  --surface: #ffffff;
  --soft-blue: #e9eef8;
  --soft-green: #e8f7ef;
  --soft-amber: #fff4cc;
  --danger: #c93737;
  --shadow: 0 10px 30px rgba(13, 27, 56, 0.1);
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.screen { min-height: 100vh; padding: max(24px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
.screen.auth { display: flex; flex-direction: column; justify-content: space-between; max-width: 480px; margin: auto; padding-bottom: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; font-size: 21px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--yellow); color: var(--blue); box-shadow: 0 6px 14px rgba(255, 199, 44, .25); }
.brand-logo { display: block; width: min(100%, 310px); aspect-ratio: 1 / 1; object-fit: cover; border-radius: 22px; box-shadow: 0 18px 38px rgba(13, 27, 56, .2); }
.auth-main { padding-top: 11vh; }
.auth-main h1 { margin: 25px 0 10px; max-width: 330px; font-size: clamp(30px, 8vw, 42px); line-height: 1.04; letter-spacing: -0.04em; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.55; max-width: 320px; }
.auth-note { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.45; margin: 22px 0; }
.auth-actions { display: grid; gap: 10px; }
.btn { min-height: 48px; border: 0; border-radius: 7px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; color: var(--ink); transition: .18s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--yellow); color: var(--blue); box-shadow: 0 6px 14px rgba(255, 199, 44, .28); }
.btn.primary:hover { background: var(--yellow-dark); }
.btn.secondary { background: var(--surface); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--blue); padding-inline: 8px; }
.btn.full { width: 100%; }
.btn.small { min-height: 36px; padding: 0 11px; font-size: 12px; }
.btn.danger { color: var(--danger); background: #fff1f1; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 24px; margin: 0; letter-spacing: -0.03em; }
.topbar p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; }
.content { max-width: 760px; margin: 0 auto; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat, .panel, .task-card, .profile-row { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.stat { padding: 15px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { display: block; margin-top: 8px; font-size: 23px; font-weight: 800; letter-spacing: -0.03em; }
.stat-value.green { color: var(--green); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 11px; }
.section-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.section-head span { color: var(--muted); font-size: 12px; }
.search { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; min-height: 44px; padding: 0 12px; margin-bottom: 10px; }
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.search svg { color: var(--muted); width: 18px; }
.filters { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 16px; padding: 7px 11px; font-size: 12px; }
.chip.active { color: var(--blue); border-color: var(--yellow); background: var(--soft-amber); font-weight: 700; }
.task-list { display: grid; gap: 10px; }
.task-card { padding: 14px; box-shadow: none; }
.task-top { display: flex; justify-content: space-between; gap: 10px; }
.task-card h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.category { color: var(--blue); font-size: 11px; font-weight: 700; margin: 7px 0 12px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 11px; }
.pay { font-size: 16px; font-weight: 800; color: var(--green); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 5px; padding: 5px 7px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge.available { color: var(--blue); background: var(--soft-blue); }
.badge.review { color: #966300; background: var(--soft-amber); }
.badge.done { color: var(--green); background: var(--soft-green); }
.badge.rejected { color: var(--danger); background: #fff1f1; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 7px 8px max(7px, env(safe-area-inset-bottom)); backdrop-filter: blur(10px); }
.nav-item { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 3px; min-height: 53px; font-size: 10px; }
.nav-item.active { color: var(--blue); font-weight: 700; }
.nav-item.active svg { color: var(--yellow-dark); filter: drop-shadow(0 2px 4px rgba(255, 199, 44, .35)); }
.nav-item svg { width: 19px; height: 19px; }
.form-wrap { max-width: 480px; margin: 0 auto; }
.back-row { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.back-row h1 { margin: 0; font-size: 21px; }
.field { display: grid; gap: 7px; margin: 14px 0; }
.field label { font-size: 13px; font-weight: 700; }
.input, .textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: var(--surface); padding: 0 12px; color: var(--ink); }
.textarea { padding: 12px; min-height: 110px; resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--yellow-dark); box-shadow: 0 0 0 3px rgba(255,199,44,.2); }
.check { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.45; margin: 18px 0 22px; }
.check input { accent-color: var(--blue); margin-top: 2px; }
.detail-panel { padding: 17px; }
.detail-panel h1 { font-size: 25px; line-height: 1.13; margin: 0 0 8px; letter-spacing: -0.035em; }
.detail-panel h2 { font-size: 15px; margin: 22px 0 9px; }
.detail-panel p, .detail-panel li { color: var(--muted); font-size: 13px; line-height: 1.55; }
.detail-panel ul { margin: 0; padding-left: 20px; }
.info { display: flex; gap: 9px; padding: 12px; border-radius: 7px; background: var(--soft-amber); color: #765100; font-size: 12px; line-height: 1.4; margin: 18px 0; }
.sticky-action { position: sticky; bottom: 78px; padding-top: 16px; background: linear-gradient(var(--bg), var(--bg)); }
.tabbar { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.tab { flex: 1 0 auto; border: 0; background: transparent; border-bottom: 2px solid transparent; padding: 9px 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.tab.active { color: var(--blue); border-color: var(--blue); }
.activity-row, .operation { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.activity-row:last-child, .operation:last-child { border-bottom: 0; }
.activity-row h3, .operation h3 { margin: 0 0 4px; font-size: 13px; line-height: 1.35; }
.activity-row p, .operation p { margin: 0; color: var(--muted); font-size: 11px; }
.amount { font-weight: 800; color: var(--green); white-space: nowrap; }
.balance-card { background: var(--blue); color: white; padding: 20px; border-radius: 8px; box-shadow: 0 10px 24px rgba(13,27,56,.25); position: relative; overflow: hidden; }
.balance-card::after { content: ""; position: absolute; width: 170px; height: 170px; right: -75px; top: -90px; border: 18px solid rgba(255,199,44,.9); border-radius: 50%; }
.balance-card .stat-label { color: rgba(255,255,255,.75); }
.balance-card .stat-value { font-size: 34px; }
.balance-card small { display: block; color: rgba(255,255,255,.72); margin-top: 12px; font-size: 11px; }
.profile-head { display: flex; align-items: center; gap: 12px; padding: 17px; margin-bottom: 15px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 50%; background: var(--soft-blue); color: var(--blue); font-weight: 800; }
.profile-head h2 { margin: 0 0 4px; font-size: 16px; }
.profile-head p { margin: 0; color: var(--muted); font-size: 12px; }
.profile-list { display: grid; gap: 8px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 13px; box-shadow: none; }
.profile-row .row-left { display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.profile-row svg { color: var(--muted); width: 18px; }
.toggle { width: 40px; height: 23px; padding: 2px; border: 0; border-radius: 12px; background: #ccd5e1; }
.toggle.on { background: var(--green); }
.toggle span { display: block; width: 19px; height: 19px; background: white; border-radius: 50%; transition: .18s; }
.toggle.on span { transform: translateX(17px); }
.empty { text-align: center; padding: 30px 18px; color: var(--muted); }
.empty svg { color: #9aa8ba; margin-bottom: 8px; }
.empty p { margin: 4px 0 13px; font-size: 13px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: end center; background: rgba(23,43,77,.35); padding: 14px; }
.modal { width: min(100%, 460px); background: var(--surface); border-radius: 10px; padding: 18px; box-shadow: 0 18px 50px rgba(23,43,77,.2); }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { margin: 0 0 17px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 82px; z-index: 50; background: #172b4d; color: white; padding: 12px 14px; border-radius: 7px; font-size: 13px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; text-align: center; }
.toast.show { opacity: 1; transform: translateY(0); }
.support-note { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 10px 0 18px; }
.toolbar, .search, .task-grid, .metric-grid, .dashboard-grid, .container, .content, section { max-width: 100%; min-width: 0; }
.motion-fallback .screen { animation: screen-in .35s ease both; }
.motion-fallback .screen > *, .motion-fallback .content > * { animation: item-in .42s ease both; }
.motion-fallback .screen > *:nth-child(2), .motion-fallback .content > *:nth-child(2) { animation-delay: .06s; }
.motion-fallback .screen > *:nth-child(3), .motion-fallback .content > *:nth-child(3) { animation-delay: .12s; }
.motion-fallback .screen > *:nth-child(4), .motion-fallback .content > *:nth-child(4) { animation-delay: .18s; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes item-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 700px) {
  .screen { padding-inline: 28px; }
  .task-list { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { place-items: center; }
}
@media (prefers-color-scheme: dark) {
  :root.tg-dark { color-scheme: dark; --bg: #091226; --surface: #111f3b; --ink: #f5f7fb; --muted: #a8b5c9; --line: #263754; --soft-blue: #1a2b4c; --soft-green: #173c2d; --soft-amber: #473815; --shadow: 0 8px 28px rgba(0,0,0,.22); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
