/*
  Regenesis desk brand layer for Frappe v16 desk (erp.regenesispod.com).
  Served as /files/regenesis-desk.css and injected before </head> by nginx sub_filter.
  Works only through Frappe's own CSS variables plus a few narrow rules, so forms,
  lists, reports and dialogs keep their layout. The Regenesis screens and the Shop
  Floor Kiosk live in shadow DOM and define their own tokens (--bg, --ink, --accent...),
  so nothing here uses those names. Our private tokens are prefixed --rg-.
  Brand pack: Gold #AC843E, Slate #5B7A8C, Dark Slate #4E6776, Warm Chrome #E0E7EB,
  Warm Beige #EDE6DA, Pale Gold #F3E2C4, Pearl #F3F0EB, font Outfit.
  Dark register = the kiosk surfaces #20272F / #1A2027 / #27303A.
  Remove the nginx sub_filter line to switch the whole layer off.
*/
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ---------- LIGHT (default, and any non dark theme) ---------- */
html:not([data-theme="dark"]) {
  --rg-gold: #AC843E;
  --rg-gold-hover: #BD9550;
  --rg-gold-active: #C9A15E;
  --rg-gold-deep: #8A672A;
  --rg-on-gold: #1E1808;
  --rg-slate: #4E6776;
  --rg-slate-hover: #5B7A8C;
  --rg-gold-line: rgba(172, 132, 62, 0.35);
  --rg-focus: 0 0 0 2px rgba(172, 132, 62, 0.5);

  --font-stack: "Outfit", "InterVariable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* type */
  --heading-color: #1E1C18;
  --text-color: #24221E;
  --text-muted: #4F4A42;
  --text-light: #6B655B;
  --text-neutral: #24221E;
  --ink-gray-8: #3A362F;
  --ink-gray-9: #24221E;

  /* layout surfaces: pearl page, white cards, beige controls */
  --bg-color: #F3F0EB;
  --fg-color: #FFFFFF;
  --card-bg: #FFFFFF;
  --modal-bg: #FFFFFF;
  --popover-bg: #FFFFFF;
  --toast-bg: #FFFFFF;
  --navbar-bg: #FBF9F6;
  --subtle-accent: #F7F4EF;
  --subtle-fg: #EDE6DA;
  --fg-hover-color: #F5EFE4;
  --highlight-color: #F7F4EF;
  --control-bg: #F1EDE6;
  --control-bg-on-gray: #E9E2D6;
  --disabled-control-bg: #F5F2ED;
  --input-disabled-bg: #ECE7DF;
  --awesomebar-focus-bg: #FFFFFF;
  --awesomplete-hover-bg: #F1EDE6;
  --placeholder-color: #F7F4EF;
  --skeleton-bg: #EDE6DA;

  --surface-menu-bar: #F7F3EC;
  --surface-white: #FFFFFF;
  --surface-modal: #FFFFFF;
  --surface-gray-1: #F7F4EF;
  --surface-gray-2: #F1EDE6;
  --surface-gray-3: #EAE4DA;
  --surface-gray-4: #E0D7C7;

  /* borders */
  --border-color: #E6DFD3;
  --dark-border-color: #D6CCBB;
  --table-border-color: #E6DFD3;
  --btn-group-border-color: #D6CCBB;
  --outline-gray-1: #ECE6DC;
  --outline-gray-2: #E3DBCD;
  --outline-gray-3: #CFC4B2;

  /* buttons: gold primary with dark ink, beige default */
  --primary: #AC843E;
  --primary-color: #24221E;
  --btn-primary: #AC843E;
  --border-primary: #AC843E;
  --btn-default-bg: #EDE6DA;
  --btn-default-hover-bg: #E0D5C2;
  --btn-ghost-hover-bg: #EDE6DA;

  /* sidebar */
  --sidebar-hover-color: #EFE8DC;
  --sidebar-active-color: #FFFFFF;
  --sidebar-border-color: #E6DFD3;
  --sidebar-select-color: #EDE6DA;
  --divider-color: #E6DFD3;

  /* focus, checkbox, progress, dates */
  --focus-default: 0 0 0 2px rgba(172, 132, 62, 0.5);
  --checkbox-focus-shadow: 0 0 0 2px rgba(172, 132, 62, 0.5);
  --checkbox-gradient: linear-gradient(180deg, #8A672A -124.51%, #8A672A 100%);
  --progress-bar-bg: #AC843E;
  --date-active-bg: #AC843E;
  --date-active-text: #1E1808;
  --highlight-shadow: 1px 1px 10px rgba(172, 132, 62, 0.25), 0 0 4px #AC843E;

  --scrollbar-thumb-color: #CFC4B2;
  --scrollbar-track-color: #EDE6DA;
}

/* ---------- DARK (kiosk register) ---------- */
html[data-theme="dark"] {
  --rg-gold: #C79A4E;
  --rg-gold-hover: #D4AA62;
  --rg-gold-active: #DDB878;
  --rg-gold-deep: #C79A4E;
  --rg-on-gold: #1E1808;
  --rg-slate: #5B7A8C;
  --rg-slate-hover: #4E6776;
  --rg-gold-line: rgba(172, 132, 62, 0.3);
  --rg-focus: 0 0 0 2px rgba(199, 154, 78, 0.55);

  --font-stack: "Outfit", "InterVariable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --gray-700: #2E3843;
  --gray-800: #27303A;
  --gray-900: #1A2027;

  --heading-color: #F3F0EB;
  --text-color: #F3F0EB;
  --text-neutral: #F3F0EB;
  --text-muted: #C2C8CD;
  --text-light: #9AA3AB;
  --ink-gray-8: #DCDFE2;
  --ink-gray-9: #F3F0EB;
  --icon-stroke: #B9C0C6;

  --bg-color: #1A2027;
  --fg-color: #20272F;
  --card-bg: #20272F;
  --modal-bg: #20272F;
  --popover-bg: #20272F;
  --toast-bg: #20272F;
  --navbar-bg: #1A2027;
  --subtle-accent: #232B34;
  --subtle-fg: #27303A;
  --fg-hover-color: #27303A;
  --highlight-color: #27303A;
  --control-bg: #27303A;
  --control-bg-on-gray: #2E3843;
  --disabled-control-bg: #232B34;
  --awesomebar-focus-bg: #27303A;
  --awesomplete-hover-bg: #2E3843;
  --placeholder-color: #27303A;
  --skeleton-bg: #27303A;

  --surface-menu-bar: #1A2027;
  --surface-white: #1A2027;
  --surface-cards: #20272F;
  --surface-modal: #20272F;
  --surface-selected: #3A4652;
  --surface-gray-1: #20272F;
  --surface-gray-2: #27303A;
  --surface-gray-3: #2E3843;
  --surface-gray-4: #3A4652;

  --border-color: #2C3640;
  --dark-border-color: #3A4652;
  --table-border-color: #2C3640;
  --btn-group-border-color: #3A4652;
  --outline-gray-1: #2C3640;
  --outline-gray-2: #3A4652;
  --outline-gray-3: #46525E;

  --primary: #C79A4E;
  --btn-primary: #C79A4E;
  --border-primary: #C79A4E;
  --btn-default-bg: #27303A;
  --btn-default-hover-bg: #323D49;
  --btn-ghost-hover-bg: #27303A;

  --sidebar-hover-color: #27303A;
  --sidebar-active-color: #2E3843;
  --sidebar-border-color: #2C3640;
  --sidebar-select-color: #27303A;
  --divider-color: #2C3640;

  --focus-default: 0 0 0 2px rgba(199, 154, 78, 0.55);
  --checkbox-focus-shadow: 0 0 0 2px rgba(199, 154, 78, 0.55);
  --checkbox-gradient: linear-gradient(180deg, #C79A4E -124.51%, #C79A4E 100%);
  --progress-bar-bg: #C79A4E;
  --date-active-bg: #C79A4E;
  --date-active-text: #1E1808;
  --highlight-shadow: 1px 1px 10px rgba(199, 154, 78, 0.2), 0 0 4px #C79A4E;
  --shadow-base: 0 4px 8px rgba(0, 0, 0, 0.25), 0 0 4px rgba(0, 0, 0, 0.3);

  --scrollbar-thumb-color: #3A4652;
  --scrollbar-track-color: #20272F;
}
/* Frappe re-scopes these two inside dialogs and grid rows in dark mode; keep them on palette. */
html[data-theme="dark"] .modal,
html[data-theme="dark"] .form-in-grid {
  --control-bg: #27303A;
  --border-color: #2C3640;
}
html[data-theme="dark"] .grid-body .editable-row {
  --control-bg: #20272F;
  --input-disabled-bg: #27303A;
}

/* ---------- Type ---------- */
html body {
  font-family: var(--font-stack);
}
html body .form-control,
html body .btn,
html body .dropdown-menu,
html body .frappe-control,
html body .ql-editor,
html body .dt-cell__content,
html body .datatable,
html body .awesomplete {
  font-family: var(--font-stack);
}

/* ---------- Buttons ---------- */
.btn.btn-primary,
.btn.btn-primary:focus {
  background-color: var(--rg-gold);
  border-color: transparent;
  color: var(--rg-on-gold);
  --icon-stroke: currentColor;
  --icon-fill-bg: var(--rg-gold);
}
.btn.btn-primary:hover {
  background-color: var(--rg-gold-hover);
  color: var(--rg-on-gold);
}
.btn.btn-primary:active,
.btn.btn-primary.active {
  background-color: var(--rg-gold-active) !important;
  color: var(--rg-on-gold) !important;
}
.btn.btn-primary:disabled,
.btn.btn-primary.disabled {
  color: var(--rg-on-gold);
  opacity: 0.55;
}
.btn.btn-secondary {
  background-color: var(--rg-slate);
  border-color: transparent;
  color: #FFFFFF;
}
.btn.btn-secondary:hover {
  background-color: var(--rg-slate-hover);
  color: #FFFFFF;
}

/* ---------- Focus rings (gold, keyboard visible) ---------- */
.btn:focus-visible,
.form-control:focus,
.frappe-control .form-control:focus,
.awesomplete input:focus,
.search-bar input:focus,
a:focus-visible,
.standard-sidebar-item .item-anchor:focus-visible {
  box-shadow: var(--rg-focus) !important;
  outline: none;
}

/* ---------- Checkbox / switch accents ---------- */
input[type="checkbox"]:checked {
  background-color: var(--rg-gold-deep);
}
.switch input:checked + .slider,
.form-switch .form-check-input:checked {
  background-color: var(--rg-gold-deep);
  border-color: var(--rg-gold-deep);
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--rg-gold-line);
}

/* ---------- Sidebar ---------- */
.body-sidebar {
  background: var(--surface-menu-bar);
}
.body-sidebar .active-sidebar,
.desk-sidebar .standard-sidebar-item.selected {
  box-shadow: inset 2px 0 0 var(--rg-gold), var(--shadow-sm);
}

/* ---------- Page head and links ---------- */
.page-head {
  border-bottom-color: var(--border-color);
}
.page-title .title-text {
  font-weight: 500;
  letter-spacing: -0.005em;
}
.frappe-control a:not(.btn):hover,
.like-disabled-input a:hover {
  color: var(--rg-gold-deep);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(172, 132, 62, 0.28);
  color: inherit;
}

/* ---------- Progress ---------- */
.progress-bar {
  background-color: var(--rg-gold);
}

/* =====================================================================================
   FRAME (unify stream "frame"): boot splash, icon Desktop, sidebar header, page chrome,
   not found / not permitted pages, dialogs, toasts, list and form chrome, web 404.
   Class names verified against the v16.17 desk sources in the backend container:
   templates/includes/splash_screen.html, desk/page/desktop/desktop.{html,js,css},
   public/js/frappe/ui/desktop_icon.html, ui/sidebar/sidebar_header.html,
   views/pageview.js (show_message_page), ui/messages.js, ui/alert, www/404.html.
   ===================================================================================== */
html:not([data-theme="dark"]) {
  --rg-tile-hover: rgba(172, 132, 62, 0.08);
  --rg-tile-shadow: 0 1px 2px rgba(40, 34, 24, 0.10), 0 6px 16px rgba(40, 34, 24, 0.08);
  --rg-gold-tile: linear-gradient(150deg, #C9A262 0%, #AC843E 52%, #8F6C2E 100%);
  --rg-module-filter: saturate(0.24) brightness(0.96);
  /* light: the coloured lockup with a stronger Slate to Gold mark (4 Oct); the plain one read faintly on Pearl */
  --rg-lockup: url("/files/regenesis-horizontal-lockup-strong.svg");
  --rg-wordmark: url("/files/regenesis-wordmark.svg");
  --rg-radials: url("/files/regenesis-radials-colored.svg");
  --rg-radials-op: 0.55;
  --rg-card-shadow: 0 1px 2px rgba(40, 34, 24, 0.05), 0 10px 30px rgba(40, 34, 24, 0.08);
  --folder-icon-background-color: #EAE4DA;
}
html[data-theme="dark"] {
  --rg-tile-hover: rgba(199, 154, 78, 0.10);
  --rg-tile-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25);
  --rg-gold-tile: linear-gradient(150deg, #D4AA62 0%, #C79A4E 50%, #A47E3A 100%);
  --rg-module-filter: saturate(0.24) brightness(0.88);
  --rg-lockup: url("/files/regenesis-horizontal-lockup-white.svg");
  --rg-wordmark: url("/files/regenesis-wordmark-white.svg");
  --rg-radials: url("/files/regenesis-radials-white.svg");
  --rg-radials-op: 0.06;
  --rg-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.3);
  --folder-icon-background-color: #27303A;
}

/* ---------- Boot splash (shown while the desk loads) ---------- */
body > .centered.splash {
  text-align: center;
}
body > .centered.splash img {
  content: var(--rg-lockup);
  width: 230px !important;
  max-width: 64vw !important;
  height: auto;
}
body > .centered.splash::after {
  content: "";
  display: block;
  width: 140px;
  height: 2px;
  margin: 22px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--rg-gold) 50%, transparent 100%) no-repeat;
  background-size: 50% 100%;
  animation: rg-splash-sweep 1.3s ease-in-out infinite;
}
@keyframes rg-splash-sweep {
  0% { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  body > .centered.splash::after { animation: none; background-size: 100% 100%; }
}

/* ---------- Icon Desktop / app grid (/desk/desktop) ---------- */
.desktop-wrapper {
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 50% -120px, rgba(172, 132, 62, 0.10), transparent 70%),
    var(--bg-color);
}
.desktop-navbar.navbar-container {
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--rg-gold-line);
}
.desktop-navbar .navbar-home #brand-logo {
  content: var(--rg-lockup);
  height: 44px;
  width: auto;
  max-width: 260px;
}
.desktop-navbar .desktop-navbar-modal-search {
  border: 1px solid var(--border-color);
}
/* Hero band (4 Oct, Barrie: "branding in the home page looks weak, hardly visible"):
   brand radial artwork behind, a large wordmark, the brand line, then the tiles. CSS only, no script. */
.desktop-container { position: relative; }
.desktop-container::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -260px;
  width: 980px;
  height: 980px;
  max-width: 160vw;
  transform: translateX(-50%);
  background: var(--rg-radials) center / contain no-repeat;
  opacity: var(--rg-radials-op);
  pointer-events: none;
  z-index: 0;
}
.desktop-container > * { position: relative; z-index: 1; }
.desktop-container > .icons-container::before {
  content: "Performance begins with recovery";
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rg-gold-deep);
  padding-top: 64px;
  padding-bottom: 22px;
  margin: 8px 0 30px;
  background:
    var(--rg-wordmark) center top / 360px auto no-repeat,
    linear-gradient(var(--rg-gold), var(--rg-gold)) center bottom / 56px 2px no-repeat;
}
@media (max-width: 600px) {
  .desktop-navbar .navbar-home #brand-logo { height: 34px; max-width: 190px; }
  .desktop-container > .icons-container::before {
    padding-top: 46px; font-size: 11px; letter-spacing: 0.2em;
    background-size: 250px auto, 44px 2px;
  }
}
.desktop-icon {
  transition: background-color 0.15s ease;
}
.desktop-icon:not(.desktop-edit-mode):hover {
  background-color: var(--rg-tile-hover);
}
.desktop-icon .icon-container {
  border-radius: 16px;
  box-shadow: var(--rg-tile-shadow);
}
.desktop-icon .icon-title {
  color: var(--heading-color);
  font-weight: 500;
  letter-spacing: 0.005em;
}
/* standard ERPNext and Frappe module tiles: the stock blue artwork toned to Regenesis slate */
.desktop-icon img.app-icon {
  filter: var(--rg-module-filter);
}
/* letter tiles in slate instead of Frappe grey */
.desktop-icon .icon-container:has(> svg.desktop-alphabet) {
  background-color: #5B7A8C !important;
}
.desktop-icon .icon-container > svg.desktop-alphabet {
  color: #FFFFFF !important;
}
/* Regenesis screens: gold tiles, always first */
.desktop-icon:is([data-id="Beranda"], [data-id="Request Items"], [data-id="Find Stock"], [data-id="Purchasing"],
  [data-id="Persetujuan"], [data-id="Stock Count"], [data-id="Shop Floor Kiosk"]) .icon-container {
  background: var(--rg-gold-tile) !important;
}
.desktop-icon:is([data-id="Beranda"], [data-id="Request Items"], [data-id="Find Stock"], [data-id="Purchasing"],
  [data-id="Persetujuan"], [data-id="Stock Count"], [data-id="Shop Floor Kiosk"]) .icon-container > svg {
  color: #FFFDF8 !important;
}
/* Regenesis tiles carry a line icon instead of Frappe's first-letter avatar: the letter comes from the record
   name (B for Beranda) while the tile caption is translated (Home), so the letter would not match the caption.
   Icons are Lucide (ISC licence) drawn as a CSS mask, so they take the tile ink colour in light and dark. */
.desktop-icon:is([data-id="Beranda"], [data-id="Request Items"], [data-id="Find Stock"], [data-id="Purchasing"], [data-id="Persetujuan"], [data-id="Stock Count"], [data-id="Shop Floor Kiosk"]) .icon-container {
  position: relative;
}
.desktop-icon:is([data-id="Beranda"], [data-id="Request Items"], [data-id="Find Stock"], [data-id="Purchasing"], [data-id="Persetujuan"], [data-id="Stock Count"], [data-id="Shop Floor Kiosk"]) .icon-container > svg.desktop-alphabet {
  opacity: 0;
}
.desktop-icon:is([data-id="Beranda"], [data-id="Request Items"], [data-id="Find Stock"], [data-id="Purchasing"], [data-id="Persetujuan"], [data-id="Stock Count"], [data-id="Shop Floor Kiosk"]) .icon-container::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  background-color: #FFFDF8;
  -webkit-mask: var(--rg-tile-icon) center / contain no-repeat;
  mask: var(--rg-tile-icon) center / contain no-repeat;
}
.desktop-icon[data-id="Beranda"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8'/%3E%3Cpath d='M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Request Items"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4'/%3E%3Cpath d='M9 15h6'/%3E%3Cpath d='M12 18v-6'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Find Stock"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Purchasing"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Persetujuan"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Stock Count"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='m9 14 2 2 4-4'/%3E%3C/svg%3E"); }
.desktop-icon[data-id="Shop Floor Kiosk"] { --rg-tile-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7V5a2 2 0 0 1 2-2h2'/%3E%3Cpath d='M17 3h2a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M21 17v2a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M7 21H5a2 2 0 0 1-2-2v-2'/%3E%3Cpath d='M7 12h10'/%3E%3C/svg%3E"); }
.desktop-container .icons > .desktop-icon[data-id="Beranda"] { order: -7; }
.desktop-container .icons > .desktop-icon[data-id="Request Items"] { order: -6; }
.desktop-container .icons > .desktop-icon[data-id="Find Stock"] { order: -5; }
.desktop-container .icons > .desktop-icon[data-id="Purchasing"] { order: -4; }
.desktop-container .icons > .desktop-icon[data-id="Persetujuan"] { order: -3; }
.desktop-container .icons > .desktop-icon[data-id="Stock Count"] { order: -2; }
.desktop-container .icons > .desktop-icon[data-id="Shop Floor Kiosk"] { order: -1; }
.page-indicator.active-page {
  background-color: var(--rg-gold) !important;
}
.desktop-edit {
  background-color: var(--rg-gold) !important;
}

/* ---------- Sidebar header (workspace switcher) ----------
   Frappe draws a first-letter avatar from the workspace's record name (B for Beranda, P for Persetujuan) or a
   module icon. The Regenesis logomark replaces it on every page, so the header is the same everywhere. */
.body-sidebar .sidebar-header .sidebar-item-icon {
  background: var(--card-bg) url("/files/regenesis-logomark.svg") center / 82% auto no-repeat !important;
  border: 1px solid var(--rg-gold-line);
  border-radius: 8px;
}
.body-sidebar .sidebar-header .header-logo {
  visibility: hidden;
}
.body-sidebar .sidebar-header .header-title {
  font-weight: 600;
  color: var(--heading-color);
}
/* the subtitle shows the framework name (ERPNext); show the company instead */
.body-sidebar .sidebar-header .header-subtitle {
  font-size: 0 !important;
}
.body-sidebar .sidebar-header .header-subtitle::after {
  content: "Regenesis";
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--rg-gold-deep);
}

/* ---------- Page head and breadcrumbs ---------- */
.page-head .navbar-breadcrumbs a {
  transition: color 0.15s ease;
}
.page-head .navbar-breadcrumbs a:hover {
  color: var(--rg-gold-deep);
  text-decoration: none;
}
.page-head .navbar-breadcrumbs li:first-child a .icon {
  --icon-stroke: var(--rg-gold-deep);
}

/* ---------- Form chrome ---------- */
.form-tabs-list .form-tabs .nav-item .nav-link.active {
  border-bottom: 2px solid var(--rg-gold);
  color: var(--heading-color);
  font-weight: 500;
  padding-bottom: 8px;
}
.form-tabs-list .form-tabs .nav-item .nav-link:hover {
  color: var(--heading-color);
}
.form-section .section-head {
  font-weight: 600;
  color: var(--heading-color);
}

/* ---------- List chrome ---------- */
.frappe-list .list-row-head {
  background-color: var(--subtle-fg);
  border-radius: 8px 8px 0 0;
}

/* ---------- Not found / not permitted (desk message pages) ---------- */
.page.message-page {
  padding: 10vh 16px 40px;
}
.message-page .message-page-content {
  max-width: 460px;
  margin: 0 auto;
  padding: 36px 32px 30px;
  background: var(--card-bg);
  border: 1px solid var(--rg-gold-line);
  border-radius: 18px;
  box-shadow: var(--rg-card-shadow);
}
.message-page .message-page-image {
  content: var(--rg-lockup);
  width: 210px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}
.message-page .lead {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-color);
  margin-bottom: 22px;
}
.message-page .btn-home {
  background-color: var(--rg-gold);
  color: var(--rg-on-gold);
  border: 0;
  padding: 6px 20px;
  font-weight: 500;
}
.message-page .btn-home:hover {
  background-color: var(--rg-gold-hover);
  color: var(--rg-on-gold);
}

/* ---------- Dialogs ---------- */
.modal-backdrop {
  background-color: #1A2027;
}
.modal-backdrop.show {
  opacity: 0.55;
}
.modal .modal-content {
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--rg-gold);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20, 16, 10, 0.22), 0 2px 6px rgba(20, 16, 10, 0.08);
}
.modal .modal-header .modal-title {
  font-weight: 600;
  letter-spacing: -0.005em;
}
.modal .modal-footer {
  border-top-color: var(--border-color);
}

/* ---------- Toasts (frappe.show_alert) ---------- */
#alert-container .desk-alert {
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--rg-gold);
  border-radius: 12px;
  box-shadow: var(--rg-card-shadow);
}
#alert-container .desk-alert.green { border-left-color: #3F8F5F; }
#alert-container .desk-alert.red { border-left-color: #C0453A; }
#alert-container .desk-alert.orange,
#alert-container .desk-alert.yellow { border-left-color: #C98A2E; }
#alert-container .desk-alert.blue { border-left-color: var(--rg-slate); }

/* ---------- Website 404 (www/404.html, a website page; light unless the device is dark) ---------- */
.error-page {
  font-family: var(--font-stack);
}
.error-page > div {
  background: #FFFFFF;
  border: 1px solid rgba(172, 132, 62, 0.35);
  border-radius: 18px;
  padding: 34px 40px 28px;
  box-shadow: 0 1px 2px rgba(40, 34, 24, 0.05), 0 10px 30px rgba(40, 34, 24, 0.08);
}
.error-page > div::before {
  content: "";
  display: block;
  width: 200px;
  height: 40px;
  margin: 0 auto 18px;
  background: url("/files/regenesis-horizontal-lockup-strong.svg") center / contain no-repeat;
}
.error-page h4 {
  color: #24221E;
  font-weight: 500;
}
.error-page .details a {
  color: #8A672A !important;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body:has(.error-page) { background-color: #1A2027 !important; }
  html:not([data-theme="light"]) .error-page > div { background: #20272F; border-color: rgba(199, 154, 78, 0.3); }
  html:not([data-theme="light"]) .error-page > div::before { background-image: url("/files/regenesis-horizontal-lockup-white.svg"); }
  html:not([data-theme="light"]) .error-page h4 { color: #F3F0EB; }
  html:not([data-theme="light"]) .error-page .details a { color: #C79A4E !important; }
}

/* =====================================================================================
   AUDIT ROUND 1 (unify, 2 Oct): fixes found by the staging UI audit. Same file, same tokens.
   ===================================================================================== */

/* Ship a Pod sidebar row: Regen Shipping only. Frappe v16.17 never evaluates a sidebar row's
   display_depends_on, so regenesis-desk.js puts "rg-no-ship" on <html> for everyone without
   Regen Shipping and the row is hidden here (English and Bahasa labels). */
html.rg-no-ship .sidebar-item-container:is([data-id="Ship a Pod"], [data-id="Kirim Pod"]) {
  display: none !important;
}

/* Dialogs in dark: always the kiosk surface, never Frappe's near black. */
html[data-theme="dark"] .modal .modal-content {
  background-color: #20272F;
  color: var(--text-color);
}
html[data-theme="dark"] .modal .modal-header,
html[data-theme="dark"] .modal .modal-body,
html[data-theme="dark"] .modal .modal-footer {
  background-color: transparent;
}
html[data-theme="dark"] .modal .btn.btn-primary {
  background-color: var(--rg-gold);
  color: var(--rg-on-gold);
}

/* Search and awesomebar match highlight: pale gold, never the browser's bright yellow. */
html body mark {
  background: #F3E2C4;
  color: #1A2027;
  padding: 0 1px;
  border-radius: 2px;
}
html[data-theme="dark"] body mark {
  background: rgba(172, 132, 62, 0.35);
  color: inherit;
}

/* Icon Desktop: tile captions wrap to two lines instead of "Shop Floor K...". */
.desktop-icon .icon-title {
  white-space: normal !important;
  overflow: hidden;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: normal;
  word-break: normal;
  /* a little wider than the tile so one long word ("Manufacturing") fits whole instead of breaking */
  width: calc(100% + 16px);
  max-width: none;
  margin-left: -8px;
  margin-right: -8px;
}

/* Workspace screens: no Frappe panel behind the Regenesis card (no frame within a frame). */
body[data-route^="Workspaces"] .layout-main-section,
body[data-route^="Workspaces"] .layout-main-section-wrapper,
body[data-route^="Workspaces"] .layout-main .layout-main-section {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  min-height: auto !important;
}

/* Narrow screens: the breadcrumb shows only the page name, so drop its leading "/", and keep a long
   form title from running under the status pill. */
@media (max-width: 991px) {
  .navbar-breadcrumbs li:last-child > a::before {
    content: none !important;
    display: none !important;
  }
}
@media (max-width: 767px) {
  .page-head .title-area {
    min-width: 0;
    gap: 6px;
    align-items: center;
  }
  .page-head .title-area .navbar-breadcrumbs {
    flex: 0 1 auto;
    min-width: 0;
  }
  .page-head .title-area .page-indicator-pill {
    flex: none;
  }
}

/* Not found / not permitted card copy sits under the logo; keep it readable on phones. */
@media (max-width: 600px) {
  .page.message-page {
    padding-top: 6vh;
  }
  .message-page .message-page-content {
    padding: 28px 20px 24px;
  }
}
