@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap");

/* ==========================================================================
   Jaeger Tex ERP — shared theme (look & feel only; no behaviour lives here)
   Visual language taken from the Figma design: DM Sans + Manrope, violet accent,
   dark sidebar, white top bar, soft bordered cards, tinted status chips.
   Loaded after each page's own <style>, so it restyles every module the same way.
   ========================================================================== */

:root {
  --ink:#242634; --ink-soft:#6b6d7b; --ink-faint:#9a9ca6; --line:#e4e4e9; --bg:#f7f7f9; --card:#ffffff;
  --accent:#5e50d4; --accent-hover:#5245c2; --accent-soft:#eeecff; --accent-line:#cfc9f5;
  --warn:#c4553f; --warn-soft:#fbece7;
  --gold:#a8701f; --gold-soft:#fff3dd;
  --good:#3a8a63; --good-soft:#e4f5ec;
  --info:#397bc1; --info-soft:#e5f1fc;
  --side:#171821; --side-line:#2a2b37; --side-ink:#a3a6b6; --side-hover:#22232d; --side-active:#2a283c; --side-active-ink:#ddd9ff;
  --shadow-sm:0 1px 2px rgba(31,32,42,.04), 0 2px 6px rgba(31,32,42,.03);
  --shadow-md:0 8px 22px rgba(31,32,42,.09);
  --ring:0 0 0 3px rgba(103,87,218,.14);
  --font-body:"DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head:"Manrope", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:#ececf2; --ink-soft:#a4a7b6; --ink-faint:#74778a; --line:#2c2d3a; --bg:#12131a; --card:#1a1b25;
    --accent:#8f82f5; --accent-hover:#a095f8; --accent-soft:#272444; --accent-line:#463f80;
    --warn:#ec8e78; --warn-soft:#3a2420; --gold:#e1b866; --gold-soft:#352b17;
    --good:#6fcf9f; --good-soft:#1f3329; --info:#7db7ee; --info-soft:#1f3347;
    --side:#0e0f15; --side-line:#22232d; --side-hover:#191a23; --side-active:#262342;
    --shadow-sm:0 1px 2px rgba(0,0,0,.3); --shadow-md:0 8px 22px rgba(0,0,0,.45); --ring:0 0 0 3px rgba(143,130,245,.25);
  }
}
:root[data-theme="dark"] {
  --ink:#ececf2; --ink-soft:#a4a7b6; --ink-faint:#74778a; --line:#2c2d3a; --bg:#12131a; --card:#1a1b25;
  --accent:#8f82f5; --accent-hover:#a095f8; --accent-soft:#272444; --accent-line:#463f80;
  --warn:#ec8e78; --warn-soft:#3a2420; --gold:#e1b866; --gold-soft:#352b17;
  --good:#6fcf9f; --good-soft:#1f3329; --info:#7db7ee; --info-soft:#1f3347;
  --side:#0e0f15; --side-line:#22232d; --side-hover:#191a23; --side-active:#262342;
  --shadow-sm:0 1px 2px rgba(0,0,0,.3); --shadow-md:0 8px 22px rgba(0,0,0,.45); --ring:0 0 0 3px rgba(143,130,245,.25);
}

/* ---------- base ---------- */
html { scroll-behavior:smooth; }
body { font-family:var(--font-body); font-size:14.5px; line-height:1.45; color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
h1, h2, h3 { font-family:var(--font-head); color:var(--ink); letter-spacing:-.02em; }
h2 { font-size:22px; font-weight:700; letter-spacing:-.03em; }
h3 { font-size:16px; font-weight:700; }
a { color:var(--accent); }
::selection { background:var(--accent-soft); }
.muted { color:var(--ink-soft); font-size:13px; }

/* ---------- buttons ---------- */
.btn {
  font-family:inherit; font-size:14px; font-weight:600; padding:9px 15px; border-radius:8px;
  background:var(--card); color:var(--ink); border:1px solid var(--line); box-shadow:0 1px 1px rgba(31,32,42,.03);
  transition:background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent); }
.btn-primary { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 3px 9px rgba(94,80,212,.22); }
.btn-primary:hover { background:var(--accent-hover); border-color:var(--accent-hover); color:#fff; }
.btn-warn { background:var(--warn); border-color:var(--warn); color:#fff; box-shadow:none; }
.btn-warn:hover { background:var(--warn); border-color:var(--warn); color:#fff; filter:brightness(.95); }
.btn-ghost { background:transparent; border-color:transparent; box-shadow:none; color:var(--ink-soft); }
.btn-ghost:hover { background:var(--accent-soft); border-color:transparent; color:var(--accent); }
.btn-sm { padding:6px 11px; font-size:13px; border-radius:7px; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.icon-btn { color:var(--warn); border-radius:7px; }
.icon-btn:hover { background:var(--warn-soft); }

/* ---------- cards ---------- */
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:18px; box-shadow:var(--shadow-sm); margin-bottom:16px; }
.card h3 { margin-bottom:8px; }
.divider { background:var(--line); }
.empty { color:var(--ink-faint); }

/* page headers (a card whose first child holds the module/page title) become plain headings, like the Figma screens */
.card:has(> h2:first-child, > div:first-child > h2:first-child):not(:has(> :nth-child(3))) { background:transparent; border:0; box-shadow:none; padding:4px 0 6px; margin-bottom:10px; }
.card:has(> h2:first-child, > div:first-child > h2:first-child):not(:has(> :nth-child(3))) h2 { font-size:26px; margin:0 0 4px; }
.card:has(> h2:first-child, > div:first-child > h2:first-child):not(:has(> :nth-child(3))) .muted { font-size:13.5px; }

/* ---------- forms ---------- */
label { color:var(--ink-soft); font-size:11.5px; font-weight:700; letter-spacing:.06em; margin-bottom:6px; }
input, select, textarea {
  font-family:inherit; font-size:15px; color:var(--ink); background:var(--card);
  border:1px solid var(--line); border-radius:8px; padding:10px 12px;
  transition:border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color:var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color:#cfd0d9; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:var(--ring); }
input[type="checkbox"], input[type="radio"] { accent-color:var(--accent); }
select { cursor:pointer; }
input[readonly], input:disabled, select:disabled, textarea:disabled { background:var(--bg); color:var(--ink-soft); }
.field-note { color:var(--ink-faint); }

/* ---------- tables ---------- */
table { font-size:14px; }
th, td { padding:11px 10px; border-bottom:1px solid var(--line); }
th { background:var(--bg); color:var(--ink-faint); font-size:11px; font-weight:700; letter-spacing:.07em; }
thead th:first-child { border-top-left-radius:8px; }
thead th:last-child { border-top-right-radius:8px; }
tr.clickable:hover td { background:var(--accent-soft); }
tbody tr:last-child td { border-bottom:0; }
td b { color:var(--ink); }

/* ---------- chips / pills ---------- */
.badge { font-size:11.5px; font-weight:600; padding:3px 10px; letter-spacing:.01em; background:var(--bg); color:var(--ink-soft); border:1px solid var(--line); }
.badge-accent, .badge-warn, .badge-gold { border-color:transparent; }
.badge-accent { background:var(--good-soft); color:var(--good); }
.badge-warn { background:var(--warn-soft); color:var(--warn); }
.badge-gold { background:var(--gold-soft); color:var(--gold); }
/* counts next to a card title read as neutral violet chips */
h2 > .badge-accent, h3 > .badge-accent { background:var(--accent-soft); color:var(--accent); }
.pill { background:var(--bg); border:1px solid var(--line); border-radius:9px; padding:8px 12px; color:var(--ink-soft); }
.pill b { color:var(--ink); font-family:var(--font-head); font-size:16px; font-weight:700; }

/* ---------- segmented toggles ---------- */
.segmented { border:0; border-radius:0; overflow:visible; gap:8px; flex-wrap:wrap; }
.segmented button { flex:0 1 auto; padding:9px 16px; border:1px solid var(--line); border-radius:8px; background:var(--card); color:var(--ink-soft); font-family:inherit; font-weight:600; }
.segmented button:hover { border-color:var(--accent-line); color:var(--accent); }
.segmented button.active { background:var(--accent-soft); border-color:var(--accent); color:var(--accent); box-shadow:0 0 0 3px rgba(103,87,218,.08); }
.seg-sm { border-radius:8px; }

/* ---------- misc ---------- */
.toast { background:#262733; color:#fff; border-radius:10px; padding:11px 18px; font-size:13.5px; box-shadow:0 10px 26px rgba(20,20,30,.28); }
.backlink { color:var(--accent); font-weight:600; }
.kebab { color:var(--ink-faint); border-radius:7px; }
.kmenu { border-radius:10px; box-shadow:var(--shadow-md); }
.kmenu button { border-radius:7px; font-weight:500; }
.login-wrap .card { padding:26px; box-shadow:var(--shadow-md); }
.login-wrap h2, .login-wrap h3 { font-family:var(--font-head); }

/* ---------- top bar ---------- */
.topbar { background:var(--card); border-bottom:1px solid var(--line); }
.brand { text-decoration:none; color:var(--ink); }
.brand b { font-family:var(--font-head); font-weight:800; font-size:15px; letter-spacing:.02em; color:var(--ink); }
.brand span { color:var(--ink-soft); font-size:11.5px; }
.who { color:var(--ink-soft); }
.who a { color:var(--ink) !important; font-weight:600; }
.who .badge { font-size:10.5px; padding:2px 8px; }
#logoutBtn { border:1px solid var(--line); background:var(--card); color:var(--ink-soft); width:36px; height:36px; padding:0; border-radius:8px; }
#logoutBtn:hover { border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent); }

/* brand monogram */
.brand { display:grid; grid-template-columns:34px auto; column-gap:11px; row-gap:1px; align-items:center; align-content:center; line-height:1.2; }
.brand::before { content:'JT'; grid-row:1 / 3; width:34px; height:34px; border-radius:9px; display:grid; place-items:center;
                 background:var(--accent); color:#fff; font:800 13px var(--font-head); letter-spacing:.02em; box-shadow:0 3px 8px rgba(94,80,212,.3); }

/* ---------- side nav ---------- */
.op-nav button { font-family:inherit; font-size:14px; font-weight:500; border-radius:9px; }
.op-nav button .count { font-weight:700; }
.nav-divider span { color:var(--ink-faint); }

/* ===================== desktop: dark sidebar + white top bar ===================== */
@media screen and (min-width:901px) {
  #app:has(.app-sidebar) { max-width:none; margin:0; padding:0 0 60px 228px; }

  /* the brand sits in the dark sidebar header, the top bar spans the content area */
  #app:has(.app-sidebar) .topbar { position:sticky; top:0; height:64px; margin:0; padding:0 32px; gap:12px; background:var(--card); border-bottom:1px solid var(--line); z-index:20; }
  #app:has(.app-sidebar) .topbar .brand { position:fixed; left:0; top:0; width:228px; height:64px; padding:0 21px; margin:0; background:var(--side);
                                          border-bottom:1px solid var(--side-line); z-index:40; }
  #app:has(.app-sidebar) .topbar .brand b { color:#fff; }
  #app:has(.app-sidebar) .topbar .brand span { color:#8a8d9e; }
  #app:has(.app-sidebar) .topbar .top-actions { margin-left:auto; align-items:center; gap:6px; }

  #app:has(.app-sidebar) .app-shell { display:block; }
  #app:has(.app-sidebar) .app-sidebar { position:fixed; left:0; top:64px; bottom:0; width:228px; z-index:30; background:var(--side); padding:18px 14px 24px; overflow-y:auto; }
  #app:has(.app-sidebar) .app-main { max-width:1320px; margin:0 auto; padding:28px 32px 40px; }

  .op-nav { gap:3px; }
  .op-nav button { height:40px; padding:0 11px; gap:11px; justify-content:flex-start; background:transparent; border:0; color:var(--side-ink); border-radius:8px; }
  .op-nav button::before { content:''; width:7px; height:7px; border-radius:50%; background:#8675f3; flex:0 0 auto; margin-left:3px; }
  .op-nav button:nth-of-type(4n+2)::before { background:#eb9a59; }
  .op-nav button:nth-of-type(4n+3)::before { background:#5bb98a; }
  .op-nav button:nth-of-type(4n+4)::before { background:#589ce5; }
  .op-nav button > span:first-child { flex:1; text-align:left; }
  .op-nav button .count { margin-left:auto; background:#2f3040; color:#b9bccb; border-radius:9px; font-size:11px; padding:2px 8px; }
  .op-nav button:empty .count, .op-nav button .count:empty { display:none; }
  .op-nav button:hover { background:var(--side-hover); color:#fff; }
  .op-nav button.active { background:var(--side-active); color:var(--side-active-ink); }
  .op-nav button.active::before { box-shadow:0 0 0 3px rgba(134,117,243,.25); }
  .op-nav button.active .count { background:#4a4672; color:#e8e5ff; }
  .nav-divider { margin:18px 4px 8px; }
  .nav-divider::before { background:var(--side-line); }
  .nav-divider span { color:#6c6f80; font-size:10px; letter-spacing:.13em; }
}

/* ===================== phones / small tablets: tab row under the top bar ===================== */
@media screen and (max-width:900px) {
  #app { max-width:none; padding-left:12px; padding-right:12px; }
  .app-shell { display:flex; flex-direction:column; align-items:stretch; gap:0; }
  .app-sidebar { width:auto; position:sticky; top:calc(env(safe-area-inset-top, 0px) + var(--tb, 56px)); z-index:9;
                 margin:0 -12px 12px; padding:8px 12px; background:var(--bg); border-bottom:1px solid var(--line); }
  .op-nav { flex-direction:row; gap:6px; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .op-nav::-webkit-scrollbar { display:none; }
  .op-nav button { flex:0 0 auto; width:auto; flex-direction:row; align-items:center; gap:8px; padding:9px 14px; min-height:40px; white-space:nowrap;
                   font-size:13.5px; background:var(--card); border:1px solid var(--line); color:var(--ink); box-shadow:none; }
  .op-nav button .count { background:var(--bg); color:var(--ink-soft); border-radius:99px; padding:1px 8px; }
  .op-nav button.active { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 3px 8px rgba(94,80,212,.25); }
  .op-nav button.active .count { background:rgba(255,255,255,.22); color:#fff; }
  .nav-divider { flex:0 0 auto; margin:0 4px; align-self:center; }
  .nav-divider::before { flex:none; width:1px; height:22px; background:var(--line); }
  #app .topbar { margin-left:-12px; margin-right:-12px; padding-left:12px; padding-right:12px; }
  .brand::before { width:30px; height:30px; font-size:12px; }
  .brand { grid-template-columns:30px auto; column-gap:9px; }
  .card:has(> h2:first-child, > div:first-child > h2:first-child):not(:has(> :nth-child(3))) h2 { font-size:22px; }
}
@media screen and (max-width:520px) {
  .card { padding:14px; border-radius:11px; }
}

/* ---------- print: never touched by the theme ---------- */
@media print {
  .brand::before { display:none; }
}
