/* Shared type, light and material */
:root {
  --bg: #141513;
  --sidebar: #191b17;
  --panel: #1e201c;
  --inset: #252822;
  --line: #343730;
  --ink: #f1f2e9;
  --dim: #b1b4a8;
  --faint: #929889;
  --lime: #d3efa7;
  --purple: #c6adee;
  --radius: 18px;
  --instrument-type: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --panel-surface: linear-gradient(145deg, #252721 -35%, #1d1f1c 65%);
  --hairlight: inset 0 1px 0 rgb(236 245 218 / 3%);
  --gutter: clamp(22px, 3vw, 48px);
}
body { -webkit-font-smoothing: antialiased; }
.app { background: radial-gradient(ellipse 85% 590px at 68% 0%, #20221e66, transparent 76%); }
.panel { background: var(--panel-surface); box-shadow: var(--hairlight); }
h1, .hero-value, .activity-value, .metric strong, .diary-metric strong { font-variant-numeric: lining-nums tabular-nums; }
h1 { font-size: clamp(2.7rem, 3.8vw, 4rem); font-weight: 600; letter-spacing: -.067em; }
.panel h2 { font-size: clamp(1.08rem, 1.27vw, 1.26rem); font-weight: 600; letter-spacing: -.042em; }
.count, .axis, .time, .cal-weekday, .cal-day>b, .heat-months, .heat-labels, .y-labels, .journal-axis { font-variant-numeric: tabular-nums; }

/* Navigation */
aside { background: linear-gradient(160deg, #1d1f19, #191b17 43%, #171916); border-right-color: #32362d; }
.brand { gap: 12px; }
.brand span { font-size: 2.5rem; font-weight: 730; letter-spacing: -.072em; }
.brand .brand-mark { filter: drop-shadow(0 1px 5px rgb(183 220 131 / 9%)); }
.brand, .profile, .navlink, .mobile-brand { user-select: none; }
.navlink { position: relative; border: 1px solid transparent; border-radius: 10px; color: #b7baaf; }
.navlink.active { color: #d9f1b3; border-color: #4a573e; background: linear-gradient(105deg, #34412a, #2c3427); }
.navlink.active::before { content: ''; position: absolute; width: 3px; height: 16px; left: -1px; top: 50%; transform: translateY(-50%); background: var(--lime); border-radius: 0 3px 3px 0; }
.navlink:not(.active):hover { background: #24271f; color: #e9ecdf; }
.avatar { color: #d6c1ef; background: linear-gradient(145deg, #52465a, #38333e); border-color: #62566b; }
.profile, .export-link { border-radius: 8px; }
.profile-text small { color: #a8ae9e; }
.workspace>header { border-bottom-color: #2e322a; background: rgb(20 22 19 / 83%); }
.crumb button:hover, .export-link:hover { color: var(--lime); }
.save-state { gap: 8px; }
.save-state i { background: #b1ca96; box-shadow: 0 0 0 3px rgb(167 207 131 / 7%); }
.save-state i.warn { background: #dda181; box-shadow: 0 0 0 3px rgb(221 161 129 / 7%); }
.dateline { color: #abb0a2; letter-spacing: .014em; }
.page-head { margin-bottom: 25px; }
.primary, .secondary, .danger, .small-action, .icon-btn, .select-wrap select { transition: background .16s, border-color .16s, box-shadow .16s, transform .16s; }
.primary { color: #233017; background: linear-gradient(150deg, #ddf4b8, #cbe8a1); border: 1px solid #e0f2c4; box-shadow: inset 0 -1px 0 rgb(67 85 37 / 12%), 0 2px 7px rgb(5 8 3 / 15%); }
.primary:active, .secondary:active, .small-action:active { transform: translateY(1px); }
.primary:hover { box-shadow: 0 0 0 3px rgb(204 234 158 / 8%); }
.icon-btn, .small-action, .select-wrap select { background-color: #282b25; border-color: #3e4338; }
.icon-btn:not(:disabled):hover, .small-action:hover, .select-wrap select:hover { background-color: #32362c; border-color: #555e4a; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #d3bcf2; outline-offset: 3px; }

/* Weekly progress and chart */
.dashboard-row.hero-row, .dashboard-row.insight-row {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.13fr);
}
.insight-row .activity { justify-content: space-between; }
.insight-row .diary-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.insight-row .diary-metric { min-width: 0; padding: 10px 12px; }
.insight-row .diary-metric strong { margin-top: 5px; font-size: clamp(1.65rem, 2.2vw, 2.15rem); }
.progress-card {
  background: radial-gradient(ellipse at 15% 9%, #e0f2bf 0%, transparent 68%), linear-gradient(108deg, #d2ebb0, #c4e59e 72%, #b2d98c);
  box-shadow: inset 0 0 0 1px rgb(242 255 217 / 38%), inset 0 -1px 0 rgb(64 88 34 / 10%);
}
.progress-card::before { content: ''; position: absolute; z-index: -1; pointer-events: none; inset: 65% 5% 6% 55%; background: radial-gradient(closest-side, rgb(60 83 38 / 19%), transparent); transform: rotate(-5deg); }
.hero-grid { background-size: 21px 21px; mask-image: linear-gradient(90deg, transparent 0%, #000 40%); opacity: .73; }
.sculpture { right: 1%; width: 54%; }
.reg { color: #748e5b; opacity: .8; }
.hero-title { color: #354329; font-size: .9rem; font-weight: 600; }
.hero-value { font-size: clamp(4.25rem, 6vw, 6.6rem); font-weight: 520; letter-spacing: -.095em; }
.hero-value small { font-size: .51em; font-weight: 450; letter-spacing: -.045em; }
.progress-caption { margin-top: 9px; color: #47583a; font-variant-numeric: tabular-nums; }
.segmented { width: clamp(128px, 13vw, 197px); height: 10px; }
.segmented i.filled { background: #485d34; }
.activity { background: radial-gradient(ellipse at 70% -40%, rgb(187 152 223 / 10%), transparent 78%), #1e201d; }
.activity-value { color: #f0e9f7; font-size: 2.45rem; font-weight: 530; }
.activity-value span { margin-left: 3px; }
.axis { color: #b5b3b9; }
.select-wrap select { padding-top: 6px; padding-bottom: 6px; }

/* Completion controls have a large interaction area even when a cell is narrow. */
.habit-name, .task-body, .streak-item, .board-card { border-radius: 6px; }
.habit-name strong, .task-body strong, .streak-item strong, .agenda-habit strong { color: #e8eadf; font-weight: 540; font-size: .93rem; }
.habit-icon { border: 1px solid color-mix(in srgb, var(--tone) 17%, var(--tint)); background: linear-gradient(145deg, color-mix(in srgb, var(--tone) 9%, var(--tint)), var(--tint)); }
.habit-name small { color: #a7ad9e; }
.week-head { color: #abb1a2; font-size: .78rem; }
.week-head>span.today { position: relative; color: var(--lime); }
.week-head>span.today::after { content: ''; position: absolute; width: 13px; height: 2px; left: 50%; bottom: -7px; transform: translateX(-50%); border-radius: 2px; background: #b3ce8c; }
.week-toolbar .icon-btn { background-color: #252821; border-color: #353a2f; width: 28px; height: 25px; }
.habit-row { border-bottom-color: #32362e; }
.habit-row>.mark-cell { align-self: stretch; }
.habit-table:has(.week-head>span:nth-child(2).today) .mark-cell:nth-child(2),
.habit-table:has(.week-head>span:nth-child(3).today) .mark-cell:nth-child(3),
.habit-table:has(.week-head>span:nth-child(4).today) .mark-cell:nth-child(4),
.habit-table:has(.week-head>span:nth-child(5).today) .mark-cell:nth-child(5),
.habit-table:has(.week-head>span:nth-child(6).today) .mark-cell:nth-child(6),
.habit-table:has(.week-head>span:nth-child(7).today) .mark-cell:nth-child(7),
.habit-table:has(.week-head>span:nth-child(8).today) .mark-cell:nth-child(8) { background: rgb(186 216 144 / 4.8%); }
.mark, .mark.done, .mark.future, .mark.off { --mark-diameter: 22px; position: relative; width: 100%; max-width: 40px; height: 42px; border: 0; background: transparent; color: #26391c; }
.mark::before { content: ''; position: absolute; top: 50%; left: 50%; width: var(--mark-diameter); height: var(--mark-diameter); box-sizing: border-box; transform: translate(-50%, -50%); border: 1px solid #666d5b; border-radius: 50%; transition: background .14s, border-color .14s, box-shadow .14s; }
.mark.done::before { background: var(--lime); border-color: #d9f1b6; }
.mark .icon, .mark.off>span { position: relative; }
.mark.future::before { border-color: #4a4f43; border-style: dashed; width: calc(var(--mark-diameter) - 2px); height: calc(var(--mark-diameter) - 2px); }
.mark.off::before { display: none; }
.mark:not(:disabled):hover { transform: none; }
.mark:not(:disabled):hover::before { border-color: #c1dfa0; box-shadow: 0 0 0 3px rgb(194 225 155 / 9%); }
.mark:focus-visible { outline: none; }
.mark:focus-visible::before { outline: 2px solid var(--purple); outline-offset: 3px; }
.mark:not(:disabled):active::before { background: #a7c883; }
.agenda-habit .mark { flex: 0 0 38px; }
.habit-name:hover strong, .streak-item:hover strong, .task-body:hover strong { color: #e2f0cf; }
.count { padding: 4px 8px; color: #c6cbbd; background: #292d25; border-color: #3c4136; font-family: var(--instrument-type); font-size: .735rem; }
.tag { font-size: .75rem; padding: 3px 8px; }
.task-check { width: 18px; height: 18px; border-color: #727a65; border-radius: 5px; position: relative; }
.task-check::after { content: ''; position: absolute; inset: -6px; }
.task-check:hover { border-color: #c2dda3; }
.completed .task-body strong { color: #a0a698; text-decoration-thickness: 1px; }
.add-inline:hover { color: var(--lime); }

/* Calendar, board and journal */
.board-col { --stage-color: #9eafc3; background: #191c18; }
.board-col:has(.s1) { --stage-color: #bea3dc; }
.board-col:has(.s2) { --stage-color: #bedb92; }
.board-title { border-bottom: 1px solid #353a31; padding-bottom: 13px; }
.board-title .stage { width: 8px; height: 8px; border: 1px solid var(--stage-color); background: color-mix(in srgb, var(--stage-color) 45%, #262924); }
.board-card { border-color: #3d4337; border-radius: 11px; background: linear-gradient(145deg, #2a2d27, #242720); box-shadow: var(--hairlight); }
.board-card:hover { border-color: color-mix(in srgb, var(--stage-color) 36%, #3d4337); }
.board-card:active { background: #33372d; }
.board-col.over { outline: 2px dashed var(--stage-color); outline-offset: -2px; background: color-mix(in srgb, var(--stage-color) 9%, #191c18); }
.board-title .count { background: transparent; }
.cal-day { background: #242720; border-color: #2b3026; font-size: 1rem; }
.cal-day.other { opacity: .48; }
.cal-day.current:not(.chosen) { border-color: #68765c; }
.cal-day.chosen { background: #d0e7ad; border-color: #ddecbd; color: #293321; }
.cal-day.chosen .habit-dot { background: #526a3b; }
.cal-day.chosen .task-dot { background: #806599; }
.cal-key { margin-top: 18px; }
.agenda h3 { padding-top: 10px; border-top: 1px solid #34392f; }
.agenda-habit { padding: 2px 0; }
.metric-row .metric { position: relative; }
.metric-row .metric:nth-child(2)>.icon { color: var(--purple); }
.metric-row .metric:nth-child(3)>.icon { color: #a1c7c3; }
.metric-row .metric strong { font-size: clamp(2rem, 3.2vw, 3.3rem); }
.metric-row .metric small { font-size: .89rem; }
.diary-values { gap: 8px; padding: 16px 18px 18px; }
.diary-metric, .diary-metric:first-child, .diary-metric:last-child { padding: 13px; border: 1px solid #373c32; border-radius: 11px; background: #242721; }
.diary-metric:has(.violet) { --metric-color: #c4aadf; }
.diary-metric:has(.peach) { --metric-color: #e2ac8a; }
.diary-metric:has(.lime) { --metric-color: #c5dc9e; }
.diary-metric:has(.aqua) { --metric-color: #99c6c7; }
.diary-metric { background: linear-gradient(145deg, color-mix(in srgb, var(--metric-color) 6%, #22251f), #23261f); }
.diary-metric:hover { border-color: color-mix(in srgb, var(--metric-color) 35%, #373c32); }
.diary-metric strong { font-weight: 530; font-size: clamp(1.8rem, 2.65vw, 2.6rem); }
.metric-label { color: #c7cbbf; }
.diary-metric strong small { font-variant-numeric: normal; margin-left: 3px; font-size: .88rem; }
.journal-history-row { min-height: 44px; color: #d0d5c8; font-variant-numeric: tabular-nums; }
.journal-history-row.table-label { color: var(--dim); }
.journal-history-row:is(button):hover, .streak-item:hover { background: rgb(200 222 173 / 3%); }
.heat { gap: 4px; grid-template-rows: repeat(7,12px); }
.heat-cell { border-radius: 3px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); }
.heat-cell:hover { outline: 1px solid #d2e5b8; outline-offset: 1px; }

/* Data entry */
dialog { background: linear-gradient(145deg, #282b24, #20231e 68%); border-color: #4b5144; border-radius: 18px; box-shadow: var(--hairlight), 0 28px 100px #04050391; }
dialog::backdrop { background: rgb(8 10 7 / 70%); }
.dialog-head { padding-bottom: 14px; border-bottom: 1px solid #3a3f34; margin-bottom: 18px; }
.dialog-head h2 { font-weight: 600; }
.field input:not([type=checkbox],[type=radio]), .field textarea, .field select { border-color: #4a5042; background-color: #1b1e18; }
.field input:not([type=checkbox],[type=radio]):focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline-width: 1.5px; outline-offset: 1px; border-color: #a58cbe; }
.pick-item { border-color: #3b4333; background: #282c24; }
.pick-item:hover { border-color: #5b664d; background: #2d3228; }
#toast { max-width: calc(100vw - 32px); white-space: normal; text-align: center; }

@media (min-width: 761px) {
  main { padding-top: clamp(26px, 2.5vw, 38px); }
  .workspace>header { height: 57px; }
  .progress-card { min-height: clamp(225px, 17vw, 260px); }
  .progress-info { padding-top: 25px; }
  .activity:not(.large) .plot>svg { height: clamp(78px, 6.8vw, 105px); }
}
@media (min-width: 1151px) {
  .app nav { padding-top: 9px; }
  .brand { height: 93px; }
  .panel-head { padding-top: 21px; }
  .habit-row { min-height: 62px; }
  .task-list .task-line { min-height: 64px; }
}
@media (min-width: 761px) and (max-width: 960px) {
  .brand { gap: 0; }
  .navlink span {
    display: block; position: absolute; width: 1px; height: 1px;
    clip-path: inset(50%); overflow: hidden; white-space: nowrap;
  }
  .navlink:is(:hover, :focus-visible) span {
    width: auto; height: auto; left: calc(100% + 8px); z-index: 1;
    clip-path: none; padding: 7px 11px; border: 1px solid #414639;
    background: #252922; border-radius: 7px; color: var(--ink); font-size: .82rem;
  }
  .diary-metric, .diary-metric:first-child, .diary-metric:last-child { padding: 10px; }
}
@media (max-width: 760px) {
  h1 { font-size: clamp(2.2rem, 6.8vw, 3rem); }
  .page-head { margin-bottom: 18px; }
  .menu-open aside { width: min(265px, calc(100vw - 50px)); }
  .menu-open .backdrop-menu { backdrop-filter: blur(3px); }
  .mobile-brand>span { padding-left: 9px; font-size: .75rem; }
  .hero-value { font-size: clamp(3.75rem, 9.8vw, 4.7rem); }
  .hero-title { font-size: .85rem; }
  .diary-values { padding: 14px; }
  .diary-metric:nth-child(2), .diary-metric:nth-child(3) { padding: 13px; border: 1px solid #373c32; }
  .metric-row .metric small { font-size: .78rem; }
}
@media (max-width: 760px) {
  /* Today’s actions stay close to the top on compact screens. */
  .dashboard { display: flex; flex-direction: column; }
  .dashboard .dashboard-row { display: contents; }
  .dashboard .progress-card { order: -4; }
  .dashboard .habits-panel { order: -3; }
  .dashboard .growth-card { order: -2; }
  .dashboard .today-panel { order: -1; }
}
@media (max-width: 650px) {
  .progress-card { min-height: 185px; }
  .progress-info { padding: 18px 20px; }
  .sculpture { width: 49%; }
  .hero-value { margin-top: 12px; }
  .segmented { margin-top: 13px; }
  .week-toolbar { margin-bottom: 8px; }
  .mark, .mark.done, .mark.future, .mark.off { --mark-diameter: clamp(17px, 4.8vw, 21px); }
  .week-head { font-size: .73rem; }
  .habit-name strong { font-size: .84rem; }
  .habit-name small { font-size: .735rem; }
  .tag { font-size: .725rem; }
  .diary-values { gap: 7px; }
  .diary-metric, .diary-metric:first-child, .diary-metric:nth-child(2), .diary-metric:nth-child(3), .diary-metric:last-child { padding: 10px; }
  .metric-label { gap: 5px; font-size: .8rem; }
  .diary-metric strong { font-size: 1.75rem; margin-top: 6px; }
  .heat { gap: 3px; grid-template-rows: repeat(7, 10px); }
  .heat-months { font-size: .71rem; }
  .metric-row .metric strong { font-size: 1.85rem; }
  .field input:not([type=checkbox],[type=radio]), .field textarea, .field select { font-size: 1rem; }
}
@media (max-width: 375px) {
  .habit-name { gap: 4px; }
  .habit-name .habit-icon { width: 22px; height: 25px; }
  .habit-name strong { font-size: .79rem; }
  .task-body strong { font-size: .89rem; }
  .save-state { font-size: .68rem; }
  .calendar-layout .cal-tools { gap: 2px; }
  .metric-row { gap: 5px; }
  .metric-row .metric small { font-size: .71rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; }
}
