/* =====================================================================
   FLIP OS V5 — components: cards, stats, chips, tables, board,
   workspace, punch, chat, modal, snack.
   ===================================================================== */

/* ---- cards ---- */
.card { background: var(--card); border-radius: var(--rc); box-shadow: var(--lift); border: 1px solid var(--hair2); }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 22px 14px; }
.card-h h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-h .csub { font-size: 13px; color: var(--mut); margin-top: 2px; }
.card-pad { padding: 22px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--hair2); }

/* ---- stats band ---- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
/* phone-size: tighter stat tiles, two-up */
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 11px; }
  .stat { padding: 14px 15px 13px; }
  .stat .s-v { font-size: 23px; margin-top: 7px; }
  .stat .s-s { font-size: 12px; }
  .ptitle h2 { font-size: 20px; }
}
.stat { background: var(--card); border-radius: var(--rc); box-shadow: var(--lift); border: 1px solid var(--hair2); padding: 18px 20px 17px; min-width: 0; }
.stat .s-v { font-size: 31px; font-weight: 750; letter-spacing: -.03em; line-height: 1.08; margin-top: 9px; font-variant-numeric: tabular-nums; }
.stat .s-v.ok { color: var(--ok); }
.stat .s-s { font-size: 12.5px; color: var(--mut); margin-top: 6px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.stat .s-bar { height: 5px; border-radius: 99px; background: var(--paper); margin-top: 12px; overflow: hidden; }
.stat .s-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

.meter { height: 6px; border-radius: 99px; background: var(--paper); overflow: hidden; }
:root[data-night="on"] .meter, :root[data-night="on"] .stat .s-bar { background: rgba(255,255,255,.08); }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

/* ---- chips ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650;
  padding: 3.5px 11px; border-radius: 99px; background: var(--paper); color: var(--ink2); white-space: nowrap; }
:root[data-night="on"] .chip { background: rgba(255,255,255,.07); }
.chip .i { width: 13px; height: 13px; }
.chip i.dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-soft); }
.chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.bad { color: var(--bad); background: var(--bad-soft); }
.chip.info { color: var(--info); background: var(--info-soft); }
.chip.brand { color: var(--brand-ink); background: var(--brand-soft); }
button.chip { cursor: pointer; border: 0; }
button.chip:hover { filter: brightness(.96); }

.scorep { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font: 700 13.5px/1 var(--f-ui); background: var(--brand-soft); color: var(--brand-ink); }

/* ---- list rows ---- */
.lrows { display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-top: 1px solid var(--hair2);
  text-align: left; width: 100%; transition: background .13s; }
.lrow:first-child { border-top: 0; }
button.lrow:hover { background: var(--paper); }
:root[data-night="on"] button.lrow:hover { background: rgba(255,255,255,.04); }
.lrow .lr-m { flex: 1; min-width: 0; }
.lrow .lr-t { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .lr-s { font-size: 12.5px; color: var(--mut); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .lr-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lrow .lr-amt.ok { color: var(--ok); }
.lrow .lr-amt small { display: block; font-weight: 500; color: var(--mut); font-size: 11.5px; text-align: right; }
.lrow > .i.chev { color: var(--mut2); width: 17px; height: 17px; }
.lthumb { border-radius: 10px; object-fit: cover; flex: none; background: var(--paper); }
.lthumb-lg { width: 74px; height: 54px; }
.lthumb-md { width: 62px; height: 47px; }
.lr-x { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.lr-side { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }

@media (max-width: 740px) {
  .lrow { padding: 13px 16px; gap: 11px; flex-wrap: wrap; }
  .lrow .lr-t, .lrow .lr-s { white-space: normal; overflow: visible; text-overflow: clip; }
  .lrow > .i.chev { display: none; }
  .lthumb-lg { width: 60px; height: 46px; }
  .lthumb-md { width: 54px; height: 42px; }
  .lrow .lr-side { flex-direction: row; align-items: center; flex-basis: 100%; justify-content: space-between; }
}

.nada { text-align: center; padding: 44px 20px; color: var(--mut); }
.nada .n-ic { width: 48px; height: 48px; border-radius: 15px; background: var(--paper); color: var(--mut2);
  display: grid; place-items: center; margin: 0 auto 13px; }
:root[data-night="on"] .nada .n-ic { background: rgba(255,255,255,.06); }
.nada h4 { font-size: 15px; color: var(--ink); }
.nada p { font-size: 13px; max-width: 330px; margin: 5px auto 14px; }

/* ---- tables (shared column grid: 20 / 30 / 18 / 32) ---- */
.tblwrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; padding: 12px 22px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.tbl th .lab { color: var(--mut); }
.tbl td { padding: 13px 22px; border-bottom: 1px solid var(--hair2); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover { background: var(--paper); }
:root[data-night="on"] .tbl tbody tr:hover { background: rgba(255,255,255,.04); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .sub { font-size: 12px; color: var(--mut); margin-top: 1px; }
.tbl .act { width: 54px; text-align: right; }
.tbl td .chip { white-space: nowrap; }
.tbl th:nth-child(1), .tbl td:nth-child(1) { width: 20%; min-width: 130px; }
.tbl th:nth-child(2), .tbl td:nth-child(2) { width: 30%; min-width: 160px; }
.tbl th:nth-child(3), .tbl td:nth-child(3) { width: 18%; min-width: 150px; white-space: nowrap; }
.tbl th:nth-child(4), .tbl td:nth-child(4) { width: 32%; }
.tbl.amt4 th:nth-child(4), .tbl.amt4 td:nth-child(4) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl.exp th:nth-child(2), .tbl.exp td:nth-child(2) { width: 12%; white-space: nowrap; }
.tbl.exp th:nth-child(3), .tbl.exp td:nth-child(3) { width: 12%; white-space: nowrap; }
.tbl.exp th:nth-child(4), .tbl.exp td:nth-child(4) { width: 16%; white-space: nowrap; }
.tbl.exp th:nth-child(5), .tbl.exp td:nth-child(5) { width: 14%; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.tbl .neg { color: var(--bad); }

@media (max-width: 740px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; width: 100% !important; }
  .tbl td { display: block; width: auto !important; min-width: 0 !important; white-space: normal !important;
    border: 0; padding: 0; text-align: left !important; }
  /* each row becomes a compact 2-col grid: text left, money/status right */
  .tbl tbody tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px;
    padding: 12px 18px 13px; border-bottom: 1px solid var(--hair2); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  /* delete lives in the edit sheet on phones */
  .tbl .act { display: none; }
  /* vendors & materials: title + status chip on line 1, details below */
  .tbl td:nth-child(1) { grid-area: 1 / 1; font-size: 14.5px; }
  .tbl td:nth-child(2) { grid-area: 2 / 1 / 2 / -1; }
  .tbl td:nth-child(3) { grid-area: 1 / 2; justify-self: end; }
  .tbl td:nth-child(4) { grid-area: 3 / 1 / 3 / -1; }
  /* pricing: amount top-right, status chip below */
  .tbl.amt4 td:nth-child(3) { grid-area: 3 / 1 / 3 / -1; justify-self: start; }
  .tbl.amt4 td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }
  /* expenses: amount top-right, date beside category, receipt last */
  .tbl.exp td:nth-child(2) { grid-area: 2 / 1; }
  .tbl.exp td:nth-child(3) { grid-area: 2 / 2; justify-self: end; }
  .tbl.exp td:nth-child(4) { grid-area: 3 / 1 / 3 / -1; }
  .tbl.exp td:nth-child(5) { grid-area: 1 / 2; justify-self: end; }
  /* money + dates never wrap */
  .tbl.exp td:nth-child(3), .tbl.exp td:nth-child(5), .tbl.amt4 td:nth-child(4) { white-space: nowrap !important; }
}

/* ---- deal detail hero ---- */
.deal-hero { display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 880px) {
  .deal-hero { grid-template-columns: 1fr; }
  .deal-hero > div:first-child { min-height: 200px; aspect-ratio: 16/9; }
  .deal-hero > div:last-child { padding: 18px 16px 20px !important; }
}

/* ---- calculator property row ---- */
@media (max-width: 620px) {
  .calcrow { flex-wrap: wrap; }
  .calcrow > div { flex: 1 1 100% !important; order: 1; }
  .calcrow .scorep { margin-left: auto; }
}

/* ---- two-column splits ---- */
.duo { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1220px) { .duo { grid-template-columns: 1fr; } }

/* ---- deal board (kanban) ---- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 10px; }
/* mobile: segmented stage switcher + single clean list */
.board-seg { width: 100%; }
.board-seg button { flex: 1; padding: 8px 4px; font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.board-seg .bs-n { font: 600 10.5px/1 var(--f-mono); background: rgba(23, 20, 31, .08); color: var(--ink2); border-radius: 99px; padding: 3px 6px; }
:root[data-night="on"] .board-seg .bs-n { background: rgba(255,255,255,.12); }
.board-seg button[aria-pressed="true"] .bs-n { background: var(--brand-soft); color: var(--brand-ink); }
/* icon-only segmented toggles (view switchers) */
.seg-ic button { padding: 6px 11px; display: grid; place-items: center; }
.seg-ic .i { width: 15.5px; height: 15.5px; }
/* properties card grid */
.pgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.bcol { background: rgba(23, 20, 31, .035); border: 1px solid var(--hair2); border-radius: var(--rc); padding: 13px; min-height: 240px; }
:root[data-night="on"] .bcol { background: rgba(255, 255, 255, .035); }
.bcol-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 12px; }
.bcol-h b { font-size: 13.5px; white-space: nowrap; }
.deal { background: var(--card); border-radius: 15px; box-shadow: var(--lift); border: 1px solid var(--hair2);
  margin-bottom: 11px; overflow: hidden; cursor: pointer; width: 100%; text-align: left; display: block;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.deal:hover { transform: translateY(-2px); box-shadow: var(--lift-lg); }
.deal img { width: 100%; aspect-ratio: 16/8.4; object-fit: cover; display: block; }
.deal .d-b { padding: 12px 14px 13px; }
.deal .d-a { font-size: 14px; font-weight: 650; }
.deal .d-s { font-size: 12px; color: var(--mut); margin: 1px 0 10px; }
.deal .d-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pgrid .deal { margin-bottom: 0; }
.deal .chip.ov { position: absolute; top: 10px; left: 10px; background: rgba(255, 255, 255, .93); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.deal .chip.ov.warn { background: rgba(255, 244, 232, .94); }
.deal .chip.ov.info { background: rgba(238, 244, 255, .94); }
@media (max-width: 740px) {
  .board { display: block; overflow: visible; padding-bottom: 0; }
  .board .bcol { display: none; background: none; border: 0; padding: 0; min-height: 0; }
  .board .bcol.cur { display: block; }
  .board .bcol-h { display: none; }
  .board .deal { margin-bottom: 12px; }
  /* two-up compact cards */
  .pgrid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .board.cols2 .bcol.cur { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; align-items: start; }
  .board.cols2 .deal { margin-bottom: 0; }
  .board.cols2 .nada { grid-column: 1 / -1; }
  .deal-sm .deal img { aspect-ratio: 16/10; }
  .deal-sm .deal .d-b { padding: 10px 12px 12px; }
  .deal-sm .deal .d-a { font-size: 13px; }
  .deal-sm .deal .d-s { font-size: 11px; margin: 1px 0 8px; }
  .deal-sm .deal .scorep { width: 30px; height: 30px; font-size: 12px; border-radius: 9px; }
  .deal-sm .deal .d-f b { font-size: 12.5px !important; }
  .deal-sm .deal .d-f .lab { font-size: 9px; }
  .deal-sm .deal .chip.ov { top: 7px; left: 7px; font-size: 10.5px; padding: 3px 9px; }
}

/* ---- flips grid ---- */
.flips { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.flip-card { background: var(--card); border-radius: var(--rc); box-shadow: var(--lift); border: 1px solid var(--hair2);
  overflow: hidden; cursor: pointer; text-align: left; display: block; width: 100%;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease); }
.flip-card:hover { transform: translateY(-3px); box-shadow: var(--lift-lg); }
.flip-card .fc-ph { position: relative; aspect-ratio: 16/8.6; background: var(--paper); }
.flip-card .fc-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flip-card .fc-ph .chip { position: absolute; top: 12px; left: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.flip-card .fc-ph .chip.warn { background: rgba(255, 244, 232, .94); }
.flip-card .fc-ph .chip.info { background: rgba(238, 244, 255, .94); }
.flip-card .fc-b { padding: 16px 20px 18px; }
.flip-card .fc-a { font-size: 16.5px; font-weight: 700; letter-spacing: -.015em; }
.flip-card .fc-l { font-size: 12.5px; color: var(--mut); margin-top: 1px; }
.flip-card .fc-m { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 16px; margin: 15px 0; }
.flip-card .fc-m .v { font-size: 15.5px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.flip-card .fc-m .v.ok { color: var(--ok); }

/* ---- workspace hero ---- */
.ws { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px 22px; }
.ws .ws-ph { width: 168px; height: 112px; border-radius: 14px; overflow: hidden; flex: none; background: var(--paper); }
.ws .ws-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws .ws-m { flex: 1; min-width: 230px; }
.ws .ws-m h2 { font-size: 23px; font-weight: 750; letter-spacing: -.025em; }
.ws .ws-loc { font-size: 13.5px; color: var(--mut); margin-top: 2px; }
.ws .ws-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ws .ws-act { display: flex; flex-direction: column; gap: 9px; }
@media (max-width: 880px) { .ws .ws-ph { width: 100%; height: 170px; } .ws .ws-act { flex-direction: row; width: 100%; } }

/* ---- underline tabs ---- */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--hair); overflow-x: auto; scrollbar-width: none; padding: 0 4px; }
.tabbar::-webkit-scrollbar { display: none; }
.tabu { display: flex; align-items: center; gap: 8px; padding: 12px 13px; margin-bottom: -1px;
  font-size: 14px; font-weight: 600; color: var(--mut); white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .14s; }
.tabu .i { width: 16.5px; height: 16.5px; }
.tabu:hover { color: var(--ink); }
.tabu.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabu .tn { font: 600 10.5px/1 var(--f-mono); background: rgba(23, 20, 31, .08); color: var(--ink2);
  border-radius: 99px; padding: 4px 7px; min-width: 14px; text-align: center; }
:root[data-night="on"] .tabu .tn { background: rgba(255, 255, 255, .12); color: var(--ink2); }
/* active tab: badge turns brand purple */
.tabu.on .tn { background: var(--brand-soft); color: var(--brand-ink); }

/* tabs collapse to icons ONLY when the bar itself runs out of room —
   measured on the tab bar's own width, not the viewport. Desktop only:
   on mobile the full labeled tabs stay and the bar swipes horizontally. */
.tabbar { container-type: inline-size; -webkit-overflow-scrolling: touch; }
@media (min-width: 881px) {
  @container (max-width: 1010px) {
    .tabu .tl { display: none; }
    .tabu.on .tl { display: inline; }
    .tabu { padding: 12px 12px; }
    .tabu .i { width: 18.5px; height: 18.5px; }
  }
}
@media (max-width: 880px) {
  .tabu { scroll-snap-align: start; }
  .tabbar { scroll-snap-type: x proximity; padding-bottom: 1px; }
}

/* ---- milestones ---- */
.mline { display: flex; margin: 6px 0 2px; }
.mst { flex: 1; position: relative; text-align: center; min-width: 84px; }
.mst::before { content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 2.5px; background: var(--hair); }
.mst:first-child::before { display: none; }
.mst .md { width: 17px; height: 17px; border-radius: 99px; margin: 0 auto 9px; position: relative; z-index: 2;
  background: var(--card); border: 2.5px solid var(--hair); }
.mst.done .md { background: var(--brand); border-color: var(--brand); }
.mst.done::before { background: var(--brand); }
.mst.now .md { border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-ring); }
.mst.now::before { background: var(--brand); }
.mst b { display: block; font-size: 12px; font-weight: 650; }
.mst span { display: block; font-size: 11px; color: var(--mut); margin-top: 1px; }

/* ---- task cards (Tasks card view) ---- */
.tgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); }
.tcard { padding: 14px 15px 13px; display: flex; flex-direction: column; gap: 11px; border-radius: 15px; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--lift-lg); }
.tcard .tc-t { font-size: 14px; font-weight: 600; line-height: 1.45; }
.tcard.fin .tc-t { color: var(--mut); text-decoration: line-through; }
.tcard.fin .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.tcard .tc-f { margin-top: auto; }

/* ---- vendor cards + clickable vendor rows ---- */
.vgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.vcard { padding: 16px 17px 15px; display: flex; flex-direction: column; gap: 13px; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.vcard:hover { transform: translateY(-2px); box-shadow: var(--lift-lg); }
div.lrow.vrow { cursor: pointer; }
div.lrow.vrow:hover { background: var(--paper); }
:root[data-night="on"] div.lrow.vrow:hover { background: rgba(255,255,255,.04); }

/* ---- home: recent photos / recent chat ---- */
.homegrid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.homegrid > .card { min-width: 0; }
@media (max-width: 1100px) { .homegrid { grid-template-columns: 1fr; } }
.shots-mini { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shots-mini .sh-ph { aspect-ratio: 1 / 1; border-radius: 11px; }
.shots-mini figcaption { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal !important; text-overflow: clip; }

@media (max-width: 740px) {
  .tgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tcard .tc-t { font-size: 13px; }
  .vgrid { grid-template-columns: 1fr; }
}

/* ---- punch list ---- */
.punch-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tick { width: 23px; height: 23px; border-radius: 99px; border: 2px solid var(--hair); flex: none; background: var(--card);
  display: grid; place-items: center; color: transparent; transition: all .14s; }
.tick .i { width: 13px; height: 13px; stroke-width: 2.6; }
.tick:hover { border-color: var(--brand); }
.task-row.fin .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-row { display: flex; align-items: center; gap: 13px; padding: 11.5px 22px; border-top: 1px solid var(--hair2); cursor: pointer; }
.task-row:first-child { border-top: 0; }
.task-row:hover { background: var(--paper); }
:root[data-night="on"] .task-row:hover { background: rgba(255,255,255,.04); }
.task-row .tk-t { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 500; }
.task-row.fin .tk-t { color: var(--mut); text-decoration: line-through; }
.task-row .tk-note { font-size: 12.5px; color: var(--mut); margin-top: 3px; display: flex; gap: 6px; align-items: flex-start; }
.task-row .tk-note .i { width: 13px; height: 13px; margin-top: 2px; }
.task-row .tk-meta { display: flex; align-items: center; gap: 8px; }
.phn { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font: 700 12px/1 var(--f-mono); background: var(--brand-soft); color: var(--brand-ink); }

/* ---- chat ---- */
.chat-scroll { display: flex; flex-direction: column; gap: 15px; padding: 22px; max-height: min(56vh, 540px); overflow-y: auto; }
.bub { display: flex; gap: 11px; max-width: 100%; }
.bub .bb { background: var(--paper); border-radius: 5px 16px 16px 16px; padding: 10px 14px; max-width: 76%; }
:root[data-night="on"] .bub .bb { background: rgba(255,255,255,.07); }
.bub .bn { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.bub .bn span { font-weight: 500; color: var(--mut); margin-left: 7px; font-size: 11px; }
.bub .bt { font-size: 14px; }
.bub.me { flex-direction: row-reverse; }
.bub.me .bb { background: var(--brand); color: #fff; border-radius: 16px 5px 16px 16px; }
.bub.me .bn { opacity: .85; }
.chat-type { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--hair2); align-items: flex-end; }
.chat-type textarea { min-height: 46px; max-height: 130px; border-radius: 14px; }

/* ---- photos / files ---- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
@media (max-width: 620px) { .shots { grid-template-columns: 1fr 1fr; } }
.shot { margin: 0; }
.shot .sh-ph { aspect-ratio: 4/3; border-radius: 13px; overflow: hidden; background: var(--paper); border: 1px solid var(--hair2);
  display: grid; place-items: center; color: var(--mut2); font: 600 11px/1 var(--f-mono);
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, var(--hair2) 14px 28px); }
.shot .sh-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot figcaption { font-size: 12px; color: var(--mut); margin-top: 6px; }

/* ---- modal / snack ---- */
.dim { position: fixed; inset: 0; z-index: 120; background: rgba(13, 10, 25, .52);
  opacity: 0; pointer-events: none; transition: opacity .18s; }
.dim.up { opacity: 1; pointer-events: auto; }
.modal { position: fixed; z-index: 130; top: 42%; left: 50%;
  width: min(490px, calc(100vw - 28px)); max-height: min(78vh, 740px); max-height: min(78dvh, 740px);
  background: var(--card); border-radius: var(--rm); box-shadow: var(--lift-lg);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, -47%) scale(.97);
  transition: opacity .19s var(--ease), transform .19s var(--ease), visibility .19s; }
.modal.up { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1);
  /* no visibility in the opening transition — it must flip instantly so fields can be focused immediately */
  transition: opacity .19s var(--ease), transform .19s var(--ease); }
:is(.modal, .pop) .m-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 24px 14px; }
:is(.modal, .pop) .m-h h3 { font-size: 17.5px; font-weight: 700; letter-spacing: -.015em; }
:is(.modal, .pop) .m-x { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: var(--paper); color: var(--mut); }
:root[data-night="on"] :is(.modal, .pop) .m-x { background: rgba(255,255,255,.08); }
:is(.modal, .pop) .m-x:hover { color: var(--ink); }
:is(.modal, .pop) .m-b { padding: 6px 24px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 15px; }
:is(.modal, .pop) .m-f { display: flex; gap: 10px; padding: 15px 24px 22px; border-top: 1px solid var(--hair2); }

.snacks { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 880px) { .snacks { bottom: calc(96px + env(safe-area-inset-bottom)); } }
.snack { display: flex; align-items: center; gap: 10px; background: #1d1929; color: #fff;
  padding: 12px 19px; border-radius: 99px; font-size: 13.5px; font-weight: 550; box-shadow: var(--lift-lg);
  animation: snackin .3s var(--ease); }
.snack .i { width: 16px; height: 16px; color: #6fdcA8; }
@keyframes snackin { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- segmented mini control ---- */
.segm { display: inline-flex; background: var(--paper); border-radius: 99px; padding: 3.5px; gap: 3px; border: 1px solid var(--hair2); }
:root[data-night="on"] .segm { background: rgba(255,255,255,.06); }
.segm button { border-radius: 99px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--mut);
  transition: background .13s, color .13s; }
.segm button:not([aria-pressed="true"]):hover { color: var(--ink); background: rgba(23, 20, 31, .06); }
:root[data-night="on"] .segm button:not([aria-pressed="true"]):hover { background: rgba(255, 255, 255, .07); }
.segm button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--lift); }
/* round month-nav buttons (calendar header) */
.cnav { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; flex: none;
  background: var(--card); border: 1px solid var(--hair); box-shadow: var(--lift); color: var(--ink2);
  transition: color .13s, border-color .13s, background .13s; }
.cnav:hover { color: var(--brand-ink); border-color: var(--brand); }
:root[data-night="on"] .cnav { background: rgba(255,255,255,.07); }
.cnav .i { width: 15px; height: 15px; }

/* month dropdown (calendar header) — compact control, same scale as .b.sm */
.msel { -webkit-appearance: none; appearance: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 650; letter-spacing: -.01em; color: var(--ink);
  min-height: 33px; padding: 0 32px 0 13px; border: 1px solid var(--hair); border-radius: 9px;
  background-color: var(--card); transition: border-color .13s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6580' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.msel:hover { border-color: var(--brand); }
:root[data-night="on"] .msel { background-color: rgba(255,255,255,.05);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b94b3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E"); }

/* ---- modal v2 ---- */
:is(.modal, .pop) .m-sub { font-size: 12.5px; color: var(--mut); margin-top: 2px; }
.m-hero { display: flex; gap: 13px; align-items: center; background: var(--paper); border-radius: 14px; padding: 11px 12px; }
:root[data-night="on"] .m-hero { background: rgba(255,255,255,.06); }
.m-hero img { width: 66px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.m-hero .mh-t { min-width: 0; flex: 1; }
.m-hero .mh-t b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-hero .mh-t span { display: block; font-size: 12px; color: var(--mut); margin-top: 1px; }

.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px;
  border: 1.5px solid var(--hair); background: var(--card); font-size: 13px; font-weight: 600; color: var(--ink2);
  transition: all .13s var(--ease); }
:root[data-night="on"] .pick button { background: rgba(255,255,255,.04); }
.pick button:hover { border-color: var(--mut2); }
.pick button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.pick.people button { padding: 6px 14px 6px 7px; }

.amtbox { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--hair); background: var(--card);
  border-radius: 14px; padding: 12px 18px; transition: border-color .15s, box-shadow .15s; }
:root[data-night="on"] .amtbox { background: rgba(255,255,255,.05); }
.amtbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-ring); }
.amtbox b { font-size: 23px; font-weight: 650; color: var(--mut2); }
.amtbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink);
  font-size: 25px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.amtbox input:focus, .amtbox input:focus-visible { outline: 0; box-shadow: none; }

.swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1.5px solid var(--hair); border-radius: 14px; padding: 12px 15px; cursor: pointer; }
.swrow .sw-t b { display: block; font-size: 14px; }
.swrow .sw-t span { display: block; font-size: 12px; color: var(--mut); margin-top: 1px; }
.swrow input { position: absolute; opacity: 0; pointer-events: none; }
.swrow .tog { width: 46px; height: 27px; border-radius: 99px; background: var(--hair); position: relative; flex: none; transition: background .18s var(--ease); }
.swrow .tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 99px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.swrow input:checked + .tog { background: var(--brand); }
.swrow input:checked + .tog::after { transform: translateX(19px); }

/* ---- undo snack ---- */
.snack .snack-act { margin-left: 4px; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 700;
  background: rgba(255, 255, 255, .16); color: #fff; flex: none; }
.snack .snack-act:hover { background: rgba(255, 255, 255, .26); }

/* ---- keyboard-selected search row ---- */
.fp-row.sel { background: var(--paper); }
:root[data-night="on"] .fp-row.sel { background: rgba(255, 255, 255, .07); }

/* ---- mobile swipe actions ---- */
@media (max-width: 880px) {
  .task-row, .tbl.exp tbody tr { touch-action: pan-y; }
}
.swx { transition: none !important; }
.task-row, .tbl.exp tbody tr { transition: transform .2s var(--ease), background .15s; }
.swx-ok { background: var(--ok-soft) !important; }
.swx-del { background: var(--bad-soft, rgba(214, 69, 69, .14)) !important; }

/* ---- calendar (month grid) ---- */
.cg-w { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 16px 16px 8px; }
.cg-w .lab { text-align: center; color: var(--ink2); }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0 16px 16px; }
.cg-d { min-height: 106px; border: 1px solid var(--hair2); border-radius: 12px; padding: 7px 7px 6px; min-width: 0;
  display: flex; flex-direction: column; gap: 4px; align-items: stretch; cursor: pointer; background: var(--card);
  transition: background .12s, border-color .12s, box-shadow .12s; }
.cg-d:hover { background: var(--paper); }
:root[data-night="on"] .cg-d:hover { background: rgba(255, 255, 255, .04); }
.cg-d.off { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.cg-d.dropping { border-color: var(--brand); box-shadow: 0 0 0 2.5px var(--brand-ring); }
.cg-n { font: 600 11.5px/1 var(--f-mono); color: var(--ink2); padding: 2px 2px 1px; }
.cg-d.today .cg-n { color: #fff; background: var(--brand); border-radius: 99px; width: 21px; height: 21px; display: grid; place-items: center; padding: 0; }
.cg-i { display: flex; align-items: center; gap: 5px; min-width: 0; width: 100%; text-align: left;
  font-size: 11.5px; font-weight: 600; padding: 3.5px 6px; border-radius: 7px; color: var(--ink); cursor: grab;
  background: color-mix(in srgb, var(--pc) 12%, transparent); }
.cg-i:active { cursor: grabbing; }
.cg-i .i { width: 12px; height: 12px; color: var(--pc); flex: none; }
.cg-i .cg-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cg-i .cg-tm { font: 600 9.5px/1 var(--f-mono); color: var(--mut); flex: none; }
.cg-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--pc, var(--mut)); flex: none; display: inline-block; }
.cg-i.fin { opacity: .5; }
.cg-i.fin .cg-t { text-decoration: line-through; }
.cg-i.late .cg-t { color: var(--bad); }
.cg-more { font-size: 11px; font-weight: 700; color: var(--mut); text-align: left; padding: 1px 6px; }
.cg-more:hover { color: var(--ink); }

/* ---- agenda view ---- */
.ag-day { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 14px 22px 9px; border-top: 1px solid var(--hair2); }
.ag-day:first-child { border-top: 0; }
.ag-num { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--paper);
  font: 700 15px/1 var(--f-mono); color: var(--ink2); flex: none; }
:root[data-night="on"] .ag-num { background: rgba(255,255,255,.07); }
.ag-num.today { background: var(--brand); color: #fff; }
.ag-t { flex: 1; min-width: 0; }
.ag-t b { display: block; font-size: 14.5px; line-height: 1.25; }
.ag-t span { display: block; font-size: 12px; color: var(--mut); }
.ag-add { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; color: var(--mut); background: var(--paper); flex: none; }
:root[data-night="on"] .ag-add { background: rgba(255,255,255,.07); }
.ag-add .i { width: 15px; height: 15px; }
.ag-day:hover .ag-add { color: var(--brand-ink); }
.ag-row { border-top: 0; padding: 9px 22px 9px 73px; }
.ag-row .chip .i { width: 14px; height: 14px; }
.ag-row.fin .lr-t { text-decoration: line-through; opacity: .55; }
.ag-none { padding: 2px 22px 10px 73px; font-size: 12.5px; color: var(--mut); }
.ag-cap { display: flex; align-items: center; gap: 8px; padding: 14px 22px 6px; font: 600 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; }
.ag-cap.bad { color: var(--bad); }
.ag-cap .i { width: 15px; height: 15px; }

/* calendar property dropdown: custom chevron with breathing room */
select[data-cal-prop-sel] { -webkit-appearance: none; appearance: none; cursor: pointer; transition: border-color .13s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6580' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
  padding-right: 34px !important; }
select[data-cal-prop-sel]:hover { border-color: var(--brand); }
:root[data-night="on"] select[data-cal-prop-sel] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b94b3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E"); }

/* ---- anchored popover (Apple Calendar-style) ---- */
.pop { position: fixed; z-index: 140; background: var(--card); border: 1px solid var(--hair2); border-radius: 18px;
  box-shadow: var(--lift-lg); display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.96);
  transition: opacity .16s var(--ease), transform .16s var(--ease), visibility .16s; }
.pop.up { opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  /* visibility must flip instantly on open so fields can be focused immediately */
  transition: opacity .16s var(--ease), transform .16s var(--ease); }
.pop[data-side="right"] { transform-origin: left center; }
.pop[data-side="left"] { transform-origin: right center; }
.pop[data-side="bottom"] { transform-origin: center top; }
.pop[data-side="top"] { transform-origin: center bottom; }
.pop .m-h { padding: 16px 18px 10px; }
.pop .m-b { padding: 4px 18px 16px; }
.pop .m-f { padding: 12px 18px 16px; }
.pop-ar { position: absolute; width: 13px; height: 13px; background: var(--card); transform: rotate(45deg); }
.pop[data-side="right"] .pop-ar { border-left: 1px solid var(--hair2); border-bottom: 1px solid var(--hair2); }
.pop[data-side="left"] .pop-ar { border-right: 1px solid var(--hair2); border-top: 1px solid var(--hair2); }
.pop[data-side="bottom"] .pop-ar { border-left: 1px solid var(--hair2); border-top: 1px solid var(--hair2); }
.pop[data-side="top"] .pop-ar { border-right: 1px solid var(--hair2); border-bottom: 1px solid var(--hair2); }

/* ---- time field with inline AM/PM segmented toggle ---- */
.timebox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hair); background: var(--card);
  border-radius: var(--rs); padding: 3.5px 4px 3.5px 13px; }
:root[data-night="on"] .timebox { background: rgba(255,255,255,.05); }
.timebox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-ring); }
.fld .timebox input, .timebox input { border: 0; background: transparent; flex: 1; min-width: 0; width: auto;
  padding: 6.5px 0; font-size: 14.5px; outline: 0; font-variant-numeric: tabular-nums; }
.fld .timebox input:focus, .timebox input:focus { border: 0; box-shadow: none; }
.ampm { display: inline-flex; background: var(--paper); border-radius: 8px; padding: 2.5px; gap: 2px; flex: none; }
:root[data-night="on"] .ampm { background: rgba(255,255,255,.07); }
.ampm button { border-radius: 6px; padding: 4.5px 9px; font-size: 11.5px; font-weight: 700; color: var(--mut);
  transition: background .12s, color .12s; }
.ampm button.on { background: var(--card); color: var(--ink); box-shadow: var(--lift); }
:root[data-night="on"] .ampm button.on { background: rgba(255,255,255,.13); }

/* ---- compact date row (expands the mini calendar on demand) ---- */
.dateline { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 1px solid var(--hair); background: var(--card); border-radius: var(--rs);
  padding: 10px 13px; font-size: 14.5px; }
:root[data-night="on"] .dateline { background: rgba(255,255,255,.05); }
.dateline:hover { border-color: var(--brand); }
.dateline .i { width: 16px; height: 16px; color: var(--mut); flex: none; }
.dateline b { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dateline .dl-hint { font-size: 12px; font-weight: 600; color: var(--brand-ink, var(--brand)); flex: none; }
@media (max-width: 700px) {
  .cg-w, .calgrid { gap: 3px; padding-left: 8px; padding-right: 8px; }
  .cg-d { min-height: 66px; padding: 4px; gap: 3px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
  .cg-n { width: 100%; }
  .cg-i { width: auto; padding: 3px 4px; border-radius: 99px; }
  .cg-i .cg-t, .cg-i .cg-tm { display: none; }
  .cg-more { width: 100%; padding: 0 2px; font-size: 10px; }
}

/* ---- list/card view toggle switch ---- */
.vswitch { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 99px;
  background: var(--paper); border: 1px solid var(--hair2); }
:root[data-night="on"] .vswitch { background: rgba(255,255,255,.06); }
.vswitch .vs-ic { display: grid; place-items: center; color: var(--mut); transition: color .15s var(--ease); }
.vswitch .vs-ic .i { width: 16px; height: 16px; }
.vswitch .vs-ic.on { color: var(--ink); }
.vswitch .tog { width: 38px; height: 22px; border-radius: 99px; background: var(--brand); position: relative; flex: none;
  transition: background .18s var(--ease); }
.vswitch .tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 99px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.vswitch[aria-checked="true"] .tog::after { transform: translateX(16px); }

.m-f { align-items: center; }
.m-f .push { margin-left: auto; }

@media (max-width: 620px) {
  .modal { top: auto; bottom: 0; left: 0; width: 100vw; max-height: 90vh; max-height: 90dvh;
    border-radius: 24px 24px 0 0; transform: translateY(8%); }
  .modal.up { transform: none; }
  .modal .m-f { padding-bottom: calc(22px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal .m-f .b.pri { flex: 1 1 auto; }
}

/* ---- sign-in gate ---- */
.gate { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 30% 20%, #241c4a, var(--rail-bg) 70%);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s var(--ease), visibility .25s; }
.gate.up { opacity: 1; visibility: visible; pointer-events: auto; }
.gate-card { width: min(380px, calc(100vw - 36px)); background: var(--card); border-radius: 24px;
  box-shadow: var(--lift-lg); padding: 34px 32px 28px; text-align: center; transform: translateY(-6vh); }
.gate-card .mark { width: 56px; height: 56px; border-radius: 17px; display: inline-grid; place-items: center;
  background: linear-gradient(145deg, #6a5cf0, #4d41dd); color: #fff; }
.gate-card .mark svg { width: 34px; height: 34px; fill: currentColor; }
.gate-card h2 { font-size: 23px; font-weight: 750; letter-spacing: -.025em; margin-top: 6px; }
.gate-card .gate-user { display: flex; align-items: center; gap: 12px; justify-content: flex-start;
  background: var(--paper); border-radius: 14px; padding: 12px 14px; margin: 18px 0 14px; }
:root[data-night="on"] .gate-card .gate-user { background: rgba(255,255,255,.06); }
.gate-card .gate-user b { font-size: 15px; }
.gate-card p { font-size: 12.5px; color: var(--mut); margin-top: 14px; }

/* ---- uploads ---- */
.upbox { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;
  border: 1.8px dashed var(--hair); border-radius: 16px; padding: 22px 16px; color: var(--mut);
  background: var(--paper); transition: border-color .15s, background .15s; cursor: pointer; }
:root[data-night="on"] .upbox { background: rgba(255,255,255,.04); }
.upbox:hover { border-color: var(--brand); color: var(--brand-ink); }
.upbox .i { width: 22px; height: 22px; margin-bottom: 3px; }
.upbox b { font-size: 14px; color: var(--ink); }
.upbox:hover b { color: var(--brand-ink); }
.upbox span { font-size: 12px; }
.updone { display: flex; align-items: center; gap: 14px; border: 1.5px solid var(--hair); border-radius: 16px; padding: 12px; }
.updone img { width: 86px; height: 64px; border-radius: 10px; object-fit: cover; }
.uplist { display: flex; flex-direction: column; gap: 8px; }
.uprow { display: flex; align-items: center; gap: 12px; border: 1px solid var(--hair2); border-radius: 13px; padding: 8px 10px; }
.uprow img { width: 46px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; }
.uprow .gl { width: 40px; height: 40px; border-radius: 10px; background: var(--paper); display: grid; place-items: center; color: var(--mut); flex: none; }
:root[data-night="on"] .uprow .gl { background: rgba(255,255,255,.06); }
.uprow .upr-t { flex: 1; min-width: 0; }
.uprow .upr-t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uprow .upr-t span { display: block; font-size: 11.5px; color: var(--mut); }
.rcpt-th { width: 46px; height: 34px; border-radius: 7px; object-fit: cover; display: block; border: 1px solid var(--hair); }

/* ---- calendar ---- */
.cal { border: 1.5px solid var(--hair); border-radius: 16px; padding: 14px; background: var(--card); }
:root[data-night="on"] .cal { background: rgba(255,255,255,.04); }
.cal-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-h b { font-size: 14.5px; letter-spacing: -.01em; }
.cal-nav { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--mut); }
.cal-nav:hover { background: var(--paper); color: var(--ink); }
:root[data-night="on"] .cal-nav:hover { background: rgba(255,255,255,.08); }
.cal-nav .i { width: 16px; height: 16px; }
.cal-w { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-w .lab { text-align: center; font-size: 9.5px; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-d { height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 13.5px; font-weight: 550; color: var(--ink2); transition: background .12s; }
.cal-d:hover { background: var(--paper); }
:root[data-night="on"] .cal-d:hover { background: rgba(255,255,255,.08); }
.cal-d.today { box-shadow: inset 0 0 0 1.5px var(--hair); font-weight: 700; }
.cal-d.on { background: var(--brand); color: #fff; font-weight: 700; box-shadow: none; }

/* ---- settings / integrations ---- */
.set-count { background: linear-gradient(145deg, #6a5cf0, #4d41dd); color: #fff; border-radius: 18px;
  padding: 16px 18px 15px; display: flex; flex-direction: column; gap: 5px; min-width: 116px; flex: none; }
.set-count b { font-size: 34px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.igrid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.itile { border: 1.5px solid var(--hair); border-radius: 16px; padding: 15px 16px 14px;
  display: flex; flex-direction: column; gap: 10px; }
:root[data-night="on"] .itile { background: rgba(255,255,255,.03); }
.itile .it-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.itile .it-h b { font-size: 14px; line-height: 1.35; }
.itile .it-h .chip { flex: none; }
.itile p { font-size: 12.5px; color: var(--ink2); line-height: 1.55; }
.itile .it-where { font-size: 11.5px; color: var(--mut); line-height: 1.55; }
.itile .it-where .lab { display: inline; font-size: 9px; margin-right: 3px; }
.itile .it-act { margin-top: auto; align-self: flex-start; }
.ai-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); }
.ai-cell { border: 1.5px solid var(--hair); border-radius: 13px; padding: 11px 12px 10px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0; }
:root[data-night="on"] .ai-cell { background: rgba(255,255,255,.03); }
.ai-cell .ai-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.ai-cell select.tin { padding: 7px 10px; font-size: 12.5px; }
.ai-cell .ai-model { font: 500 10px/1.4 var(--f-mono); color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 740px) {
  .igrid { grid-template-columns: 1fr; }
  .ai-grid { grid-template-columns: 1fr 1fr; }
  .ai-cell select.tin { font-size: 16px; }
  .set-count { flex-direction: row; align-items: center; gap: 12px; padding: 13px 16px; }
  .set-count b { font-size: 27px; }
  .set-count .lab br { display: none; }
}

/* ---- misc ---- */
.mut { color: var(--mut); }
.tnum { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.rowflex { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.wgap { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 36px; height: 36px; border-radius: 99px; border: 2.5px solid transparent; cursor: pointer; }
.sw.on { box-shadow: 0 0 0 2.5px var(--brand); border-color: var(--card); }
