:root {
  color-scheme: dark;
  --bg: #15171c;
  --surface: #20232a;
  --surface-2: #292d35;
  --border: rgba(255,255,255,.10);
  --text: #f7f7f8;
  --muted: #9da3ae;
  --yellow: #f5bd18;
  --red: #ef4355;
  --green: #52c77a;
  --shadow: 0 20px 60px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #252932 0, var(--bg) 42rem);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
.shell { width: min(760px, 100%); margin: 0 auto; padding: 28px 18px 72px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.8rem, 5vw, 2.35rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.2rem; letter-spacing: -.015em; }
.eyebrow { margin: 0 0 5px; color: var(--yellow); font-size: .72rem; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.card { background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.role-badge { padding: 7px 10px; border-radius: 999px; background: rgba(245,189,24,.12); color: var(--yellow); font-size: .75rem; font-weight: 800; }
.role-badge[data-role="admin"] { background: rgba(239,67,85,.13); color: #ff8490; }
.icon-button, .text-button { border: 0; background: transparent; color: var(--muted); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-size: 1.1rem; }
.icon-button:hover, .text-button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.text-button { padding: 8px 10px; border-radius: 9px; font-size: .85rem; font-weight: 700; }
.sync-bar { display: flex; justify-content: center; align-items: center; gap: 7px; min-height: 22px; margin-bottom: 12px; color: var(--muted); font-size: .73rem; cursor: pointer; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sync-bar[data-state="loading"] .sync-dot { background: var(--yellow); animation: pulse 1s infinite; }
.sync-bar[data-state="error"] { color: #ff9ba4; }
.sync-bar[data-state="error"] .sync-dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .25; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 14px; background: rgba(0,0,0,.18); }
.tab { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; }
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.progress-card { padding: 22px; }
.progress-heading { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.progress-heading p { margin-bottom: 0; }
.unit-total { margin-top: 5px !important; font-size: clamp(1.55rem, 6vw, 2.2rem); font-weight: 900; letter-spacing: -.04em; }
.unit-total > span { color: var(--muted); font-size: .46em; letter-spacing: 0; }
.percent { color: var(--red); font-size: 1.55rem; }
.track { position: relative; height: 62px; margin-top: 20px; overflow: hidden; border-radius: 15px; background: #101216; border: 1px solid rgba(255,255,255,.04); }
.fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(239,67,85,.6), rgba(245,189,24,.62)); transition: width .45s ease; }
.bike { position: absolute; z-index: 2; left: 2%; top: 50%; transform: translate(-42%, -50%); font-size: 1.85rem; transition: left .45s ease; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.trophy { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 1.55rem; }
.remaining { margin: 13px 0 0; text-align: center; color: var(--muted); font-size: .84rem; }
.goal-message { margin-top: 13px; padding: 11px; text-align: center; color: #191505; background: var(--yellow); border-radius: 11px; font-weight: 900; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 22px; }
.stat-card { display: flex; flex-direction: column; gap: 3px; padding: 15px; border-radius: 15px; border: 1px solid var(--border); background: rgba(32,35,42,.72); }
.stat-card strong { font-size: 1.35rem; }
.stat-card span { color: var(--muted); font-size: .72rem; }
#addTaskCard { padding: 20px; margin-bottom: 28px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.add-task-form { display: grid; grid-template-columns: minmax(0, 1fr) 105px auto; align-items: end; gap: 10px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { min-width: 0; }
label { color: var(--muted); font-size: .76rem; font-weight: 750; }
input, select { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; outline: none; background: #20232a; color: var(--text); }
input:focus, select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,189,24,.12); }
.button { min-height: 45px; padding: 10px 17px; border: 0; border-radius: 11px; font-weight: 850; }
.button.primary { background: linear-gradient(135deg, var(--red), #ff5d53); color: white; }
.button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.quick-units { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 11px; color: var(--muted); font-size: .73rem; }
.quick-units button { min-width: 34px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); }
.quick-units button:hover { border-color: var(--yellow); color: var(--yellow); }
.task-section { margin-top: 3px; }
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); transition: background .2s, border-color .2s; }
.task-row.completed { background: #252a20; border-color: rgba(245,189,24,.28); }
.task-check { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2px solid #8f96a2; border-radius: 50%; background: transparent; color: #17150a; font-weight: 950; }
.task-row.completed .task-check { border-color: var(--yellow); background: var(--yellow); }
.task-body { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.task-title { overflow-wrap: anywhere; font-size: .93rem; }
.task-row.completed .task-title { color: #b7baa9; text-decoration: line-through; }
.task-meta { color: var(--muted); font-size: .7rem; }
.unit-pill { padding: 6px 8px; border-radius: 999px; background: rgba(245,189,24,.11); color: var(--yellow); font-size: .72rem; font-weight: 850; white-space: nowrap; }
.task-actions { display: flex; gap: 4px; }
.mini-button { padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .7rem; }
.mini-button:hover { background: rgba(255,255,255,.06); color: var(--text); }
.mini-button.danger:hover { color: #ff8490; }
.empty-state { padding: 28px 18px; border: 1px dashed rgba(255,255,255,.15); border-radius: 15px; color: var(--muted); text-align: center; font-size: .86rem; }
.more-button { padding: 12px; border: 0; border-radius: 12px; background: transparent; color: var(--yellow); font-weight: 800; }
.tasks-heading { margin-top: 5px; }
.controls-card { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 14px; margin-bottom: 14px; box-shadow: none; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - 100px); }
.login-card { width: min(430px, 100%); padding: 28px; border: 1px solid var(--border); border-radius: 24px; background: rgba(32,35,42,.95); box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 12px; }
.login-icon { margin-bottom: 18px; font-size: 3rem; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.form-error { min-height: 18px; margin: 0; color: #ff929d; font-size: .8rem; }
.modal { width: min(460px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 20px; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(5,7,10,.74); backdrop-filter: blur(5px); }
.modal-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translate(-50%, 20px); max-width: calc(100% - 30px); padding: 11px 16px; border-radius: 12px; background: #f5f5f5; color: #17191e; box-shadow: var(--shadow); font-size: .84rem; font-weight: 800; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast[data-kind="error"] { background: #ff7180; color: white; }
@media (max-width: 650px) {
  .shell { padding: 20px 13px 60px; }
  .topbar { align-items: center; }
  .header-actions { gap: 2px; }
  .role-badge { display: none; }
  .progress-card { padding: 18px 15px; }
  .stats-grid { gap: 7px; }
  .stat-card { padding: 12px 9px; }
  .add-task-form { grid-template-columns: minmax(0,1fr) 92px; }
  .add-button { grid-column: 1 / -1; }
  .task-row { grid-template-columns: 34px minmax(0,1fr) auto; padding: 12px 10px; }
  .task-actions { grid-column: 2 / -1; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 7px; }
  .controls-card { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  h1 { font-size: 1.65rem; }
  .unit-pill { font-size: .66rem; }
  .task-title { font-size: .86rem; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; }
  .stat-card span { font-size: .64rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
