:root {
  --bg: #f5f6f8; --card: #ffffff; --ink: #1c2330; --muted: #667085; --line: #e3e6ec;
  --brand: #2f6fed; --brand-ink: #ffffff; --danger: #c0352b; --ok-bg: #e7f6ec; --ok-ink: #17623a; --err-bg: #fdecea; --err-ink: #8c2b22;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --card: #1b2029; --ink: #e8ecf3; --muted: #9aa4b5; --line: #2b3240;
    --brand: #5b8cff; --brand-ink: #0b1220; --danger: #ff7b6e; --ok-bg: #12301f; --ok-ink: #8fe0ae; --err-bg: #3a1815; --err-ink: #ffb4aa;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 2rem; margin: 0; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.late { color: var(--danger); font-weight: 600; }
.count { display: inline-block; min-width: 1.5em; padding: 0 .45em; border-radius: 999px; background: var(--line); color: var(--muted); font-size: .75rem; font-weight: 600; text-align: center; vertical-align: middle; }

/* palette */
.c-0 { --c: #d64545; } .c-1 { --c: #e07a1f; } .c-2 { --c: #c99a06; } .c-3 { --c: #2e9d57; } .c-4 { --c: #139c96; } .c-5 { --c: #1f90d6; }
.c-6 { --c: #3b6ee8; } .c-7 { --c: #5b52d6; } .c-8 { --c: #9a4fd0; } .c-9 { --c: #d6478f; } .c-10 { --c: #8a6246; } .c-11 { --c: #6b7686; }
@media (prefers-color-scheme: dark) {
  .c-0 { --c: #ff7d7d; } .c-1 { --c: #ffa24d; } .c-2 { --c: #f0c43c; } .c-3 { --c: #58d08a; } .c-4 { --c: #4fd1ca; } .c-5 { --c: #5cbcf5; }
  .c-6 { --c: #7fa2ff; } .c-7 { --c: #9a93ff; } .c-8 { --c: #c78cf2; } .c-9 { --c: #ff8cc4; } .c-10 { --c: #c79d80; } .c-11 { --c: #a2adbd; }
}
[class*="c-"] { --cbg: color-mix(in srgb, var(--c) 16%, var(--card)); }

/* layout */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); font-size: 1.1rem; display: flex; align-items: center; gap: .4rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .4rem .7rem; border-radius: 8px; display: inline-flex; gap: .35rem; align-items: center; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { background: color-mix(in srgb, var(--brand) 14%, var(--card)); color: var(--brand); font-weight: 600; }
.who { display: flex; align-items: center; gap: .6rem; }
.me { padding: .25rem .6rem; border-radius: 999px; background: var(--cbg); color: var(--ink); border: 1px solid var(--c); font-size: .9rem; }
.me:hover { text-decoration: none; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .5rem 0 1rem; flex-wrap: wrap; }
.crumbs { margin: .25rem 0 .5rem; font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; }
.grid-show { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 820px) { .grid2, .grid-show { grid-template-columns: 1fr; } .side { order: -1; } }
@media (max-width: 560px) {
  .nl { display: none; }
  .topbar { gap: .4rem .75rem; }
  .nav { order: 3; flex: 1 0 100%; justify-content: space-around; }
  .nav a { padding: .45rem .8rem; font-size: 1.25rem; }
  .who { margin-left: auto; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 0; }
.col > .card, .wrap > .card { margin-bottom: 0; }
.wrap > .card, .wrap > .flash, .wrap > .tlist { margin-bottom: 1rem; }
.card.attention { border-color: #e0a526; background: color-mix(in srgb, #e0a526 10%, var(--card)); }
.card.late { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); font-weight: normal; color: var(--ink); }

/* forms & buttons */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: .55rem .65rem; margin-top: .25rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 400;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
textarea { resize: vertical; }
.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.wide { width: 100%; display: block; }
.btn.link, button.link { background: none; border: 0; color: var(--brand); padding: .3rem; cursor: pointer; font: inherit; }
button.x { color: var(--muted); }
.form .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 640px) { .form .row3 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem .3rem; margin: 0 0 .8rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.actions { display: flex; gap: .5rem; margin-top: .5rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.addline { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.addline input[type=text] { margin-top: 0; }
.addline select { margin-top: 0; width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { margin: 0; width: auto; flex: 1 1 150px; }
.filters input[type=search] { flex: 2 1 220px; }
.filters-inline { display: flex; gap: .5rem; }
.filters-inline select { margin: 0; width: auto; }
.quick { display: flex; gap: .5rem; margin-bottom: 1rem; }
.quick input { margin: 0; flex: 1; background: var(--card); }
@media (max-width: 560px) { .quick .btn:last-child { display: none; } }
.flash { padding: .65rem .9rem; border-radius: 10px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.err { background: var(--err-bg); color: var(--err-ink); }
input.copy { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }

/* auth */
body.bare { display: grid; place-items: center; min-height: 100vh; }
.auth { width: 100%; max-width: 420px; padding: 1rem; }
.auth-brand { text-align: center; margin-bottom: 1rem; }
.logo.big { font-size: 3rem; }
.auth-card label { margin-top: .5rem; }
.auth-card .btn.wide { margin-top: .8rem; }

/* chips & badges */
.chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--cbg, var(--line)); color: var(--c, var(--muted)); border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 40%, transparent); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.chip.pick { cursor: pointer; display: inline-flex; gap: .35rem; align-items: center; font-size: .85rem; padding: .2rem .65rem; font-weight: 600; margin-bottom: 0; }
.st { padding: .05rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--line); color: var(--muted); }
.st-in_progress { background: #dbe7ff; color: #1b4fc4; } .st-waiting { background: #fdeccd; color: #8a5a00; } .st-done { background: var(--ok-bg); color: var(--ok-ink); } .st-open { background: var(--line); }
@media (prefers-color-scheme: dark) { .st-in_progress { background: #1c2f5c; color: #a9c2ff; } .st-waiting { background: #4a3710; color: #ffd98a; } }
.prio-3 { color: #b36200; font-weight: 600; font-size: .75rem; } .prio-4 { color: var(--danger); font-weight: 700; font-size: .75rem; } .prio-1, .prio-2 { font-size: .75rem; color: var(--muted); }
.owner { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; background: var(--cbg, var(--line)); border: 1px solid var(--c, var(--line)); color: var(--ink); font-size: .85rem; white-space: nowrap; }
.owner:hover { text-decoration: none; }
.owner.unassigned { --c: var(--line); border-style: dashed; color: var(--muted); }
.owner.small { font-size: .75rem; padding: .05rem .5rem; }
.owner-big { font-size: 1.1rem; padding: .5rem .8rem; border-radius: 10px; background: var(--cbg, var(--bg)); border: 1px solid var(--c, var(--line)); font-weight: 600; }
.owner-big.unassigned { border-style: dashed; color: var(--muted); }

/* ticket list */
.tlist { list-style: none; margin: 0; padding: 0; }
.card > .tlist { margin-top: .25rem; }
.trow { display: flex; align-items: center; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.trow.closed .ttitle { text-decoration: line-through; color: var(--muted); }
.trow-main { flex: 1; display: flex; gap: .6rem; align-items: flex-start; color: var(--ink); min-width: 0; }
.trow-main:hover { text-decoration: none; }
.trow-main:hover .ttitle { color: var(--brand); }
.ticon { font-size: 1.2rem; line-height: 1.4; }
.ticon.big { font-size: 2rem; }
.ttext { min-width: 0; }
.ttitle { display: block; font-weight: 600; overflow-wrap: anywhere; }
.tmeta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.ref { color: var(--muted); font-variant-numeric: tabular-nums; }
.when.late { color: var(--danger); }
.trow.p4 { box-shadow: inset 3px 0 0 var(--danger); padding-left: .5rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1rem 0; }
li.offer { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .3rem .75rem; align-items: center; }
.row-actions { display: flex; gap: .4rem; margin-left: auto; margin-top: .4rem; }
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.people li { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.people.big li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.people li.inactive { opacity: .55; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }

/* ticket page */
.ticket-head { margin-bottom: 1rem; }
.th-top { display: flex; gap: .8rem; align-items: flex-start; }
.th-title h1 { overflow-wrap: anywhere; }
.status-bar { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.prose { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; }
details.handoff, details.manage { margin-top: .6rem; }
summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .9rem; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; }
.checks li span { flex: 1; overflow-wrap: anywhere; }
.checks li.done span { text-decoration: line-through; color: var(--muted); }
.tick { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--brand); padding: 0 .2rem; line-height: 1; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .3rem 0; }
.dropping { outline: 2px dashed var(--brand); outline-offset: 4px; }
.comment-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-bottom: 1rem; }
.comment-form textarea { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.tl { display: flex; gap: .7rem; }
.tl-dot { flex: 0 0 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--cbg, var(--line)); border: 1px solid var(--c, var(--line)); font-size: 1rem; }
.tl-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.bubble { background: var(--bg); padding: .5rem .7rem; border-radius: 4px 12px 12px 12px; margin-top: .2rem; }
.tl:not(.tl-comment) .tl-body .muted { font-size: .9rem; }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.bcol { background: color-mix(in srgb, var(--line) 45%, var(--bg)); border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.bcol h2 { display: flex; align-items: center; gap: .5rem; }
.drop { display: flex; flex-direction: column; gap: .5rem; min-height: 120px; }
.bcol.over { outline: 2px dashed var(--brand); }
.bcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; box-shadow: var(--shadow); cursor: grab; }
.bcard a { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.bcard.p4 { border-left: 3px solid var(--danger); }
.bcard.dragging { opacity: .4; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--card); padding: .4rem; text-align: center; font-size: .8rem; color: var(--muted); font-weight: 600; }
.cal-day { background: var(--card); min-height: 96px; padding: .25rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day.out { background: color-mix(in srgb, var(--bg) 70%, var(--card)); opacity: .75; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num { font-size: .8rem; text-align: right; }
.cal-num a { color: var(--muted); }
.cal-item { display: block; font-size: .72rem; line-height: 1.25; padding: 1px 4px; border-radius: 4px; background: var(--cbg, var(--line)); border-left: 3px solid var(--c, var(--muted)); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item:hover { text-decoration: none; filter: brightness(.95); }
.cal-item.done { text-decoration: line-through; opacity: .6; }
.cal-item .ct { font-weight: 700; margin-right: 2px; }
.cal-more { font-size: .72rem; color: var(--muted); }
.cal-nav { display: flex; gap: .4rem; align-items: center; }
.cal-nav select { margin: 0; width: auto; }
@media (max-width: 640px) { .cal-day { min-height: 64px; } .cal-item .ct { display: none; } .cal-item { font-size: .65rem; } }
@media (max-width: 760px) { .board { grid-template-columns: repeat(4, 260px); } }

/* ---- notes, house, pets ---- */
.tagbar { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.chip.on { outline: 2px solid var(--brand); }
.tagbar a.chip { text-decoration: none; }
.notegrid, .petgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.petcard { display: flex; flex-direction: column; gap: .3rem; color: var(--ink); text-decoration: none; align-items: flex-start; }
.petcard:hover { text-decoration: none; border-color: var(--brand); }
.petemoji { font-size: 2.2rem; line-height: 1; }
.hlist { list-style: none; margin: 0; padding: 0; }
.hrow { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hrow:last-child { border-bottom: 0; }
.hmain { display: flex; gap: .6rem; color: var(--ink); text-decoration: none; flex: 1 1 14rem; min-width: 0; }
.hmain:hover { text-decoration: none; }
.hacts { display: flex; gap: .3rem; flex-wrap: wrap; }
.exp { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--line); color: var(--muted); }
.exp-ok { background: #dcfce7; color: #166534; }
.exp-soon { background: #fef3c7; color: #92400e; }
.exp-late { background: #fee2e2; color: #991b1b; }
.exp-ended, .exp-none { background: var(--line); color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl td, .tbl th { padding: .35rem .3rem; border-bottom: 1px solid var(--line); text-align: left; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.sum td { font-weight: 700; }
.sched { list-style: none; padding: 0; margin: 0 0 .5rem; }
.sched li { padding: .2rem 0; }
.sched li.past { text-decoration: line-through; opacity: .55; }
.cal-item.rem { border-left-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.cal-item.rem.major { font-weight: 700; }
.notebody { white-space: normal; }
@media (max-width: 640px) { .nav a { padding: .4rem .45rem; font-size: 1.1rem; } }
input.narrow { max-width: 6rem; }
