/* v141 foundation: one set of rules that every tab shares. Loaded LAST (after strip.css), so removing the one <link> in base.html
   returns the exact v140 look. CSS only, no script, no new text.
   1. Header: one row at every desktop width (the settings gear never drops to a second row).
   2. List rows: inner padding comes from the shared spacing tokens (strip.css), not 2-4 px per screen.
   3. Tiles: every number tile has the same top bar rule.
   4. Desktop: one content width cap on every tab; long lists read as columns. */

/* 1. header ------------------------------------------------------------- */
@media(min-width:901px){
 .top{flex-wrap:nowrap}
 .top>*{flex-shrink:0}
 .top .area-switch{flex-shrink:1;min-width:0;overflow-x:auto;scrollbar-width:none}
 .top .area-switch::-webkit-scrollbar{display:none}
 .top .area-switch a{white-space:nowrap}
 .top .badge{flex-shrink:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
}
/* the confidentiality badge gives way before anything wraps (it is already hidden up to 900 px) */
@media(min-width:901px) and (max-width:1180px){.top .badge{display:none}.top .area-switch{margin-left:auto}}

/* 2. list rows ---------------------------------------------------------- */
.rcv-customer,.day-person-action,.stock .stock-product{
 padding-block:calc(var(--sp-card) * .85);
 padding-inline:var(--sp-card);
}
.rcv-customer{gap:calc(var(--sp-row) + 2px)}
.rcv-customer header,.rcv-customer>p{min-width:0}
.rcv-customer>p{overflow-wrap:anywhere;line-height:1.45}
.rcv-customer .rcv-bar{height:6px}
/* a pressed / hovered row looks tappable, like the tiles */
@media(hover:hover){.rcv-customer:hover,.stock .stock-product:hover{background:color-mix(in srgb,var(--blue,#1b75bb) 7%,transparent)}}
.rcv-customer:active,.stock .stock-product:active{background:color-mix(in srgb,var(--blue,#1b75bb) 12%,transparent)}
@media(max-width:750px){
 .rcv-customer,.stock .stock-product{min-height:44px}
}

/* 3. tiles: a tile without a status colour gets a neutral top bar, so the row of tiles lines up */
.ov-card:not([class*=" t-"])::before{content:'';position:absolute;left:0;right:0;top:0;height:4px;background:color-mix(in srgb,var(--muted,#526778) 45%,transparent);border-radius:var(--sp-radius,20px) var(--sp-radius,20px) 0 0}
.ov-card{overflow:hidden}

/* 4. desktop ------------------------------------------------------------- */
@media(min-width:901px){
 /* the same content width on every tab, centred */
 main.stock,main.intelligence,.stock-devices{max-width:1320px;margin-inline:auto}
 /* customers as a table-like row: name + amount | age bar | last payment */
 .rcv-list:not([data-view=departments]) .rcv-customer{
  display:grid;grid-template-columns:minmax(0,1.3fr) minmax(200px,.9fr) minmax(0,1fr);
  align-items:center;column-gap:calc(var(--sp-card) * 1.5);row-gap:0}
 .rcv-list:not([data-view=departments]) .rcv-customer>p{text-align:left}
}

/* 5. page head (v142): every tab opens the same way -------------------------------------------
   row 1: the area name (left) and the freshness / note line (right)
   row 2: the section tabs (pill switch)
   row 3: the controls, bare (never in a card), always after the tabs
   On phone and tablet portrait (up to 900 px) the header already shows the page name, so the title row is not repeated. */
.page-area{display:none}
@media(min-width:901px){
 .stock-head.has-tabs{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"title status" "tabs tabs";align-items:center;column-gap:var(--sp-block);row-gap:var(--sp-row);margin-bottom:var(--sp-block)}
 .stock-head.has-tabs .page-area{display:block;grid-area:title;font-size:28px;font-weight:700;letter-spacing:-.8px;line-height:1.2;margin:0}
 .stock-head.has-tabs .stock-tabs{grid-area:tabs;justify-self:start}
 .stock-head.has-tabs .stock-status,.stock-head.has-tabs .ov-note,.stock-head.has-tabs [data-page-fresh]{grid-area:status;margin:0;text-align:right;justify-self:end}
 /* Overview: visible title, same size */
 .stock-head:not(.has-tabs) h1,.workspace-heading h1{font-size:28px;letter-spacing:-.8px;line-height:1.2;margin:0}
 /* Social media period bar: the same compact switch as the other tabs, not a full-width bar */
 .mx-bar{max-width:none}
 .mx-bar .mx-periods{width:fit-content}
}
/* Marketing: title like the others, controls bare, tabs BEFORE the controls (order only, no markup moved) */
.workspace-heading{align-items:center;margin-bottom:var(--sp-block)}
@media(max-width:900px){.workspace-heading h1,.stock-head:not(.has-tabs) h1{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.workspace-heading{justify-content:flex-end;margin-bottom:var(--sp-row)}}
main.intelligence .workspace-tabs{margin:0 0 var(--sp-row);width:fit-content;max-width:100%}
html main.intelligence .workspace-controls{border:0;background:transparent;box-shadow:none;padding:0;margin:0 0 var(--sp-block)}
@media(min-width:901px){html main.intelligence .workspace-controls{background:var(--bg,#0d1724);box-shadow:0 1px 0 var(--line);border-radius:0;padding-block:var(--sp-row)}}   /* the sticky bar on Marketing is solid too */
@media(max-width:900px){main.intelligence .workspace-tabs{width:100%}}

/* 6. v143 desktop structure (901 px and up only; phone and tablet portrait are untouched) ------------------------------
   section tabs = underline (navigation); pills stay for period / branch / view switches (filtering the same content);
   one control bar that sticks under the header; Receivables: controls first, then the numbers; one Reset for list filters. */
@media(min-width:901px){
 /* section tabs: underline style, same everywhere. The older rules (ui.css, areas.css, slider.css) force a pill container, 9px item padding
    and a sliding pill highlight (.seg-host::before) with !important, so these selectors are deliberately more specific. */
 html .stock-tabs.stock-tabs.stock-tabs,html .workspace-tabs.workspace-tabs.workspace-tabs{display:flex!important;width:100%!important;max-width:none!important;gap:calc(var(--sp-block) + 8px)!important;padding:0!important;margin:0 0 var(--sp-block)!important;
  background:transparent!important;border:0!important;border-bottom:1px solid var(--line)!important;border-radius:0!important;box-shadow:none!important;justify-content:flex-start}
 html .stock-tabs.seg-host::before,html .workspace-tabs.seg-host::before{display:none!important}
 html .stock-head.has-tabs .stock-tabs>a,html main.intelligence .workspace-tabs>button,html .stock-tabs>a{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;gap:8px;min-width:0;min-height:44px!important;
  padding:10px 0!important;border:0;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:color-mix(in srgb,var(--ink) 78%,var(--bg,transparent));font-size:14px!important;font-weight:650!important}
 html .stock-head.has-tabs .stock-tabs>a:first-of-type,html .stock-tabs>a:first-of-type,html main.intelligence .workspace-tabs>button:first-of-type{padding-left:0!important}   /* the first tab lines up with the page title */
 .stock-tabs>a::after,.workspace-tabs>button::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:2px;border-radius:2px;background:transparent}
 html .stock-head.has-tabs .stock-tabs>a[aria-current=page],html .stock-tabs>a[aria-current=page],html main.intelligence .workspace-tabs>button[aria-selected=true]{color:var(--blue)}
 .stock-tabs>a[aria-current=page]::after,.workspace-tabs>button[aria-selected=true]::after{background:var(--blue)}
 html .stock-head.has-tabs .stock-tabs>a:hover:not([aria-current=page]),html main.intelligence .workspace-tabs>button:hover:not([aria-selected=true]){color:var(--ink)}
 .stock-tabs .tab-indicator,.workspace-tabs .tab-indicator,.stock-tabs .seg-indicator{display:none!important}
 /* one control bar that stays under the header while a long list scrolls */
 .ov-controls,.stock-search-panel,.workspace-controls,.mx-bar{border-radius:0;position:sticky;top:68px;z-index:20;background:var(--bg,#0d1724);box-shadow:0 1px 0 var(--line);padding-block:var(--sp-row);margin-top:calc(var(--sp-row) * -1)}
 /* Receivables: controls first, then the numbers (order only; the phone keeps its order) */
 main.receivables{display:flex;flex-direction:column}
 main.receivables>*{order:5}
 main.receivables>.stock-head{order:0}
 main.receivables>.rcv-filters{order:1}
 main.receivables>.rcv-asof{order:2}
 main.receivables>.rcv-summary{order:3}
 main.receivables>.rcv-ages{order:4}
 main.receivables>.rcv-segmented{order:5;margin-top:var(--sp-block)}
 main.receivables>.rcv-filters{margin-bottom:var(--sp-block)}
}

/* v144 */
/* Marketing > Customers search and every control stay inside the screen on a phone */
@media(max-width:750px){
 .workspace-controls{flex-wrap:wrap}
 .workspace-controls label{min-width:0;max-width:100%}
 .workspace-controls .customer-search{min-width:0!important;max-width:100%;flex:1 1 100%}   /* beats the older min-width:100%!important that pushed the field past the screen edge */
 .workspace-controls .customer-search input,.workspace-controls select{width:100%;min-width:0}
}
/* the freshness label lives in the title row now; the old foot copy on Meta and Website would repeat it */
.ov-ads .mx-foot .ov-asof,.ov-website .mx-foot .ov-asof{display:none}
.stock-head [data-page-fresh]:empty{display:none}
.page-fresh{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--muted);white-space:nowrap}
.page-fresh:empty{display:none}
@media(max-width:900px){.stock-head .page-fresh{margin-left:auto}}

/* v146 alignment (UX review, measured): the same component has the same geometry on every page ------------------------------ */
@media(min-width:901px){
 html .top{height:68px;min-height:68px}   /* one header height on every page, so the title never moves by a pixel between pages */
 .workspace-heading{margin-bottom:var(--sp-row)}   /* Marketing's tab row sits where it does on Warehouse, Finance and Social media */
 .stock-head:not(.has-tabs) h1,.workspace-heading h1{font-weight:700}   /* the same title weight as the other pages */
 html .ov-controls .ov-day,html .ov-controls .ov-branches{height:46px;box-sizing:border-box}   /* the day box and the branch switch are one height */
 html .ov-controls .ov-branches button{min-height:38px!important}
 .workspace-controls .day-date-controls,.workspace-controls .month-switch,html .ov-controls .ov-day{flex:0 0 260px;width:260px}   /* the same date control width on Overview, Sales and Marketing */
 html .ov-controls .ov-day .ov-day-pick{flex:1 1 auto}   /* the label takes the free space: arrows at both ends, label centred (a fixed width left dead space at the right) */
 html main.intelligence .workspace-tabs.workspace-tabs{margin-bottom:calc(var(--sp-block) + 8px)!important}   /* the control bar sits at the same height under the tab row as on every other page */
 html .mx-bar .mx-periods{height:46px;box-sizing:border-box}   /* Meta/Website period switch: the same height as the Overview branch switch */
 html .mx-bar .mx-periods button{min-height:38px!important}
 main.receivables>.rcv-filters{margin-bottom:var(--sp-row)}   /* the first block starts at the same y as on every other page */
 html .finance-bar+.cm .cm-main{padding-top:0}   /* Commission's control row at the same y as the other pages */
 html main.intelligence .workspace-controls{margin-bottom:var(--sp-row)}   /* Marketing's first block starts at the same y as on every other page (was 8px lower) */
 html .us-ranges{height:46px;box-sizing:border-box}   /* Server health / Usage range switch: the same height as the other switches */
 html .us-ranges button,html .ov-branches.us-ranges button{min-height:38px!important}   /* beats the ui.css :is() rule, so the buttons fit their 46px track
 */
 html main.intelligence .headline-metrics{margin-top:0}   /* Marketing > Marketers: the first block starts at the same y as on the other sub-tabs */
}
html .finance-bar{padding:var(--sp-top) var(--sp-gutter) 0}   /* Commission's title row starts where every other page's does, at every width */
.stock-results-heading{margin-inline:0}   /* was 2 px inset */
.ov-sales .ov-panel,.ov-website .ov-panel,.ov-ads .ov-panel{padding-inline:0}   /* these panels have no visible edge: their content starts at the page edge (x=32), not 20 px in */
html .cm .cm-main{padding-inline:var(--sp-gutter)}   /* Commission's content starts at the same x as its title and tabs at every width (its own CSS used 24px below 1200 and 18px below 650) */
@media(max-width:900px){.workspace-heading{margin-bottom:0}}   /* Marketing's tab row sits at the same y as on the other pages on a phone */

/* v147 polish (owner approved the list 2026-11-10) */
html main.intelligence .headline-metrics{margin-top:0}   /* Marketing > Marketers: the first block starts at the same y on the other sub-tabs at every width */
.stock-head:not(.has-tabs) h1,.workspace-heading h1{font-weight:700}   /* the same title weight at every width */
html main.intelligence .workspace-controls{border-radius:0}   /* no rounded bar edge at tablet width */
.mx-bar:not(:has(>:not([hidden]))){display:none}   /* Meta / Website: no empty bar while nothing is shown in it (Meta not connected) */
@media(max-width:430px){   /* Commission's four inner tabs: two rows of two, so no label touches its pill edge (Turkish is longer) */
 .cm .tabs{display:grid!important;grid-template-columns:1fr 1fr;gap:4px}
 .cm .tabs button{min-width:0;white-space:normal;line-height:1.25}
}

/* v147 header (owner feedback 2026-11-10: the top navigation moved from page to page). The navigation, the confidentiality badge and the status
   icon each had margin-left:auto and shared the free space, so the navigation's x depended on the badge text and on whether the page has a
   status icon. Now: fixed distance after the logo block, and ONE auto margin (on the navigation) that pushes everything after it to the right. */
@media(min-width:901px){
 html .top .area-switch{margin-left:var(--sp-gutter);margin-right:auto}
 html .top .badge,html .top .data-status{margin-left:0}
}
@media(min-width:901px){html .finance-bar,html .cm .cm-main{max-width:1320px;margin-inline:auto}}   /* Commission uses the same content width as every other page (its own CSS allowed 1720px, so its title sat 200px further left on a wide screen) */
html{scrollbar-gutter:stable}   /* at every width: content does not shift sideways between pages with and without a vertical scrollbar (on a phone with floating scrollbars it changes nothing) */

/* v147 round 2: the header keeps the same spots on every page: pages without the data-status icon keep an empty slot of the same size, so search and badge never shift */
.top .data-status-slot{display:none}
@media(min-width:901px){html .top .data-status-slot{display:block;flex:none;width:40px;height:40px;margin-left:0}}
/* freshness dot on every page (it was only styled in stock.css, which Marketing does not load) */
.page-fresh .stock-dot{width:7px;height:7px;border-radius:50%;background:var(--stock-accent,#46c39b);flex-shrink:0}
.page-fresh .stock-dot.is-stale{background:var(--stock-negative,#f28b82)}
html[data-theme=dark] .page-fresh .stock-dot{background:var(--stock-accent,#80cfb4)}
html[data-theme=dark] .page-fresh .stock-dot.is-stale{background:var(--stock-negative,#f1b17b)}
/* Marketing's old live-status row had 14px/20px margins that pushed the freshness label 7px below the other pages' label */
html .workspace-heading .workspace-live{margin:0}
/* Commission's month stepper is the same control as the date stepper elsewhere: 260x46, arrows at both ends, label centred in the space between them */
html .cm .month-picker{box-sizing:border-box;width:260px;height:46px;padding:0 4px;gap:0}
html .cm .month-picker .cm-month-pick{flex:1 1 auto;min-width:0;height:38px}
html .cm .month-picker .cm-step{height:38px}

/* v148: tapping a tab or area link answers at once: the new tab is active immediately and the old content fades while the next page loads (the delay keeps an instant, prefetched page from flickering) */
html[data-navigating] main{opacity:.55;transition:opacity .16s ease .12s}
@media(prefers-reduced-motion:reduce){html[data-navigating] main{transition:none;opacity:.7}}

/* v149 header width (owner feedback 2026-11-10): on a wide screen the header stretched edge to edge while the page content is a centred 1320px column.
   The header content now lives in the same column: logo starts where the page title starts, settings icon ends where the cards end. */
@media(min-width:901px){
 html .top{padding-inline:max(var(--sp-gutter),calc((100% - 1320px)/2 + var(--sp-gutter)))}
}

/* v158: Marketing's three views (Daily / Marketers / Customers) are a pill switch inside the control bar, not a second underlined tab row under the page tabs. */
html main.intelligence .workspace-controls .view-switch{display:inline-flex;flex:0 0 auto;align-self:flex-end;width:auto;max-width:100%;margin:0;padding:4px;gap:4px;border-radius:999px;border:0;box-shadow:none}
html main.intelligence .view-switch button{min-height:calc(var(--control-h,40px) - 8px);padding:0 16px;border:0;border-radius:999px;background:transparent;color:#4f6a7f;font-size:14px;font-weight:650;white-space:nowrap}
html main.intelligence .view-switch button[aria-selected=true]{color:#146ba8;background:#fff;box-shadow:0 2px 5px #183d5714}
html main.intelligence .view-switch.seg-host button[aria-selected=true]{background:transparent;box-shadow:none}
html[data-theme="dark"] main.intelligence .view-switch{background:#1b2f41}
html[data-theme="dark"] main.intelligence .view-switch button{color:#b1c2d4}
html[data-theme="dark"] main.intelligence .view-switch button[aria-selected=true]{color:#89c6f1;background:#29425e;box-shadow:none}
html[data-theme="dark"] main.intelligence .view-switch.seg-host button[aria-selected=true]{background:transparent}
@media(max-width:900px){
 html main.intelligence .workspace-controls{flex-wrap:wrap;row-gap:var(--sp-row)}   /* the older phone rule kept one nowrap row and pushed the date control off screen */
 html main.intelligence .workspace-controls .view-switch{display:flex;flex:1 1 100%;width:auto;order:0;background:transparent;border:1px solid var(--line);padding:3px}   /* outlined and shorter than the filled page-tab bar above, so the two never read as the same row */
 html main.intelligence .view-switch button{flex:1 1 0;min-width:0;min-height:36px;padding:0 8px;font-size:13px}
 html main.intelligence .workspace-controls .day-date-controls,html main.intelligence .workspace-controls .month-switch{order:1;flex:1 1 0;min-width:0;width:auto}   /* second line: date control with the Filters button beside it; the full-width switch above fits 'Pazarlamacılar' (v158 UX review) */
 html main.intelligence .workspace-controls .advanced{order:2}
 html main.intelligence .workspace-controls .customer-search{order:3}
}
