/* Habits page */
.hb-head .cap { margin-left: auto; }
.hb-win { box-shadow: var(--sh); }
.hb-win .title { cursor: default; }
.hb-sub { margin-left: auto; font-size: 12px; border: var(--b); background: var(--field); padding: 0 6px; }
.hb-win h4, .hb-archived h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

/* today cards */
.hb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.hb-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border: var(--b); background: var(--field); padding: 10px 12px; }
.hb-card.done { background: color-mix(in srgb, var(--grass) 55%, var(--field)); }
.hb-card.rest { opacity: .7; }
.hb-sprite { width: 52px; height: 52px; object-fit: contain; flex: none; }
.hb-sprite.big { width: 64px; height: 64px; }
.hb-card:not(.done) .hb-sprite { opacity: .55; }
.hb-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hb-card-main b { font-size: 16px; }
.hb-card-main .mut { font-size: 12px; }
.hb-streak { font-size: 12px; font-weight: 700; }
.hb-card-act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.hb-log { height: 36px; padding: 0 12px; font-size: 13px; }
.hb-log[aria-pressed="true"] { background: var(--grass-2); color: var(--ink); }
.hb-plus { border: var(--line) dashed var(--outline); background: transparent; font-size: 12px; font-weight: 700; padding: 2px 8px; }
.hb-plus:hover, .hb-plus[aria-expanded="true"] { border-style: solid; background: var(--hover); }
.hb-add { flex-basis: 100%; display: flex; gap: 6px; }
.hb-add input { flex: 1; min-width: 0; height: 34px; border: var(--b); background: var(--surface); padding: 0 8px; font-size: 14px; }
.hb-add .btn { height: 34px; padding: 0 12px; font-size: 13px; }

/* garden */
.hb-garden-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.hb-islands { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.hb-island { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: var(--b); background: var(--water); text-align: left; }
.hb-island:hover { box-shadow: var(--sh); }
.hb-island[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.hb-island-name { font-weight: 700; font-size: 13px; padding: 2px 4px; }
.hb-island svg { width: 100%; height: auto; display: block; }
.island-label { fill: var(--ink); font-family: var(--mono); }
.hb-legend { margin: 10px 0 0; font-size: 12px; line-height: 1.5; max-width: 90ch; }

/* stats */
.hb-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-tabs [role="tab"] { border: var(--b); background: var(--field); padding: 4px 12px; font-weight: 700; font-size: 13px; }
.hb-tabs [role="tab"]:hover { background: var(--hover); }
.hb-tabs [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.hb-detail { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.hb-dhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hb-dhead h3 { margin: 0; font-family: var(--display); font-size: 28px; letter-spacing: -.02em; }
.hb-dhead p { margin: 2px 0 0; font-size: 13px; }
.hb-dhead .tt-ghost { margin-left: auto; }

.hb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.hb-tile { border: var(--b); background: var(--field); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.hb-tile small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.hb-tile b { font-family: var(--display); font-size: 32px; line-height: 1.05; }
.hb-tile span { font-size: 12px; color: var(--mute); }
.hb-tile .pill { height: 12px; border: var(--b); padding: 1px; background: var(--surface); margin-top: 4px; }
.hb-tile .pill div { height: 100%; background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 10px); }

.hb-cols { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
.hb-block { border: var(--b); background: var(--field); padding: 10px 12px; min-width: 0; }

/* heatmap */
.hb-heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.hb-heat { display: grid; grid-template-columns: 16px repeat(var(--weeks), 13px); grid-template-rows: 13px 14px repeat(7, 13px); gap: 2px; width: max-content; }
.hb-mon { font-size: 10px; white-space: nowrap; }
.hb-yr { font-weight: 700; }
.hb-wd { grid-column: 1; font-size: 10px; color: var(--mute); line-height: 13px; position: sticky; left: 0; background: var(--surface); }
.hb-cell { width: 13px; height: 13px; padding: 0; border: 1px solid var(--rule); background: var(--surface); }
.hb-cell:hover:not(:disabled) { outline: 2px solid var(--ink); outline-offset: 0; }
.hb-cell:disabled { cursor: default; opacity: .45; }
.hb-cell.l1, .hb-heat-key .l1 { background: color-mix(in srgb, var(--heat) 40%, var(--field)); }
.hb-cell.l2, .hb-heat-key .l2 { background: color-mix(in srgb, var(--heat) 60%, var(--field)); }
.hb-cell.l3, .hb-heat-key .l3 { background: color-mix(in srgb, var(--heat) 80%, var(--field)); }
.hb-cell.l4, .hb-heat-key .l4 { background: var(--heat); }
.hb-cell.miss, .hb-heat-key .miss { background: var(--soil); }
.hb-cell.rest, .hb-heat-key .rest { background: repeating-linear-gradient(45deg, var(--surface) 0 2px, var(--rule) 2px 3px); }
.hb-cell.open { border: 2px dashed var(--accent); }
.hb-heat-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; margin-top: 6px; }
.hb-heat-key i { width: 11px; height: 11px; border: 1px solid var(--rule); display: inline-block; }
.hb-heat-key .l0 { background: var(--surface); }
.hb-heat-key .miss { margin-left: 10px; }

/* streak list */
.hb-runs { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.hb-runs b { font-family: var(--display); font-size: 18px; }
.hb-live { border: var(--b); background: var(--grass-2); font-size: 10px; font-weight: 700; padding: 0 4px; text-transform: uppercase; }

/* history bars */
.hb-hist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.hb-hist-head h4 { margin: 0; margin-right: auto; }
.hb-seg { display: flex; }
.hb-seg button { padding: 3px 10px; white-space: nowrap; }
.hb-bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 18px; }
.hb-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.hb-bar i { width: 100%; max-width: 38px; background: var(--accent-2); border: var(--b); min-height: 2px; display: block; }
.hb-bar-v { font-size: 11px; font-weight: 700; }
.hb-bar-l { font-size: 10px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* archived */
.hb-archived:empty { display: none; }
.hb-archived { border: 2px dashed var(--rule); padding: 10px 14px; }
.hb-archived ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* add / edit dialog */
.hb-dlg { width: min(560px, 94vw); }
.hb-form label { font-weight: 700; font-size: 13px; }
.hb-form input:not([type="radio"]):not([type="checkbox"]), .hb-form select {
  height: 40px; border: var(--b); background: var(--field); padding: 0 10px; font-size: 15px; width: 100%;
}
.hb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hb-row2 > div { display: flex; flex-direction: column; gap: 4px; }
.hb-form input[hidden] { display: none; }
.hb-sched, .hb-species { border: var(--b); margin: 0; padding: 8px 10px 10px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.hb-sched legend, .hb-species legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.hb-sched > label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.hb-days { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
.hb-days.off { opacity: .45; }
.hb-days label { position: relative; }
.hb-days input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hb-days span { display: block; border: var(--b); background: var(--field); padding: 3px 8px; font-size: 12px; }
.hb-days input:checked + span { background: var(--accent); color: var(--on-accent); }
.hb-days input:focus-visible + span { outline: 2px dashed var(--ink); outline-offset: 2px; }
.hb-species-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.hb-species-grid label { position: relative; border: var(--b); background: var(--field); padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-weight: 400; font-size: 11px; }
.hb-species-grid input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hb-species-grid img { width: 42px; height: 42px; object-fit: contain; }
.hb-species-grid label:has(input:checked) { background: var(--accent-2); outline: 2px solid var(--ink); outline-offset: 1px; }
.hb-species-grid label:has(input:focus-visible) { outline: 2px dashed var(--ink); outline-offset: 2px; }
.hb-dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hb-dlg-actions .hb-archive { margin-left: auto; }

@media (max-width: 860px) {
  .hb-cols { grid-template-columns: 1fr; }
  .hb-tile b { font-size: 26px; }
  .hb-species-grid { grid-template-columns: repeat(4, 1fr); }
  .hb-head .cap { margin-left: 0; }
}
