﻿/* Maizona ERP theme: green, black and white. Overrides Django admin colour variables. */

:root, html[data-theme="light"] {
  --erp-green: #1f7a35;
  --erp-green-dark: #145226;
  --erp-green-light: #e8f4ea;
  --erp-black: #141414;
  --erp-gold: #c9a227;
  --erp-red: #b00020;
  --erp-amber: #b26a00;

  --primary: var(--erp-green);
  --secondary: var(--erp-green-dark);
  --accent: #9fd3a8;
  --primary-fg: #ffffff;
  --body-fg: #1b1b1b;
  --body-bg: #ffffff;
  --body-quiet-color: #5d5d5d;
  --header-color: #ffffff;
  --header-branding-color: #ffffff;
  --header-bg: var(--erp-black);
  --header-link-color: #ffffff;
  --breadcrumbs-fg: #e9f5eb;
  --breadcrumbs-link-fg: #ffffff;
  --breadcrumbs-bg: var(--erp-green);
  --link-fg: var(--erp-green-dark);
  --link-hover-color: var(--erp-green);
  --link-selected-fg: var(--erp-green);
  --hairline-color: #e3e3e3;
  --border-color: #cfcfcf;
  --selected-bg: var(--erp-green-light);
  --selected-row: #f1f8f2;
  --button-fg: #ffffff;
  --button-bg: var(--erp-green);
  --button-hover-bg: var(--erp-green-dark);
  --default-button-bg: var(--erp-black);
  --default-button-hover-bg: #333333;
  --close-button-bg: #555555;
  --object-tools-bg: var(--erp-black);
  --object-tools-hover-bg: var(--erp-green);
  --darkened-bg: #f6f7f6;
  --erp-card-bg: #ffffff;
  --erp-nav-bg: #f4f6f4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --body-fg: #eeeeee; --body-bg: #101210; --body-quiet-color: #a8a8a8; --header-bg: #000000;
    --breadcrumbs-bg: var(--erp-green-dark); --link-fg: #7fd08f; --link-hover-color: #a6e3b1;
    --link-selected-fg: #7fd08f; --hairline-color: #2a2d2a; --border-color: #3a3d3a; --selected-bg: #1b3020;
    --selected-row: #18261b; --darkened-bg: #181b18; --erp-card-bg: #171a17; --erp-nav-bg: #0c0e0c;
  }
}
html[data-theme="dark"] {
  --body-fg: #eeeeee; --body-bg: #101210; --body-quiet-color: #a8a8a8; --header-bg: #000000;
  --breadcrumbs-bg: var(--erp-green-dark); --link-fg: #7fd08f; --link-hover-color: #a6e3b1;
  --link-selected-fg: #7fd08f; --hairline-color: #2a2d2a; --border-color: #3a3d3a; --selected-bg: #1b3020;
  --selected-row: #18261b; --darkened-bg: #181b18; --erp-card-bg: #171a17; --erp-nav-bg: #0c0e0c;
}

/* ---------------------------------------------------------------- header */
#header { border-bottom: 3px solid var(--erp-green); padding: 8px 24px; }
#branding h1 { display: flex; align-items: center; gap: 12px; font-weight: 700; }
#branding h1 a { display: flex; align-items: center; gap: 12px; }
#branding img.erp-logo { height: 42px; background: transparent; }
#branding .erp-sub { font-size: 12px; font-weight: 400; color: #9fd3a8; display: block; }
.module h2, .module caption, .inline-group h2 { background: var(--erp-green); }

/* ---------------------------------------------------------------- top module bar */
.erp-topbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 16px; background: var(--erp-green);
  border-bottom: 3px solid var(--erp-green-dark); }
.erp-top-btn { appearance: none; border: 0; cursor: pointer; padding: 9px 16px; border-radius: 6px;
  background: transparent; color: #fff !important; font: 700 13px/1 var(--font-family-primary, sans-serif);
  letter-spacing: .3px; text-transform: uppercase; text-decoration: none; }
.erp-top-btn:hover { background: var(--erp-green-dark); }
.erp-top-btn.active { background: var(--erp-black); box-shadow: inset 0 -3px 0 #9fd3a8; }

/* ---------------------------------------------------------------- left panel: screens of chosen module */
#nav-sidebar.erp-nav { background: var(--erp-nav-bg); border-right: 1px solid var(--hairline-color); padding: 10px 8px; }
#erp-nav-filter { width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border-color); background: var(--body-bg); color: var(--body-fg); }
.erp-side-group { display: none; margin-bottom: 8px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--hairline-color); background: var(--erp-card-bg); }
.erp-side-group.active, .erp-side-group.searching { display: block; }
.erp-side-title { padding: 10px 12px; font-weight: 700; font-size: 13px; letter-spacing: .3px;
  text-transform: uppercase; background: var(--erp-black); color: #fff; }
.erp-side-group ul { list-style: none; margin: 0; padding: 4px 0; }
.erp-side-group li { padding: 0; margin: 0; }
.erp-side-group li a { display: block; padding: 8px 14px 8px 16px; font-size: 13px; color: var(--body-fg);
  text-decoration: none; border-left: 3px solid transparent; }
.erp-side-group li a:hover { background: var(--selected-bg); border-left-color: var(--erp-green); }
.erp-side-group li.current a { background: var(--selected-bg); border-left-color: var(--erp-green); font-weight: 700;
  color: var(--link-fg); }
.erp-side-hint { font-size: 13px; color: var(--body-quiet-color); padding: 6px 4px; }
/* ---------------------------------------------------------------- dashboard */
/* Dashboard uses the whole screen width (Django limits it to 600px by default) */
.dashboard #content { width: auto; max-width: none; padding: 20px 28px; box-sizing: border-box; }
.dashboard #content-main { float: none; width: 100%; }
#content { max-width: none; }
.erp-dash { width: 100%; }
.erp-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.erp-hero { display: flex; align-items: center; gap: 20px; padding: 18px 22px; border-radius: 12px;
  background: linear-gradient(120deg, var(--erp-black) 0%, #1c2a1f 55%, var(--erp-green-dark) 100%); color: #fff;
  margin-bottom: 20px; }
.erp-hero img { height: 96px; background: transparent; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
/* logo left | company name centred | date right */
.erp-hero { display: grid; grid-template-columns: 1fr auto 1fr; }
.erp-hero-center { text-align: center; }
/* white letters with a red outline */
.erp-hero h1 { color: #9fd3a8; margin: 0; font-size: 44px; font-weight: 800; letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0,0,0,.45); }  /* same light green as the company name in the top corner */
.erp-hero p { margin: 6px 0 0; color: #cfe9d4; }
.erp-hero .erp-date { justify-self: end; text-align: right; font-size: 13px; color: #cfe9d4; }
@media (max-width: 760px) {
  .erp-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .erp-hero .erp-date { justify-self: center; text-align: center; }
}
.erp-section-title { font-size: 15px; font-weight: 700; margin: 22px 0 10px; color: var(--body-fg);
  border-left: 4px solid var(--erp-green); padding-left: 8px; }
.erp-quick { display: flex; flex-wrap: wrap; gap: 10px; }
.erp-btn { display: inline-block; padding: 10px 16px; border-radius: 8px; background: var(--erp-green); color: #fff !important;
  text-decoration: none; font-weight: 600; font-size: 13px; }
.erp-btn:hover { background: var(--erp-green-dark); }
.erp-btn.dark { background: var(--erp-black); }
.erp-btn.dark:hover { background: #333; }
.erp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.erp-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 10px;
  background: var(--erp-card-bg); border: 1px solid var(--hairline-color); border-left: 5px solid var(--erp-green);
  text-decoration: none; color: var(--body-fg) !important; }
.erp-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.erp-card .num { font-size: 28px; font-weight: 800; line-height: 1; }
.erp-card .lbl { font-size: 13px; font-weight: 600; }
.erp-card .hint { font-size: 12px; color: var(--body-quiet-color); }
.erp-card .go { font-size: 12px; font-weight: 700; color: var(--link-fg); margin-top: auto; }
.erp-card.red { border-left-color: var(--erp-red); }
.erp-card.red .num { color: var(--erp-red); }
.erp-card.amber { border-left-color: var(--erp-amber); }
.erp-card.amber .num { color: var(--erp-amber); }
.erp-card.ok .num { color: var(--erp-green); }
.erp-allclear { padding: 14px 16px; border-radius: 10px; background: var(--selected-bg); font-weight: 600; }

/* ---------------------------------------------------------------- login */
.login #header { justify-content: center; }
.login #container { border-top: 4px solid var(--erp-green); border-radius: 10px; }
.erp-login-logo { text-align: center; padding: 16px 0 0; }
.erp-login-logo img { max-width: 240px; }



/* ---------------------------------------------------------------- status colours in every list */
.erp-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700;
  white-space: nowrap; border: 1px solid transparent; }
.erp-badge a { color: inherit !important; }
.erp-badge.grey  { background: #eceeec; color: #444; border-color: #d0d4d0; }
.erp-badge.amber { background: #fff3dc; color: #8a5200; border-color: #f0c37a; }
.erp-badge.green { background: #e1f3e5; color: #145226; border-color: #9fd3a8; }
.erp-badge.red   { background: #fde8eb; color: #b00020; border-color: #f2a5b1; }
#result_list tr.erp-row-green td, #result_list tr.erp-row-green th { background: #f3faf4; }
#result_list tr.erp-row-red td, #result_list tr.erp-row-red th { background: #fdf3f4; color: #8a8a8a; }
#result_list tr.erp-row-amber td, #result_list tr.erp-row-amber th { background: #fffaf0; }
#result_list tr.erp-row-grey td, #result_list tr.erp-row-grey th { background: #ffffff; }
html[data-theme="dark"] #result_list tr.erp-row-green td { background: #15241a; }
html[data-theme="dark"] #result_list tr.erp-row-red td { background: #2a1517; }
html[data-theme="dark"] #result_list tr.erp-row-amber td { background: #2a2214; }

/* ---------------------------------------------------------------- order progress bar (PO / SO) */
.erp-prog { width: 190px; height: 10px; border-radius: 6px; background: #e3e6e3; overflow: hidden; margin-top: 2px; }
.erp-prog-bar { height: 100%; background: var(--erp-amber); }
.erp-prog.full .erp-prog-bar { background: var(--erp-green); }
.erp-prog.none .erp-prog-bar { width: 0 !important; }
.erp-prog-txt { font-size: 11.5px; color: var(--body-quiet-color); margin-top: 3px; white-space: nowrap; }

/* ---- Bigger, slightly bold text everywhere (owner's request) ---------------------------------------------- */
body { font-size: 16px; font-weight: 600; }
#content, #content p, #content li, .module td, .module th, fieldset .form-row, .help, .helptext,
.readonly, .breadcrumbs, .paginator, #changelist-filter, #changelist-filter a, .messagelist li { font-size: 15.5px; }
label, .aligned label, .form-row label { font-size: 15.5px; font-weight: 700; color: var(--body-fg); }
input, select, textarea, button, .button, input[type=submit], input[type=button],
.vTextField, .vIntegerField, .vDateField, .vTimeField, .vLargeTextField, .select2-container .select2-selection {
  font-size: 16px !important; font-weight: 600 !important; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=search], input[type=password],
select, textarea { padding: 7px 9px; min-height: 36px; }
#result_list td, #result_list th { font-size: 15.5px; padding: 9px 8px; }
#result_list thead th, #result_list thead th a { font-size: 14px; font-weight: 800; }
.inline-group td, .inline-group th { font-size: 15px; }
div.help, p.help, .help { font-weight: 500; color: var(--body-quiet-color); }
#content h1 { font-size: 26px; font-weight: 800; }
#content h2 { font-size: 19px; font-weight: 800; }
.erp-top-btn { font-size: 15px !important; }
.erp-side-title { font-size: 15px; }
.erp-side-group li a { font-size: 15px; font-weight: 600; }
.erp-badge { font-size: 14px; }
.erp-prog-txt { font-size: 13.5px; font-weight: 600; }
.erp-card .lbl { font-size: 15px; }
.erp-card .hint { font-size: 13.5px; font-weight: 500; }
table.rep td, table.rep th { font-size: 15.5px; }

/* Sub-headings inside a module's left panel (Reports > Accounts, Sales ...) */
.erp-side-group li.erp-side-sub { padding: 12px 12px 4px; font-size: 13px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--erp-green-dark); border-top: 1px solid var(--hairline-color); }
.erp-side-group li.erp-side-sub:first-child { border-top: 0; }

/* ---- Stronger status colours (owner: darker green and amber) ----------------------------------------------- */
.erp-badge.grey  { background: #5f6360; color: #ffffff; border-color: #5f6360; }
.erp-badge.amber { background: #b86e00; color: #ffffff; border-color: #b86e00; }
.erp-badge.green { background: #1b6e30; color: #ffffff; border-color: #1b6e30; }
.erp-badge.red   { background: #b00020; color: #ffffff; border-color: #b00020; }
#result_list tr.erp-row-green td, #result_list tr.erp-row-green th { background: #cfe9d5; }
#result_list tr.erp-row-amber td, #result_list tr.erp-row-amber th { background: #fbe0b0; }
#result_list tr.erp-row-red td, #result_list tr.erp-row-red th { background: #f5cdd3; color: #5a5a5a; }
#result_list tr.erp-row-grey td, #result_list tr.erp-row-grey th { background: #f1f2f1; }
#result_list tr.erp-row-green:hover td, #result_list tr.erp-row-amber:hover td { filter: brightness(0.96); }
.erp-prog { background: #cfd3cf; }
.erp-prog-bar { background: #b86e00; }
.erp-prog.full .erp-prog-bar { background: #1b6e30; }

/* Left panel: the panel itself does not scroll. Search box and module heading stay fixed at the top; only the
   list of screens under the heading scrolls. */
#nav-sidebar.erp-nav { display: flex; flex-direction: column; height: 100vh; max-height: 100vh; overflow: hidden;
  box-sizing: border-box; }
#erp-nav-filter { flex: 0 0 auto; }
.erp-side-group.active, .erp-side-group.searching { display: flex; flex-direction: column; min-height: 0;
  flex: 0 1 auto; }
.erp-side-title { flex: 0 0 auto; }
.erp-side-group ul { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.erp-side-hint { flex: 0 0 auto; }

/* Logo bar and green module bar stay at the top while the page scrolls; the left panel sits right under them */
#header { position: sticky; top: 0; z-index: 30; }
.erp-topbar { position: sticky; top: var(--erp-header-h, 60px); z-index: 29; }
#nav-sidebar.erp-nav { top: var(--erp-top-h, 110px) !important; }
@media print { #header, .erp-topbar { position: static; } }
nav[aria-label="Breadcrumbs"] { position: sticky; top: var(--erp-bar-bottom, 110px); z-index: 28; }
@media print { nav[aria-label="Breadcrumbs"] { position: static; } }

/* "+ Add" button beside the Search box on every list */
.erp-search-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--darkened-bg);
  border-top: 1px solid var(--hairline-color); border-bottom: 1px solid var(--hairline-color); padding-right: 10px; }
.erp-search-row #toolbar { border: 0; margin: 0; flex: 0 1 auto; background: transparent; }
.erp-search-row .erp-add-btn { flex: 0 0 auto; padding: 9px 18px; font-size: 15px; white-space: nowrap; }
.erp-search-row:not(:has(#toolbar)) { padding: 8px 10px; }

/* Lists: the column-name row (CODE, NAME, TYPE ...) stays visible under the top bars while the list scrolls */
#changelist .results, #changelist-form .results { overflow: visible !important; }
#result_list thead th { position: sticky; top: var(--erp-top-h, 110px); z-index: 5;
  background: var(--erp-nav-bg, #f4f6f4); box-shadow: inset 0 -2px 0 var(--erp-green); }
/* The page frame grows with the content, so the fixed top bars stay fixed on long lists too */
html, body { height: auto; min-height: 100%; }
#container { height: auto; min-height: 100vh; }

/* Filters: a compact row ABOVE the list (never on top of the table); each filter opens as a small drop-down */
#changelist.module { flex-direction: column; }
#changelist #changelist-filter { order: -1; flex: 0 0 auto; margin: 0 0 10px 0; display: flex; flex-wrap: wrap;
  align-items: flex-start; gap: 6px 14px; padding: 6px 10px; border-radius: 8px; position: relative; z-index: 6; }
#changelist-filter h2 { margin: 0; padding: 6px 10px; border-radius: 6px; font-size: 13px; align-self: center; }
#changelist-filter > p, #changelist-filter #changelist-filter-extra-actions { margin: 0; align-self: center; font-size: 13px; }
#changelist-filter details { position: relative; margin: 0; border: 1px solid var(--hairline-color); border-radius: 6px;
  background: var(--body-bg); }
#changelist-filter details > summary { padding: 6px 10px; margin: 0; cursor: pointer; white-space: nowrap; }
#changelist-filter details[open] > ul { position: absolute; left: 0; top: 100%; z-index: 20; min-width: 200px;
  max-height: 320px; overflow: auto; background: var(--body-bg); border: 1px solid var(--border-color);
  border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 6px 0; margin: 2px 0 0 0; }
#changelist-filter details:not([open]) > ul { display: none; }
#changelist .changelist-form-container { width: 100%; }

/* Sideways scrolling of a wide list: logo bar, module bar, breadcrumbs and the left panel stay where they are */
#container { width: fit-content; min-width: 100%; }  /* wider only when a list really needs it; text still wraps */
#header, .erp-topbar, nav[aria-label="Breadcrumbs"] { left: 0; width: var(--erp-vw, 100vw); box-sizing: border-box; }
#nav-sidebar.erp-nav { left: 0 !important; }
.main > #nav-sidebar { position: sticky; }

/* FI register: rows with an alert (expiring soon / low balance / expired) are shaded amber */
#result_list tr:has(.fi-warn) td { background: #fbf3d5 !important; }

/* ---- More room for work (laptop screens): slimmer logo bar, module bar always on one line -------------------- */
#header { padding: 4px 20px; }
#branding img.erp-logo { height: 34px; }
.erp-topbar { flex-wrap: wrap; padding: 4px 8px; gap: 1px; }
.erp-top-btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 8px; font-size: 13px !important; letter-spacing: .1px; }

/* Save buttons always visible at the bottom of the screen on long forms (no scrolling down to save) */
#content-main form > div > div.submit-row:last-of-type { position: sticky; bottom: 0; z-index: 20; margin-bottom: 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .12); }
@media print { #content-main form > div > div.submit-row:last-of-type { position: static; box-shadow: none; } }

/* Button boxes above a form (shipment folder ...) wrap inside the screen instead of running off to the right */
.erp-folder { max-width: calc(var(--erp-vw, 100vw) - 330px); box-sizing: border-box; }
.erp-folder .erp-btn { white-space: nowrap; }

/* Text boxes inside table-style lines are narrower so the page does not run off to the right */
.inline-group .tabular td input.vTextField { width: 170px; max-width: 100%; box-sizing: border-box; }
.inline-group .tabular td textarea { width: 200px; height: 2.6em; min-height: 0; box-sizing: border-box; }
.inline-group .tabular td input[type=file] { max-width: 220px; }
.inline-group .tabular td select { max-width: 200px; }
.inline-group .tabular td input.vTextField { width: 150px; }
.inline-group .tabular td input[type=file] { max-width: 190px; }
.inline-group .tabular td .related-widget-wrapper-link.delete-related,
.inline-group .tabular td .related-widget-wrapper-link.view-related { display: none; }
.inline-group .tabular td, .inline-group .tabular th { padding-left: 6px; padding-right: 6px; }
.main #content { padding-left: 20px; padding-right: 16px; }

/* Line tables (order lines, voucher lines, receipt lines ...): number, date and text boxes sized to their content */
.inline-group .tabular td input[type=number], .inline-group .tabular td input.vIntegerField,
.inline-group .tabular td input.vDecimalField, .inline-group .tabular td input.vBigIntegerField { width: 100px; }
.inline-group .tabular td input.vDateField { width: 105px; }
.inline-group .tabular td input.vTextField { width: 125px; }
/* list action bar never sticks out past the screen edge */
#changelist .actions { box-sizing: border-box; max-width: 100%; }
/* Lists: long text (names, item, status notes) wraps onto two lines instead of making the list very wide */
#result_list td, #result_list th { white-space: normal; }
#result_list td { max-width: 15em; overflow-wrap: anywhere; }
#result_list thead th { max-width: 9em; }
/* Line tables, tighter still: boxes measured with their padding, smaller search boxes, no pencil icon, calendar icon only */
.inline-group .tabular td input, .inline-group .tabular td select, .inline-group .tabular td textarea { box-sizing: border-box; }
.inline-group .tabular td input[type=number], .inline-group .tabular td input.vIntegerField,
.inline-group .tabular td input.vDecimalField, .inline-group .tabular td input.vBigIntegerField { width: 92px; }
.inline-group .tabular td input.vTextField { width: 115px; }
.inline-group .tabular td input.vDateField { width: 100px; }
.inline-group .tabular td .select2-container { width: 175px !important; }
.inline-group .tabular td .related-widget-wrapper-link.change-related { display: none; }
.inline-group .tabular td .datetimeshortcuts { font-size: 0; }
.inline-group .tabular td .datetimeshortcuts a:first-child { display: none; }
.inline-group .tabular td .datetimeshortcuts a:last-child { font-size: 13px; }
.inline-group .tabular td .select2-container { width: 155px !important; }
.inline-group .tabular td select:not(.admin-autocomplete) { max-width: 150px; }
.inline-group .tabular td input.vTextField { width: 100px; }
.inline-group .tabular td, .inline-group .tabular th { padding-left: 4px; padding-right: 4px; }
#result_list td { max-width: 11em; }
#result_list thead th { max-width: 7em; }
#result_list thead th .text, #result_list thead th .text a { white-space: normal; }
#result_list td .erp-badge { white-space: normal; max-width: 10em; line-height: 1.25; overflow-wrap: normal; }
#result_list td .erp-prog-txt { white-space: normal; }
/* never split a number or a word in the middle; progress bars stay inside their column */
#result_list td { overflow-wrap: normal; word-break: normal; }
#result_list td .erp-prog { max-width: 100%; box-sizing: border-box; }
#result_list td .erp-prog { width: 150px; }
.erp-top-btn { padding: 8px 6px; letter-spacing: 0; }
/* button columns in lists (Edit / Delete, Print ...) never squeeze onto two lines */
#result_list td:has(.erp-btn) { max-width: none; white-space: nowrap; }

/* ---- Dashboard charts (validated reference palette: series 1 blue, series 2 orange) ---------------------- */
.viz-root { color-scheme: light; --surface-1: #fcfcfb; --text-primary: #0b0b0b; --text-secondary: #52514e;
  --grid: #e6e5e1; --axis: #b9b8b2; --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --series-4: #eda100; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root { color-scheme: dark; --surface-1: #1a1a19;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --grid: #2e2e2c; --axis: #55554f;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; }
}
:root[data-theme="dark"] .viz-root { color-scheme: dark; --surface-1: #1a1a19; --text-primary: #f0efec;
  --text-secondary: #c3c2b7; --grid: #2e2e2c; --axis: #55554f; --series-1: #3987e5; --series-2: #d95926;
  --series-3: #199e70; --series-4: #c98500; }
.viz-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.viz-kpi { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 10px; padding: 12px 16px;
  text-decoration: none !important; display: flex; flex-direction: column; gap: 4px; }
.viz-kpi .lbl { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.viz-kpi .num { color: var(--text-primary); font-size: 24px; font-weight: 800; }
.viz-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; margin-bottom: 18px; }
.viz-card { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 10px; padding: 12px 14px; }
.viz-title { display: block; color: var(--text-primary) !important; font-weight: 800; font-size: 15px;
  margin-bottom: 6px; text-decoration: none; }
.viz-box svg { width: 100%; height: auto; display: block; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-axis { stroke: var(--axis); stroke-width: 1; }
.viz-tick { fill: var(--text-secondary); font-size: 11px; }
.viz-label { fill: var(--text-primary); font-size: 12.5px; font-weight: 600; }
.viz-value { fill: var(--text-secondary); font-size: 12px; font-weight: 600; }
.viz-legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.viz-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.viz-empty { color: var(--text-secondary); padding: 40px 0; text-align: center; }
.viz-tip { position: fixed; display: none; z-index: 9999; pointer-events: none; background: #1a1a19; color: #f0efec;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.viz-tip .viz-key { vertical-align: middle; }

/* Left panel: exactly the height of the window below the top bars, so the last screens can always be reached;
   the wheel scrolls the list (not the page) and the last item keeps some space under it */
#nav-sidebar.erp-nav { height: calc(100vh - var(--erp-top-h, 110px)) !important;
  max-height: calc(100vh - var(--erp-top-h, 110px)) !important; }
.erp-side-group ul { overscroll-behavior: contain; padding-bottom: 14px; }

/* Left panel buttons that open / close their screens (Inventory: Stock work / Items set-up / Stores and reports) */
.erp-side-group li.erp-side-fold { padding: 4px 6px 2px; }
.erp-side-group li.erp-side-fold button { width: 100%; text-align: left; border: 0; border-radius: 6px; cursor: pointer;
  padding: 9px 12px; background: #e3efe5; color: #145226; font-weight: 800; font-size: 14.5px; letter-spacing: .2px; }
.erp-side-group li.erp-side-fold button::before { content: "\25B8"; display: inline-block; width: 16px; }
.erp-side-group li.erp-side-fold.open button { background: #1f7a35; color: #fff; }
.erp-side-group li.erp-side-fold.open button::before { content: "\25BE"; }
.erp-side-group li.folded { display: none; }
.erp-side-group.searching li.folded { display: list-item; }
.erp-side-group li.erp-side-fold + li:not(.erp-side-fold) { margin-top: 2px; }

/* search everything (black header) */
#erp-search { display: inline-block; margin-right: 14px; vertical-align: middle; }
#erp-search input { width: 300px; max-width: 34vw; padding: 6px 10px; border-radius: 6px; border: 1px solid #555;
  background: #222; color: #fff; font-size: 14px; }
#erp-search input::placeholder { color: #aaa; }
/* My work (dashboard) */
.erp-mywork { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.erp-mw-card { border: 1px solid var(--hairline-color); border-radius: 10px; padding: 10px 14px; display: flex;
  flex-direction: column; gap: 5px; background: var(--body-bg); }
.erp-mw-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 15px;
  margin-bottom: 4px; }
.erp-mw-card > a { font-size: 14px; }
.erp-mw-none { color: var(--body-quiet-color); font-size: 14px; }

/* title row: '?' help and favourite star */
.erp-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.erp-title-row h1 { margin-right: 4px; }
.erp-fav { border: 0; background: none; cursor: pointer; font-size: 24px; color: #b9b8b2; padding: 0 2px; line-height: 1; }
.erp-fav.on { color: #e8a400; }
.erp-help { position: relative; }
.erp-help summary { list-style: none; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; background: #0b5cad;
  color: #fff; font-weight: 800; text-align: center; line-height: 24px; font-size: 14px; }
.erp-help summary::-webkit-details-marker { display: none; }
.erp-help > div { position: absolute; z-index: 40; top: 30px; left: 0; width: min(420px, 80vw); background: #fffbe6;
  color: #222; border: 1px solid #e8c766; border-radius: 8px; padding: 10px 12px; font-size: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15); }
/* header: favourites list */
.erp-favs { display: inline-block; position: relative; margin-right: 10px; vertical-align: middle; }
.erp-favs summary { list-style: none; cursor: pointer; color: #e8a400; font-size: 20px; }
.erp-favs summary::-webkit-details-marker { display: none; }
.erp-favs > div { position: absolute; right: 0; top: 28px; z-index: 50; background: #fff; border: 1px solid #ccc;
  border-radius: 8px; min-width: 260px; padding: 6px 0; box-shadow: 0 6px 18px rgba(0,0,0,.2); text-align: left; }
.erp-favs > div a, .erp-favs > div span { display: block; padding: 7px 14px; color: #111 !important; font-size: 14px;
  text-transform: none; letter-spacing: 0; }
.erp-favs > div a:hover { background: #eef5ef; }

/* Urdu option */
.erp-lang { display: inline-block; margin-right: 10px; padding: 3px 10px; border-radius: 6px; background: #1f7a35;
  color: #fff !important; font-weight: 700; vertical-align: middle; font-size: 14px; text-decoration: none; }
body.erp-ur .erp-top-btn, body.erp-ur .erp-side-group li a, body.erp-ur .erp-side-title,
body.erp-ur .erp-side-fold button, body.erp-ur .erp-section-title, body.erp-ur .erp-btn, body.erp-ur .erp-mw-head {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Segoe UI", sans-serif; letter-spacing: 0;
  text-transform: none; }
body.erp-ur .erp-side-group li a, body.erp-ur .erp-side-fold button { direction: rtl; text-align: right; }
body.erp-ur .erp-side-fold button::before { float: left; }
body.erp-ur .erp-top-btn { font-size: 14px !important; padding-top: 4px; padding-bottom: 4px; }

/* Purchase request lines: wide item box so the full product name shows */
.model-purchaserequest .field-item .select2-container { width: 560px !important; max-width: 70vw; }
.model-purchaserequest .field-item .select2-selection__rendered { white-space: normal !important; line-height: 1.3 !important; padding-top: 4px; padding-bottom: 4px; }
.model-purchaserequest .field-item .select2-selection--single { height: auto !important; min-height: 32px; }

/* GRN lines: wide item box so the full product name shows */
.model-stockreceipt .field-item .select2-container { width: 460px !important; max-width: 60vw; }
.model-stockreceipt .field-item .select2-selection__rendered { white-space: normal !important; line-height: 1.3 !important; padding-top: 4px; padding-bottom: 4px; }
.model-stockreceipt .field-item .select2-selection--single { height: auto !important; min-height: 32px; }


/* Dashboard (owner, 20 Nov 2026): needs-attention strip, today tiles, big coloured quick tiles */
.erp-hot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 10px 14px;
  background: #fff6f6; border: 1px solid #f0c8c8; border-radius: 10px; }
.erp-hot-title { font-weight: 800; color: #9b1c1c; margin-right: 4px; }
.erp-hot-pill { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 14px; text-decoration: none;
  color: #fff !important; }
.erp-hot-pill.red { background: #c62828; } .erp-hot-pill.amber { background: #b86e00; }
.erp-hot-pill:hover { filter: brightness(1.1); }
.erp-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.erp-today-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px;
  text-decoration: none; background: #fff; border: 1px solid #e3e3df; border-left: 6px solid #1f7a35;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.erp-today-tile .lbl { color: #555; font-weight: 600; font-size: 14px; }
.erp-today-tile .num { color: #111; font-weight: 800; font-size: 24px; }
.erp-today-tile.green { border-left-color: #1f7a35; } .erp-today-tile.amber { border-left-color: #b86e00; }
.erp-today-tile.red { border-left-color: #c62828; } .erp-today-tile.blue { border-left-color: #2a78d6; }
.erp-today-tile:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.erp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.erp-tile { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 10px;
  border-radius: 12px; color: #fff !important; font-weight: 800; font-size: 16px; text-align: center;
  text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.erp-tile:hover { filter: brightness(1.08); transform: translateY(-1px); }
.erp-tile.t-sale { background: #1f7a35; } .erp-tile.t-buy { background: #2a5fb0; }
.erp-tile.t-money { background: #b86e00; } .erp-tile.t-make { background: #6b3fa0; }

/* Stock transfer lines: wide item box so the full product name shows */
.model-stocktransfer .field-item .select2-container { width: 420px !important; max-width: 55vw; }
.model-stocktransfer .field-item .select2-selection__rendered { white-space: normal !important; line-height: 1.3 !important; }
.model-stocktransfer .field-item .select2-selection--single { height: auto !important; min-height: 32px; }
.model-stocktransfer .field-batch select { min-width: 260px; }

/* My colours button in the header */
.erp-colours-btn { display: inline-block; margin-right: 10px; font-size: 20px; text-decoration: none; vertical-align: middle; }


/* "Arrange my dashboard" (owner 21 Nov 2026) */
.erp-dash [data-item].dash-hidden { display: none !important; }
.erp-dash.dash-arranging [data-item].dash-hidden { display: inline-flex !important; opacity: .35; }
.erp-dash.dash-arranging .erp-dsec { outline: 2px dashed #9aa5b1; outline-offset: 4px; margin-bottom: 14px; cursor: move; }
.erp-dash.dash-arranging [data-item] { cursor: grab; position: relative; }
.dash-eye { position: absolute; top: -8px; right: -8px; background: #fff; border: 1px solid #9aa5b1; border-radius: 50%;
  width: 22px; height: 22px; font-size: 12px; line-height: 20px; text-align: center; cursor: pointer; z-index: 2; }

.erp-topbar .dash-top-move { outline: 2px dashed #fff; outline-offset: 2px; cursor: grab; }


/* announcements + slim alerts bar on every screen (owner 22 Nov 2026) */
.erp-announce { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 10px;
  margin: 0 0 12px; border: 1px solid; font-size: 1.05em; }
.erp-announce.red { background: #fdecec; border-color: #f3b4b4; color: #7a1010; }
.erp-announce.amber { background: #fff6e0; border-color: #f0d9a8; color: #6b4a00; }
.erp-announce.green { background: #e9f7ee; border-color: #b6e2c4; color: #1d5c33; }
.erp-announce-icon { font-size: 1.5em; line-height: 1; }
.erp-alertbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 16px;
  background: #fff8e6; border-bottom: 1px solid #f0d9a8; }
.erp-alertbar-title { font-weight: 700; color: #8a5a00; margin-right: 4px; }
.erp-alertbar .erp-hot-pill { font-size: .9em; padding: 2px 10px; }
