:root {
  --bg: #0d1017;
  --sidebar: #090c12;
  --panel: #151923;
  --panel-2: #1b202c;
  --panel-3: #222836;
  --text: #f3f5f7;
  --muted: #8e96a7;
  --line: #2a3040;
  --accent: #c7ff4a;
  --accent-soft: rgba(199,255,74,.12);
  --orange: #ff8a4c;
  --red: #ff646e;
  --blue: #6aa9ff;
  --shadow: 0 20px 70px rgba(0,0,0,.24);
  --radius: 1.35rem;
  --sidebar-width: 15rem;
}
[data-theme="light"] {
  --bg: #eef0e9;
  --sidebar: #f8f9f4;
  --panel: #fff;
  --panel-2: #f5f6f1;
  --panel-3: #e9ece5;
  --text: #161a20;
  --muted: #68707a;
  --line: #d9ddd4;
  --accent: #78a900;
  --accent-soft: rgba(120,169,0,.12);
  --shadow: 0 20px 55px rgba(30,40,22,.09);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: .5rem; left: .5rem; padding: .7rem 1rem; color: #10130b; background: var(--accent); font-weight: 800; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 1.5rem 1.1rem; border-right: 1px solid var(--line); background: var(--sidebar); }
.logo { display: inline-flex; align-items: center; gap: .75rem; min-height: 2.8rem; color: var(--text); font-size: .83rem; font-weight: 900; letter-spacing: .08em; text-decoration: none; }
.logo b { color: var(--accent); }
.logo-mark { position: relative; width: 2.15rem; height: 2.15rem; border: 2px solid var(--accent); border-radius: 50%; }
.logo-mark i:first-child { position: absolute; inset: .35rem; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; transform: rotate(35deg); }
.logo-mark i:last-child { position: absolute; width: .38rem; height: .38rem; top: 50%; left: 50%; background: var(--accent); border-radius: 50%; transform: translate(-50%,-50%); }
.sidebar nav { display: grid; gap: .4rem; margin-top: 3rem; }
.nav-link, .nav-button { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .8rem .9rem; color: var(--muted); border: 0; border-radius: .75rem; background: transparent; font-size: .86rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
.nav-link span, .nav-button span { display: grid; place-items: center; width: 1.4rem; color: inherit; font-size: 1rem; }
.nav-link:hover, .nav-button:hover, .nav-link.active { color: var(--text); background: var(--panel); }
.nav-link.active span { color: var(--accent); }
.sidebar-bottom { display: grid; gap: 1rem; margin-top: auto; }
.local-badge { display: flex; gap: .75rem; align-items: center; padding: .8rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--panel); }
.local-badge > span { width: .55rem; height: .55rem; flex: 0 0 auto; background: var(--accent); border-radius: 50%; box-shadow: 0 0 12px var(--accent); }
.local-badge strong, .local-badge small { display: block; }
.local-badge strong { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.local-badge small { color: var(--muted); font-size: .62rem; }
.mobile-header { display: none; }
main { min-height: 100vh; margin-left: var(--sidebar-width); padding: 2rem clamp(1.25rem,4vw,4rem) 4rem; }
.view { display: none; animation: view-in .28s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.topbar { min-height: 5rem; display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-bottom: 2rem; }
.topbar p { margin: 0 0 .25rem; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(1.9rem,4vw,3rem); letter-spacing: -.045em; }
.top-actions { display: flex; align-items: center; gap: .7rem; }
.icon-button, .avatar { display: grid; place-items: center; height: 2.65rem; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.icon-button { width: 2.65rem; border-radius: 50%; }
.avatar { padding: 0 .8rem; color: var(--accent); border-radius: .8rem; font-size: .64rem; font-weight: 900; letter-spacing: .08em; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.dashboard-grid { display: grid; grid-template-columns: minmax(25rem,1.3fr) minmax(19rem,.7fr); gap: 1.25rem; }
.timer-card { grid-row: span 2; padding: 1.6rem; text-align: center; }
.mode-switch { display: grid; grid-template-columns: repeat(3,1fr); gap: .3rem; padding: .3rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel-2); }
.mode-switch button { min-height: 2.45rem; padding: .45rem; color: var(--muted); border: 0; border-radius: .6rem; background: transparent; font-size: .72rem; font-weight: 800; cursor: pointer; }
.mode-switch button.active { color: var(--text); background: var(--panel-3); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.timer-ring { position: relative; display: grid; place-items: center; width: min(24rem,100%); aspect-ratio: 1; margin: 1rem auto; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--panel-3); }
.ring-progress { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 659.73; stroke-dashoffset: 0; transition: stroke-dashoffset .4s linear; filter: drop-shadow(0 0 8px rgba(199,255,74,.35)); }
.timer-readout { position: absolute; display: grid; place-items: center; }
.timer-readout strong { font-size: clamp(4rem,9vw,7.7rem); line-height: .9; letter-spacing: -.08em; font-variant-numeric: tabular-nums; }
.timer-readout span { margin-top: .8rem; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.active-task { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; max-width: 29rem; margin: 0 auto 1.3rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel-2); text-align: left; }
.active-task span { grid-column: 1; color: var(--muted); font-size: .58rem; font-weight: 900; letter-spacing: .11em; }
.active-task strong { grid-column: 1; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.active-task button { grid-column: 2; grid-row: 1 / 3; color: var(--accent); border: 0; background: transparent; font-size: .68rem; font-weight: 800; cursor: pointer; }
.timer-controls { display: flex; justify-content: center; align-items: center; gap: 1rem; }
.primary-control { min-width: 11.5rem; min-height: 3.5rem; display: inline-flex; justify-content: center; align-items: center; gap: .7rem; color: #10130b; border: 0; border-radius: 999px; background: var(--accent); font-weight: 900; cursor: pointer; }
.primary-control:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-control { width: 3rem; height: 3rem; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); cursor: pointer; }
.shortcut-hint { margin: 1rem 0 0; color: var(--muted); font-size: .63rem; }
kbd { padding: .15rem .35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: .25rem; background: var(--panel-2); font-size: .6rem; }
.today-card { padding: 1.4rem; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.panel-heading span, .sound-card > div > span, .intention-card > span, .planner-summary > span, .score-card > span, .privacy-card > span { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .6rem; font-weight: 900; letter-spacing: .11em; }
.panel-heading h2, .sound-card h2, .privacy-card h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.02em; }
.text-button { padding: 0; color: var(--accent); border: 0; background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; }
.goal-progress { margin: 1.3rem 0; }
.goal-progress > div:first-child { display: flex; justify-content: space-between; margin-bottom: .5rem; color: var(--muted); font-size: .68rem; }
.goal-progress strong { color: var(--text); }
.progress-track { height: .35rem; overflow: hidden; border-radius: 999px; background: var(--panel-3); }
.progress-track i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .3s ease; }
.task-list { display: grid; gap: .65rem; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--panel-2); }
.task-item.completed { opacity: .58; }
.task-check { width: 1.25rem; height: 1.25rem; display: grid; place-items: center; padding: 0; color: #10130b; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.task-item.completed .task-check { border-color: var(--accent); background: var(--accent); }
.task-copy { min-width: 0; }
.task-copy strong, .task-copy small { display: block; }
.task-copy strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.task-item.completed .task-copy strong { text-decoration: line-through; }
.task-copy small { color: var(--muted); font-size: .62rem; }
.task-actions { display: flex; gap: .35rem; }
.task-actions button { width: 1.8rem; height: 1.8rem; padding: 0; color: var(--muted); border: 0; border-radius: .4rem; background: transparent; cursor: pointer; }
.task-actions button:hover { color: var(--text); background: var(--panel-3); }
.priority-dot { display: inline-block; width: .4rem; height: .4rem; margin-right: .35rem; border-radius: 50%; }
.priority-high { background: var(--red); }.priority-medium { background: var(--orange); }.priority-low { background: var(--blue); }
.empty-state { padding: 1.7rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: .8rem; font-size: .76rem; text-align: center; }
.empty-action { width: 100%; margin-top: .8rem; padding: .75rem; color: var(--muted); border: 0; background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; }
.empty-action:hover { color: var(--text); }
.stats-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,1fr); }
.stats-strip .stat { padding: 1.2rem 1.4rem; border-right: 1px solid var(--line); }
.stats-strip .stat:last-child { border: 0; }
.stats-strip span, .stats-strip strong, .stats-strip small { display: block; }
.stats-strip span { color: var(--muted); font-size: .58rem; font-weight: 900; letter-spacing: .11em; }
.stats-strip strong { margin: .45rem 0 .2rem; font-size: 1.65rem; letter-spacing: -.05em; }
.stats-strip small { color: var(--muted); font-size: .62rem; }
.sound-card { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 1.3rem 1.4rem; }
.sound-card p { margin: .35rem 0 0; color: var(--muted); font-size: .7rem; }
.sound-options { display: flex; gap: .4rem; }
.sound-options button { padding: .65rem .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: .6rem; background: var(--panel-2); font-size: .66rem; font-weight: 800; cursor: pointer; }
.sound-options button.active { color: #10130b; border-color: var(--accent); background: var(--accent); }
.primary-small, .secondary-small, .danger-button { min-height: 2.7rem; padding: .65rem 1rem; border-radius: .7rem; font-size: .72rem; font-weight: 850; cursor: pointer; }
.primary-small { color: #10130b; border: 1px solid var(--accent); background: var(--accent); }
.secondary-small { color: var(--text); border: 1px solid var(--line); background: var(--panel); }
.danger-button { color: #fff; border: 1px solid var(--red); background: rgba(255,100,110,.15); }
.task-layout { display: grid; grid-template-columns: minmax(0,1fr) 20rem; gap: 1.25rem; }
.task-board { min-height: 35rem; padding: 1.4rem; }
.task-filters { display: flex; gap: .3rem; margin-bottom: 1.2rem; }
.task-filters button { padding: .55rem .8rem; color: var(--muted); border: 0; border-radius: .55rem; background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; }
.task-filters button.active { color: var(--text); background: var(--panel-3); }
.task-list.full .task-item { padding: 1rem; }
.task-list.full .task-copy strong { font-size: .88rem; }
.planner-aside { display: grid; gap: 1.25rem; align-content: start; }
.intention-card, .planner-summary { padding: 1.3rem; }
.intention-card textarea { width: 100%; min-height: 8rem; margin-top: .8rem; padding: .8rem; resize: vertical; color: var(--text); border: 1px solid var(--line); border-radius: .7rem; outline: 0; background: var(--panel-2); }
.intention-card small { display: block; margin-top: .35rem; color: var(--muted); text-align: right; }
.planner-summary { display: grid; gap: .8rem; }
.planner-summary > div { display: flex; justify-content: space-between; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.planner-summary > div:last-child { border: 0; }
.planner-summary strong { font-size: 1.45rem; }
.planner-summary small { color: var(--muted); }
.insights-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(16rem,.7fr); gap: 1.25rem; }
.week-chart, .score-card, .history-card, .privacy-card { padding: 1.4rem; }
.week-chart .panel-heading > strong { font-size: 1.6rem; }
.bars { height: 15rem; display: grid; grid-template-columns: repeat(7,1fr); gap: .7rem; align-items: end; margin-top: 1.5rem; }
.bar-column { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: .6rem; align-items: end; text-align: center; }
.bar-column > div { height: 100%; display: flex; align-items: end; justify-content: center; }
.bar-column i { width: min(2.2rem,70%); min-height: .3rem; border-radius: .35rem .35rem .1rem .1rem; background: var(--accent); opacity: .35; }
.bar-column.today i { opacity: 1; box-shadow: 0 0 18px rgba(199,255,74,.2); }
.bar-column span { color: var(--muted); font-size: .58rem; font-weight: 800; }
.score-card { display: grid; align-content: center; min-height: 15rem; }
.score-card > strong { display: block; margin: .6rem 0; color: var(--accent); font-size: clamp(3rem,7vw,5.2rem); letter-spacing: -.08em; }
.score-card p, .privacy-card p { color: var(--muted); font-size: .78rem; }
.history-card { min-height: 20rem; }
.history-list { display: grid; margin-top: 1rem; }
.history-item { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.history-icon { display: grid; place-items: center; width: 2rem; height: 2rem; color: var(--accent); border-radius: 50%; background: var(--accent-soft); font-size: .7rem; font-weight: 900; }
.history-copy strong, .history-copy small { display: block; }
.history-copy strong { font-size: .76rem; }
.history-copy small, .history-item > time { color: var(--muted); font-size: .62rem; }
.privacy-card > div { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
dialog { width: min(34rem,calc(100% - 1.5rem)); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 1.2rem; background: var(--panel); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
dialog::backdrop { background: rgba(3,5,8,.72); backdrop-filter: blur(6px); }
dialog form, #privacy-dialog { padding: 1.4rem; }
.dialog-heading { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.dialog-heading span { color: var(--muted); font-size: .58rem; font-weight: 900; letter-spacing: .11em; }
.dialog-heading h2 { margin: .25rem 0 0; font-size: 1.5rem; }
.dialog-close { width: 2.2rem; height: 2.2rem; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.2rem; cursor: pointer; }
dialog label { display: grid; gap: .4rem; margin-bottom: 1rem; color: var(--muted); font-size: .68rem; font-weight: 750; }
dialog input, dialog textarea, dialog select { width: 100%; padding: .8rem; color: var(--text); border: 1px solid var(--line); border-radius: .65rem; outline: 0; background: var(--panel-2); }
dialog textarea { min-height: 6rem; resize: vertical; }
.field-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .8rem; }
.field-grid.three { grid-template-columns: repeat(3,1fr); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }
.switch-row { grid-template-columns: 1fr auto; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--text); font-size: .75rem; }
.switch-row small { margin-top: .15rem; font-weight: 400; }
.switch-row input { width: 1.2rem; height: 1.2rem; }
#privacy-dialog p, #privacy-dialog li { color: var(--muted); font-size: .82rem; }
.toast-region { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; }
.toast { min-width: 16rem; padding: .85rem 1rem; color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: .7rem; background: var(--panel); box-shadow: var(--shadow); font-size: .72rem; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1050px) {
  .sidebar { width: 5.2rem; align-items: center; }
  .sidebar .logo > span:last-child, .nav-link:not(.active) { font-size: 0; }
  .nav-link, .nav-button { justify-content: center; padding: .8rem; }
  .nav-link span, .nav-button span { font-size: 1rem; }
  .nav-button { font-size: 0; }
  .local-badge div { display: none; }
  main { margin-left: 5.2rem; }
  .dashboard-grid { grid-template-columns: minmax(22rem,1.15fr) minmax(17rem,.85fr); }
  .task-layout { grid-template-columns: 1fr 17rem; }
}
@media (max-width: 780px) {
  .sidebar { display: none; }
  .mobile-header { position: sticky; z-index: 20; top: 0; min-height: 4rem; display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: rgba(13,16,23,.94); backdrop-filter: blur(12px); }
  [data-theme="light"] .mobile-header { background: rgba(238,240,233,.94); }
  .mobile-header .logo-mark { width: 1.9rem; height: 1.9rem; }
  .mobile-header button { width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); }
  main { margin-left: 0; padding: 1rem 1rem 5.5rem; }
  .topbar { min-height: 4.2rem; margin-bottom: 1rem; }
  .top-actions { display: none; }
  .dashboard-grid, .task-layout, .insights-grid { grid-template-columns: 1fr; }
  .timer-card { grid-row: auto; }
  .today-card { order: 2; }
  .stats-strip { grid-template-columns: repeat(2,1fr); }
  .stats-strip .stat:nth-child(2) { border-right: 0; }
  .stats-strip .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .sound-card { align-items: flex-start; flex-direction: column; }
  .planner-aside { grid-template-columns: repeat(2,1fr); }
  .view::after { content: ""; position: fixed; z-index: 18; right: 0; bottom: 0; left: 0; height: 4.5rem; border-top: 1px solid var(--line); background: var(--sidebar); }
  .mobile-nav { display: grid; }
}
@media (max-width: 520px) {
  .timer-card { padding: 1rem; }
  .timer-ring { margin-block: .5rem; }
  .timer-readout strong { font-size: 4.4rem; }
  .mode-switch button { font-size: .62rem; }
  .active-task { grid-template-columns: 1fr; }
  .active-task button { grid-column: 1; grid-row: 3; justify-self: start; padding: .35rem 0 0; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .planner-aside, .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .bars { gap: .25rem; }
  .sound-options { width: 100%; }
  .sound-options button { flex: 1; padding-inline: .35rem; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .mobile-header, .timer-controls, .sound-card, dialog, .toast-region { display: none !important; }
  body, .panel { color: #000; background: #fff; box-shadow: none; }
  main { margin: 0; padding: 1rem; }
  .view { display: block !important; page-break-after: always; }
}
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .mobile-nav { position: fixed; z-index: 22; right: 0; bottom: 0; left: 0; height: 4.5rem; grid-template-columns: repeat(4,1fr); border-top: 1px solid var(--line); background: var(--sidebar); }
  .mobile-nav a, .mobile-nav button { display: grid; place-items: center; align-content: center; gap: .15rem; padding: .35rem; color: var(--muted); border: 0; background: transparent; font-size: .58rem; font-weight: 800; text-decoration: none; cursor: pointer; }
  .mobile-nav span { font-size: .9rem; }
  .mobile-nav a.active { color: var(--accent); }
  .view::after { display: none; }
}
