/* ============================================================================
   CineScale Workflow on a phone (with js/phone.js)
   Jay, 30 Nov 2026: more iPhone, less scrolling, things lined up. Same
   functions, same places; only how it sits on a phone changes. Loaded last,
   and every rule is inside the phone width: the computer never sees it.
   `html` in front of a selector is only there to win over the new look's
   own rules (css/look.css), which are scoped the same way.
   ============================================================================ */

.ph-more, .ph-select { display: none; }

/* ------------------------------------------------------------ the scale
   Jay, 30 Nov: "some things are just way too big … make them way smaller so
   that they fit on an actual iPhone". The app reads almost every size from
   these tokens, so the phone gets its own set and everything shrinks
   together, in proportion: iOS sizes (body 15, headings 17 to 24), tighter
   spacing, a 14px edge. */
@media (max-width: 760px) {
  :root, html[data-theme="light"] {
    --cs-fs-d1: 40px; --cs-fs-d2: 34px; --cs-fs-d3: 30px;
    --cs-fs-h1: 24px; --cs-fs-h2: 21px; --cs-fs-h3: 19px; --cs-fs-h4: 17px; --cs-fs-h5: 15px;
    --cs-fs-lead: 16px; --cs-fs-body: 15px; --cs-fs-small: 13px; --cs-fs-caption: 11.5px; --cs-fs-micro: 10.5px;
    --cs-s-5: 18px; --cs-s-6: 22px; --cs-s-7: 28px; --cs-s-8: 36px; --cs-s-9: 48px; --cs-s-10: 64px;
    --cs-gutter: 14px; --cs-gutter-sm: 14px; --cs-col-gap: 12px;
  }
  body { font-size: 15px; }
  html .btn { min-height: 38px; padding-top: 0; padding-bottom: 0; font-size: 14px; }
  html .btn--sm { min-height: 32px; font-size: 12.5px; }
  html .chip { font-size: 9.5px; padding: 2px 6px; }
  html .cs-eyebrow { font-size: 10px; letter-spacing: .12em; }
  html .view, html[data-look="new"] .view { padding-top: 14px; }
  html .panel, html[data-look="new"] .panel { margin-bottom: 12px; }
  html .panel__body:not(.panel__body--flush) { padding: 12px; }
}

@media (max-width: 760px) {

  /* ------------------------------------------------------------ the top
     The bar already says where you are ("Pipelines / All pipelines"), so a
     page's own head is shorter: no small label above the title, a smaller
     title, the buttons in one even row. */
  /* The bar along the top, like an iPhone's: the menu on the left, where
     you are in the middle, the bell and you on the right; the page's own
     tabs centred under it. */
  html .topbar, html[data-look="new"] .topbar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 8px; row-gap: 6px;
  }
  html .topbar > .menu-toggle { grid-column: 1; grid-row: 1; justify-self: start; }
  html .topbar > .topbar__search { grid-column: 2; grid-row: 1; justify-self: center; min-width: 0; max-width: 52vw; text-align: center; }
  html .topbar > .topbar__meta { grid-column: 3; grid-row: 1; justify-self: end; gap: 10px; }
  html .topbar > .subnav { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  html .topbar .lk-crumb { justify-content: center; white-space: nowrap; overflow: hidden; }
  html .topbar .lk-crumb > a, html .topbar .lk-crumb > i { display: none; }
  html .topbar .lk-crumb > b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 15px; }
  html .subnav, html[data-look="new"] .subnav {
    display: flex; flex-wrap: wrap; justify-content: center; overflow: visible; max-width: 100%;
  }
  html .subnav[hidden] { display: none; }
  html .subnav__item { font-size: 13px; padding-left: 12px; padding-right: 12px; }
  html[data-look="new"] .subnav { border-radius: 18px; }

  /* A page's toolbar (filters and the one-line summary): centred. */
  html .toolbar {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; text-align: center;
  }
  html .toolbar > * { max-width: 100%; }

  /* A page's head, centred: the title, then the buttons in one even row. */
  html .view-head, html .record-head {
    margin-bottom: 16px; gap: 12px; text-align: center;
    flex-direction: column; align-items: stretch;
  }
  html .view-head > div > .cs-eyebrow:first-child,
  html .view-head__title > .cs-eyebrow:first-child,
  html .record-head .crumbs { display: none; }
  html .view-head h1, html .record-head h1 { font-size: 23px; line-height: 1.15; letter-spacing: -0.01em; text-align: center; }
  html .record-head p { text-align: center; }
  html .record-head .stage-pick .cs-eyebrow { text-align: center; }
  html .view-head__actions {
    display: flex; flex-wrap: nowrap; justify-content: center; gap: 8px; width: 100%; margin: 0;
  }
  html .view-head__actions > .btn, html .view-head__actions > a.btn {
    flex: 1 1 0; min-width: 0; min-height: 44px; justify-content: center; text-align: center;
    padding-left: 10px; padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  html .view-head__actions > .ph-in-more { display: none; }
  html .ph-more { display: inline-flex; }

  /* The dashboard's head: the title and the date, centred, no buttons (New
     deal and New project are on the + at the bottom). */
  html .view-head--center { margin-bottom: 14px; }
  html .view-head--center h1 { font-size: 22px; }
  html .view-head--center .view-head__title > .cs-eyebrow { display: block; margin-top: 6px; }
  html .view-head--center .view-head__actions { display: none; }

  /* The menu that jumped down a long page: the folded sections do that
     job now, and better. */
  html .page-jump { display: none; }

  /* ---------------------------------------------------- folding sections */
  html .panel[data-fold] > .panel__head {
    position: relative; display: flex; align-items: center; gap: 10px;
    min-height: 48px; padding: 10px 30px 10px 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  }
  html .panel[data-fold] > .panel__head > .cs-eyebrow,
  html[data-look="new"] .panel[data-fold] > .panel__head > .cs-eyebrow { font-size: 18px; line-height: 1.2; }
  html .panel[data-fold] > .panel__head::after {
    content: ""; position: absolute; right: 8px; top: 50%;
    width: 9px; height: 9px; margin-top: -7px;
    border-right: 1.6px solid var(--cs-fg-muted); border-bottom: 1.6px solid var(--cs-fg-muted);
    transform: rotate(45deg); transition: transform var(--cs-dur-fast) var(--cs-ease-cine);
  }
  html .panel[data-fold].is-folded > .panel__head::after { transform: rotate(-45deg); margin-top: -4px; }
  html .panel[data-fold].is-folded > :not(.panel__head) { display: none !important; }
  html .panel[data-fold].is-folded { padding-bottom: 0; margin-bottom: 10px; }
  html .panel[data-fold] > .panel__head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--cs-focus-ring); }
  html .panel[data-fold] > .panel__head > .cs-eyebrow { flex: 1; min-width: 0; }
  html .panel[data-fold] > .panel__head .ph-sub {
    display: block; margin-top: 3px; font-family: var(--cs-font-body, inherit); font-style: normal;
    font-size: 12px; letter-spacing: .02em; color: var(--cs-fg-subtle);
  }
  html .panel[data-fold] > .panel__head > .cs-caption { flex: none; white-space: nowrap; }
  /* The heading's own link ("New task →") stays a small text link. */
  html .panel[data-fold] > .panel__head a, html .panel[data-fold] > .panel__head button { margin-left: auto; flex: none; }

  /* ------------------------------------------------------ the dashboard
     The three numbers on one screen: revenue across the top, the pipeline
     and the north star side by side under it. Nothing to swipe. */
  html .kpi-row, html[data-look="new"] .kpi-row {
    display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: row; gap: 8px; overflow: visible;
    margin: 0 0 16px; padding: 0;
    background: transparent !important; border: 0; box-shadow: none !important;
  }
  html .kpi-row > .kpi, html[data-look="new"] .kpi-row > .kpi {
    min-width: 0; min-height: 0; margin: 0;
    border: 0 !important; border-radius: 12px; padding: 11px 10px; position: relative; text-align: center;
    /* The strip's own colours (the sabel in cream mode) on each card. */
    background: var(--cs-bg-elev); box-shadow: var(--lk-lift, 0 6px 18px -10px rgba(0,0,0,.35));
  }
  html .kpi-row > .kpi--rev { grid-column: 1 / -1; padding: 12px 84px 12px 14px; text-align: left; }
  html .kpi-row > .kpi .cs-eyebrow { font-size: 9.5px; letter-spacing: .12em; }
  html .kpi-row > .kpi .kpi__value { font-size: 19px; line-height: 1.15; margin-top: 3px; }
  html .kpi-row > .kpi--rev .kpi__value { font-size: 26px; }
  html .kpi-row > .kpi .kpi__note { font-size: 10px; margin-top: 4px; line-height: 1.3; }
  /* The ring sits in the card's corner instead of under the number. */
  html .kpi-row > .kpi--rev .kpi__ring { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 58px; height: 58px; margin: 0; }
  html .kpi-row > .kpi--rev .kpi__ring svg { width: 58px; height: 58px; }
  html .kpi-row > .kpi--rev .kpi__ring b { font-size: 12px; }
  html .kpi-row > .kpi--rev .kpi__ring small { font-size: 8px; }
  html .kpi-row > .kpi * { max-width: 100%; }

  /* Signals: the three cards, without the explaining around them. */
  html .signals__sub, html .signals__full, html .signals__count { display: none; }
  html .signals__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  html .signals__monday { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  html .signals__monday-acts { display: flex; gap: 8px; }
  html .signals__monday-acts > .btn { flex: 1; min-height: 40px; justify-content: center; }

  /* The week's deadlines: a tidy list, one a row, name left and who right. */
  html .week__items { display: flex; flex-direction: column; gap: 6px; }
  html .week-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-height: 44px; max-width: none; text-align: left;
  }
  html .week-item__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html .week__when { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }

  /* ------------------------------------------------------------- boards
     One column at a time, the full width; the column names above it, all
     in view and centred, switch between them (js/phone.js). No swiping. */
  html .kanban.ph-one, html[data-look="new"] .kanban.ph-one {
    display: block; overflow: visible; scroll-snap-type: none; margin: 0; padding: 0;
  }
  html .kanban.ph-one > .kanban__col, html[data-look="new"] .kanban.ph-one > .kanban__col {
    width: 100%; min-width: 0; max-width: none; flex: none; margin: 0;
  }
  html .kanban.ph-one > .kanban__col.ph-off { display: none; }
  html .board-jump {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
    overflow: visible; margin: 0 0 12px; padding: 0;
  }
  html .board-jump__item { flex: none; min-height: 34px; padding: 0 12px; font-size: 12px; }

  /* --------------------------------------------------------------- lists
     Each row: the name on top, the rest as one quiet line, lined up on the
     left, nothing empty in between. */
  html .table.table--list, html[data-look="new"] .table.table--list { display: block; overflow: visible; border: 0; }
  html .table--list thead { display: none; }
  html .table--list tbody { display: block; }
  html .table--list tr, html[data-look="new"] .table--list tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    padding: 14px 2px; margin: 0; border: 0; border-bottom: 1px solid var(--cs-border-faint);
    background: none; box-shadow: none; border-radius: 0; cursor: pointer;
  }
  html .table--list td, html[data-look="new"] .table--list td {
    display: inline-flex; align-items: center; height: auto; padding: 0; border: 0; box-shadow: none;
    white-space: normal; font-size: 13px; line-height: 1.35; color: var(--cs-fg-muted); min-width: 0; overflow-wrap: anywhere;
  }
  html .table--list td:first-child {
    flex-basis: 100%; display: block; font-size: 16px; font-weight: 600; color: var(--cs-fg);
  }
  html .table--list td:first-child .cs-caption { display: none; }
  html .table--list td.ph-empty, html .table--list td:empty { display: none; }
  html .table--list td.num { margin-left: auto; color: var(--cs-fg); }
  html .table--list tr:active { background: color-mix(in srgb, var(--cs-fg) 5%, transparent); }

  /* Filters: nothing scrolls sideways. Short rows are buttons, centred and
     wrapping; long rows are a dropdown each (js/phone.js), side by side. */
  html .pills, html .view .tabs {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
    overflow: visible; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
  }
  html .pills > .pill { flex: none; min-height: 34px; padding: 0 12px; font-size: 12.5px; }
  html .pills.ph-as-select > .pill { display: none; }
  html .pills.ph-as-select { width: 100%; justify-content: center; }
  html .ph-select {
    display: block; width: 100%; max-width: 260px; min-height: 40px; padding: 0 30px 0 12px; border-radius: 999px;
    border: 1px solid var(--cs-border); background-color: var(--cs-bg-elev); color: var(--cs-fg);
    font-size: 14px !important; text-align: center; text-align-last: center;
    -webkit-appearance: none; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  }
  html .ph-filterbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  html .ph-filterbar > .pills { margin: 0; }
  html .ph-filterbar > .pills.ph-as-select { flex: 1 1 0; min-width: 0; }
  html .ph-filterbar > .pills:not(.ph-as-select) { flex: 1 1 100%; }

  /* ------------------------------------------------------- a deal, a lead */
  html .record-head .stage-pick { margin-top: 12px; }
  html .record-head .reach { margin-top: 10px; }

  /* ------------------------------------------- sheets and pop-up forms
     Forms rise from the bottom like an iPhone sheet, rounded on top. */
  html .modal-backdrop { align-items: flex-end; }
  html .modal {
    min-height: 0; height: auto; max-height: calc(100dvh - max(24px, env(safe-area-inset-top)));
    display: flex; flex-direction: column;
    border-radius: 14px 14px 0 0; overflow: hidden;
  }
  html .modal__body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  html .sheet { border-radius: 14px 14px 0 0; }
  html .sheet__item--danger { color: var(--cs-fg-subtle); }
}

@media (max-width: 760px) {
  /* The project board's money line (admin): centred, two by two. */
  html .ed-money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: center; justify-items: center; }
  html .ed-money__item { align-items: center; }
  html .ed-money__item--done { padding-left: 0; border-left: 0; }
  html .ed-money__note { grid-column: 1 / -1; }
  /* Bookings: the calendar's own buttons centred and in view. */
  html .bk-nav, html .bk-views, html .bk-pills { justify-content: center; flex-wrap: wrap; }
}

@media (max-width: 760px) {
  /* Bookings: the six view buttons on one line. */
  html .bk-views .pill, html .toolbar .pills > .pill { padding: 0 10px; font-size: 12px; }
}

/* ======================================================= pass 3: sizes
   Jay, 30 Nov: smaller, so it fits an actual iPhone. Section by section. */
@media (max-width: 760px) {
  /* The revenue card: number left, ring right (beats the new look's centre). */
  html[data-look="new"] .kpi-row > .kpi--rev, html .kpi-row > .kpi--rev { text-align: left; }
  html[data-look="new"] .kpi-row > .kpi--rev .kpi__note { padding-right: 0; }

  /* Signals: a lighter frame; the focus card compact; the other two one
     row each (number, title with its date under it, Focus). */
  html .signals, html[data-look="new"] .signals { padding: 12px; margin-bottom: 12px; }
  html .signals__monday { padding: 12px; font-size: 13px; gap: 8px; }
  html .signals__monday-acts > .btn { min-height: 34px; font-size: 13px; }
  html .signals__head { margin: 10px 0 8px; }
  html .signals__grid { gap: 8px; }
  html .signal--focus, html[data-look="new"] .signal--focus { padding: 14px; }
  html .signal--focus .signal__n { font-size: 15px; }
  html .signal--focus .signal__title { font-size: 19px; line-height: 1.2; margin: 6px 0 4px; }
  html .signal--focus .signal__why { font-size: 13px; margin: 0 0 8px; }
  html .signal--focus .signal__foot { gap: 8px; flex-wrap: wrap; }
  html .signal--mini, html[data-look="new"] .signal--mini {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; padding: 10px 12px; min-height: 0;
  }
  html .signal--mini .signal__top { display: contents; }
  html .signal--mini .signal__n { grid-column: 1; grid-row: 1 / span 2; font-size: 14px; }
  html .signal--mini .signal__title { grid-column: 2; grid-row: 1; margin: 0; font-size: 13.5px; line-height: 1.3; }
  html .signal--mini .signal__due { grid-column: 2; grid-row: 2; font-size: 10.5px; }
  html .signal--mini .signal__focus-btn { grid-column: 3; grid-row: 1 / span 2; }

  /* The to-do list: rows a fingertip high, not more. */
  html .todo-row { min-height: 42px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
  html .todo__col-head { padding: 10px 12px; }
}
@media (max-width: 760px) {
  html .signal--mini, html[data-look="new"] .signal--mini { height: auto; overflow: visible; }
}
@media (max-width: 760px) {
  /* Page titles: the new look's 40px is a desktop size. */
  html[data-look="new"] .view-head:not(.view-head--center) .view-head__title h1,
  html[data-look="new"] .view-head h1, html[data-look="new"] .record-head h1 { font-size: 23px; line-height: 1.15; letter-spacing: -0.01em; }
  html[data-look="new"] .view-head { margin-bottom: 14px; }

  /* The top bar's page name: never runs into the menu button. */
  html .topbar > .topbar__search { max-width: 54vw; overflow: hidden; }
  html .topbar .lk-crumb > b { display: block; max-width: 100%; white-space: nowrap; }

  /* On a record (a deal, a lead, a client) the area's tabs are not what you
     came for: hidden, the record starts right under the bar. */
  html body.ph-record .topbar > .subnav { display: none; }

  /* A folded section shows only its name: its links come back when open. */
  html .panel[data-fold].is-folded > .panel__head a,
  html .panel[data-fold].is-folded > .panel__head button { display: none; }

  /* Call / text / email under a record's name: small and side by side. */
  html .reach { gap: 6px; }
  html .reach__btn { min-height: 34px; font-size: 13px; }
  html .stage-pick select { min-height: 38px; font-size: 15px !important; }

  /* Deal cards on the board: tighter. */
  html[data-look="new"] .deal-card, html .deal-card { padding: 10px 12px 9px; }
  html .deal-card__company { margin-bottom: 6px; }
  html .deal-card__foot { margin-top: 6px; padding-top: 6px; }
  html[data-look="new"] .deal-card__value { font-size: 15px; }
  html .board-jump__item { min-height: 30px; font-size: 11px; }
}
@media (max-width: 760px) {
  /* On a record, the bar names the area it belongs to (like iOS's back
     title); the record's own name is the big title just below. */
  html body.ph-record .topbar .lk-crumb > a { display: inline; font-weight: 600; font-size: 15px; color: var(--cs-fg); text-decoration: none; }
  html body.ph-record .topbar .lk-crumb > a::before { content: "‹ "; }
  html body.ph-record .topbar .lk-crumb > i, html body.ph-record .topbar .lk-crumb > b { display: none; }
}
@media (max-width: 760px) {
  /* Filter dropdowns: side by side, small. */
  html .ph-filterbar, html .toolbar.ph-filterbar { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
  html .ph-filterbar > .pills.ph-as-select { flex: 1 1 140px; max-width: 220px; width: auto; }
  html .ph-select { min-height: 36px; font-size: 13px !important; padding: 0 28px 0 10px; }
  html .toolbar { gap: 6px; margin-bottom: 10px; }
  html .toolbar .cs-caption, html .toolbar .mono { font-size: 10.5px; }

  /* List rows: denser, the date as quiet as the rest. */
  html .table--list tr, html[data-look="new"] .table--list tr { padding: 10px 12px; gap: 4px 8px; }
  html .table--list td:first-child { font-size: 15px; }
  html .table--list td { font-size: 12.5px; }
  html .table--list td.mono, html .table--list td .mono { font-size: 10.5px; }
}
@media (max-width: 760px) {
  html .board-jump.ph-as-select { display: none; }
  html .ph-colsel { margin: 0 auto 10px; max-width: 300px; font-weight: 600; }
  /* The project board's money (admin): four small figures, two by two. */
  html .ed-money { padding: 10px 12px; gap: 8px 12px; margin-bottom: 10px; }
  html .ed-money__k { font-size: 9px; }
  html .ed-money__v { font-size: 13px; }
  html .ed-money__note { font-size: 10.5px; }
  /* Project cards: tighter. */
  html .ed-card, html[data-look="new"] .ed-card { padding: 10px 12px; }
  html .ed-card__title { font-size: 14px; }
  html .empty, html .empty-state { padding: 24px 16px; }
}
@media (max-width: 760px) {
  /* The calculator: packages as compact cards, two by two, the price a
     line rather than a box. */
  html .quote-packs { grid-template-columns: 1fr 1fr; gap: 8px; }
  html .quote-pack { padding: 10px; gap: 4px; min-height: 0; }
  html .quote-pack__name { font-size: 13px; line-height: 1.25; }
  html .quote-pack__cue { font-size: 10.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  html .quote-pack__price { padding: 6px 8px; margin-top: 4px; min-height: 0; }
  html .quote-pack__amount { font-size: 17px; }
  html .quote-pack__price-sub { min-height: 0; font-size: 10px; }
  html .quote-pack .chip { font-size: 8.5px; }
}
@media (max-width: 760px) {
  /* Bookings: a month that fits the screen, like the iPhone's own. */
  html .bk-cal .cal__day { min-height: 52px; padding: 3px; }
  html .bk-cal .cal__head, html .bk-cal .cal__dow { font-size: 9px; }
  html .bk-chip { font-size: 9px; padding: 1px 3px; min-height: 0; line-height: 1.3; }
  html .bk-date { font-size: 11px; }
  /* The view buttons and Mine / Everyone on one line. */
  html .view .pills > .pill { padding: 0 9px; font-size: 11.5px; min-height: 30px; }
  html .bk-nav .btn { min-height: 34px; }
}
@media (max-width: 760px) {
  /* Goals: the star across the top with a small ring beside it; the other
     goals two by two, each a small card. */
  html .sg-row--top, html .sg-row--mid { grid-template-columns: 1fr 1fr; gap: 8px; }
  html .sg-row--top > .sg-tile--star, html .sg-row--mid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  html .sg-cockpit { gap: 8px; }
  html .sg-tile { padding: 12px; gap: 6px; border-radius: 12px; }
  html .sg-tile--star { flex-direction: row; align-items: center; gap: 12px; }
  html .sg-tile--star .sg-ring { width: 76px; height: 76px; }
  html .sg-ring { width: 76px; height: 76px; }
  html .sg-ring--sm { width: 62px; height: 62px; }
  html .sg-ring b { font-size: 16px; }
  html .sg-ring--sm b { font-size: 14px; }
  html .sg-ring b small { font-size: 7.5px; margin-top: 2px; }
  html .sg-tile__value { font-size: 24px; margin: 2px 0; }
  html .sg-tile__num { font-size: 19px; }
  html .sg-tile__cap, html .sg-tile__warn { font-size: 11px; line-height: 1.4; }
  html .sg-dots { grid-template-columns: repeat(6, 12px); gap: 6px; }
  html .sg-dots i { width: 12px; height: 12px; }
  html .sg-gauge { max-width: 130px; }
}
@media (max-width: 760px) {
  /* Finance: the year's chart scales to the screen instead of scrolling. */
  html .fin-result__scroll { overflow: visible; }
  html .fin-result__scroll > svg, html svg.fin-result { width: 100%; height: auto; min-width: 0; }
  html .fin-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  html .fin-row > .fin-tile--hero, html .fin-row > .fin-tile--result { grid-column: 1 / -1; }
  html .fin-tile--hero .sg-tile__value, html .fin-hero__value { font-size: 30px; }
  /* Any other chart drawn at a fixed width does the same. */
  html .view svg[viewBox][width]:not(.kpi__ring svg):not(.sg-ring svg) { max-width: 100%; height: auto; }
}
@media (max-width: 760px) {
  /* Wide tables as cards (js/phone.js cardTables): the first value is the
     row's name, the rest label left, value right. */
  html table.ph-cards, html[data-look="new"] table.ph-cards { display: block; width: 100%; min-width: 0 !important; overflow: visible; border: 0; }
  html table.ph-cards thead { display: none; }
  html table.ph-cards tbody, html table.ph-cards tfoot { display: block; }
  html table.ph-cards tr {
    display: block; padding: 10px 12px; margin: 0 0 8px;
    border: 1px solid var(--cs-border-faint); border-radius: 10px; background: var(--cs-bg-elev);
  }
  html table.ph-cards td, html[data-look="new"] table.ph-cards td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    height: auto; padding: 3px 0; border: 0; box-shadow: none; text-align: right;
    white-space: normal; font-size: 13px; min-width: 0; overflow-wrap: anywhere;
  }
  html table.ph-cards td::before {
    content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    font-size: 10.5px; letter-spacing: .04em; color: var(--cs-fg-subtle);
  }
  html table.ph-cards td:first-child { display: block; text-align: left; font-weight: 600; font-size: 14px; padding-bottom: 5px; }
  html table.ph-cards td:first-child::before { content: none; }
  html table.ph-cards td:empty { display: none; }
  html table.ph-cards td input, html table.ph-cards td select { max-width: 60%; }
  html .fin-rec, html .fin-table { min-width: 0 !important; overflow: visible; }
}
@media (max-width: 760px) {
  /* Every section heading at the phone size, folded or not. */
  html[data-look="new"] .panel__head > .cs-eyebrow, html .panel__head > .cs-eyebrow { font-size: 18px; line-height: 1.2; }
  html[data-look="new"] .panel__head { padding: 12px 0 8px; }
  html .view img { max-width: 100%; height: auto; }
  /* Settings: its tabs wrap, centred, instead of running off the side. */
  html .settings__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; overflow: visible; }
  html .settings__tab { flex: none; font-size: 12px; padding: 6px 10px; min-height: 32px; }
}
@media (max-width: 760px) {
  /* The map: Denmark across the width, the score under it. */
  html .conquest__body, html .conquest--page .conquest__body { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
  html .conquest__map svg { max-height: 420px; }
  html .conquest__num { font-size: 26px; }
  html[data-look="new"] .conquest__side { padding: 14px; }
}
@media (max-width: 760px) {
  /* The 98 kommuner: compact rows in the region cards. */
  html .cq-idx { min-height: 26px; font-size: 12px; padding-top: 2px; padding-bottom: 2px; }
  html .cq-region, html[data-look="new"] .cq-region { padding: 10px; }
}
@media (max-width: 760px) {
  /* Pop-up forms: edge to edge like an iPhone sheet, a smaller title. */
  html .modal-backdrop, html[data-look="new"] .modal-backdrop { padding: 0; }
  html .modal, html[data-look="new"] .modal { width: 100%; max-width: none; margin: 0; }
  html .modal__head, html[data-look="new"] .modal__head { padding: 14px 16px 10px; }
  html .modal__head h2, html .modal__head h3, html .modal__title, html[data-look="new"] .modal__head h2 { font-size: 19px; line-height: 1.2; }
  html .modal__body { padding: 12px 16px; }
  html .modal__foot { padding: 10px 16px max(10px, env(safe-area-inset-bottom)); }
  html .modal label > .cs-eyebrow, html .modal .field > .cs-eyebrow { margin-bottom: 4px; }
  html .modal .field, html .modal label { margin-bottom: 10px; }
}
@media (max-width: 760px) {
  /* Fields: the iPhone's own 44, not 52. */
  html .view :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea),
  html .modal :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
    min-height: 42px; padding-top: 8px; padding-bottom: 8px;
  }
  html .view textarea, html .modal textarea { min-height: 72px; }
}

/* ================================================ the installed app's edges
   Jay, 30 Nov (screenshot from the Home Screen app): the menu button and the
   page tabs sat under the iPhone's clock, and a black strip showed under the
   bottom bar. Opened from the Home Screen the page runs edge to edge, so:
   - the top bar starts below the status bar (the new look had set its
     padding to 0, which threw away the iPhone's safe area);
   - the bottom bar's brown carries on past its own edge, so whatever the
     iPhone leaves below it is brown, never a black strip. */
@media (max-width: 760px) {
  html .topbar, html[data-look="new"] .topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 8px;
  }
  html .tabbar { overflow: visible; }
  html .tabbar::after {
    content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 160px;
    background: inherit; pointer-events: none;
  }
}

/* Jay, 30 Nov (second screenshot): still a black strip under the bottom bar
   in the Home Screen app. The iPhone paints that strip with the page's root
   colour, so in the installed app the root is the bar's own brown, and the
   bar sits flush on the bottom edge with only the home-indicator gap. */
@media (max-width: 760px) and (display-mode: standalone) {
  html { background: var(--cs-bg-elev) !important; }
  html .tabbar { bottom: 0; padding-bottom: max(4px, calc(env(safe-area-inset-bottom, 0px) - 10px)); }
}

/* The strip under the bottom bar, second try (Jay, 30 Nov, screenshot: still
   a dark band under the brown bar in the Home Screen app). On the iPhone the
   app's layout can end one status bar's height above the screen's edge, and
   nothing pinned to the bottom is drawn past it; what shows there is the
   page's outermost background. So that background is the bottom bar's own
   colour (the page itself keeps its colour on <body>), and the strip reads
   as part of the bar, in either theme. */
@media (max-width: 760px) {
  html { background-color: var(--cs-bg-elev); }
  html body.cs-root { background-color: var(--cs-bg); }
}

/* The layout extended to the true bottom of the screen when the iPhone
   leaves it short (js/phone.js fitScreen sets html.ph-gap and --ph-gap):
   the page grows by the gap, and the bottom bar sits at the end of the
   page rather than at the short layout's edge. */
@media (max-width: 760px) {
  html.ph-gap { height: calc(100% + var(--ph-gap, 0px)); }
  html.ph-gap body { height: 100%; position: relative; }
  html.ph-gap .app { height: 100%; grid-template-rows: 100%; }
  html.ph-gap .tabbar { position: absolute; bottom: 0; }
}
