/* Proposal Desk on a phone: density and polish. Linked with media="(max-width: 760px)", so none of this reaches a desktop or a tablet.
   The base layout and the touch fixes live in app.css; this sheet makes every page compact and consistent at iPhone size. */

html, body { font-size: 15px; }
.main { padding: 6px 14px calc(88px + env(safe-area-inset-bottom)); }
h2 { font-size: 1rem; } h3 { font-size: .92rem; }

/* ---- header: the page title and three quiet icon buttons ---- */
.topbar { min-height: 52px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px 14px; gap: 0; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .crumb { font-size: 1.14rem; font-weight: 660; }
.topbar .iconbtn, .topbar .searchbtn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; border: 0; background: transparent; box-shadow: none; border-radius: 12px; display: grid; place-items: center; }
.topbar .iconbtn:active, .topbar .searchbtn:active { background: var(--sunk); }
.statuschip { min-width: 34px; min-height: 34px; margin: 0 2px; }

/* ---- tab bar ---- */
.tabbar { padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
.tabbar a { min-height: 46px; padding: 4px 0; gap: 1px; font-size: .66rem; }
.tabbar a svg { width: 22px; height: 22px; }

/* ---- the intro line under each title: two lines, tap to read the rest ---- */
.top { gap: 8px; margin-bottom: 10px; }
.top > div > p { margin: 0; font-size: .86rem; line-height: 1.4; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top > div > p.open { -webkit-line-clamp: unset; display: block; }
.top .btn { min-height: 42px; }

/* ---- cards, panels, spacing ---- */
.panel { border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 27, 45, .05); }
.pad { padding: 14px; } .panel > header { padding: 12px 14px 0; }
.stack { gap: 12px; } .grid2 { gap: 12px; }
.empty { padding: 28px 18px; } .empty .art { width: 84px; height: auto; }
.btn { font-size: .95rem; padding-inline: 14px; } .btn.sm { font-size: .88rem; }
.chip { font-size: .88rem; padding-inline: 12px; }
.pill { white-space: nowrap; flex: none; }
.callout { padding: 12px 14px; }

/* ---- numbers: compact tiles with a small icon in the corner ---- */
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { position: relative; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 12px 14px; align-content: start; }
.kpi .ico { position: absolute; top: 10px; right: 10px; grid-row: auto; width: 28px; height: 28px; border-radius: 9px; }
.kpi .ico svg { width: 15px; height: 15px; }
.kpi .n { font-size: 1.45rem; padding-right: 30px; } .kpi .l { font-size: .8rem; line-height: 1.25; }
.rp-card { padding: 12px 14px; } .rp-kpis { gap: 10px; }
.rp-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }   /* no blank gaps waiting for a scroll trigger */

/* ---- Today ---- */
.hero { padding: 16px; border-radius: 18px; margin-bottom: 14px; gap: 14px; }
.hero h1 { font-size: 1.3rem; } .hero p { font-size: .9rem; margin-top: 4px; }
.hero .row { gap: 8px; margin-top: 12px !important; } .hero .btn { min-height: 42px; }
.board { margin-top: 8px; }
.board-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who num" "slots status"; gap: 6px 12px; padding: 10px 14px; align-items: center; }
.board-row > :nth-child(1) { grid-area: who; min-width: 0; } .board-row > :nth-child(2) { grid-area: slots; } .board-row > :nth-child(3) { grid-area: status; text-align: right; }
.board-row > :nth-child(4) { grid-area: num; font-weight: 640; } .board-row > :nth-child(5) { display: none; }
.board-row .avatar { width: 32px; height: 32px; font-size: .8rem; }
.slot { width: 24px; height: 12px; } .slots { gap: 4px; }

/* ---- profiles ---- */
.pcard { padding: 14px; gap: 10px; }
.pcard .top2 { gap: 8px; }

/* ---- lists (messages, follow-ups, contracts, invitations) ---- */
.list .item, .mlist .item { padding: 12px 14px; }

/* ---- charts and wide figures never push the page ---- */
svg { max-width: 100%; }

/* ---- more compaction found by measuring every card on every page ---- */
.st-niche, .st-card, .rp-sec, .op-feed, .ch-card, .au-task { padding: 14px; }
summary { padding: 12px 14px; }
.empty, .panel.empty { padding: 22px 16px; }
.board-row > :nth-child(4)::after { content: " Connects"; font-weight: 500; color: var(--mute); font-size: .76rem; }
.pcard .avatar.lg, .pcard .who .avatar { width: 40px; height: 40px; font-size: .95rem; }
.pcard h2 { font-size: 1.02rem; }
.pcard .top2 .small.muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .kv { gap: 4px 12px; font-size: .9rem; }
.top > .row > .btn { min-height: 40px; }
@media (max-width: 430px) { .top > .row > .btn { flex: 1 1 100%; } .top > .row > .seg { flex: 1 1 100%; } }

/* ---- feels like an app: controls are not selectable text and do not pop the iOS copy menu ---- */
.btn, .chip, .tabbar a, .seg button, .iconbtn, .item, .pill, .m-back-btn, summary { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* the Back bar of a full-screen detail is solid: nothing from the page behind it shows through */
.m-backbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* layering: a dialog opened from inside a full-screen detail (Send reply, Approve and send...) must sit above that screen (55) and its Back bar (60) */
.scrim { z-index: 100; }
.sheet-scrim { z-index: 110; }
#toasts { z-index: 140; }

/* ================= phone polish, second pass (from real iPhone screenshots) ================= */

/* ---- header: title first, then search, a small mode pill, bell, account. Nothing stacks, nothing is cut mid-word ---- */
.topbar { gap: 2px; }
.topbar .crumb { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; }
.topbar .spacer { display: none; }
.topbar .iconbtn, .topbar .searchbtn { width: 38px; height: 38px; min-width: 38px; min-height: 38px; flex: none; }
.statuschip { flex: none; display: inline-flex; place-items: unset; align-items: center; justify-content: center; gap: 6px; min-width: 34px; min-height: 34px; padding: 0 8px; margin: 0 2px; }
.statuschip .t { display: none !important; }
.statuschip .ts { display: none; }
.statuschip.live { padding: 0 10px; } .statuschip.live .ts { display: inline; font-size: .78rem; font-weight: 640; }
.statuschip .pulse { width: 8px; height: 8px; }
.statuschip.run { padding: 0; min-width: 34px; } .statuschip.pause { padding: 0; min-width: 34px; }

/* ---- the long intro line under the title never hides what a page is for: show it all, quietly ---- */
.top > div > p { -webkit-line-clamp: unset; display: block; font-size: .85rem; }

/* ---- cards: one padding, whatever the card is called. A header inside a card no longer gets a second indent ---- */
.panel.au-task > header, .panel.ch-card > header, .panel.op-card > header, .panel.rp-card > header, .panel.op-feed > header, .au-task header, .ch-card header, .op-card header { padding: 0 !important; }
.au-task footer, .ch-card footer, .op-card footer { padding-inline: 0; }
.au-task, .ch-card, .op-card, .op-feed, .rp-card, .pcard { padding: 14px; }
.au-task header h3 { font-size: 1rem; } .au-task .pill { margin-top: 1px; }
.au-facts > div { grid-template-columns: 1fr; gap: 1px; } .au-facts dt { font-size: .78rem; }
.au-task footer .btn { flex: 1 1 0; }

/* ---- chip rows scroll sideways, aligned to the card's content instead of poking out of it ---- */
.chips { margin-inline: -14px; padding: 2px 14px 6px; scroll-padding-inline: 14px; }
.panel > header .chips { margin-inline: -14px; }

/* ---- profile-change cards: stat tiles in two columns so labels are not broken mid-word ---- */
.ch-stats, .ch-stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ch-stats > div { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; padding: 8px 12px; }
.ch-stats span { overflow-wrap: normal; word-break: normal; }
.ch-card footer, .op-card > footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--line2); padding-top: 12px; }
.ch-card footer .op-sparkwrap, .op-card > footer .op-sparkwrap, .op-sparkwrap { display: none; }
.ch-card footer .btn { width: 100%; justify-content: center; white-space: normal; text-align: center; line-height: 1.2; min-height: 44px; padding-inline: 8px; }
.ch-chip { border-radius: 10px; }
.op-card > footer .small { grid-column: 1 / -1; order: 3; }
.op-card > footer { grid-template-columns: 1fr auto; align-items: center; }
.op-card > footer .small { grid-column: auto; order: 0; }

/* ---- opponents card: stats as a tidy 2x2 grid ---- */
.op-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }

/* ---- selects and search boxes use the full width ---- */
select, .op-using select, .toolbar select, .row select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.op-using { width: 100%; } .op-actions { width: 100%; } .op-actions .btn { width: 100%; }

/* ---- Research and other KPI tiles: numbers never wrap or collide ---- */
.kpi .n { white-space: nowrap; font-size: 1.3rem; }
.kpi .l { overflow-wrap: anywhere; }
.rp-sec + .kpis, .panel + .kpis, .panel + .stack, .callout + .kpis { margin-top: 12px; }
.skill-card, .st-skill { padding: 12px 14px; }

/* ---- activity timeline rows: friendly text, a quiet time ---- */
.tl2 .ev { grid-template-columns: 40px minmax(0, 1fr) auto; padding-block: 10px; }
.ev > div { font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.ev > div b { font-weight: 620; }
.ev .muted.small { font-size: .78rem; padding-top: 2px; }

/* ---- Settings: phone-useless blocks stay out of the way ---- */
#kbd-card, .kbd-card { display: none; }

/* ---- generic safety: long words and urls never push a card wider than the screen ---- */
.panel, .kpi, .item { overflow-wrap: anywhere; }
/* the "automation running" dot is the normal state, so it only shows when something is off (paused) */
.statuschip.run { display: none; }
.ch-chip small { display: inline; }
/* technical call lists are noise on a phone; the counts and status below them stay */
.au-facts .tech { display: none; }
.filters { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; } .filters select, .filters input { width: 100%; }
/* a card that has its own padding must not pad its header a second time */
.rp-sec > header, .st-niche > header, .st-card > header, .pad > header, .panel.pad > header, .pcard > header { padding: 0 !important; margin-bottom: 8px; }

/* ---- background-work bar: sits right under the header, one line plus a thin progress meter ---- */
.bgbar { top: calc(52px + env(safe-area-inset-top)); margin: 4px 14px 0; padding: 8px 10px; gap: 8px; }
.bgbar .btn.sm { min-height: 34px; padding-inline: 10px; }
.bgmeter { flex: 0 0 48px; }
.bgi { grid-template-columns: 22px 1fr; } .bgi .small { grid-column: 2; text-align: left; }
.invq-row { padding-inline: 0; }
.bgbar { flex-wrap: wrap; row-gap: 6px; }
.bgbar .bgtxt { flex: 1 1 0; }
.bgbar .bgmeter { order: 5; flex: 1 0 100%; height: 6px; }
.bgi { padding: 4px 0; }

/* Ranking on a phone */
.rk-card { grid-template-columns: 64px 1fr; padding: 12px 14px; gap: 12px; } .rk-badge { width: 64px; height: 64px; border-radius: 18px; } .rk-badge b { font-size: 1.25rem; }
.rk-trend { grid-column: 1 / -1; justify-items: start; margin-top: -4px; padding-left: 76px; }
.rk-cards { grid-template-columns: 1fr; } .rk-opts { grid-template-columns: 1fr; } .rk-go .rk-btn { flex: 1 1 100%; }
.rk-h { grid-template-columns: 1fr; } .rk-mr { grid-template-columns: 96px repeat(var(--cols), 70px); min-width: calc(96px + var(--cols) * 76px); }
.seg2 button { padding: 9px 6px; font-size: .86rem; line-height: 1.2; }
.bgc { padding: 14px; border-radius: 14px; } .bgc-chip { font-size: .82rem; padding: 5px 9px; }
/* ranking: the keyword comparison fits the screen (names are on the cards above) */
.rk-tbl { min-width: 0; } .rk-tbl th, .rk-tbl td { padding: 10px 6px; font-size: .86rem; } .rk-tbl td .nm { display: none; }

@media (max-width: 700px) {
  .ts-head { display: none; }
  .ts-row { grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 16px; }
  .ts-row .ts-main { grid-column: 1 / -1; }
  .ts-row .ts-c::before { content: attr(data-l); display: block; font-size: .72rem; color: var(--muted, #6b7280); margin-bottom: 2px; }
  .ts-row .ts-n { text-align: left; }
  .ts-tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ts-tiles .rk-tile { padding: 12px 10px; } .ts-tiles .rk-tile b { font-size: 1.15rem; } .ts-tiles .rk-tile .small { font-size: .72rem; }
}
