/* App chrome for the Gourmet Nut operating app. Tokens and gn- classes come from gn-house-style.css (copied whole).
   Look-specific layout lives in looks.css (data-look="a|b|c" on <html>). */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }

/* masthead: stays a light band in both themes (house rule), so its controls use fixed light colours */
.app-mast { color-scheme: light; }
.app-mast-in { max-width: none; padding-block: 8px; padding-inline: 16px; gap: 12px; }
.app-brand { display: flex; align-items: center; }
.app-brand:hover { text-decoration: none; }
.app-mast img { height: 30px; }
.app-product { font: 700 15px/1 var(--f-title); text-transform: uppercase; letter-spacing: .03em; color: #502C2C; padding-left: 12px; border-left: 2px solid #CFD4DA; }
.app-spacer { flex: 1 1 auto; }
.app-mast .gn-pill { font-size: 12.5px; }
.app-toplink { color: #882030; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.app-count { display: inline-block; min-width: 1.6em; margin-left: 5px; padding: 0 5px; background: #F6E7E9; color: #882030; border-radius: 9px; text-align: center; font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.app-count:empty { display: none; }
.app-btn, .app-viewas select { font: 600 13px/1.2 var(--f-body); color: #1E1A19; background: #FFFFFF; border: 1px solid #8A9099; border-radius: 3px; padding: 5px 9px; cursor: pointer; }
.app-btn:hover, .app-viewas select:hover { border-color: #882030; }
.app-viewas { font-size: 13px; color: #574F4C; display: inline-flex; align-items: center; gap: 6px; }
.app-viewas select { max-width: 230px; }

/* body: navigation + content */
.app-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 0; }
.app-nav { overflow: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 8px 0 24px; }
.nav-home { display: block; }
.nav-group h2 { font: 700 14px/1.2 var(--f-title); text-transform: uppercase; letter-spacing: .02em; color: var(--gn-wine); margin: 16px 16px 4px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 6px 16px; color: var(--ink); border-left: 3px solid transparent; font-size: 14px; line-height: 1.3; }
.nav-item:hover { background: var(--head); text-decoration: none; }
.nav-item[aria-current="page"] { border-left-color: var(--gn-wine); background: var(--gn-wine-soft); color: var(--gn-wine); font-weight: 600; }
.nav-flag { margin-left: auto; }
.nav-flag.gn-pill { font-size: 11.5px; padding: 0 6px; }
.app-main { overflow: auto; padding: 20px 24px var(--gn-float-h); min-width: 0; }
.app-main:focus { outline: none; }
.app-main > * + * { margin-top: 22px; }
.app-main.is-frame { padding: 0 0 var(--gn-float-h); overflow: hidden; }
.app-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }

/* screen header drawn by the shell for native screens */
.screen-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.screen-head .gn-title { font-size: 28px; }
.screen-source { flex-basis: 100%; margin: -2px 0 0; color: var(--muted); font-size: 13px; max-width: 110ch; }
/* ui-1 X5: a native screen that draws its own head (.g-screen) hides the shell's title row, Source paragraph and chip even when view buttons sit between the two (grammar.css has the adjacent form, which the
   buttons break). The screen keeps its own title, chip and About drawer; the Source sentence stays one hover away on that title (shell.js). */
.screen-head:has(~ .screen-body .g-screen) { display: none; }
/* the one short source line of a framed view, between the purpose line and the view buttons (shell.js viewSource): full sentence in the hover */
.app-main.is-frame > .view-source { flex: none; margin: 0; max-width: none; padding: 2px 14px 0; background: var(--surface); line-height: 1.35; }
@media (min-width: 821px) { .app-main.is-frame > .view-source { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
@media (max-width: 820px) { .app-main.is-frame > .view-source { padding: 4px 12px; } }
.gn-lede { margin-top: 4px; }

/* tables inside screens */
.app-main .gn-table td, .app-main .gn-table th { padding: 6px 9px; }
.cell-wrap { max-width: 46ch; overflow-wrap: anywhere; }
.cell-src { cursor: pointer; }   /* a clickable cell (the System screen's Source cell: click, Enter or Space opens the full line) */
.cell-src:hover { background: var(--surface-2); }
.row-actions { white-space: nowrap; }
.app-btn.small { padding: 3px 9px; font-size: 12.5px; }
.app-main .app-btn { background: var(--surface); color: var(--ink); border-color: var(--muted); }
.app-main .app-btn:hover { border-color: var(--gn-wine); color: var(--gn-wine); }
.filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.filters label { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); }
.filters select { font: 14px var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--muted); border-radius: 3px; padding: 4px 8px; }
.banner { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gn-wine); padding: 10px 14px; font-size: 14px; }
.banner b { color: var(--gn-wine); }
.empty { padding: 18px 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.raw-json { margin: 4px 0 0; padding: 6px 8px; background: var(--head); border: 1px solid var(--line); font: 12px/1.4 Consolas, monospace; overflow: auto; max-height: 240px; white-space: pre-wrap; }  /* the raw change under a staged request */

/* Requests (Round W, W3): the Send to NetSuite dialog. Tokens only. */
.req-dialog { border: 1px solid var(--line-strong, var(--muted)); border-left: 4px solid var(--gn-wine); background: var(--surface); color: var(--ink); padding: 14px 18px; width: min(460px, calc(100vw - 28px)); font-size: 14px; }
.req-dialog::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
.req-dialog h2 { margin: 0 0 8px; }
.req-dialog p { margin: 6px 0; }
.req-field { display: grid; gap: 4px; margin: 10px 0 6px; font-size: 13.5px; color: var(--muted); }
.req-input { font: 14px var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--muted); border-radius: 3px; padding: 6px 8px; width: 100%; box-sizing: border-box; }
.req-check { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 14px; }
.req-out { min-height: 1.4em; margin: 8px 0; font-size: 14px; }
.req-out.ok { color: var(--ok); font-weight: 600; }
.req-out.bad { color: var(--bad); font-weight: 600; }
.req-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.req-table { min-width: 880px; }
.req-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* polish-5 (B-13): Requests on a phone. At 820px and under (where the shell turns to the phone layout) each request is a stacked card: the table's header row stays for a screen reader,
   each cell prints its column's name (data-label) beside its value, empty cells are left out, the page never scrolls sideways, and every button is 44px tall so a thumb finds it. Tokens only. */
@media (max-width: 820px) {
  .app-main .req-table.gn-table { display: block; min-width: 0; border: 0; background: transparent; }
  .app-main .req-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app-main .req-table tbody { display: grid; gap: 10px; }
  .app-main .req-table tr { display: grid; gap: 7px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-strong); }
  .app-main .req-table tr.new { background: var(--new); }
  html[data-look] .app-main:not(.is-frame) .req-table.gn-table td { display: block; position: relative; min-width: 0; max-width: none; padding: 0 0 0 6.5em; border: 0; text-align: left; white-space: normal; background: transparent; }
  html[data-look] .app-main:not(.is-frame) .req-table.gn-table td::before { content: attr(data-label); position: absolute; left: 0; top: 0; width: 6em; color: var(--muted); font-size: 12.5px; font-weight: 600; }
  html[data-look] .app-main:not(.is-frame) .req-table.gn-table td[data-empty] { display: none; }
  html[data-look] .app-main:not(.is-frame) .req-table.gn-table td.row-actions { padding: 4px 0 0; }
  html[data-look] .app-main:not(.is-frame) .req-table.gn-table td.row-actions::before { content: none; }
  .app-main .req-table pre { max-width: 100%; }
  .req-actions { gap: 8px; }
  .req-actions .app-btn, .req-btns .app-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding-inline: 14px; font-size: 14px; }
  .req-btns .app-btn { flex: 1 1 0; }
  .req-root .filters select { min-height: 40px; }
  .app-mast .gn-pill { white-space: normal; max-width: 100%; }   /* polish-5: the masthead's long "Held · ..." pill wraps instead of widening the page, on every screen's phone masthead */
}

/* polish-4: places. The menu is Today + five places + one collapsed System; each place's tabs are a strip at the top of its screens (shell.js placeStrip),
   the second level (Round 2's view strip) sits under it. Tokens only: every look and both themes set --line, --muted, --ink, --gn-wine, --surface. */
.place-tabs { display: flex; flex-wrap: nowrap; gap: 2px; align-items: flex-end; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-bottom: var(--k-rule, 1px) solid var(--line); }
.place-tab { flex: none; margin-bottom: calc(-1 * var(--k-rule, 1px)); padding: 8px 16px 7px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.place-tab:hover { color: var(--ink); border-bottom-color: var(--line-strong, var(--line)); text-decoration: none; }
.place-tab[aria-selected="true"] { color: var(--gn-wine); border-bottom-color: var(--gn-wine); }
.place-tab:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: -2px; }
.place-tab[data-link]::after { content: "\2192"; margin-left: 6px; font-weight: 400; }   /* a link out of this place (Trucks lives in Model) */
.app-main:not(.is-frame) > .place-tabs + * { margin-top: 14px; }
.app-main.is-frame > .place-tabs { padding: 0 14px; background: var(--surface); }
.app-main.is-frame.has-places { display: flex; flex-direction: column; overflow: hidden; }
.app-main.is-frame.has-places > .app-frame { flex: 1 1 auto; min-height: 0; height: auto; }
.nav-system { border-top: 1px solid var(--line); margin-top: 12px; }
.nav-system > summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; padding: 10px 16px 6px; font: 700 14px/1.2 var(--f-title); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.nav-system > summary::-webkit-details-marker { display: none; }
.nav-system > summary::after { content: "+"; font-weight: 400; }
.nav-system[open] > summary::after { content: "\2212"; }
.nav-system > summary:hover, .nav-system[open] > summary { color: var(--gn-wine); }
.nav-system > summary:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: -2px; }
.nav-system-items .nav-item { padding-left: 24px; }
/* Look B puts the menu on a top bar: System is the last entry, its items a pop-down under it */
html[data-look="b"] .nav-system-group { margin-left: auto; }
html[data-look="b"] .nav-system { position: relative; margin: 0; border-top: 0; }
html[data-look="b"] .nav-system > summary { padding: 14px 14px 12px; font: 500 14.5px/1.2 var(--f-body); text-transform: none; letter-spacing: 0; gap: 8px; }
html[data-look="b"] .nav-system-items { position: absolute; top: 100%; right: 0; z-index: 60; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--pop-shadow, none); }
html[data-look="b"] .nav-system-items .nav-item { padding: 9px 14px; white-space: nowrap; }

/* toast */
.app-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 9500; background: var(--ink); color: var(--bg); padding: 9px 16px; font-size: 14px; font-weight: 600; border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.3); max-width: 90vw; }

/* phones: the rail becomes a scrolling strip */
@media (max-width: 820px) {
  body { overflow: auto; display: block; height: auto; }
  .app-body { display: block; }
  .app-nav { display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group { display: flex; align-items: center; flex: none; }
  .nav-group h2 { margin: 0 6px 0 12px; border: 0; padding: 0; white-space: nowrap; }
  .nav-item { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 10px 10px; }
  .nav-item[aria-current="page"] { border-bottom-color: var(--gn-wine); }
  .app-main { padding: 14px 12px var(--gn-float-h); overflow: visible; }
  .app-main.is-frame { height: 80vh; }
  .app-product, .app-viewas { font-size: 12px; }
  .nav-system { margin: 0; border-top: 0; display: flex; align-items: center; }
  .nav-system > summary { white-space: nowrap; padding: 10px 10px; }
  .nav-system-items { display: flex; }
  .nav-system-items .nav-item { padding-left: 10px; }
  html[data-look="b"] .nav-system-items { position: static; display: flex; padding: 0; border: 0; box-shadow: none; }
}

/* ui-1 (A): the data pill is a button that opens the list of data feeds (web/age-pill.js). The list is one line per feed: its name, its state in a word the pill uses everywhere, then what that means. */
#agePill[role="button"] { cursor: pointer; }
#agePill[role="button"]:hover, #agePill[aria-expanded="true"] { border-color: currentColor; }
#agePill[role="button"]:focus-visible, .lk-timeline .tl-more:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: 2px; }
.age-pop { position: fixed; z-index: 9400; max-height: calc(100vh - 80px); overflow: auto; box-sizing: border-box; padding: 12px 14px 10px; background: var(--surface, #fff); color: var(--ink, #1E1A19); border: 1px solid var(--line, #CFD4DA); border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.22); font-size: 13px; line-height: 1.35; }
.age-pop:focus { outline: none; }
.age-pop .age-title { margin: 0 0 2px; font: 700 14px/1.2 var(--f-title); text-transform: uppercase; letter-spacing: .02em; color: var(--gn-wine); }
.age-pop .age-note, .age-pop .age-foot { margin: 0 0 8px; color: var(--muted, #574F4C); font-size: 12.5px; }
.age-pop .age-foot { margin: 8px 0 0; }
.age-pop .age-lines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line, #CFD4DA); }
.age-pop .age-line { display: grid; grid-template-columns: minmax(7.5em, auto) auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line, #CFD4DA); }
.age-pop .age-name { font-weight: 700; }
.age-pop .age-word { font-size: 12px; padding: 1px 7px; white-space: nowrap; justify-self: start; }
.age-pop .age-text { color: var(--ink, #1E1A19); }
@media (max-width: 820px) {
  .age-pop .age-line { grid-template-columns: auto minmax(0, 1fr); }
  .age-pop .age-text { grid-column: 1 / -1; }
}

/* ui-1 (B): the purpose line (shell.js purposeLine): one muted line right under the place tab strip (first in the screen when the place has one tab), above the screen's own title row, the same
   on every screen. On a wide screen it stays one line (ellipsis, never a second row); on a phone it may wrap but never widens the page. Tokens only, so every look and both themes get >= 4.5:1. */
.place-purpose { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.35; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.app-main:not(.is-frame) > .place-purpose, .app-main:not(.is-frame) > .place-tabs + .place-purpose { margin-top: 8px; }
.app-main:not(.is-frame) > .place-purpose + * { margin-top: 12px; }
.app-main.is-frame > .place-purpose { flex: none; padding: 6px 14px; background: var(--surface); border-bottom: var(--k-rule, 1px) solid var(--line); }
.app-main.is-frame.has-purpose { display: flex; flex-direction: column; overflow: hidden; }
.app-main.is-frame.has-purpose:not(.has-panel) > .app-frame { flex: 1 1 auto; min-height: 0; height: auto; }
@media (min-width: 821px) { .place-purpose { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
@media (max-width: 820px) { .app-main.is-frame > .place-purpose { padding: 6px 12px; } }

/* ui-2 I2 (L29): the floating "Point at something" (and, for the owner, "Ask") buttons sit 18px above the window's bottom edge and are about 40px tall. Every screen, framed or not, leaves that much room
   under its last row (the page's bottom padding is the buttons' height), so the pair never covers a row. */
:root { --gn-float-h: 64px; }
/* one Ask entry per screen: the screen's own head button when it has one (it carries what the reader is looking at), the floating one when it has not. Ask runs for the owner only: any other role gets neither. */
html[data-ask="off"] .g-ask, html[data-ask="off"] .gn-ask-btn { display: none; }
html:has(#main .g-ask) .gn-ask-btn { display: none; }

/* ui-2 I2: a link that leaves the app (NetSuite) ends in an outward arrow: one rule. A link that already draws its own (a menu entry, a search offer) carries data-noarrow or is a menu entry. The word joiner keeps the
   arrow on the line of the last letters, so a record number is never split from it. Framed pages get the same rule from shell.js (arrowIn). */
a[href*="netsuite.com"]:not([data-noarrow]):not(.nav-item):not(.place-tab)::after { content: "\2060\2197"; margin-left: .15em; font-size: .9em; }

/* ui-2 I2 (L30): at 600px and under Look, Theme and View as fold into one Settings button (shell.js installMastMenu moves the three controls into its panel). It sits on the logo's row; the data pill and
   the links start the next row. Wider than 600px the button does not show and the controls sit where they always did. */
.app-more { display: none; position: relative; margin-left: auto; }
.app-more-panel { position: absolute; z-index: 95; top: calc(100% + 6px); right: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; box-sizing: border-box; width: max-content; max-width: calc(100vw - 20px);
  padding: 10px 12px; background: var(--mast-bg, #fff); color: var(--mast-ink, #1E1A19); border: 1px solid var(--mast-line, #CFD4DA); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.app-more-btn[aria-expanded="true"] { border-color: var(--gn-wine); color: var(--gn-wine); }
@media (max-width: 600px) {
  .app-more { display: block; }
  .app-mast-in .app-spacer { flex: 1 0 100%; height: 0; }
  .app-more-panel .app-viewas { flex-wrap: wrap; }
  .app-more-panel .app-viewas select { max-width: calc(100vw - 64px); }
}
