/* ==========================================================================
   IAV ERP shell (copper) - adapted from the MN ERP look kit — one stylesheet for every screen.
   Part 1: tokens, left console, page frame, buttons, inputs, tables, pager,
           dialogs, toast, search bar.
   Part 2: page components (tabs, chips, record card, forms, File Manager,
           Control Panel rights grid, reporting).
   Change the brand by editing the --brand tokens below (colours, font) and the logo only.
   ========================================================================== */

:root {
  /* --brand: set these from the client's answers (colour, logo, font) before anything else */
  --navy: #4c240c; --navy-soft: #854e2a; --navy-deep: #260e04;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ink: #1f2937; --muted: #6b7280; --faint: #9ca3af;
  --bg: #f7f6f2; --card: #ffffff; --line: #e5e7eb; --pill: #f5ede5;
  
  --fill-go: #86563b;  --tint-go: #f9e6d6;  --ink-go: #5e3721;
  --fill-yes: #386042; --tint-yes: #e4f6e7; --ink-yes: #244e30;
  --fill-no: #794845;  --tint-no: #ffe7e4;  --ink-no: #633330;
  --fill-hold: #685136; --tint-hold: #fbedde; --ink-hold: #553f24;
  --ok: #067647; --ok-bg: #ecfdf3; --ok-line: #abefc6;
  --warn: #b42318; --warn-bg: #fef3f2; --warn-line: #fecdc9;
  --side: 216px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  font-family: var(--font); font-size: 14px;
}

#console {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40;
  background: var(--card); color: var(--ink); display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#console .top { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
#console .top img { width: 100%; max-width: 104px; display: block; margin: 0 auto 7px; }

#console .top b { display: block; font-size: 12.5px; text-align: center; font-weight: 600; letter-spacing: -.01em; padding: 0 32px; }
#console .top span { display: block; font-size: 11px; text-align: center; color: var(--faint); padding: 0 32px; }

#console .top { position: relative; }
#console .appsbtn {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--faint);
}
#console .appsbtn:hover { background: var(--pill); border-color: var(--line); color: var(--navy); }
#console .appsbtn .ic { width: 18px; height: 18px; }

#console .appsbtn .ic path { fill: currentColor; stroke: none; }

.appswrap {
  position: fixed; inset: 0; z-index: 90; background: rgba(30, 14, 5, .34);
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 14px 0 0 calc(var(--side) + 10px);
}
.appscard {
  width: 336px; max-width: calc(100vw - 24px); background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 13px 11px;
  box-shadow: 0 18px 44px rgba(30, 14, 5, .22);
  max-height: calc(100vh - 28px); display: flex; flex-direction: column;
}
.appshead { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; }
.appshead b { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.appsedit {
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--navy-soft); text-decoration: underline; text-underline-offset: 2px;
}
.appsedit:hover { opacity: .75; }

.appsbody { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.appsgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.apptile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 12px 5px 11px; border-radius: 10px; text-decoration: none; color: var(--ink);
}
.apptile:hover { background: var(--pill); }
.apptile .ic { width: 23px; height: 23px; color: var(--navy-soft); }
.apptile span { font-size: 11px; line-height: 1.3; color: var(--muted); }
.apptile:hover span { color: var(--ink); }

.appscat {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
  margin: 10px 4px 3px;
}
.appscat:first-child { margin-top: 0; }
.appsrow {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 6px;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink); text-align: left;
}
.appsrow:hover { background: var(--bg); }
.appsrow > span { flex: 1; }
.appsrow .ic { width: 17px; height: 17px; color: var(--faint); }

.appsrow .ic.star { color: var(--line); }
.appsrow.on .ic.star { color: #c9971a; fill: #f3c14b; }
.appsrow.on > span { font-weight: 600; }

.appsfoot { border-top: 1px solid var(--line); margin-top: 9px; padding-top: 9px; }
.appsfoot input[type=search] {
  width: 100%; padding: 7px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.appsnone { font-size: 12.5px; color: var(--muted); margin: 14px 6px; }

#console nav {
  flex: 1; min-height: 0; padding: 10px 8px 16px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #d8dae0 transparent;
}
#console nav::-webkit-scrollbar { width: 8px; }
#console nav::-webkit-scrollbar-thumb { background: #dcdee4; border-radius: 4px; }
#console nav::-webkit-scrollbar-thumb:hover { background: #c7cad2; }
#console nav::-webkit-scrollbar-track { background: transparent; }

#console .cat {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: #9aa0ab; padding: 18px 10px 7px; font-weight: 600;
}
#console nav > .cat:first-child { padding-top: 4px; }

#console .cat { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; border: 0; margin: 0; background: none; }
#console .cat:hover { color: var(--navy, #4c240c); }
#console .cat:focus-visible { outline: 2px solid var(--navy, #4c240c); outline-offset: -2px; border-radius: 6px; }
#console .cat .chev { width: 12px; height: 12px; margin: 0 2px 0 -2px; transform: rotate(90deg); }
#console .cat.folded .chev { transform: rotate(0deg); }
#console .catbody { border: 0; margin: 0; padding: 0; background: none; }
#console .catbody.closed { display: none; }

#console a, #console .soon {
  display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: 8px;
  border: 0; margin: 0 0 2px; background: none; box-shadow: none;
  color: #2c3038; text-decoration: none; font-size: 13.5px; font-weight: 450;
  line-height: 1.35; cursor: pointer;
}
#console a:hover { background: #f4f5f7; }
#console a.active { background: #f0f1f4; color: var(--navy); font-weight: 600; }
#console a.active .ic { color: var(--navy); }

#console .soon { color: #a8adb6; cursor: default; }

#console .soon.lit { color: #2c3038; cursor: pointer; }
#console .soon.lit .ic { color: #6b7280; }
#console .soon.active { color: var(--navy); font-weight: 600; }
#console .soon.active .ic { color: var(--navy); }
#console .soon em {
  font-style: normal; font-size: 9.5px; margin-left: auto; letter-spacing: .03em;
  color: #a8adb6; background: #f4f5f7; padding: 1px 6px; border-radius: 999px;
}

.ic {
  flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
#console .ic { width: 17px; height: 17px; color: #6b7280; }
#console .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#console .chev {
  width: 14px; height: 14px; flex: none; color: #b3b8c0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s ease;
}
#console .parent.open .chev { transform: rotate(90deg); }

#console .sub { margin: 0 0 2px 0; padding: 0 0 0 28px; border: 0; background: none;
  font-size: inherit; color: inherit; font-style: normal; display: block; }
#console .sub.closed { display: none; }
#console .sub a, #console .sub .soon {
  font-size: 13px; padding: 6px 10px; gap: 0;
}
#console .sub .soon { font-size: 12px; font-style: italic; }

#console .bottom {
  flex: none; padding: 5px 8px 6px; border-top: 1px solid var(--line);
  background: var(--card);
}

#console .bottom a.act, #console .bottom button.act {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 5.5px 10px; border-radius: 7px; border: none; background: none;
  font-family: inherit; font-size: 12.5px; font-weight: 450; color: #4a4f5c;
  text-decoration: none; cursor: pointer; text-align: left; line-height: 1.3;
}
#console .bottom a.act:hover, #console .bottom button.act:hover {
  background: var(--bg); color: var(--ink);
}
#console .bottom a.act.active { background: #f0f1f4; color: var(--navy); font-weight: 600; }
#console .bottom a.act.active .ic { color: var(--navy); }
#console .bottom button.act.danger:hover { background: var(--warn-bg); color: var(--warn); }
#console .bottom .ic { width: 15px; height: 15px; flex: none; color: #8b909b; }

#console .who {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 2px;
  margin-top: 3px; border-top: 1px solid var(--line);
}
#console .who .av {
  width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--pill);
  color: var(--navy); font-size: 10.5px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; letter-spacing: -.02em;
}
#console .who .nm { min-width: 0; }
#console .who b {
  display: block; font-size: 12px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#console .who span {
  display: block; font-size: 10px; color: var(--faint); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#console .setmenu { display: none; padding: 1px 0 2px; }
#console .setmenu.open { display: block; }
#console .setmenu a, #console .setmenu button {
  display: block; width: 100%; text-align: left; padding: 4.5px 10px 4.5px 36px;
  font-family: inherit; font-size: 11.5px; color: var(--muted); background: none;
  border: none; border-radius: 7px; text-decoration: none; cursor: pointer;
}
#console .setmenu a:hover, #console .setmenu button:hover { background: var(--bg); color: var(--ink); }
#console .bottom .caret { margin-left: auto; font-size: 9px; color: var(--faint); }
@media (prefers-reduced-motion: reduce) { #console .chev { transition: none; } }

.shell { margin-left: var(--side); min-height: 100vh; }
.pagehead {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 18px 30px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.pagehead h1 { margin: 0; font-size: 17.5px; font-weight: 620; letter-spacing: -.012em; }
.pagehead p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.pagehead .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.content { max-width: 1280px; padding: 26px 30px 60px; }

#burger { display: none; }

#console .drawer { display: contents; }
#console .dhead { display: none; }

@media (max-width: 900px) {
  
  #console { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  #console .top { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
  #console .top img { width: 40px; margin: 0; padding: 2px; }
  #console .top .titles { text-align: left; min-width: 0; }
  #console .top b, #console .top span { text-align: left; padding: 0; }
  #console .top b { font-size: 14px; }
  #console .appsbtn { position: static; margin-left: auto; width: 40px; height: 40px; }
  #burger {
    display: flex; order: -1; align-items: center; justify-content: center; width: 40px; height: 40px;
    margin: 0; padding: 0; background: none; border: 1px solid var(--line); border-radius: 10px;
    color: var(--navy); font-family: inherit; font-size: 20px; line-height: 1; cursor: pointer;
  }
  #console .drawer {
    position: fixed; inset: 0 auto 0 0; width: min(72vw, 296px); z-index: 80;    display: flex; flex-direction: column;
    background: linear-gradient(176deg, #3b1907 0%, var(--navy) 45%, var(--navy-deep) 100%); color: #fff;
    transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.35); overflow: hidden;
  }
  #console.open .drawer { transform: none; }
  .dscrim { position: fixed; inset: 0; background: rgba(38, 14, 4, .45); z-index: 70; }
  body.drawer-open { overflow: hidden; }
  #console .dhead { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; position: relative; }
  #console .dhead::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px; background: linear-gradient(90deg, rgba(225,180,117,.55), rgba(225,180,117,0)); }
  #console .dhead img { width: 42px; height: 42px; object-fit: contain; background: #f7f5ef; border-radius: 10px; padding: 3px; flex: none; }
  #console .dtitles { min-width: 0; }
  #console .dhead b { display: block; font-size: 15px; font-weight: 650; letter-spacing: .2px; text-align: left; padding: 0; }
  #console .dhead span { display: block; font-size: 11px; color: rgba(255,255,255,.7); text-align: left; padding: 0; }
  #console .dclose { margin-left: auto; width: 34px; height: 34px; flex: none; border: 0; background: rgba(255,255,255,.08); color: #fff; border-radius: 9px; font-family: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
  #console nav { display: block; flex: 1; overflow-y: auto; padding: 6px 0 10px; }
  #console .cat { color: #e1b475; opacity: .9; font-size: 9.5px; letter-spacing: 1.6px; text-transform: uppercase; padding: 14px 16px 5px; }
  #console .cat:hover, #console .cat .chev { color: #e1b475; }
  #console a, #console .soon { color: rgba(255,255,255,.86); border-left: 3px solid transparent; border-radius: 0; padding: 9px 16px 9px 13px; font-size: 13.5px; }
  #console .soon { color: rgba(255,255,255,.4); }
  #console .soon.lit { color: rgba(255,255,255,.86); }
  #console a:hover { background: rgba(255,255,255,.07); }
  #console a.active, #console .soon.active { background: rgba(255,255,255,.11); border-left-color: #e1b475; color: #fff; font-weight: 650; }
  #console .ic, #console .soon.lit .ic { color: rgba(255,255,255,.75); }
  #console a.active .ic, #console .soon.active .ic { color: #e1b475; }
  #console .soon em { color: rgba(255,255,255,.6); background: rgba(255,255,255,.12); }
  #console .sub a, #console .sub .soon { padding-left: 40px; }
  #console .bottom { display: block; background: none; border-top: 0; padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 10px); position: relative; }
  #console .bottom::before { content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 1px; background: linear-gradient(90deg, rgba(225,180,117,.45), rgba(225,180,117,0)); }
  #console .bottom a.act, #console .bottom button.act { width: 100%; padding: 7px 10px; color: rgba(255,255,255,.86); font-size: 13px; }
  #console .bottom a.act:hover, #console .bottom button.act:hover, #console .bottom a.act.active { background: rgba(255,255,255,.1); color: #fff; }
  #console .bottom .ic, #console .bottom a.act.active .ic { color: rgba(255,255,255,.75); }
  #console .bottom button.act.danger { color: rgba(255,214,214,.85); }
  #console .bottom button.act.danger:hover { background: rgba(255,255,255,.1); color: #ffdcdc; }
  #console .bottom .caret { color: rgba(255,255,255,.6); }
  #console .setmenu a, #console .setmenu button { color: rgba(255,255,255,.7); }
  #console .setmenu a:hover, #console .setmenu button:hover { background: rgba(255,255,255,.08); color: #fff; }
  #console .who { border-top: 1px solid rgba(255,255,255,.12); margin-top: 6px; padding: 8px 10px 2px; }
  #console .who .av { background: rgba(255,255,255,.14); color: #fff; }
  #console .who b { color: #fff; }
  #console .who span { display: block; color: rgba(255,255,255,.65); }
  .appswrap { padding: 8px 8px 0; align-items: flex-start; justify-content: center; }
  .appscard { width: 100%; max-width: 420px; }
  .apptile { padding: 14px 5px 13px; }
  .shell { margin-left: 0; }
  .content { padding: 20px 18px 50px; }
  .pagehead { padding: 16px 18px; }
}

.btn {
  padding: 7px 14px; font-size: 13px; font-family: inherit; cursor: pointer; line-height: 1.35;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
}
.btn:hover { background: var(--bg); }

.btn.primary { background: var(--fill-go); color: #fff; border-color: var(--fill-go); font-weight: 550; }
.btn.primary:hover { background: #6f4329; border-color: #6f4329; }

.btn.yes { background: var(--fill-yes); color: #fff; border-color: var(--fill-yes); font-weight: 550; }
.btn.yes:hover { background: #2f5339; border-color: #2f5339; }
.btn.no { background: var(--tint-no); color: var(--ink-no); border-color: #f2cdc8; font-weight: 550; }
.btn.no:hover { background: #ffdcd7; }
.btn.hold { background: var(--tint-hold); color: var(--ink-hold); border-color: #eedcc4; font-weight: 550; }
.btn.hold:hover { background: #f7e3cd; }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn.danger { color: var(--warn); border-color: var(--warn-line); }
.btn:disabled { opacity: .55; cursor: default; }

.btn.ghost { background: none; border-color: transparent; color: var(--navy-soft); }
.btn.ghost:hover { background: var(--pill); border-color: transparent; }
.pill.tiny { font-size: 9.5px; font-weight: 600; padding: 1px 6px; }
.formacts { display: flex; gap: 8px; align-items: center; margin-top: 13px; flex-wrap: wrap; }
.formacts 
.half { max-width: 1100px; }

.savemark { font-size: 12.5px; color: var(--ok); white-space: nowrap; opacity: 0;
  transition: opacity .15s; }
.savemark.show { opacity: 1; }
.savemark.busy { color: var(--muted); }

.hint { margin: 5px 0 0; font-size: 11.5px; font-style: italic; color: var(--muted);
  line-height: 1.45; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(76,36,12,.04); margin-bottom: 22px;
}
.panel-head { padding: 18px 22px 14px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 620; letter-spacing: -.008em; }
.panel-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.panel-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner {
  background: var(--pill); border: 1px solid #ecdccd; border-radius: 12px;
  padding: 12px 16px; font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; color: #4c240c;
}
.scroll { overflow-x: auto; }

.dtyping { font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: .04em;
  font-variant-numeric: tabular-nums; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; padding: 8px 16px; border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line); background: #fbfbfa; white-space: nowrap;
}
td { padding: 9px 16px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="month"],
input[type="number"], select, textarea {
  width: 100%; min-width: 0; padding: 8px 10px; font-size: 13.5px; font-family: inherit;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; outline: none;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-soft); box-shadow: 0 0 0 3px rgba(133,78,42,.14); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.on { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.pill.off { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.empty { padding: 30px 22px; color: var(--muted); }
.hidden { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(76,36,12,.25); display: none; z-index: 60; max-width: 90vw;
}
.toast.show { display: block; }
.toast.good { background: #065f46; }
:focus-visible { outline: 2px solid var(--navy-soft); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.pgbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 22px; border-top: 1px solid var(--line); }
.pgbar .pgcount { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pgbar .pgnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.pgbar .pgnav button {
  font-family: inherit; font-size: 12.5px; cursor: pointer; padding: 6px 11px;
  border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pgbar .pgnav button:hover { background: var(--bg); color: var(--ink); }
.pgbar .pgnav button.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 650; }
.pgbar .pgnav button.off { opacity: .4; cursor: default; }
.pgbar .pgnav button.off:hover { background: var(--card); color: var(--muted); }
.pgbar .pggap { color: var(--faint); font-size: 12.5px; padding: 0 2px; }
@media (max-width: 700px) {
  .pgbar { padding: 12px 16px; }
  .pgbar .pgnav { margin-left: 0; width: 100%; }
  .pgbar .pgnav button { flex: 1; }
  
  .pgbar .pgnav button:not(.on):not(:first-child):not(:last-child) { display: none; }
  .pgbar .pggap { display: none; }
}

.expwrap { position: fixed; inset: 0; background: rgba(17,19,24,.45); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.expcard { background: var(--card); border-radius: 14px; padding: 20px 22px;
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.expcard h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.expcard p { margin: 4px 0 14px; font-size: 12.5px; color: var(--muted); }
.expcard p.expnote { margin: 12px 0 0; font-size: 12px; color: var(--faint); line-height: 1.5; }
.expfields { display: flex; flex-wrap: wrap; gap: 7px; }
.expfields button {
  font-family: inherit; font-size: 12.5px; cursor: pointer; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.expfields button.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.exprow { display: flex; gap: 8px; margin-top: 12px; }
.expfoot { display: flex; gap: 9px; margin-top: 18px; }
.expghost, .expgo {
  font-family: inherit; font-size: 13px; cursor: pointer; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.expghost:hover { background: var(--bg); color: var(--ink); }
.expgo { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.expgo:hover { background: #3b1907; }

.pickwrap { position: relative; }
.pickinput {
  width: 100%; font: inherit; font-size: 13.5px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.pickinput:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(76,36,12,.08); }
.picklist {
  display: none; position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 3px);
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 26px rgba(76,36,12,.14); overflow-y: auto;

  
  --pickrow: 54px;
  max-height: calc(var(--pickrow) * 5.5);
}
.picklist.open { display: block; }

.pickrow { padding: 7px 11px; cursor: pointer; font-size: 13px; line-height: 1.35;
  border-bottom: 1px solid var(--line); height: 54px; box-sizing: border-box;
  overflow: hidden; }
.pickrow .nm, .pickrow .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickrow:last-child { border-bottom: 0; }
.pickrow:hover, .pickrow.on { background: var(--pill); }
.pickrow .nm { display: block; color: var(--ink); font-weight: 550; }

.pickrow .sub { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.pickrow.none { color: var(--muted); cursor: default; font-style: italic; }
.pickrow.none:hover { background: none; }

.pwwrap { position: fixed; inset: 0; background: rgba(17,19,24,.5); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.pwcard { background: var(--card); border-radius: 14px; padding: 20px 22px;
  width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.24); }
.pwcard h2 { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; }
.pwcard p { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pwrow { display: flex; align-items: center; gap: 6px; }
.pwrow input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; letter-spacing: .04em; }
.pwrow input:focus { outline: none; border-color: var(--navy); }
.pwrow .pweye { flex: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; padding: 8px 10px; color: var(--navy-soft); line-height: 1; font-size: 13px; }
.pwrow .pweye:hover { border-color: #d6c3b2; }
.pwerr { margin: 8px 0 0; font-size: 12px; color: #b3261e; min-height: 1em; }
.pwacts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.askwrap { position: fixed; inset: 0; z-index: 130; background: rgba(30, 14, 5, .45);
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.askbox { background: var(--card); border-radius: 16px; padding: 22px 22px 18px;
  max-width: 420px; width: 100%; box-shadow: 0 18px 50px rgba(76, 36, 12, .28); }

.askbox h4 { margin: 0 0 8px; font-size: 16px; font-weight: 560; letter-spacing: -.008em;
  line-height: 1.4; text-wrap: pretty; }

.askbox p { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); line-height: 1.6;
  white-space: pre-line; text-wrap: pretty; }
.askrow { display: flex; gap: 9px; justify-content: flex-end; }

.needshot { display: block; margin: 8px 0 0; font-size: 12.5px; line-height: 1.6;
  color: #a2481f; }
.needshot.hidden { display: none; }
.askin { width: 100%; font: inherit; font-size: 15px; padding: 10px 12px; margin: 0 0 16px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink);
  resize: vertical; }
.askin:focus { outline: none; border-color: var(--navy); }

.askin::placeholder { color: #9aa0aa; opacity: 1; }

.askin[type="number"]::-webkit-outer-spin-button,
.askin[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.askin[type="number"] { -moz-appearance: textfield; }

.mnx {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 34px; height: 34px; border-radius: 999px;
  border: none; background: rgba(76, 36, 12, .06); color: var(--muted, #6b7280);
  font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mnx:hover { background: rgba(76, 36, 12, .12); color: var(--ink, #14161c); }
.mnx:focus-visible { outline: 2px solid var(--navy, #4c240c); outline-offset: 2px; }

.sheet > h4:first-child, .sheet > h3:first-child { padding-right: 40px; }

#console .jump { position: relative; padding: 8px 10px; }

#console form.jrow { margin: 0; }

.mnsearch, #console .jrow {
  display: flex; align-items: center; gap: 7px;
  background: #f4f5f7; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px;
  margin: 0;
}
.mnsearch:focus-within { border-color: var(--navy); background: #fff; }
.mnsearch > .ic { width: 15px; height: 15px; flex: none; color: #8b909b; }
.mnsearch > input {
  flex: 1 1 auto; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 12.5px; padding: 7px 0; color: var(--ink);
  -webkit-appearance: none; appearance: none; border-radius: 0;
}

.mnsearch > input::-webkit-search-cancel-button,
.mnsearch > input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.mnsearch > input:focus, .mnsearch > input:focus-visible {
  outline: none; box-shadow: none; border: 0;
}
#console .jrow:focus-within { border-color: var(--navy); background: #fff; }

#console .jump input:focus,
#console .jump input:focus-visible { outline: none; box-shadow: none; border: 0; }
#console .jrow > .ic { width: 15px; height: 15px; flex: none; color: #8b909b; }
#console .jump input {
  flex: 1 1 auto; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 12.5px; padding: 7px 0; color: var(--ink);
  -webkit-appearance: none; appearance: none; border-radius: 0;
}

#console .jump input::-webkit-search-cancel-button,
#console .jump input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
#console .jlist {
  display: none; position: absolute; left: 10px; right: 10px; z-index: 45;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 5px;
  box-shadow: 0 14px 34px rgba(76, 36, 12, .18);
}
#console .jlist.on { display: block; }

#console .jump:not(.up) .jlist { top: calc(100% + 2px); }
#console .jump.up .jlist { bottom: calc(100% + 2px); }

#console .jlist { max-height: min(46vh, 340px); overflow-y: auto; }

#console .bottom { overflow: visible; }
#console .jhit {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
  text-decoration: none; color: var(--ink);
}
#console .jhit.on { background: #f0f1f4; }
#console .jhit .ic { width: 15px; height: 15px; flex: none; color: #6b7280; }

#console .jtxt { min-width: 0; }
#console .jtxt b {
  display: block; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#console .jtxt span { display: block; font-size: 10.5px; color: var(--faint); }
#console .jnone { padding: 8px; font-size: 12px; color: var(--faint); }

@media (max-width: 900px) {
  #console .bottom .jump { flex: 1 1 100%; padding: 4px 0 6px; }
}

.shell button:not([class]),
.panel button:not([class]),
.wrap button:not([class]) {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 14px;
}
.shell button:not([class]):hover,
.panel button:not([class]):hover,
.wrap button:not([class]):hover { border-color: var(--navy); color: var(--navy); }
.shell button:not([class]):disabled,
.panel button:not([class]):disabled,
.wrap button:not([class]):disabled { opacity: .55; cursor: default; }

.tabbar, .scroll, .tblwrap {
  scrollbar-width: thin;
  scrollbar-color: #d8dae0 transparent;
}
.tabbar::-webkit-scrollbar, .scroll::-webkit-scrollbar, .tblwrap::-webkit-scrollbar { height: 5px; width: 5px; }
.tabbar::-webkit-scrollbar-track, .scroll::-webkit-scrollbar-track, .tblwrap::-webkit-scrollbar-track { background: transparent; }
.tabbar::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb, .tblwrap::-webkit-scrollbar-thumb {
  background: #dcdee4; border-radius: 3px;
}
.tabbar::-webkit-scrollbar-thumb:hover, .scroll::-webkit-scrollbar-thumb:hover, .tblwrap::-webkit-scrollbar-thumb:hover {
  background: #c7cad2;
}

@media (min-width: 761px) {
  .shell .tabbar, .shell .tabs, .shell .gtabs, .shell .railtabs { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
}

/* ==========================================================================
   PAGE COMPONENTS — the parts each MN ERP screen draws inside .content.
   In MN ERP these lived in each page's own <style>; here they are shared.
   ========================================================================== */

/* ---- header figures: the big numbers on the right of .pagehead ---- */
.counts { display: flex; gap: 22px; }
.counts div { text-align: right; }
.counts b { display: block; font-size: 24px; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.counts span { font-size: 12px; color: var(--muted); }

/* ---- TABS, kind 1: underline strip (the queue/view switcher above a list) ---- */
.tabbar { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line);
  margin: 0 0 16px; overflow-x: auto; }
.tabbar button, .tabbar .tb { appearance: none; background: none; border: none; font-family: inherit; cursor: pointer;
  font-size: 13.5px; color: #7c828c; padding: 9px 15px 8px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabbar button:hover { color: var(--ink); }
.tabbar button.on { color: #111318; font-weight: 650; border-bottom-color: #111318; }
.tabbar .count { font-size: 10.5px; font-weight: 700; background: #eceef2; color: #5b6270;
  border-radius: 999px; padding: 0 6px; margin-left: 6px; }
/* a labelled group break inside one strip (CRM style): <span class="brk"></span><span class="grp">Bill se</span> */
.tabbar .brk { flex-basis: 100%; height: 0; }
.tabbar .grp { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 9px 6px 8px 4px; }

/* ---- TABS, kind 2: pill tabs (sections of one settings/admin screen) ---- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 7px 16px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-family: inherit;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.tab:hover { border-color: var(--navy-soft); }
.tab.active, .tab.on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }

/* ---- TABS WRAP, never scroll (desktop); a strip that needs a 4th line is a design decision ---- */
@media (min-width: 761px) {
  .shell .tabbar, .shell .tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
}

/* ---- CHIPS: small filters / views with a count, under the tabs ---- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { font-family: inherit; font-size: 12.5px; cursor: pointer; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); white-space: nowrap; }
.chip:hover { color: var(--ink); border-color: #dccbbc; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.chip b { font-weight: 700; margin-left: 5px; opacity: .7; font-variant-numeric: tabular-nums; }

/* ---- status tags inside rows (never colour alone: always a word) ---- */
.st { display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st.ok   { background: var(--tint-yes); color: var(--ink-yes); }
.st.wait { background: var(--tint-hold); color: var(--ink-hold); }
.st.bad  { background: var(--tint-no); color: var(--ink-no); }
.st.mute { background: #eceef2; color: #5b6270; }
.st.info { background: var(--tint-go); color: var(--ink-go); }
.st.off  { background: #f4f5f7; color: var(--muted); }

/* ---- the action bar above a list: search · sort · spacer · buttons ---- */
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 0 14px; }
.bar .spacer { margin-left: auto; }
.bar .mnsearch { flex: 1; min-width: 240px; max-width: 420px; }
.bar select { width: auto; min-width: 160px; }

/* ---- the list table (inside .panel > .tablewrap) ---- */
.tablewrap { overflow-x: auto; }
table.list td.firm b, table.list td .main { font-weight: 620; display: block; }
table.list td.firm span, table.list td .sub { display: block; font-size: 11.5px; color: var(--faint); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list tr.row { cursor: pointer; }
table.list tr.row:hover td { background: #fafbfc; }
table.list td.check { width: 34px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.dash { color: #c3c8d0; }

/* ---- the RECORD CARD: a sheet that slides in from the right when a row is clicked ---- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(17,19,24,.45); z-index: 60; display: none; justify-content: flex-end; }
.sheet-wrap.show { display: flex; }
.sheet-wrap .card { position: relative; background: var(--card); width: min(720px, 100%); height: 100%; overflow-y: auto;
  box-shadow: -12px 0 40px rgba(0,0,0,.16); }
.sheet-wrap .head { position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--line);
  padding: 16px 60px 16px 22px; z-index: 2; }
.sheet-wrap .head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.sheet-wrap .head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.sheet-wrap .foot { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 22px; display: flex; gap: 8px; justify-content: flex-end; }
.grp { padding: 14px 22px 4px; }
.grp h3 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 7px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd.none { color: #c3c8d0; }
@media (max-width: 600px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 6px; } }

/* ---- FORMS: label ABOVE the box, quieter than the answer; boxes full width ---- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 14px; }
.fgrid > * { min-width: 0; }
.field label, label.fl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 5px; }
.field .hint { margin-top: 4px; }
.field.wide { grid-column: 1 / -1; }

/* ---- the centred DIALOG (small forms, confirmations that need fields) ---- */
.backdrop { position: fixed; inset: 0; background: rgba(76,36,12,.45); z-index: 70;
  display: none; align-items: center; justify-content: center; padding: 24px; }
.backdrop.show { display: flex; }
.backdrop .sheet, .dialog { position: relative; background: var(--card); border-radius: 14px; padding: 20px 22px;
  width: 560px; max-width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
.backdrop .sheet h2, .dialog h4 { margin: 0 40px 4px 0; font-size: 15.5px; font-weight: 650; }
.backdrop .sheet p.who { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

/* ---- FILE MANAGER: a left rail of "App" shelves + a grid of shelves (sections) ---- */
.secwrap { display: grid; grid-template-columns: 272px 1px minmax(0, 1fr); gap: 18px; padding: 14px 20px 18px; align-items: start; }
.secrail { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.secdiv { align-self: stretch; background: var(--line); }
.secgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; align-content: start; min-width: 0; }
@media (max-width: 1000px) { .secwrap { grid-template-columns: minmax(0, 1fr); gap: 10px; } .secdiv { display: none; } }
.sec { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 12px 13px 10px;
  display: flex; flex-direction: column; gap: 7px; }
.sec:hover { border-color: #dccbbc; }
.sec.locked { border-color: #ece0c6; background: #fffdf8; }
.sec .top { display: flex; align-items: flex-start; gap: 8px; }
.sec .ib { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--pill); display: grid; place-items: center; color: var(--navy-soft); }
.sec .ib .ic { width: 13px; height: 13px; }
.sec h3 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.35; }
.sec .kind { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.sec .note { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.sec .files { list-style: none; margin: 0; padding: 0; }
.sec .files li { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.sec .files .nm { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; color: var(--navy-soft); text-decoration: none; }
.sec .files .nm:hover { text-decoration: underline; }
.sec .files .sz { font-size: 10.5px; color: var(--faint); }
.lockpill { font-size: 9.5px; font-weight: 650; color: #a8781f; background: #fbf3e2; border-radius: 999px; padding: 1px 6px; margin-left: 5px; }

/* ---- CONTROL PANEL: the rights grid (rows = modules, columns = rights) ---- */
table.rights th.r, table.rights td.r { text-align: center; width: 64px; }
table.rights td.mod { font-weight: 550; }
table.rights td.mod.child { padding-left: 34px; font-weight: 450; color: var(--muted); }
table.rights tr.cat td { background: #fbfbfa; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
table.rights td.r.plus { background: var(--tint-yes); }
table.rights td.r.minus { background: var(--tint-no); }
.diffpill { font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.diffpill.plus { background: var(--tint-yes); color: var(--ink-yes); }
.diffpill.minus { background: var(--tint-no); color: var(--ink-no); }

/* ---- REPORTING: KPI tiles + bar rows + verdict lists (the Analysis tab) ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.kpi span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi b { display: block; font-size: 22px; font-weight: 650; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .trk { height: 10px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.hbar .fil { height: 100%; background: #2a78d6; border-radius: 4px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.verdict { border: 1px solid var(--line); border-left: 3px solid var(--fill-go); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; background: var(--card); }
.verdict.bad { border-left-color: var(--warn); }
.verdict.good { border-left-color: var(--ok); }
.verdict h4 { margin: 0 0 3px; font-size: 13.5px; font-weight: 650; }
.verdict .rule { font-size: 11.5px; color: var(--muted); font-style: italic; margin: 0 0 8px; }
.verdict ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
