/* PPI ERP web pages, painted with the desktop app's branding (app/branding.py):
   Segoe UI, the cool grey page, white cards with a gentle edge, the purple
   module tab, 36 px table rows. One skin for office and floor; a page with
   data-mode="floor" (the production pages) only enlarges type and targets
   for a PC beside a scale. */
:root {
  --purple: #7A5AA6; --purple-ink: #ffffff; --grey: #5B6770; --border: #D3D8DD;
  --soft: #F7F7F7; --header: #F3F5F6; --ink: #253039; --muted: #5F6B75; --row-hi: #EEF1F3;
  --page: #EEF0F3; --card: #FFFFFF; --card-border: #D6DBE0; --tab: #E4E8EC; --tab-hover: #EBEEF1;
  --ok: #1f7a3f; --warn: #b26a00; --bad: #b3261e; --ok-bg: #e3f3e8; --warn-bg: #fff1dc; --bad-bg: #fde5e3;
  --radius: 4px; --row: 36px; --fs: 14px; --control: 34px;
}
html[data-mode="floor"] { --fs: 17px; --control: 50px; --row: 44px; }
* { box-sizing: border-box; }
html { font-size: var(--fs); }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink);
       background: var(--page); line-height: 1.4; }
a { color: var(--purple); }
/* ---- module tabs across the top, like the desktop ------------------------ */
header.top { background: var(--card); border-bottom: 1px solid var(--card-border); display: flex;
             align-items: flex-end; gap: .4rem; padding: .55rem 1rem 0; flex-wrap: wrap; }
header.top .brand { font-weight: 700; color: var(--grey); letter-spacing: .04em; padding: 0 .9rem .6rem 0; align-self: center; }
header.top nav { display: flex; gap: 3px; flex-wrap: wrap; }
header.top nav a { color: var(--grey); text-decoration: none; background: var(--tab); border: 1px solid var(--card-border);
                   border-bottom: none; border-radius: 4px 4px 0 0; padding: .45rem 1.1rem; min-width: 96px; text-align: center; }
header.top nav a:hover { background: var(--tab-hover); color: var(--ink); }
header.top nav a.on { background: var(--page); color: var(--ink); font-weight: 600; border-top: 3px solid var(--purple); padding-top: .32rem; margin-bottom: -1px; }
header.top .who { margin-left: auto; color: var(--muted); font-size: .9rem; display: flex; gap: .8rem; align-items: center; padding-bottom: .5rem; }
header.top form { display: inline; }
header.top .topsearch input { width: 15rem; min-height: 30px; padding: .2rem .6rem; font-size: .9rem; }
@media (max-width: 720px) { header.top .topsearch input { width: 9rem; } }
header.top .who button { min-height: 28px; padding: .15rem .7rem; font-size: .85rem; }
main { max-width: 1320px; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
h1 { font-size: 1.45rem; margin: .4rem 0 .9rem; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .85rem; margin: 0 0 .5rem; color: var(--grey); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sub, .muted { color: var(--muted); font-size: .93rem; }
.flash { padding: .6rem .9rem; border-radius: var(--radius); margin: .4rem 0 .9rem; font-weight: 600; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3c9; }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: #f3bdb8; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #f1d3a1; }
.grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
/* ---- cards = the desktop's group boxes ---------------------------------- */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: .8rem 1rem; overflow-x: auto; }
.card.accent { border-left: 4px solid var(--purple); }
.card.tile { text-decoration: none; color: inherit; display: block; }
.card.tile:hover { border-color: var(--purple); }
.tile .big { font-size: 1.3rem; font-weight: 700; }
.kpis { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: .3rem 0 .7rem; }
.kpi { min-width: 110px; }
.kpi .v { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
/* ---- tables = QTableView ------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--card); }
th { background: var(--header); color: var(--grey); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
     text-align: left; padding: .35rem .55rem; border-bottom: 1px solid var(--card-border); border-right: 1px solid #E3E7EA; }
th:last-child { border-right: none; }
td { padding: .3rem .55rem; border-bottom: 1px solid #E9ECEF; vertical-align: middle; height: var(--row); }
tr:nth-child(even) td { background: #F8F9FB; }
tr:hover td { background: var(--row-hi); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td b, .band, td.id { white-space: nowrap; }
tr.urgent td:first-child { border-left: 4px solid var(--bad); }
/* ---- forms = the desktop's inputs ---------------------------------------- */
form.inline { display: inline; }
.row, form .row { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: flex-end; margin-bottom: .5rem; }
label { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; font-size: 1rem; padding: .3rem .5rem; border: 1px solid var(--border);
                          border-radius: 3px; min-height: var(--control); background: var(--card); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 2px rgba(122, 90, 166, .18); }
input[type=number] { width: 8.5rem; font-variant-numeric: tabular-nums; }
input.wide, select.wide { min-width: 18rem; }
select { width: max-content; max-width: 100%; min-width: 8rem; }
textarea { min-height: 64px; min-width: 20rem; }
button, .btn { font: inherit; font-size: .95rem; font-weight: 600; padding: .3rem 1rem; min-height: var(--control);
               border-radius: 3px; border: 1px solid var(--card-border); background: var(--card); color: var(--ink);
               cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .btn:hover { border-color: var(--grey); background: #F7F8FA; }
form .row > button:last-child:not(.quiet):not(.danger):not(.ok), button.primary, .btn.primary, form > button:not(.quiet) {
  background: var(--purple); border-color: var(--purple); color: var(--purple-ink); }
form .row > button:last-child:not(.quiet):not(.danger):not(.ok):hover { background: #6A4C92; }
button.quiet, .btn.quiet { background: var(--card); color: var(--purple); border-color: var(--card-border); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small, .btn.small { min-height: calc(var(--control) - 8px); padding: .2rem .7rem; font-size: .88rem; }
.band { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; font-size: .82rem; }
.band.green { background: var(--ok-bg); color: var(--ok); }
.band.amber { background: var(--warn-bg); color: var(--warn); }
.band.red { background: var(--bad-bg); color: var(--bad); }
.band.unknown, .band.grey { background: #e9edf0; color: var(--muted); }
.down { background: var(--bad-bg); border-color: var(--bad); }
.live { background: #F3EEFA; border-color: var(--purple); }
.target { font-size: .93rem; color: var(--muted); }
.target b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stack > * + * { margin-top: .9rem; }
.login { max-width: 420px; margin: 4rem auto; }
.login input { width: 100%; }
.num { font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.mode { font-size: .8rem; color: var(--muted); }
@media (max-width: 720px) { main { padding: .8rem; } .grid.two { grid-template-columns: 1fr; } header.top nav a { min-width: 0; padding: .4rem .7rem; } }

/* Built-in help (web/help.py): a panel on the right, over the page. */
.help-btn { font-weight: 700; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(26rem, 100vw); overflow-y: auto; z-index: 50;
  background: var(--card); border-left: 1px solid var(--card-border); box-shadow: -6px 0 18px rgba(0,0,0,.12); padding: 1rem 1.1rem; }
.help-panel[hidden] { display: none; }
.help-panel .help-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.help-panel h4 { margin: .9rem 0 .3rem; }
.help-panel ol, .help-panel ul { padding-left: 1.2rem; margin: 0; }
.help-panel li { margin: .25rem 0; line-height: 1.4; }
.help-panel dt { font-weight: 700; margin-top: .45rem; }
.help-panel dd { margin: .1rem 0 0 0; line-height: 1.4; }
.guide-steps li { margin: .6rem 0; }

@media print { .help-panel, .help-btn { display: none !important; } }
