/* OneNine Finance, look and feel rework (25 Nov 2026): phone width and long Danish or German texts, every page.
   Loaded after v5.css. One file per area, kept separate.
   Measured with the crawl in the review folder (every page in en, da, de at 390 px and 1440 px): what pushed the page
   sideways, what was cut, what was too small to touch or to read. The product's phone breakpoint is 700 px. */

/* ---- 1. Nothing pushes the page sideways (every width: German tables did it at 1440 px too) ---- */
/* a statement table that sits straight in its card, and the dashboards' table wrapper, scroll inside their own box */
body.app.ui-v2 section.card:has(> table.fin), body.app.ui-v2 .tw { overflow-x: auto; }
body.app.ui-v2 .kpi, body.app.ui-v2 .mk, body.app.ui-v2 .kcard, body.app.ui-v2 .chat-log, body.app.ui-v2 .suggest { min-width: 0; }

/* the bars-in-rows chart has a drawing of its own for a narrow screen (partials/modviews.html); it carries the hidden
   attribute, so it stays out of sight wherever this file is not loaded */
body.app.ui-v2 .rb-phone .rb-l { font-size: 13px; }
body.app.ui-v2 .rb-phone .rb-v { font-size: 13px; }

@media (max-width: 700px) {
  /* ---- 2. Key figures: a long label wraps, it does not push its tile wider or end in three dots ---- */
  body.app.ui-v2 .kpi .delta, body.app.ui-v2 .mk .delta, body.app.ui-v2 .kcard .delta { white-space: normal; }
  body.app.ui-v2 .kpi-l, body.app.ui-v2 .kpi .delta, body.app.ui-v2 .mk-l, body.app.ui-v2 .mk .delta {
    overflow-wrap: anywhere; hyphens: auto; }
  body.app.ui-v2 .mk-l, body.app.ui-v2 .month-kpis .mk-l { white-space: normal; overflow: visible; text-overflow: clip; }
  body.app.ui-v2 svg.mk-spark, body.app.ui-v2 svg.kp-spark { max-width: 100%; }
  /* headings: a long German or Danish compound breaks at a syllable instead of running out of its card */
  body.app.ui-v2 .card-head h2, body.app.ui-v2 .content h1, body.app.ui-v2 .more-sum-t { overflow-wrap: anywhere; hyphens: auto; }
  /* Ask: a suggested question wraps inside the card */
  body.app.ui-v2 .sugg { white-space: normal; text-align: left; height: auto; min-height: 40px; }
  body.app.ui-v2 .chat-log, body.app.ui-v2 .suggest { max-width: 100%; }

  /* ---- 3. The top bar: the page's name gets the room, search is its icon ---- */
  body.app.ui-v2 .tb-search { flex: 0 0 40px; width: 40px; min-width: 40px; padding-left: 0; padding-right: 0; justify-content: center; }
  body.app.ui-v2 .tb-crumbs { flex: 1 1 auto; }

  /* ---- 4. Touch targets of 40 px ---- */
  body.app.ui-v2 .side .side-nav a { min-height: 40px; }
  body.app.ui-v2 .appbar .ico-btn, body.app.ui-v2 .tb-search, body.app.ui-v2 .tb-bug, body.app.ui-v2 .appbar summary,
  body.app.ui-v2 .appbar select.input { min-height: 40px; }
  body.app.ui-v2 .appbar .ico-btn, body.app.ui-v2 .tb-bug { min-width: 40px; }
  body.app.ui-v2 .ico-btn { width: 40px; height: 40px; }
  body.app.ui-v2 .card-head .ico-btn { margin: -6px -4px -6px 0; }
  body.app.ui-v2 .btn-sm, body.app.ui-v2 .input-s, body.app.ui-v2 select.input, body.app.ui-v2 .content .btn { min-height: 40px; }
  body.app.ui-v2 .fig-x { width: 40px; height: 40px; margin: -10px -6px -10px -2px; vertical-align: middle; border-color: transparent; background: transparent; }
  body.app.ui-v2 .oi-dock-x, body.app.ui-v2 .rb-tb, body.app.ui-v2 .mpick-yr { min-width: 40px; min-height: 40px; }
  body.app.ui-v2 summary.small, body.app.ui-v2 a.act-go { min-height: 40px; display: inline-flex; align-items: center; }
  body.app.ui-v2 .ex-bar-row { min-height: 40px; }
  /* the Ask button never covers the last lines of a page */
  body.app.ui-v2 main.content { padding-bottom: 88px; }

  /* ---- 5. Tables that scroll sideways show it: a shadow on the side that holds more ---- */
  body.app.ui-v2 .table-wrap, body.app.ui-v2 .tw, body.app.ui-v2 .chart-x, body.app.ui-v2 section.card:has(> table.fin) {
    background-image:
      linear-gradient(to right, var(--v-surface, #FFFFFF) 35%, rgba(255, 255, 255, 0)),
      linear-gradient(to left, var(--v-surface, #FFFFFF) 35%, rgba(255, 255, 255, 0)),
      radial-gradient(farthest-side at 0 50%, rgba(29, 39, 51, .26), rgba(29, 39, 51, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(29, 39, 51, .26), rgba(29, 39, 51, 0));
    background-position: left center, right center, left center, right center;
    background-size: 44px 100%, 44px 100%, 14px 100%, 14px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
  /* rows keep the shadow visible: a shaded row is see-through at the edge the shadow sits on */
  body.app.ui-v2 .table-wrap table, body.app.ui-v2 .tw table { background: transparent; }

  /* ---- 6. Charts drawn on the server stay readable ---- */
  /* a twelve-month chart keeps a readable size and scrolls inside its card (app.js puts it into .chart-x and
     starts at the newest month); without the script it stays as it was */
  body.app.ui-v2 .chart-x { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  body.app.ui-v2 .chart-x > svg { display: block; width: 660px; min-width: 660px; max-width: none; height: auto; overflow: visible; }
  body.app.ui-v2 .chart-x > svg.chart text { font-size: 19px; }
  body.app.ui-v2 .chart-x > svg.chart .mdot { r: 4.5px; }
  body.app.ui-v2 .chart-x > svg.chart .ann.endv, body.app.ui-v2 .chart-x > svg.chart .val.now { font-size: 21px; }
  /* the half-width charts (400 to 560 units wide) fill the card; their text is set larger so it lands near 10 px */
  body.app.ui-v2 svg.chart:not(.rowbars)[viewBox^="0 0 4"] text, body.app.ui-v2 svg.chart:not(.rowbars)[viewBox^="0 0 5"] text { font-size: 17px; }
  body.app.ui-v2 svg.chart:not(.rowbars)[viewBox^="0 0 4"], body.app.ui-v2 svg.chart:not(.rowbars)[viewBox^="0 0 5"] { overflow: visible; }
  /* bars in rows: the phone drawing in place of the wide one */
  body.app.ui-v2 svg.chart.rowbars.rb-wide { display: none; }
  body.app.ui-v2 .rb-phone[hidden] { display: block !important; }
  /* pipeline by stage: the bar column keeps a head that fits */
  body.app.ui-v2 th.stagebar-h { max-width: 96px; white-space: normal; line-height: 1.2; }
  body.app.ui-v2 td.stagebar-c { width: auto; min-width: 84px; }
  /* the age bar in the receivables table stays wide enough to read */
  body.app.ui-v2 svg.agebar { min-width: 72px; }
}

@media (max-width: 700px) {
  /* settings: a long German button no longer widens every card past the screen */
  body.app.ui-v2 .settings-grid > * { min-width: 0; }
  body.app.ui-v2 .settings-grid .btn { white-space: normal; height: auto; text-align: left; }
  /* a key figure stays on one line: "−1,13 Mio." broke in two in a half-width tile */
  body.app.ui-v2 .kpis .kpi-v { font-size: 22px; white-space: nowrap; }
  /* bars in rows on a phone: the label stands clear of the dotted connector behind it */
  body.app.ui-v2 .rb-phone .rb-l { paint-order: stroke; stroke: var(--v-surface, #FFFFFF); stroke-width: 5px; stroke-linejoin: round; }
}

/* a tablet: the twelve-month charts are about 700 px wide there, their text lands under 8 px without this */
@media (min-width: 701px) and (max-width: 1000px) {
  body.app.ui-v2 svg.chart[viewBox^="0 0 1100"] text { font-size: 16px; }
  body.app.ui-v2 svg.chart[viewBox^="0 0 1100"] { overflow: visible; }
}

/* ---- 7. Longer Danish and German words, every width ---- */
/* a table head may wrap in Danish and German: "Abweichung seit Jahresbeginn" on one line pushed the last column of
   the budget and customer tables out of their cards at 1440 px */
html[lang="de"] body.app.ui-v2 :is(table.fin, table.list) thead th,
html[lang="da"] body.app.ui-v2 :is(table.fin, table.list) thead th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
/* sign-in: the button beside the six-digit field wraps instead of touching its own edges
   ("Zweistufige Anmeldung einschalten") */
.flow-code .btn { white-space: normal; line-height: 1.25; padding-left: 16px; padding-right: 16px; }

/* ---- 8. A table that still scrolls sideways shows it at every width, not only on a phone ---- */
@media (min-width: 701px) {
  body.app.ui-v2 .table-wrap, body.app.ui-v2 .tw, body.app.ui-v2 .chart-x, body.app.ui-v2 section.card:has(> table.fin) {
    background-image:
      linear-gradient(to right, var(--v-surface, #FFFFFF) 35%, rgba(255, 255, 255, 0)),
      linear-gradient(to left, var(--v-surface, #FFFFFF) 35%, rgba(255, 255, 255, 0)),
      radial-gradient(farthest-side at 0 50%, rgba(29, 39, 51, .22), rgba(29, 39, 51, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(29, 39, 51, .22), rgba(29, 39, 51, 0));
    background-position: left center, right center, left center, right center;
    background-size: 44px 100%, 44px 100%, 14px 100%, 14px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
}

@media (max-width: 700px) {
  /* touch targets, second round: rules elsewhere pinned these under 40 px */
  body.app.ui-v2 main button.fig-x { width: 40px !important; height: 40px !important; }
  body.app.ui-v2 .tb-pop > summary { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  body.app.ui-v2 .tb-menu a, body.app.ui-v2 .tb-menu button { min-height: 40px; display: flex; align-items: center; }
  body.app.ui-v2 :is(.appbar-tools, .content) .input-s { height: 40px; min-height: 40px; }
  body.app.ui-v2 .side select.input, body.app.ui-v2 .content select { height: 40px; min-height: 40px; }
  body.app.ui-v2 .side-brand { min-height: 40px; display: inline-flex; align-items: center; }
  body.app.ui-v2 .rb-open, body.app.ui-v2 .tpl-open { min-height: 40px; }
}

/* Danish and German key-figure labels may take two lines at every width ("Resultat før afskrivninger") */
html[lang="da"] body.app.ui-v2 .mk-l, html[lang="de"] body.app.ui-v2 .mk-l { white-space: normal; overflow: visible; text-overflow: clip; }
/* receivables follow-up: the age bar and the cells leave room, so the table fits its half-width card */
body.app.ui-v2 svg.agebar { width: 76px; min-width: 60px; }
body.app.ui-v2 .mod-grid2 table.list :is(th, td) { padding-left: 6px; padding-right: 6px; }

@media (max-width: 700px) {
  /* settings: an address wraps instead of ending in three dots; the unit's language row stays inside the card */
  body.app.ui-v2 .person-mail { white-space: normal; overflow-wrap: break-word; text-overflow: clip; }
  body.app.ui-v2 #units .unit-list { grid-template-columns: minmax(0, 1fr); }
  body.app.ui-v2 .unit-lang, body.app.ui-v2 .unit-lang select { max-width: 100%; min-width: 0; }
  body.app.ui-v2 .settings-grid li { min-width: 0; max-width: 100%; }
}

@media (max-width: 700px) {
  /* the bridge from budget to actual has words, not months, under its bars: they keep a size that does not collide */
  body.app.ui-v2 svg.chart.mchart[viewBox="0 0 560 256"] .tick { font-size: 13.5px; }
}

@media (max-width: 700px) {
  /* touch targets, third round: the view switcher, folds and the links in a card's head */
  body.app.ui-v2 .rp-views a { min-height: 40px; display: inline-flex; align-items: center; }
  body.app.ui-v2 .content details > summary { min-height: 40px; padding-top: 9px; padding-bottom: 9px; box-sizing: border-box; }
  body.app.ui-v2 .card-head a.small { display: inline-block; padding: 10px 0; }
  .topbar .brand { min-height: 40px; display: inline-flex; align-items: center; }
}
