/* ==========================================================================
   AES Production · follows the AES Dashboard design language
   (AESDashboard/docs/DESIGN-LANGUAGE.md): same tokens, shell, report parts.
   ========================================================================== */
:root {
  --brand: #2f6f4f;
  --brand-dark: #245a40;
  --brand-soft: #eaf3ee;
  --accent: #e0a458;
  --ink: #1f2a24;
  --muted: #6b7a72;
  --line: #e3e8e5;
  --bg: #f5f7f6;
  --bad: #b23b3b;
  --sidebar-w: 250px;

  /* older names still used by some pages, mapped onto the tokens above */
  --text: var(--ink);
  --text-2: #45524c;
  --border: var(--line);
  --surface: #fff;
  --series: var(--brand);
  --series-track: #e2efe8;
  --critical: var(--bad);
  --radius: 10px;

  /* Bootstrap: brand green as "primary" */
  --bs-primary: #2f6f4f;
  --bs-primary-rgb: 47, 111, 79;
  --bs-link-color: #2f6f4f;
  --bs-link-color-rgb: 47, 111, 79;
  --bs-link-hover-color: #245a40;
  --bs-link-hover-color-rgb: 36, 90, 64;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-body-color: #1f2a24;
  --bs-body-bg: #f5f7f6;
  --bs-border-color: #e3e8e5;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); }
.min-w-0 { min-width: 0; }
.icon-btn { border: 0; background: transparent; color: var(--ink); width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.icon-btn:hover { background: var(--brand-soft); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar.offcanvas-lg { background-color: #fff !important; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; } }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { width: 270px; } }
.sidebar-close { position: absolute; top: 12px; right: 12px; }
/* Brand lockup, in order of importance: logo, app, legal entity */
.sidebar-brand {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 20px 18px;
  text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line);
}
.brand-logo { display: block; height: 34px; width: auto; max-width: 100%; margin-bottom: 16px; }
.brand-title { font-size: .92rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.brand-entity { margin-top: 3px; font-size: .72rem; line-height: 1.4; color: var(--muted); text-wrap: balance; }
.sidebar-brand:hover .brand-title { color: var(--brand); }
.sidebar-nav { padding: 10px 0; }
.nav-group-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 20px 4px; font-weight: 700; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 20px; color: #384740; text-decoration: none; font-size: .9rem;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { color: #93a09a; font-size: .95rem; width: 18px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--brand-soft); }
.sidebar-nav .nav-link.active { background: var(--brand-soft); border-left-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.sidebar-nav .nav-link.active i { color: var(--brand); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 26px; position: sticky; top: 0; z-index: 1020;
}
.topbar-left { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 0; min-width: 0; flex: 1; }
.topbar-title { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.topbar-back { font-size: .76rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.topbar-back:hover { color: var(--brand); }
.data-stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); }
.data-stamp-sep { color: #c3ccc7; }
.env-tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-weight: 700; font-size: .7rem;
  background: #fdf3e3; color: #8a5a16; border: 1px solid #f0d9ad; margin-left: 4px; }
.user-toggle {
  display: inline-flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px;
  background: transparent; border: 1px solid transparent; border-radius: 999px; color: var(--ink); font-size: .88rem; cursor: pointer;
}
.user-toggle:hover, .user-toggle[aria-expanded="true"] { background: var(--brand-soft); border-color: var(--line); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem; }
.user-name { font-weight: 600; color: var(--muted); font-size: .88rem; }
.user-caret { color: var(--muted); font-size: .75rem; transition: transform .15s; }
.user-toggle[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
.user-menu { min-width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(20,60,40,.14); margin-top: 6px !important; }
.user-menu-head { padding: 8px 12px 6px; }
.user-menu-name { font-weight: 700; font-size: .9rem; color: var(--ink); }
.user-menu-sub { font-size: .78rem; color: var(--muted); }
.user-menu .dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: .88rem; color: var(--ink); }
.user-menu .dropdown-item i { color: var(--muted); }
.user-menu .dropdown-item:hover, .user-menu .dropdown-item:focus { background: var(--brand-soft); color: var(--brand-dark); }
.user-menu .dropdown-item.user-menu-signout, .user-menu .dropdown-item.user-menu-signout i { color: #b3261e; }
.user-menu .dropdown-item.user-menu-signout:hover { background: #fdecea; color: #8c1d18; }
@media (max-width: 600px) { .user-name { display: none; } .env-tag { display: none; } .topbar { padding: 0 14px; } }
.content { padding: 24px 26px; flex: 1; max-width: 1600px; width: 100%; }
@media (max-width: 991.98px) { .content { padding: 16px; } }
.app-footer { padding: 16px 26px; border-top: 1px solid var(--line); background: #fff; font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.5; }

/* ---------- Page header (inside the content) ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.page-sub { color: var(--muted); margin: 0; font-size: .9rem; }
.section-title { font-size: 1.02rem; font-weight: 800; margin: 6px 0 12px; }
.section-sub { font-size: .78rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
h5 { font-weight: 700; }

/* ---------- Cards: report-card look ---------- */
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.card-header {
  background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px;
  font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.card-header:first-child { border-radius: 10px 10px 0 0; }
.card-header .small, .card-header .fw-normal, .card-header a, .card-header .badge { text-transform: none; letter-spacing: 0; }
.card-header a { color: var(--brand); font-weight: 600; }
.card-body { padding: 14px 16px; }
.panel { padding: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.panel-head p { color: var(--muted); font-size: .78rem; margin: 2px 0 0; }

/* ---------- KPI tiles ---------- */
.kpi-grid, .kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { display: block; position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; color: inherit; text-decoration: none; }
a.kpi { transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: 0 8px 24px rgba(47,111,79,.12); transform: translateY(-2px); color: inherit; }
.kpi-icon { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.kpi-icon-blue { background: #e8eef7; color: #2d4f7c; }
.kpi-icon-amber { background: #fdf3e3; color: #8a5a16; }
.kpi-icon-slate { background: #eef1ef; color: var(--muted); }
.kpi-icon-red { background: #fdecea; color: var(--bad); }
.kpi-icon-green { background: #e2efe8; color: var(--brand); }
.kpi-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.kpi-good .kpi-value { color: var(--brand); }
.kpi-warn .kpi-value { color: var(--accent); }
.kpi-bad .kpi-value, .kpi-critical .kpi-value { color: var(--bad); }

/* ---------- Single-series bar chart ---------- */
.hbar-chart { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr 44px; align-items: center; gap: 12px; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; }
.hbar-row:hover { background: #f4f8f5; }
.hbar-label { color: var(--text-2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 12px; border-left: 1px solid #c3ccc7; }
.hbar-fill { height: 100%; min-width: 3px; background: var(--brand); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-weight: 600; font-size: .85rem; color: var(--brand); }

.meter { height: 6px; border-radius: 3px; background: #eef0ef; overflow: hidden; }
.meter-fill { height: 100%; background: var(--brand); border-radius: 3px; }

/* ---------- Attention list ---------- */
.attention-list { list-style: none; padding: 0; margin: 0; }
.attention-list a { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.attention-list li:last-child a { border-bottom: 0; }
.attention-list a:hover { background: #f4f8f5; }
.att-flag { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; font-size: 0; }
.att-critical { background: #c0504d; }
.att-warning { background: var(--accent); }
.att-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.att-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.att-sub { color: var(--muted); font-size: .78rem; }
.att-when { font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.text-critical { color: var(--bad) !important; font-weight: 600; }
.empty-state { display: flex; align-items: center; gap: 10px; color: var(--brand-dark); padding: 12px 14px; background: #e2efe8; border-radius: 10px; }
.empty-state i { font-size: 1.2rem; }

/* ---------- Messages: alerts and callouts look like AES Dashboard flash bars ---------- */
.alert, .callout { border-radius: 10px; border: 1px solid transparent; padding: 11px 16px; font-size: .9rem; }
.callout { display: flex; gap: 10px; align-items: flex-start; }
.callout i, .alert > i { margin-top: 2px; }
.alert-success, .callout-success { background: #e2efe8; color: var(--brand-dark); border-color: #bcdcc9; }
.alert-warning, .callout-warning { background: #fdf3e3; color: #8a5a16; border-color: #f0d9ad; }
.alert-danger, .callout-danger { background: #fdecec; color: var(--bad); border-color: #f5c9c9; }
.alert-info, .alert-secondary, .alert-light { background: #e8eef7; color: #2d4f7c; border-color: #cbd8ea; }
.alert-heading { color: inherit; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f4f8f5; margin-bottom: 0; }
.table > thead th, .table-light th, .table > thead.table-light th {
  background: #fff !important; color: var(--muted); font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--line); white-space: nowrap;
}
.table td, .table th { vertical-align: middle; border-color: var(--line); font-size: .88rem; }
.table > tfoot td, .table > tfoot th, .table tfoot tr.fw-bold td, .table tfoot tr.fw-semibold td { border-top: 2px solid var(--line); background: #f7faf8; font-weight: 700; }
.table td.neg, .text-neg { color: var(--bad); }
.modern-table td { padding-top: .6rem; padding-bottom: .6rem; }
.cell-sub { color: var(--muted); font-size: .76rem; }
.clickable-row { cursor: pointer; }
.clickable-row:hover > td { background: #f4f8f5; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-foot-note { font-size: .74rem; color: var(--muted); margin-top: 8px; }

/* ---------- Status pills: colour plus words ---------- */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-planned { background: #eef1ef; color: var(--muted); }
.status-released { background: #e8eef7; color: #2d4f7c; }
.status-closed { background: #e2efe8; color: var(--brand-dark); }
.status-cancelled { background: #fdecea; color: #a4261d; }
.badge { font-weight: 600; border-radius: 999px; padding: .3em .7em; }
.badge.text-bg-primary { background: #e8eef7 !important; color: #2d4f7c !important; }
.badge.text-bg-info { background: #fdf3e3 !important; color: #8a5a16 !important; }
.badge.text-bg-secondary { background: #eef1ef !important; color: var(--muted) !important; }
.badge.text-bg-success { background: #e2efe8 !important; color: var(--brand-dark) !important; }
.badge.text-bg-warning { background: #fdf3e3 !important; color: #8a5a16 !important; }
.badge.text-bg-danger { background: #fdecea !important; color: #a4261d !important; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: 8px; font-weight: 500; }
.btn-aes, .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-aes:hover, .btn-aes:focus, .btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-aes:disabled, .btn-primary:disabled { background: #8fb79f; border-color: #8fb79f; color: #fff; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.btn-outline-primary:disabled { color: #8fb79f; border-color: #c9dccf; }
.btn-outline-success { color: var(--brand); border-color: var(--brand); }
.btn-outline-success:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.btn-light.border { background: #fff; border-color: var(--line) !important; }
.btn-light.border:hover { background: var(--brand-soft); }
.form-control, .form-select { border-color: #d6ddd9; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(47,111,79,.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(47,111,79,.15); }
.form-control-sm, .form-select-sm { border-radius: 6px; }
.text-primary { color: var(--brand) !important; }
.bg-warning-subtle { background: #fdf3e3 !important; }
.border-warning { border-color: #f0d9ad !important; }
.nav-tabs .nav-link.active { color: var(--brand-dark); border-bottom-color: #fff; }
.nav-tabs .nav-link { color: var(--muted); }

.sap-form dt { font-weight: normal; color: var(--muted); font-size: .84rem; }
.sap-form dd { margin-bottom: .35rem; }
.udf-panel { background: #fff; }
.brand-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-right: 6px; }

/* ---------- Sign-in: AES Dashboard split card ---------- */
.auth-body {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(120% 120% at 50% 0%, #eef4f0 0%, #f7f9f8 45%, #f2f5f3 100%);
}
.auth-split {
  width: 100%; max-width: 900px; display: grid; grid-template-columns: 1.02fr 1fr;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(20,60,40,.13);
  animation: authRise .4s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes authRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 36px;
  background: linear-gradient(145deg, #1f8256 0%, #145f3f 45%, #4f4a2c 78%, #7a5c2b 100%); background-size: 160% 160%;
  animation: authGradient 18s ease infinite;
}
@keyframes authGradient { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.auth-brand-noise { position: absolute; inset: 0; opacity: .06; pointer-events: none; background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0); background-size: 24px 24px; }
.auth-brand-blob { position: absolute; border-radius: 50%; filter: blur(50px); pointer-events: none; }
.auth-brand-blob-1 { width: 300px; height: 300px; background: #33b277; opacity: .45; top: -110px; right: -90px; animation: authFloat 14s ease-in-out infinite; }
.auth-brand-blob-2 { width: 260px; height: 260px; background: #cf9a4a; opacity: .38; bottom: -110px; left: -70px; animation: authFloat 17s ease-in-out infinite reverse; }
@keyframes authFloat { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(18px,-20px) scale(1.07); } }
.auth-brand-inner { position: relative; z-index: 1; margin-top: auto; margin-bottom: auto; }
.auth-brand-eyebrow {
  display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.82); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); padding: 5px 11px; border-radius: 999px; margin-bottom: 18px;
}
.auth-brand-title { font-size: 1.85rem; line-height: 1.15; font-weight: 800; margin: 0 0 14px; letter-spacing: -.4px; }
.auth-brand-tagline { font-size: .88rem; line-height: 1.6; color: rgba(255,255,255,.86); margin: 0 0 24px; }
.auth-features { display: flex; flex-direction: column; gap: 10px; }
.auth-feature { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 12px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16); transition: transform .18s, background .18s; }
.auth-feature:hover { transform: translateX(3px); background: rgba(255,255,255,.15); }
.auth-feature-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); color: #ffe6bf; }
.auth-feature-t { font-size: .88rem; font-weight: 700; }
.auth-feature-s { font-size: .75rem; color: rgba(255,255,255,.78); }
.auth-brand-foot { position: relative; z-index: 1; font-size: .72rem; color: rgba(255,255,255,.7); margin-top: 22px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 36px; background: #fff; }
.auth-card { width: 100%; max-width: 340px; }
.auth-logo { display: block; height: 40px; width: auto; max-width: 230px; margin: 0 auto 20px; }
.auth-welcome { text-align: center; }
.auth-welcome h2 { font-size: 1.3rem; font-weight: 800; margin: 0 0 4px; color: var(--ink); letter-spacing: -.3px; }
.auth-welcome p { color: var(--muted); font-size: .86rem; margin: 0 0 20px; line-height: 1.5; }
.auth-alert { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 11px 14px; border-radius: 10px; font-size: .86rem; }
.auth-alert-error { background: #fdecec; color: var(--bad); border: 1px solid #f5c9c9; }
.auth-alert-warn { background: #fdf3e3; color: #8a5a16; border: 1px solid #f0d9ad; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field-label { font-size: .8rem; font-weight: 600; color: #45524c; }
.auth-input { position: relative; display: flex; align-items: center; }
.auth-input-icon { position: absolute; left: 14px; color: #9aa8a1; pointer-events: none; z-index: 1; }
.auth-input input, .auth-input select {
  width: 100%; height: 48px; padding: 0 44px 0 42px; font-size: .95rem; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfdfc; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-input select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239aa8a1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 14px center; background-size: 14px 10px; }
.auth-input input::placeholder { color: #b3bdb7; }
.auth-input input:focus, .auth-input select:focus { border-color: var(--brand); background-color: #fff; box-shadow: 0 0 0 4px rgba(47,111,79,.12); }
.auth-input:focus-within .auth-input-icon { color: var(--brand); }
.auth-eye { position: absolute; right: 8px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: #9aa8a1; cursor: pointer; border-radius: 8px; }
.auth-eye:hover { color: var(--brand); background: var(--brand-soft); }
.auth-submit {
  margin-top: 6px; height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: none; border-radius: 12px; cursor: pointer; font-size: 1rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #2f8659 0%, #1e7a52 55%, #17603f 100%); box-shadow: 0 10px 24px rgba(30,122,82,.28);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.auth-submit:hover { filter: brightness(1.05); box-shadow: 0 14px 30px rgba(30,122,82,.36); transform: translateY(-1px); }
.auth-submit:disabled { filter: grayscale(.3); cursor: wait; transform: none; }
.auth-secure { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .76rem; color: #9aa8a1; text-align: center; }
.text-danger.small { font-size: .78rem; }
@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; max-width: 420px; }
  .auth-brand { display: none; }
  .auth-panel { padding: 32px 26px; }
}
@media (max-width: 480px) {
  .auth-body { padding: 20px 16px; background: #fff; }
  .auth-split { border: none; box-shadow: none; }
  .auth-panel { padding: 16px 4px; }
}
@media (prefers-reduced-motion: reduce) { .auth-split, .auth-brand, .auth-brand-blob { animation: none; } }

/* ---------- Traceability tree ---------- */
.trace-root { display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--brand-soft); }
.trace-links, .trace-batches { list-style: none; margin: 0; padding-left: 18px; border-left: 2px solid var(--line); }
.trace-links { margin-left: 10px; margin-top: 8px; }
.trace-links > li { position: relative; padding: 6px 0 2px; }
.trace-link { display: flex; gap: 10px; align-items: flex-start; }
.trace-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .9rem; }
.trace-prod { background: #e8eef7; color: #2d4f7c; }
.trace-supplier { background: #e2efe8; color: var(--brand-dark); }
.trace-customer { background: #fdf3e3; color: #8a5a16; }
.trace-conv { background: #f1ecfb; color: #5a3fc0; }
.trace-other { background: #eef1ef; color: var(--muted); }
.trace-link-title { font-weight: 600; }
.trace-link-title a { text-decoration: none; }
.trace-link-sub { color: var(--muted); font-size: .8rem; }
.trace-batches { margin: 6px 0 4px 13px; }
.trace-batches > li { padding: 3px 0; }
.trace-batch { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.trace-batch-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; text-decoration: none; color: var(--brand); }
.trace-batch-item { color: var(--text-2); font-size: .82rem; }
.trace-batch-qty { color: var(--ink); font-size: .82rem; font-variant-numeric: tabular-nums; }
.trace-note { font-size: .75rem; color: var(--muted); }

/* ---------- Receipt: quantity split rule ---------- */
.split-rule { display: flex; gap: 10px; align-items: flex-start; background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; padding: 10px 14px; font-size: .86rem; }
.split-rule > i { margin-top: 2px; }
.split-rule code { background: #fff; color: var(--brand-dark); padding: 1px 6px; border-radius: 5px; }
.split-rule .text-muted { color: var(--muted) !important; }
.out-row.zero-value td { background: #fafbfa; color: var(--muted); }
.pct-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: #eef0ef; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.pct-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* ===== Relationship map (order → issue/receipt → cost-split revaluation) ===== */
.map-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:.75rem;color:var(--muted)}
.map-legend .sw{display:inline-block;width:14px;height:10px;border-radius:2px;margin-right:5px;vertical-align:-1px;border:1px solid}
.map-legend .sw-order{background:#fde98f;border-color:#d9b84a}
.map-legend .sw-doc{background:#dce7f5;border-color:#9fb6d6}
.map-legend .sw-reval{background:var(--brand-soft);border-color:#7fb08f}
.map-legend .sw-pending{background:#fff1d9;border-color:var(--accent);border-style:dashed}
.map-wrap{overflow:auto;background:#fbfcfb;border:1px solid var(--line);border-radius:10px}
.rmap{position:relative;display:grid;grid-template-columns:230px 260px 270px;column-gap:80px;row-gap:22px;padding:28px 36px;width:max-content;align-items:center}
.rmap-svg{position:absolute;left:0;top:0;pointer-events:none;overflow:visible}
.rmap-col{font-size:.68rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700;text-align:center;align-self:end}
.rmap-cell{position:relative;z-index:1}
.rnode{background:#fff;border:1px solid #9fb6d6;border-radius:6px;box-shadow:0 4px 10px rgba(31,42,36,.08);font-size:.8rem;cursor:pointer;transition:box-shadow .15s,transform .15s}
.rnode:hover,.rnode:focus-visible{box-shadow:0 6px 18px rgba(31,42,36,.16);transform:translateY(-1px);outline:none}
.rnode.sel{outline:3px solid var(--accent);outline-offset:1px}
.rnode-h{background:#dce7f5;border-bottom:1px solid #9fb6d6;font-weight:700;text-align:center;padding:4px 8px;border-radius:6px 6px 0 0}
.rnode-b{padding:6px 10px;text-align:right;line-height:1.55}
.rnode-b .k{float:left;color:var(--muted)}
.rnode-b .v{font-weight:600}
.rnode-order{border-color:#d9b84a}.rnode-order .rnode-h{background:#fde98f;border-color:#d9b84a}
.rnode-reval{border-color:#7fb08f}.rnode-reval .rnode-h{background:var(--brand-soft);border-color:#7fb08f;color:var(--brand-dark)}
.rnode-pending{border:1.5px dashed var(--accent);background:#fffaf2;cursor:default}
.rnode-pending .rnode-h{background:#fff1d9;border-color:var(--accent);color:#8a5a12}
.rnode-cancelled{opacity:.55}.rnode-cancelled .rnode-b .v{text-decoration:line-through}
.rtag{display:inline-block;font-size:.66rem;font-weight:700;padding:0 6px;border-radius:999px;background:#f3d9d9;color:#b23b3b}
.rtag-grey{background:#eef0ef;color:#555}
.rmap-detail{border:1px solid var(--line);border-radius:10px;padding:12px 14px;background:#fff}
.card-header .map-open{text-transform:none;letter-spacing:0;font-weight:600}
