:root {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #171717;
    background: #f3f3f1;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 750; cursor: pointer; background: #171717; color: #fff; }
button.secondary { background: #ececea; color: #171717; }
button.ghost { background: transparent; color: #333; border: 1px solid #d1d1ce; }
button.small { padding: 8px 11px; font-size: .85rem; }
button:disabled { opacity: .55; cursor: wait; }
.danger-secondary { background: #f1eceb; color: #7b2f2a; border: 1px solid #dfc9c5; }

.container { width: min(1180px, calc(100% - 32px)); margin: 26px auto 70px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.hero h1 { margin: 3px 0 4px; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.hero h1 span { font-size: .42em; font-weight: 700; opacity: .52; }
.hero p { margin: 0; color: #65655f; }
.eyebrow { font-size: .7rem; font-weight: 850; letter-spacing: .14em; color: #74746d; }

.view-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border: 1px solid #d9d9d4; border-radius: 13px; background: #fff; }
.view-tabs .tab { background: transparent; color: #3f3f3a; min-width: 92px; padding: 9px 12px; }
.view-tabs .tab.active { background: #171717; color: #fff; }

.goal-strip { display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 16px; align-items: center; background: #fff; border: 1px solid #deded9; border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.goal-strip-main { min-width: 0; }
.goal-strip select { margin-top: 5px; }
.status { color: #686862; font-size: .9rem; line-height: 1.4; }
.status.ok { color: #2f5a3c; font-weight: 700; }
.status.warning { color: #775f20; font-weight: 700; }
.status.error { color: #843a34; font-weight: 700; }

.app-view[hidden] { display: none !important; }
.panel { background: #fff; border: 1px solid #deded9; border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.panel h2 { margin: 3px 0 14px; font-size: 1.12rem; }
.section-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.section-head.compact { margin-bottom: 12px; }
.section-head.compact h2 { margin-bottom: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; }
.today-panel, .progress-panel { min-height: 250px; }
.stack { display: grid; gap: 10px; }
.muted, .hint { color: #70706a; font-size: .9rem; }

.today-card { border: 1px solid #e1e1dc; border-radius: 12px; padding: 16px; background: #fafaf8; }
.today-card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.task-meta-line { margin: 0; color: #66665f; }
.progress-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.result { margin: 12px 0 0; font-weight: 750; }

.progress-hero { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin-bottom: 8px; }
.progress-hero strong { font-size: 2rem; line-height: 1; }
.progress-hero span { color: #66665f; font-size: .85rem; text-align: right; }
.progress-bar { height: 11px; background: #e8e8e4; border-radius: 999px; overflow: hidden; margin: 12px 0 16px; }
.progress-bar > div { height: 100%; background: #171717; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.summary-grid > div { border: 1px solid #e5e5e0; border-radius: 10px; padding: 10px; min-width: 0; }
.summary-grid span, .summary-grid strong { display: block; }
.summary-grid span { font-size: .74rem; color: #73736d; margin-bottom: 4px; }
.summary-grid strong { font-size: .9rem; overflow-wrap: anywhere; }
.warning-box { border: 1px solid #d7caa4; background: #fbf8ed; border-radius: 10px; padding: 11px; font-size: .9rem; }

.next-task-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; border-bottom: 1px solid #ecece7; padding: 11px 2px; }
.next-task-card:last-child { border-bottom: 0; }
.next-task-card > strong { font-size: .86rem; color: #62625c; }
.next-task-card > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; min-width: 0; }
.next-task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.next-task-card small { color: #777770; flex: 0 0 auto; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.days { grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 12px; }
form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; font-weight: 680; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #cfcfca; border-radius: 9px; background: #fff; color: #171717; }
textarea { resize: vertical; }
details { border: 1px solid #e1e1dc; border-radius: 11px; padding: 12px; }
summary { cursor: pointer; font-weight: 760; }

.roadmap-stack { display: grid; gap: 10px; }
.roadmap-summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 4px 2px 10px; }
.roadmap-summary h3 { margin: 0; }
.roadmap-summary span { color: #696963; font-size: .9rem; }
.roadmap-phase { padding: 0; overflow: hidden; background: #fafaf8; }
.roadmap-phase > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; list-style: none; padding: 14px 15px; }
.roadmap-phase > summary::-webkit-details-marker { display: none; }
.roadmap-phase > summary::after { content: "+"; color: #777770; font-size: 1.1rem; }
.roadmap-phase[open] > summary::after { content: "−"; }
.roadmap-phase > summary small { color: #7a7a73; font-weight: 650; }
.roadmap-phase ul { margin: 0; padding: 4px 34px 15px; }
.roadmap-phase li { margin: 7px 0; line-height: 1.45; }
.roadmap-note p { white-space: pre-wrap; line-height: 1.55; color: #60605a; }

.calendar-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 14px; }
.calendar-toolbar h2 { margin: 3px 0 0; font-size: 1.4rem; }
.calendar-actions { display: flex; gap: 8px; }
.timer-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; border: 1px solid #d6d6d1; background: #fafaf8; border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; }
.timer-panel.running { background: #202020; color: #fff; border-color: #202020; }
.timer-panel.paused { background: #deded9; color: #171717; border-color: #adada7; }
.timer-main { display: grid; gap: 2px; min-width: 160px; }
.timer-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.timer-panel p { margin: 0; font-size: .86rem; opacity: .74; }
.timer-state { font-size: .78rem; font-weight: 850; letter-spacing: .04em; }
.timer-clock { font-size: 1.85rem; font-variant-numeric: tabular-nums; }
.timer-finish { flex: 0 0 auto; background: #fff; color: #171717; border: 1px solid #bdbdb7; }
.calendar-scroll { overflow-x: auto; padding-bottom: 4px; }
.calendar-grid { min-width: 800px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekday { padding: 8px; text-align: center; font-size: .78rem; font-weight: 850; color: #666660; }
.calendar-blank { min-height: 118px; border-radius: 10px; background: #f6f6f3; }
.calendar-day { min-height: 128px; text-align: left; display: flex; flex-direction: column; gap: 7px; padding: 10px; color: #171717; background: #fff; border: 1px solid #ddddda; border-radius: 10px; font-weight: 500; min-width: 0; }
.calendar-day.today { border: 2px solid #171717; }
.calendar-day.selected { outline: 2px solid #8a8a84; outline-offset: 1px; }
.calendar-day.running { background: #202020; color: #fff; border-color: #202020; }
.calendar-day.paused { background: #deded9; color: #171717; border-color: #a9a9a3; }
.calendar-day-number { font-weight: 850; font-size: .9rem; }
.calendar-task-wrap { display: grid; gap: 4px; min-width: 0; }
.calendar-task { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .76rem; line-height: 1.25; border-left: 3px solid #999; padding-left: 5px; }
.calendar-task.completed { text-decoration: line-through; opacity: .6; }
.calendar-task.partial { border-left-style: dashed; }
.calendar-task.skipped { opacity: .5; }
.calendar-more { font-size: .72rem; opacity: .7; }
.calendar-meta { margin-top: auto; font-size: .7rem; opacity: .75; line-height: 1.3; }
.calendar-detail-task { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid #ecece7; padding: 9px 0; }
.calendar-detail-task span { color: #666660; font-size: .85rem; flex: 0 0 auto; }
.calendar-detail-total { font-weight: 800; margin-bottom: 0; }

.history-list { display: grid; gap: 0; }
.history-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 11px 2px; border-bottom: 1px solid #ecece7; }
.history-row:last-child { border-bottom: 0; }
.history-row span { color: #64645e; font-size: .9rem; }
.task-history-row > div { display: grid; gap: 3px; min-width: 0; }
.task-history-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-history-row small { color: #7a7a74; }

@media (hover: hover) and (pointer: fine) {
    button:hover { filter: brightness(.94); }
    .calendar-day:hover { border-color: #999993; }
    .view-tabs .tab:hover:not(.active) { background: #f0f0ed; }
}

@media (max-width: 860px) {
    .container { width: min(100% - 20px, 1180px); margin-top: 18px; }
    .hero { align-items: stretch; flex-direction: column; }
    .view-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .view-tabs .tab { flex: 1 0 auto; }
    .goal-strip { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .grid.two, .summary-grid { grid-template-columns: 1fr 1fr; }
    .grid.days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .section-head { align-items: stretch; flex-direction: column; }
    .calendar-toolbar { align-items: stretch; flex-direction: column; }
    .calendar-actions { justify-content: space-between; }
    .timer-panel { align-items: flex-start; flex-direction: column; }
    .timer-controls { width: 100%; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
    .panel { padding: 16px; }
    .grid.two, .summary-grid { grid-template-columns: 1fr; }
    .next-task-card { grid-template-columns: 58px 1fr; }
    .next-task-card > div { align-items: flex-start; flex-direction: column; gap: 3px; }
    .calendar-detail-task, .history-row { align-items: flex-start; flex-direction: column; }
    .progress-controls button { flex: 1 1 120px; }
}


/* v0.1.5 auth */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.auth-screen[hidden] { display: none !important; }
.auth-card { width: min(820px, 100%); background: #fff; border: 1px solid #deded9; border-radius: 18px; padding: 26px; }
.auth-card h1 { margin: 4px 0 6px; }
.auth-card h1 span { font-size: .45em; opacity: .52; }
.auth-lead { color: #66665f; margin: 0 0 14px; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.auth-form { border: 1px solid #e3e3de; border-radius: 13px; padding: 18px; align-content: start; }
.auth-form h2 { margin: 0 0 4px; font-size: 1.05rem; }
.hero-actions { display: grid; gap: 9px; justify-items: end; }
.account-chip { display: flex; align-items: center; gap: 10px; color: #5f5f59; font-size: .86rem; }
.account-chip > span { font-weight: 800; }
@media (max-width: 860px) {
    .hero-actions { justify-items: stretch; }
    .account-chip { justify-content: space-between; }
}
@media (max-width: 620px) {
    .auth-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 20px; }
}
