/* --- The house: maintenance, chores, trackers, and the calendar -------------
   Loaded after planner.css on purpose. The House Calendar reuses the planner's
   grid wholesale (.plcal, .cal-day, .cal-chip) so the two calendars in the app
   are one calendar wearing two hats; everything here is either the parts the
   planner hasn't got — a job chip that has to say "overdue" — or the House
   Maintenance page, which is a list and shares nothing with it. */

/* ---------- shared bits ---------- */
/* the sidebar count goes red the moment something is actually late — a number
   that always looks the same is a number you stop reading */
.sb-tab .sb-count.warn { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.sb-tab.active .sb-count.warn { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }

/* four tabs is one too many for a phone in one line — they wrap rather than
   pushing the page sideways */
.hs-tabs { flex-wrap: wrap; }

.hs-tabn {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted);
}
.ptabs button.on .hs-tabn { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

.hs-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 16px; }
.hs-toolnote { color: var(--text-muted); font-size: 12.5px; }

/* ---------- the job list ---------- */
.hs-group { margin-bottom: 18px; }

.hs-ghead {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 2px 8px;
}
.hs-ghead .n {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); letter-spacing: 0;
}
.hs-ghead em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }
.hs-group.overdue .hs-ghead { color: var(--red); }
.hs-group.today .hs-ghead, .hs-group.soon .hs-ghead { color: var(--amber); }

.hs-row {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  transition: border-color .12s ease, background-color .12s ease;
}
.hs-row.overdue { border-left-color: var(--red); }
.hs-row.today   { border-left-color: var(--gold); }
.hs-row.soon    { border-left-color: var(--amber); }
.hs-row.later   { border-left-color: var(--accent); }
.hs-row.none    { border-left-color: var(--border-strong); }
.hs-row.off     { opacity: .62; }
.hs-row.hl      { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.hs-cat {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-soft);
}
.hs-cat .ic { width: 17px; height: 17px; }

.hs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hs-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-title b, .hs-main > b { font-size: 14.5px; font-weight: 700; cursor: pointer; }
.hs-title b:hover, .hs-main > b:hover { color: var(--accent); }

.hs-pill {
  font-size: 10.5px; font-weight: 750; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted);
}
.hs-pill.overdue { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.hs-pill.today   { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--amber); }
.hs-pill.soon    { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.hs-pill.later   { background: var(--accent-soft); color: var(--green-dark); }

.hs-sub {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-muted);
}
.hs-sub span { display: inline-flex; align-items: center; gap: 5px; }
.hs-sub .ic { width: 13px; height: 13px; opacity: .8; }
.hs-sub a { color: var(--blue); text-decoration: none; font-weight: 600; }
.hs-sub a:hover { text-decoration: underline; }

.hs-note {
  font-size: 12.5px; color: var(--text-soft); background: var(--bg-soft);
  border-radius: 8px; padding: 6px 9px; margin-top: 4px; line-height: 1.4;
  white-space: pre-wrap;
}

.hs-acts { display: flex; gap: 6px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- nothing here yet ---------- */
.hs-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 42px 20px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface-2);
}
.hs-eic { color: var(--text-muted); opacity: .7; }
.hs-eic .ic.lg { width: 34px; height: 34px; }
.hs-empty b { font-size: 15.5px; font-weight: 700; }
.hs-empty p { color: var(--text-muted); font-size: 13px; max-width: 52ch; line-height: 1.5; margin: 0 0 6px; }

/* ---------- cards: contacts and trackers ---------- */
.hs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.hs-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px; box-shadow: var(--shadow-card);
}
.hs-card.tracker.met { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.hs-chead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-chead > b { font-size: 14.5px; font-weight: 700; cursor: pointer; }
.hs-chead > b:hover { color: var(--accent); }
.hs-chead .rowbtn { margin-left: auto; }

.hs-trade {
  font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); white-space: nowrap;
}

.hs-clines { display: flex; flex-direction: column; gap: 4px; }
.hs-clines a {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  color: var(--blue); text-decoration: none; font-weight: 600;
}
.hs-clines a:hover { text-decoration: underline; }
.hs-clines .ic { width: 14px; height: 14px; }

.hs-cjobs { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.hs-cjobs.none { color: var(--text-muted); font-size: 12px; }
.hs-cjobs .lchip { cursor: pointer; }
.hs-cjobs .lchip:hover { border-color: var(--blue); }
.hs-cjobs.sheet { margin-top: 12px; font-size: 12.5px; color: var(--text-muted); }

.hs-tnum { display: flex; align-items: baseline; gap: 7px; }
.hs-tnum b { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.hs-tnum span { font-size: 12.5px; color: var(--text-muted); }

.hs-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hs-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* the last seven days, one box each */
.hs-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hs-strip button {
  aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11.5px; font-weight: 650; cursor: pointer;
}
.hs-strip button:hover { border-color: var(--accent); }
.hs-strip button.on { background: var(--accent-soft); color: var(--green-dark); border-color: transparent; }
.hs-strip button.td { border-color: var(--accent); }

/* ---------- the sheet ---------- */
.housesheet { max-width: 720px; padding: 22px 24px 20px; max-height: 88vh; overflow-y: auto; }
.housesheet h3 { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 750; }
.housesheet h3 .ic { width: 19px; height: 19px; color: var(--text-muted); flex: none; }
.housesheet .sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 16px; display: flex; align-items: center; gap: 8px; }

.hs-nameinput {
  flex: 1; min-width: 0; font-size: 17px; font-weight: 750; color: var(--text);
  background: transparent; border: none; border-bottom: 1px dashed var(--border-strong);
  padding: 2px 2px 4px; outline: none;
}
.hs-nameinput:focus { border-bottom-color: var(--accent); }

.hs-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 18px; }
.hs-f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.hs-f.wide { grid-column: 1 / -1; }
.hs-f > span:first-child { font-weight: 700; color: var(--text-soft); }

.hs-f input[type="text"], .hs-f input[type="tel"], .hs-f input[type="email"],
.hs-f input[type="url"], .hs-f input[type="date"], .hs-f input[type="number"],
.hs-f select, .hs-f textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--bg-soft); color: var(--text); outline: none;
}
.hs-f input:focus, .hs-f select:focus, .hs-f textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
.hs-f textarea { resize: vertical; line-height: 1.45; }

/* two-way switch: someone comes / we do it */
.hs-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-3); border-radius: 9px; }
.hs-seg button {
  flex: 1; padding: 7px 10px; border: none; background: transparent; border-radius: 8px;
  font-weight: 650; font-size: 12.5px; color: var(--text-muted); cursor: pointer;
}
.hs-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }

.hs-repeat { display: flex; flex-direction: column; gap: 7px; }
.hs-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.hs-chips button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12px; font-weight: 650; color: var(--text-soft); cursor: pointer;
}
.hs-chips button:hover { background: var(--surface-3); }
.hs-chips button.on {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent);
}

.hs-every { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12.5px; }
.hs-every input { width: 68px; }
.hs-every select { width: auto; }

.hs-who { display: flex; flex-direction: column; gap: 7px; }
.hs-whocard { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hs-whocard .tool { text-decoration: none; }

.hs-money, .hs-days { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-muted); font-size: 12.5px; }
.hs-money input { width: 110px; }
.hs-days input { width: 76px; }
.hs-days em { font-style: normal; opacity: .85; flex-basis: 100%; }

.hs-sheetacts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- the history log ---------- */
.hs-log { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.hs-loghead {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}
.hs-loghead .ic { width: 14px; height: 14px; }
.hs-loghead .n { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); letter-spacing: 0; }
.hs-loghead em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; }

.hs-logrow {
  display: grid; grid-template-columns: 1fr 90px 2fr 30px; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 8px; font-size: 13px;
}
.hs-logrow:nth-child(odd) { background: var(--surface-2); }
.hs-logrow .d { font-weight: 650; }
.hs-logrow .c { color: var(--green-dark); font-weight: 650; }
.hs-logrow .n { color: var(--text-muted); font-size: 12.5px; }
.hs-logempty { color: var(--text-muted); font-size: 12.5px; padding: 4px 2px 8px; }

/* ---------- the House Calendar ----------------------------------------------
   The grid itself comes from planner.css. What's here is the chip a job needs
   (colour = how late it is) and the panels underneath the calendar. */
.hc-filters { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.hc-filters button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12.5px; font-weight: 650; color: var(--text-muted); cursor: pointer;
}
.hc-filters button .ic { width: 13px; height: 13px; }
.hc-filters button.on {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent);
}

.cal-day.hc-late { border-color: color-mix(in srgb, var(--red) 45%, transparent); }

.cal-chip.hc-chip {
  cursor: pointer;
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  color: var(--amber);
}
.cal-chip.hc-chip.overdue { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.cal-chip.hc-chip.today   { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--amber); }
.cal-chip.hc-chip.later   { background: var(--surface-3); color: var(--text-soft); }
.cal-chip.hc-chip.done    { background: var(--surface-3); color: var(--text-muted); text-decoration: line-through; }
.cal-chip.hc-chip.proj    { opacity: .72; border: 1px dashed color-mix(in srgb, var(--text-muted) 40%, transparent); }
.cal-chip.hc-meal { cursor: pointer; }
.cal-chip .hc-ic { flex: none; display: flex; align-items: center; }
.cal-chip .hc-ic .ic { width: 12px; height: 12px; }
.cal-chip.hc-chip:hover, .cal-chip.hc-meal:hover { filter: brightness(.97); }

.hc-wkn {
  font-size: 10px; font-weight: 750; padding: 1px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber);
}

/* what needs doing, under the grid */
.hc-next {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-card);
}
.hc-next.calm { background: var(--surface-2); box-shadow: none; }
.hc-next.calm p { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }
.hc-next.calm a, .page-sub a { color: var(--accent); font-weight: 600; }

.hc-nhead {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}
.hc-nhead .ic { width: 15px; height: 15px; }
.hc-nhead .n { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); letter-spacing: 0; }

.hc-nrow {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.hc-nrow:first-of-type { border-top: none; }
.hc-nrow .hs-acts .tool { text-decoration: none; }

.hc-tstrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.hc-tcard {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.hc-tcard.met { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.hc-tcard b { font-size: 13.5px; font-weight: 700; }
.hc-tcard span { font-size: 12px; color: var(--text-muted); grid-column: 1 / -1; }
.hc-tcard .hs-bar { grid-column: 1 / -1; margin-top: 3px; }
.hc-tcard .rowbtn { grid-row: 1; grid-column: 2; }

/* one day, opened out of the calendar */
.hc-dlist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.hc-drow {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.hc-drow.overdue { border-left-color: var(--red); }
.hc-drow.today   { border-left-color: var(--gold); }
.hc-drow.soon    { border-left-color: var(--amber); }
.hc-drow.later   { border-left-color: var(--accent); }
.hc-drow.meal    { border-left-color: var(--accent); }
.hc-drow.done    { opacity: .7; }

@media (max-width: 820px) {
  /* The month grid drops its leading gutter column on a phone (planner.css
     hides .cal-wk), but the empty header cell that lines up with it is still
     in the flow — so Mon lands under Tue and Sunday wraps to its own row. Both
     calendars are built from the same markup, so hiding it here fixes the meal
     planner as well. */
  .plcal.month .cal-dow:first-child { display: none; }

  .hs-row { flex-wrap: wrap; }
  /* …and so does the calendar's "Needs doing" row, for the same reason. A
     full-width .hs-acts in a row that can't wrap doesn't drop to a second line,
     it squeezes everything beside it to nothing — the job's name and date came
     out one letter per line on a phone. */
  .hc-nrow { flex-wrap: wrap; }
  .hs-acts { width: 100%; justify-content: flex-start; }
  .hs-form { grid-template-columns: minmax(0, 1fr); }
  .hs-logrow { grid-template-columns: 1fr 80px 30px; }
  .hs-logrow .n { grid-column: 1 / -1; }
  .cal-chip .hc-ic { display: none; }        /* the name matters more than the glyph */
}
