:root {
  --navy: #071827;
  --navy-2: #0c2639;
  --teal: #16b8a6;
  --teal-dark: #0b8e82;
  --teal-soft: #e7f8f5;
  --ink: #102432;
  --muted: #5d707c;
  --line: #dbe4e8;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --amber: #d99022;
  --amber-soft: #fff7e8;
  --red: #c84343;
  --red-soft: #fff0f0;
  --green: #14806f;
  --shadow: 0 18px 50px rgba(9, 34, 49, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
}
.finance-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 12%, rgba(25, 184, 164, .14), transparent 28%),
    linear-gradient(145deg, #071827, #0b3043);
}
.finance-gate-card {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid #dce7e7;
  border-radius: 22px;
  background: white;
  box-shadow: 0 28px 80px rgba(0, 12, 20, .25);
}
.finance-gate-card h1 { margin: 0 0 10px; font-size: 25px; }
.finance-login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 18% 12%, rgba(31, 189, 169, .2), transparent 28%),
    linear-gradient(135deg, #061522, #08283b 58%, #0a3445);
}
.finance-login-atmosphere {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(109, 216, 205, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 216, 205, .035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to right, #000, transparent 75%);
}
.finance-login-intro {
  position: relative;
  align-self: center;
  padding: clamp(44px, 8vw, 108px);
}
.finance-login-logo {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(91, 220, 204, .28);
  border-radius: 19px;
  background: rgba(8, 76, 80, .32);
}
.finance-login-logo img { width: 44px; height: 44px; object-fit: contain; }
.finance-login-intro h1 {
  margin: 20px 0 14px;
  font-size: clamp(42px, 5.5vw, 72px);
  line-height: 1;
  letter-spacing: -.045em;
}
.finance-login-intro > p:not(.eyebrow) {
  max-width: 570px;
  margin: 0;
  color: #a7c3ce;
  font-size: 17px;
  line-height: 1.7;
}
.finance-login-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.finance-login-points span {
  padding: 7px 12px;
  border: 1px solid rgba(120, 218, 207, .2);
  border-radius: 999px;
  color: #b7d8d8;
  background: rgba(11, 59, 71, .42);
  font-size: 11px;
}
.finance-login-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background: rgba(246, 250, 250, .98);
  box-shadow: -26px 0 70px rgba(1, 17, 27, .16);
}
.finance-login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid #dce7e7;
  border-radius: 22px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
}
.finance-login-card h2 { margin: 0 0 7px; font-size: 27px; }
.finance-login-card .field { margin-top: 17px; }
.finance-login-card .btn { margin-top: 7px; }
.finance-back-link {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 11px;
}
.finance-back-link:hover { color: var(--teal-dark); }
.brand-mark img { width: 30px; height: 30px; object-fit: contain; }
.brand-mark.large img { width: 50px; height: 50px; }
.sidebar-return {
  display: block;
  margin-top: 14px;
  color: #83b2c1;
  font-size: 11px;
  text-decoration: none;
}
.sidebar-return:hover { color: #72e0d2; }
.user-chip { cursor: default; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 9px;
  color: #83e0d4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
}
.eyebrow.dark { color: var(--teal-dark); }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(85, 217, 201, .35);
  border-radius: 12px;
  background: rgba(12, 88, 86, .22);
}
.brand-mark.large { width: 68px; height: 68px; border-radius: 20px; }
.brand-mark svg { width: 26px; height: 26px; fill: none; stroke: #6fe1d3; stroke-width: 2.2; }
.brand-mark.large svg { width: 42px; height: 42px; }

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr);
  background:
    radial-gradient(circle at 17% 16%, rgba(25, 184, 164, .19), transparent 28%),
    linear-gradient(135deg, #061523 0%, #082235 58%, #0b3043 100%);
  position: relative;
  overflow: hidden;
}
.login-atmosphere {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 221, 205, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 221, 205, .03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to right, #000, transparent 74%);
}
.login-brand {
  position: relative;
  padding: clamp(48px, 8vw, 112px);
  align-self: center;
  color: white;
  max-width: 760px;
}
.login-brand h1 {
  margin: 20px 0 18px;
  font-size: clamp(48px, 6vw, 82px);
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 650;
}
.login-lead {
  max-width: 550px;
  margin: 0;
  color: #a8c1ce;
  font-size: 18px;
  line-height: 1.6;
}
.login-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}
.login-trust span {
  border: 1px solid rgba(129, 219, 208, .2);
  border-radius: 999px;
  padding: 7px 13px;
  color: #b7d4d7;
  background: rgba(14, 62, 75, .42);
  font-size: 12px;
}
.login-panel {
  position: relative;
  min-height: 100vh;
  padding: 34px;
  display: grid;
  place-items: center;
  background: rgba(244, 248, 248, .97);
  box-shadow: -30px 0 80px rgba(1, 17, 27, .15);
}
.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid #dce7e7;
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}
.login-card h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.025em; }
.login-card form { display: grid; gap: 17px; margin-top: 30px; }
.login-foot { margin: 27px 0 0; text-align: center; color: #84959f; font-size: 11px; letter-spacing: .08em; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 282px;
  padding: 25px 19px 18px;
  display: flex;
  flex-direction: column;
  color: white;
  background:
    radial-gradient(circle at 20% 4%, rgba(20, 178, 158, .18), transparent 24%),
    linear-gradient(180deg, #061624, #0a273a);
  box-shadow: 18px 0 44px rgba(2, 18, 30, .2);
  transform: translateX(-101%);
  transition: transform .24s cubic-bezier(.22,.8,.24,1);
}
.sidebar.open { transform: translateX(0); }
.sidebar-hover-zone { display: none; }
.app-shell[hidden] + .sidebar-hover-zone { display: none !important; }
.app-shell.sidebar-pinned .main-shell { margin-left: 282px; }
.app-shell:not(.sidebar-pinned) .main-shell {
  transition: margin-left .24s cubic-bezier(.22,.8,.24,1);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
}
.sidebar-brand strong { display: block; letter-spacing: .08em; font-size: 14px; }
.sidebar-brand span { display: block; margin-top: 3px; color: #6fdfd1; font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.nav-list {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 223, 209, .28) transparent;
}
.nav-group {
  display: block;
  padding: 0 0 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
}
.nav-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px 5px;
  color: #7c99a7;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .02em;
  cursor: pointer;
  list-style: none;
}
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label::marker { display: none; }
.nav-group-items { display: grid; gap: 2px; padding-top: 2px; }
.nav-active-highlight {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 4px;
  top: 0;
  height: 30px;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(26, 176, 157, .28), rgba(15, 107, 104, .15));
  box-shadow: inset 3px 0 #4ad7c4, 0 5px 16px rgba(18, 176, 156, .08);
  transition: transform .24s cubic-bezier(.22,.8,.24,1), height .24s ease,
    width .24s ease, opacity .16s ease;
}
.nav-active-highlight.visible { opacity: 1; }
.nav-chevron {
  color: #5f8493;
  font-size: 12px;
  font-style: normal;
  transition: transform .16s ease;
}
.nav-group[open] .nav-chevron { transform: rotate(180deg); }
.nav-item {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  border-radius: 12px;
  min-height: 42px;
  padding: 9px 11px;
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9eb2bf;
  background: transparent;
  text-align: left;
  transition: .18s ease;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", system-ui, sans-serif;
}
.nav-item.nav-link { text-decoration: none; cursor: pointer; }
.nav-item:hover { color: white; background: rgba(255, 255, 255, .06); }
.nav-item.active {
  color: #eafffc;
  background: transparent;
  box-shadow: none;
}
.nav-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(138, 217, 208, .15);
  border-radius: 7px;
  font-size: 15px;
}
.nav-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0b84e;
  color: #372700;
  font-size: 11px;
  font-weight: 700;
}
.finance-system-switch {
  flex: 0 0 auto;
  margin: 10px 0 0;
  padding: 12px 0 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.system-switch-label {
  padding: 0 11px 6px;
  color: #668392;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
}
.system-switch-item {
  border: 1px solid rgba(93, 211, 197, .12);
  background: rgba(21, 141, 130, .13);
  min-height: 38px;
  padding: 8px 10px;
  font-size: 15px;
  line-height: 1.45;
}
.system-switch-item:hover { background: rgba(21, 141, 130, .24); }
.system-switch-item .switch-arrow { margin-left: auto; color: #69d5c8; }
.sidebar-foot { margin-top: 0; padding: 14px 9px 2px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-note { color: #678191; font-size: 10px; letter-spacing: .08em; }
.sidebar-user { margin-top: 10px; color: #dce9ee; font-size: 12px; }
.sidebar-user span { display: block; color: #7893a1; margin-top: 3px; font-size: 10px; }

.main-shell {
  margin-left: 282px;
  min-height: 100vh;
  transition: margin-left .24s cubic-bezier(.22,.8,.24,1);
}
.app-shell:not(.sidebar-pinned) .main-shell { margin-left: 0; }
.topbar {
  min-height: 92px;
  padding: 21px clamp(24px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid #e1e8ea;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 12;
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.finance-sync-status {
  color: var(--muted);
  font-family: var(--finance-num);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.finance-sync-status[data-state="loading"] { color: #8a641f; }
.finance-sync-status[data-state="error"] { color: #a33a32; }

.finance-sidebar-auth-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.finance-sidebar-auth-actions .btn {
  flex: 1;
  justify-content: center;
}
.command-trigger { gap: 8px; color: #385260; }
.command-trigger kbd {
  padding: 2px 5px;
  border: 1px solid #d8e2e5;
  border-radius: 5px;
  background: #f4f8f9;
  color: #64808c;
  font: 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.period-control {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}
.period-control > span:first-child {
  padding-top: 10px;
}
.period-select-stack {
  display: grid;
  gap: 2px;
}
.period-select-stack small {
  color: #7a8d98;
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}
.period-control select { min-width: 118px; }
.user-chip {
  min-width: 130px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  background: transparent;
  text-align: left;
}
.user-chip span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.page-wrap { padding: 32px clamp(20px, 4vw, 54px) 56px; }
.page-content { max-width: 1460px; margin: 0 auto; }

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.dashboard-head h2 { margin: 0 0 7px; font-size: 18px; }
.dashboard-head p { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-head-actions { display: flex; gap: 9px; }
.dashboard-welcome {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 188px;
  margin-bottom: 18px;
  padding: 28px 32px;
  border-radius: 22px;
  color: white;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr);
  align-items: center;
  gap: 28px;
  background:
    radial-gradient(620px 250px at 12% -25%, rgba(69, 226, 207, .3), transparent 62%),
    radial-gradient(430px 260px at 96% 118%, rgba(236, 181, 78, .25), transparent 64%),
    linear-gradient(125deg, #072937 0%, #0b4550 56%, #0a303e 100%);
  box-shadow: 0 20px 48px rgba(6, 42, 53, .18);
}
.dashboard-welcome::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .16;
  background-image:
    linear-gradient(rgba(173, 238, 231, .22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(173, 238, 231, .22) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, #000, transparent 78%);
}
.dashboard-welcome::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 230px;
  height: 230px;
  right: 24%;
  top: -145px;
  border: 1px solid rgba(133, 235, 222, .2);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(133, 235, 222, .035),
    0 0 0 70px rgba(133, 235, 222, .025);
  animation: finance-welcome-float 8s ease-in-out infinite;
}
.welcome-copy, .welcome-tasks { position: relative; z-index: 1; }
.welcome-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9fe8de;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.welcome-date::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69dfcf;
  box-shadow: 0 0 0 5px rgba(105, 223, 207, .1);
}
.welcome-copy h2 {
  margin: 13px 0 8px;
  font-size: clamp(26px, 2.3vw, 38px);
  line-height: 1.15;
  letter-spacing: -.035em;
}
.welcome-copy > p {
  margin: 0 0 18px;
  color: #c6dcdf;
  font-size: 13px;
}
.welcome-primary, .welcome-secondary {
  border-color: rgba(255, 255, 255, .2);
  color: white;
}
.welcome-primary {
  background: linear-gradient(135deg, #25c7b4, #0b8e83);
  box-shadow: 0 9px 24px rgba(4, 38, 44, .2);
}
.welcome-secondary { background: rgba(255, 255, 255, .1); }
.welcome-secondary:hover, .welcome-primary:hover { background: rgba(255, 255, 255, .19); }
.welcome-tasks {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid rgba(169, 232, 224, .22);
  border-radius: 17px;
  background: rgba(5, 31, 39, .38);
  color: white;
  text-align: left;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  backdrop-filter: blur(13px);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
  transition: transform .18s ease, background .18s ease;
}
.welcome-tasks:hover { transform: translateY(-2px); background: rgba(5, 31, 39, .54); }
.welcome-task-count {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #25c8b5, #0b8e83);
  font-size: 19px;
  font-weight: 800;
}
.welcome-task-copy { min-width: 0; }
.welcome-task-copy strong, .welcome-task-copy small { display: block; }
.welcome-task-copy strong { font-size: 14px; }
.welcome-task-copy small {
  margin-top: 4px;
  overflow: hidden;
  color: #a8c8cc;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.welcome-task-arrow { color: #8fe4d9; font-size: 11px; white-space: nowrap; }
@keyframes finance-welcome-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-8px, 7px, 0) scale(1.025); }
}
.simple-dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.simple-dashboard-head h2 { margin: 5px 0 6px; font-size: clamp(22px, 2vw, 30px); letter-spacing: -.035em; }
.simple-dashboard-head p { margin: 0; color: var(--muted); font-size: 12px; }
.simple-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.simple-kpi {
  appearance: none;
  border: 1px solid #dfe8eb;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(13, 43, 56, .045);
  padding: 18px;
  min-height: 132px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  text-align: left;
  font: inherit;
  transition: transform .18s ease, box-shadow .18s ease;
}
button.simple-kpi { cursor: pointer; }
button.simple-kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(13, 43, 56, .09); }
.simple-kpi-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: #0b766d;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
}
.simple-kpi > span:nth-child(2) { min-width: 0; flex: 1; }
.simple-kpi small, .simple-kpi em { display: block; font-style: normal; color: var(--muted); }
.simple-kpi small { font-size: 11px; font-weight: 700; }
.simple-kpi strong { display: block; margin: 8px 0 7px; font-size: clamp(20px, 1.7vw, 29px); letter-spacing: -.045em; white-space: nowrap; }
.simple-kpi em { font-size: 10px; line-height: 1.45; }
.simple-kpi > b { align-self: flex-end; color: #0b8b80; font-size: 10px; white-space: nowrap; }
.simple-dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  margin-bottom: 18px;
}
.simple-dashboard-grid > .panel + .panel { margin-top: 0; }
.quick-action-list { display: grid; gap: 8px; }
.simple-dashboard-grid .quick-action-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.quick-action-list button {
  border: 1px solid var(--line);
  background: #f8fbfb;
  border-radius: 11px;
  padding: 12px 13px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.quick-action-list button:hover { border-color: #73cfc5; background: #f1fbf9; }
.quick-action-list b, .quick-action-list span { display: block; }
.quick-action-list b { font-size: 12px; }
.quick-action-list span { color: var(--muted); font-size: 10px; margin-top: 4px; }
.simple-asset-list { display: grid; gap: 2px; }
.simple-asset-list > button { width: 100%; border: 0; background: transparent; color: var(--ink); font: inherit; display: flex; justify-content: space-between; gap: 15px; padding: 11px 2px; border-bottom: 1px solid #edf2f3; cursor: pointer; text-align: left; }
.simple-asset-list > button:last-child { border-bottom: 0; }
.simple-asset-list > button:hover { background: #f4faf9; }
.simple-asset-list span { color: var(--muted); font-size: 12px; }
.simple-asset-list b { font-size: 13px; font-variant-numeric: tabular-nums; }
.clickable-metric { cursor: pointer; transition: background .16s ease, transform .16s ease; }
.clickable-metric:hover { background: #f1faf8; transform: translateY(-1px); }
.clickable-category { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.clickable-category:hover { background: #f3faf8; }
.factory-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr);
  gap: 18px;
  margin-bottom: 18px;
}
.factory-chart-grid > .panel { margin: 0; min-width: 0; }
.factory-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: -2px 0 15px;
  color: var(--muted);
  font-size: 10px;
}
.factory-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.factory-chart-legend i { width: 9px; height: 9px; border-radius: 3px; }
.factory-bar-chart {
  height: 205px;
  display: grid;
  align-items: end;
  gap: 12px;
  padding: 10px 4px 0;
  border-bottom: 1px solid #dfe8eb;
  background: repeating-linear-gradient(to top, transparent 0, transparent 49px, #eef3f4 50px);
}
.factory-month-column {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
}
.factory-bar-group {
  height: 168px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.factory-bar {
  width: min(13px, 20%);
  min-width: 5px;
  padding: 0;
  border: 0;
  border-radius: 5px 5px 1px 1px;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
.factory-bar:hover, .factory-bar:focus-visible { filter: brightness(1.08); transform: scaleX(1.15); }
.series-operating { background: #0f766e; }
.series-production { background: #d28a22; }
.series-purchase { background: #3478a5; }
.series-asset { background: #7a6497; }
.factory-month-label { color: var(--muted); font-size: 10px; text-align: center; white-space: nowrap; }
.mini-line-block + .mini-line-block {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e6edef;
}
.mini-line-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}
.mini-line-head strong { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.mini-line-chart { width: 100%; height: 138px; overflow: visible; }
.mini-line-chart .line-grid { stroke: #e7edef; stroke-width: 1; }
.mini-line-chart .line-path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.mini-line-chart .line-point { fill: currentColor; }
.mini-line-chart .line-hit {
  fill: transparent;
  stroke: transparent;
  cursor: pointer;
  pointer-events: all;
}
.mini-line-chart .line-axis-label { fill: #748792; font-size: 10px; }
.line-sales { color: #0f8f82; }
.line-output { color: #cd7c1b; }
.insight-panel {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid #dbe6e8;
  border-radius: var(--radius);
  background:
    radial-gradient(420px 180px at 100% 0, rgba(31, 183, 161, .09), transparent 70%),
    #fff;
  box-shadow: 0 10px 32px rgba(13, 43, 56, .05);
}
.insight-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}
.insight-kicker {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}
.insight-head h3 { margin: 4px 0 3px; font-size: 16px; }
.insight-head p { margin: 0; color: var(--muted); font-size: 11px; }
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.insight-card {
  position: relative;
  min-width: 0;
  padding: 15px;
  border: 1px solid #e0e8ea;
  border-radius: 13px;
  background: #f9fbfb;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.insight-card:hover {
  transform: translateY(-2px);
  border-color: #8fcfc5;
  background: #f3faf8;
}
.insight-card > span, .insight-card > strong, .insight-card > small { display: block; }
.insight-card > span { color: var(--muted); font-size: 10px; }
.insight-card > strong { margin: 7px 0 8px; font-size: 20px; letter-spacing: -.03em; }
.insight-card > small { margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.trend-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}
.trend-badge.good { color: #0d766a; background: #e7f7f3; }
.trend-badge.bad { color: #a43b3b; background: #fff0f0; }
.trend-badge.neutral { color: #687b86; background: #eef2f3; }
@media (max-width: 1180px) {
  .factory-chart-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
}
.detail-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fbfb;
}
.detail-filter-bar input {
  flex: 1;
  min-width: 220px;
  border: 1px solid #d7e2e5;
  border-radius: 9px;
  padding: 9px 11px;
  background: white;
  font: 12px inherit;
}
.filter-chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid #d8e4e7;
  border-radius: 999px;
  padding: 7px 11px;
  background: white;
  color: #536b76;
  font: 11px inherit;
  cursor: pointer;
}
.filter-chip.active { color: white; border-color: #0d7b73; background: #0d7b73; }
.detail-row-button {
  border: 0;
  background: transparent;
  color: #087d73;
  font: 11px inherit;
  font-weight: 700;
  cursor: pointer;
}
.command-results { display: grid; gap: 6px; max-height: 55vh; overflow: auto; margin-top: 12px; }
.command-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.command-result.active { border-color: #35b9aa; background: #eefbf8; }
.command-result small { color: var(--muted); font-size: 10px; }
.ledger-detail-list { display: grid; gap: 9px; }
.ledger-detail-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 13px;
}
.ledger-detail-top, .ledger-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ledger-detail-top span, .ledger-detail-foot { color: var(--muted); font-size: 10px; }
.ledger-detail-top strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.ledger-detail-item p {
  margin: 9px 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}
.debt-detail-filters {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dedad1;
  border-radius: 10px;
  background: #f7f4ee;
}
.debt-detail-filter-top,
.debt-detail-filter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.debt-detail-filter-top input,
.debt-detail-filter-top select {
  flex: 1;
  min-width: 220px;
  padding: 9px 11px;
  border: 1px solid #d8d4ca;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.debt-detail-filter-top select { flex: 0 0 auto; min-width: 128px; }
.debt-detail-filter-top input:focus,
.debt-detail-filter-top select:focus,
.debt-detail-dates input:focus {
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(13, 113, 101, .11);
}
.debt-detail-reset {
  padding: 8px 10px;
  border: 1px solid #d8d4ca;
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.debt-detail-reset:hover {
  border-color: #b9b5aa;
  color: var(--ink);
}
.debt-detail-filter-controls {
  justify-content: space-between;
}
.debt-detail-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.debt-detail-dates label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}
.debt-detail-dates input {
  width: 128px;
  padding: 7px 8px;
  border: 1px solid #d8d4ca;
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}
.debt-detail-summary {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.debt-detail-summary span:first-child {
  color: var(--ink);
  font-weight: 500;
}
.debt-detail-empty {
  margin: 0;
  padding: 24px 0;
  text-align: center;
}
.drawer-data-filter {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  gap: 9px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #d8d4ca;
  border-radius: 11px;
  background: rgba(248, 246, 240, .97);
  box-shadow: 0 8px 20px rgba(25, 27, 23, .06);
  backdrop-filter: blur(8px);
}
.drawer-data-filter-main,
.drawer-data-filter-controls,
.drawer-data-filter-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer-data-filter input,
.drawer-data-filter select {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d7d2c8;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: 12px inherit;
}
.drawer-data-filter input[type="search"] { flex: 1; min-width: 170px; }
.drawer-data-filter select { min-width: 120px; }
.drawer-data-filter label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.drawer-data-filter-summary { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.ledger-detail-people {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 9px;
  color: #526976;
  font-size: 10px;
}
.ledger-detail-people b { color: var(--ink); }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(13, 43, 56, .045);
}
.kpi-card { padding: 18px 19px; min-height: 116px; position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(13, 43, 56, .09); }
.kpi-card.clickable-metric {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.kpi-card.clickable-metric:focus-visible {
  outline: 3px solid rgba(24, 97, 91, .28);
  outline-offset: 2px;
}
.kpi-card.task-filter-active {
  background: #f1f5f2;
  box-shadow: inset 0 -3px 0 #0d7b73;
}
.kpi-card.accent.task-filter-active {
  background: #24362f;
  box-shadow: inset 0 -3px 0 #8fd7ca;
}
.finance-card-target-highlight {
  animation: finance-card-target-pulse 1.6s ease;
}
@keyframes finance-card-target-pulse {
  0%, 100% { box-shadow: none; }
  25%, 70% { box-shadow: 0 0 0 4px rgba(24, 97, 91, .18); }
}
.kpi-card::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  right: -26px;
  top: -30px;
  background: var(--teal-soft);
}
.kpi-label { color: var(--muted); font-size: 11px; }
.kpi-value {
  display: block;
  min-width: 0;
  margin: 12px 0 8px;
  font-size: clamp(17px, 1.35vw, 24px);
  line-height: 1.12;
  letter-spacing: -.045em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kpi-meta { color: var(--muted); font-size: 10px; }
.kpi-card.accent { color: white; border-color: transparent; background: linear-gradient(145deg, #0d4a51, #0d7b73); }
.kpi-card.accent::after { background: rgba(255, 255, 255, .08); }
.kpi-card.accent .kpi-label, .kpi-card.accent .kpi-meta { color: rgba(255, 255, 255, .67); }
.kpi-card.negative .kpi-value { color: var(--red); }
.flow-card {
  width: 100%;
  border: 0;
  color: white;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.flow-card .kpi-label, .flow-card .kpi-meta { color: rgba(255,255,255,.72); }
.flow-card::after { background: rgba(255,255,255,.09); }
.flow-card-link {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: rgba(255,255,255,.88);
  font-size: 10px;
  font-weight: 700;
}
.flow-expense { background: linear-gradient(145deg, #98602c, #d39542); }
.flow-inventory { background: linear-gradient(145deg, #11636c, #17a393); }
.flow-asset { background: linear-gradient(145deg, #204d72, #3a82ad); }
.flow-transfer { background: linear-gradient(145deg, #574b78, #8373ad); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  gap: 18px;
}
.panel { padding: 22px; border-color: #dfe8eb; box-shadow: 0 10px 32px rgba(13, 43, 56, .05); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.panel-head h2,
.panel-head h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-head-actions { display: flex; gap: 8px; }
.chart {
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(var(--bars, 6), minmax(40px, 1fr));
  align-items: end;
  gap: 10px;
  padding: 12px 2px 0;
  border-bottom: 1px solid var(--line);
}
.bar-group { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; height: 225px; justify-content: flex-end; }
.bar-stack { height: 188px; width: 100%; display: flex; align-items: end; justify-content: center; position: relative; }
.bar {
  width: min(28px, 70%);
  min-height: 3px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #29c4b1, #0b9488);
  position: relative;
}
.bar:hover::after {
  content: attr(data-value);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  z-index: 5;
  padding: 5px 7px;
  white-space: nowrap;
  transform: translateX(-50%);
  border-radius: 6px;
  background: var(--navy);
  color: white;
  font-size: 10px;
}
.bar-label { color: var(--muted); font-size: 9px; white-space: nowrap; }
.category-list { display: grid; gap: 11px; max-height: 300px; overflow-y: auto; padding-right: 5px; scrollbar-width: thin; scrollbar-color: #c9d9dd transparent; }
.category-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; align-items: center; gap: 10px; padding: 4px 2px; border-radius: 8px; }
.category-row:hover { background: #f7fbfb; }
.category-name { color: #334b59; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-amount { font-size: 11px; font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: #edf2f3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #22bcae, #8bd8cd); border-radius: inherit; }
.alert-list { display: grid; gap: 9px; }
.alert-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 11px;
  color: #6d572d;
  background: var(--amber-soft);
  border: 1px solid #f6e5c5;
}
.alert-item.good { color: #24685f; background: #edf9f6; border-color: #d9f0ea; }
.alert-count { min-width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, .68); font-weight: 700; }
.alert-copy strong { display: block; font-size: 11px; }
.alert-copy span { display: block; margin-top: 2px; font-size: 10px; opacity: .78; }
.task-list { display: grid; gap: 9px; }
.task-item { width: 100%; text-align: left; cursor: pointer; justify-content: flex-start; }
.task-item .alert-copy { flex: 1; }
.task-item .status { margin-left: auto; white-space: nowrap; }
.task-state-badge {
  flex: none;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.task-state-badge.new {
  color: #8a5b08;
  background: #fff;
  border: 1px solid #edcf91;
}
.task-state-badge.read {
  color: #5f6f74;
  background: #f0f2f1;
}
.task-state-badge.in_progress {
  color: #0b6f65;
  background: #def4ef;
}
.task-state-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.task-item .status { margin-left: 4px; white-space: nowrap; }

.table-wrap { position: relative; overflow: auto; max-height: 560px; border: 1px solid #e5ebed; border-radius: 12px; background: #fff; }
.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
}
.table-tools .btn { padding: 6px 10px; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; background: white; }
.order-quantity-cell { min-width: 132px; }
.order-quantity-line { display: grid; gap: 2px; }
.order-quantity-line + .order-quantity-line {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #edf1f2;
}
.order-quantity-line strong {
  color: var(--ink);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-quantity-line small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.order-quantity-line .order-quantity-chain {
  color: #64746d;
  font-variant-numeric: tabular-nums;
}
.data-table .table-subline {
  display: block;
  margin-top: 2px;
  white-space: normal;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 12px;
  color: #71838e;
  background: #f6f9fa;
  border-bottom: 1px solid #e2e9eb;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid #edf1f2; font-size: 11.5px; line-height: 1.42; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfd; }
.data-table tbody tr.clickable-table-row { cursor: pointer; }
.data-table tbody tr.clickable-table-row:hover {
  background: #f1faf8;
  box-shadow: inset 3px 0 0 #17a393;
}
.data-table .numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.text-positive { color: var(--green); }
.text-negative { color: var(--red); }
.reserve-snapshot-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 10px;
}
.reserve-snapshot-label strong { font-size: 14px; }
.reserve-snapshot-label span { color: var(--muted); font-size: 10px; }
.reserve-snapshot-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 2px solid var(--teal-dark);
  background: #f7f6f1;
  color: var(--muted);
  font-size: 12px;
}
.reserve-snapshot-line strong {
  color: var(--ink);
  font-family: var(--finance-num);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.reserve-snapshot-line small { margin-left: auto; color: var(--muted); }
#finance-kicker { display: none; }
.data-table .description { min-width: 190px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .actions { white-space: nowrap; text-align: right; }
.task-detail-table { min-width: 0; table-layout: fixed; }
.task-detail-table th:nth-child(1), .task-detail-table td:nth-child(1) { width: 27%; }
.task-detail-table th:nth-child(2), .task-detail-table td:nth-child(2) { width: 37%; }
.task-detail-table th:nth-child(3), .task-detail-table td:nth-child(3) { width: 18%; }
.task-detail-table th:nth-child(4), .task-detail-table td:nth-child(4) { width: 18%; }
.task-detail-table td { overflow-wrap: anywhere; }
.task-detail-table .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  white-space: normal;
}
.task-detail-table .actions .btn { padding: 6px 8px; font-size: 10px; }
.table-sort-button {
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  text-align: inherit;
  font: inherit;
  font-weight: inherit;
}
.data-table th.numeric .table-sort-button { justify-content: flex-end; }
.table-sort-button span { color: #a8b6be; font-size: 9px; }
.data-table th.sort-asc .table-sort-button span,
.data-table th.sort-desc .table-sort-button span { color: var(--teal-dark); }
.data-table th.sort-asc .table-sort-button span { transform: rotate(180deg); }
.empty-row td { padding: 42px 16px; text-align: center; color: var(--muted); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}
.status.approved { color: #0e6d5e; background: #e7f7f3; }
.status.pending { color: #9a6519; background: #fff4df; }
.status.rejected { color: #a63434; background: #ffeded; }
.status.recorded { color: #0e6d5e; background: #e7f7f3; }
.status.voided { color: #6d7b84; background: #eef1f3; }
.flag {
  display: inline-block;
  margin-left: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.toolbar-filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.toolbar-actions { display: flex; gap: 8px; }
.search-box { min-width: 230px; }
.toolbar-filters > select { width: auto; min-width: 145px; }
.toolbar-filters > .btn { width: auto; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  transition: .18s ease;
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: white; background: linear-gradient(135deg, #13aa9b, #087e76); box-shadow: 0 7px 18px rgba(14, 149, 137, .18); }
.btn.secondary { color: var(--teal-dark); background: var(--teal-soft); border-color: #ccebe6; }
.btn.ghost { color: #536b78; background: white; border-color: var(--line); }
.btn.danger { color: var(--red); background: var(--red-soft); border-color: #f2d3d3; }
.btn.compact { padding: 7px 10px; }
.btn.wide { width: 100%; padding: 12px 16px; }
.btn.print-action { color: #294956; background: #eef5f6; border-color: #d4e2e5; }
.print-only, .print-sheet { display: none; }
.btn.small { padding: 6px 9px; font-size: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #617684;
  background: white;
  font-size: 20px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #d6e1e5;
  border-radius: 9px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #51bbae;
  box-shadow: 0 0 0 3px rgba(33, 184, 166, .11);
}
textarea { min-height: 92px; resize: vertical; }
.field { display: grid; gap: 7px; }
.field > span { color: #48606c; font-size: 11px; font-weight: 600; }
.field-check {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
}
.field-check input { width: auto; margin: 0; }
.form-error { min-height: 16px; margin: 0; color: var(--red); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid > .panel { grid-column: 1 / -1; min-width: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.recipe-product-bar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}
.recipe-product-bar .field { flex: 1; }
.recipe-line {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) minmax(110px, .6fr) 60px auto;
  align-items: end;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px solid #e7edef;
}
.recipe-line:last-child { border-bottom: 0; }
.recipe-unit {
  align-self: center;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
}
.form-note {
  margin: 0;
  padding: 11px 13px;
  border-radius: 10px;
  color: #65512d;
  background: var(--amber-soft);
  font-size: 10px;
  line-height: 1.6;
}
.form-note.income-classification-warning {
  border: 1px solid #e7c477;
  color: #6f4b0c;
  background: #fff4dc;
}
.income-classification-warning .btn {
  margin-left: 8px;
  vertical-align: middle;
}
.special-price-control {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid #d6e1e5;
  border-radius: 11px;
  background: #fbfdfd;
}
.special-price-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}
.special-price-control > span {
  display: grid;
  gap: 3px;
}
.special-price-control strong { color: var(--ink); font-size: 12px; }
.special-price-control small { color: var(--muted); font-size: 10px; }
.sales-proof-box {
  padding: 14px;
  border: 1px solid #dbe7e9;
  border-radius: 13px;
  background: #f6faf9;
}
.sales-proof-box > .field { margin-bottom: 12px; }
.sales-proof-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sales-proof-title strong { font-size: 12px; color: var(--ink); }
.sales-proof-title span { color: var(--muted); font-size: 10px; }
.sales-proof-review {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 11px 12px;
  border: 1px solid #dce8e9;
  border-radius: 11px;
  background: #f7fbfb;
}
.sales-proof-review > span {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 650;
}
.sales-proof-review > span.approved { color: #0e6d5e; background: #e7f7f3; }
.sales-proof-review > span.pending { color: #9a6519; background: #fff4df; }
.sales-proof-review small { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.sales-attention-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #e3d3bb;
  border-left: 3px solid #a75a32;
  border-radius: 10px;
  background: #fffaf1;
}
.sales-attention-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sales-attention-head strong {
  color: #6f321d;
  font-size: 12px;
  font-weight: 650;
}
.sales-attention-head span {
  color: #7d7065;
  font-size: 10px;
}
.sales-attention-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding-top: 10px;
  border-top: 1px solid #eadfce;
}
.sales-attention-item strong {
  color: #743d26;
  font-size: 11px;
}
.sales-attention-item span {
  color: #544b43;
  font-size: 11px;
  line-height: 1.55;
}
.sales-attention-warning {
  display: grid;
  gap: 1px;
  margin-top: 6px;
  color: #5f4b3d;
  font-size: 10px;
  line-height: 1.4;
}
.sales-attention-warning strong {
  color: #9b4b2b;
  font-weight: 650;
}

.section-title { margin: 0 0 6px; font-size: 18px; }
.section-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-strip.five-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-note { margin: -8px 0 16px; color: var(--muted); font-size: 11px; }
.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}
.metric span { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 8px; font-size: 20px; }
.analysis-switch {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.analysis-switch button {
  border: 0;
  border-radius: 8px;
  padding: 8px 15px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
}
.analysis-switch button:hover { color: var(--teal-dark); background: var(--teal-soft); }
.analysis-switch button.active {
  color: white;
  background: linear-gradient(135deg, #13aa9b, #087e76);
  box-shadow: 0 5px 14px rgba(14, 149, 137, .16);
}
.production-scope-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.production-scope-bar > div {
  display: grid;
  gap: 4px;
}
.production-scope-bar strong {
  color: var(--ink);
  font-size: 12px;
}
.production-scope-bar span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.production-scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid #d6e1e5;
  border-radius: 9px;
  background: white;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.production-scope-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}
.analysis-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.compact-chart { min-height: 220px; }
.compact-chart .bar-group { height: 195px; }
.compact-chart .bar-stack { height: 160px; }
.analysis-table { max-height: 560px; }
.data-warning-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid #efcf9d;
  border-radius: 13px;
  color: #6f4d18;
  background: linear-gradient(90deg, #fff7e8, #fffaf1);
  text-align: left;
  box-shadow: 0 7px 22px rgba(140, 91, 20, .06);
}
.data-warning-banner:hover { border-color: #dfae65; }
.warning-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: #d99022;
  font-weight: 800;
}
.data-warning-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.data-warning-banner b { display: block; font-size: 12px; }
.data-warning-banner small { display: block; margin-top: 3px; color: #9a773f; font-size: 10px; line-height: 1.55; }
.data-warning-banner > strong { flex: 0 0 auto; font-size: 10px; color: #a76d15; }
.range-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 15px; }
.range-presets button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--teal-dark);
  background: white;
  font-size: 10px;
}
.range-presets button:hover { border-color: #8dd3c9; background: var(--teal-soft); }

.drawer-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 21, 31, .38);
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(520px, 92vw);
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  padding: 25px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: #f8fafb;
  box-shadow: -24px 0 60px rgba(4, 21, 31, .17);
  transform: translateX(105%);
  transition: transform .23s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head, .modal-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.drawer-head { flex: 0 0 auto; }
.drawer-head h2, .modal-head h2 { margin: 0; font-size: 20px; }
.drawer-content {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 25px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
#finance-drawer .metric-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#finance-drawer .metric-strip .metric strong {
  white-space: nowrap;
  font-size: 17px;
}
.finance-full-detail-content {
  min-width: 0;
}
html.finance-overlay-open,
html.finance-overlay-open body {
  overflow: hidden;
  overscroll-behavior: none;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item span { display: block; color: var(--muted); font-size: 9px; margin-bottom: 5px; }
.detail-item strong { font-size: 12px; font-weight: 500; }
.attachment-list { display: grid; gap: 8px; margin-top: 10px; }
.attachment-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--teal-dark);
  background: white;
  text-decoration: none;
  font-size: 11px;
}

.reimbursement-attachment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.reimbursement-attachment-row + .reimbursement-attachment-row {
  margin-top: 6px;
}

.attachment-filename-button {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.attachment-filename-button:hover {
  text-decoration: underline;
}

.reimbursement-view-button {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 3px 8px;
  border-color: #c9ddd8;
  color: var(--teal-dark);
  background: #f2f8f6;
}

.reimbursement-view-button:hover {
  background: #e7f2ef;
}

.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 25px;
  border-radius: 20px;
  background: #f9fbfb;
  box-shadow: 0 30px 90px rgba(2, 20, 31, .25);
}

.toast-region { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: grid; gap: 9px; }
.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid #d8e7e4;
  border-radius: 11px;
  color: #174b45;
  background: #edf9f6;
  box-shadow: var(--shadow);
  font-size: 11px;
  animation: toast-in .18s ease;
}
.toast.error { color: #8d2828; border-color: #f0cdcd; background: #fff0f0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.loading {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.loading::before {
  content: "";
  width: 26px;
  height: 26px;
  border: 2px solid #d8e3e4;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-card {
  padding: 20px;
  border: 1px solid #f0d3d3;
  border-radius: 14px;
  color: #7d2f2f;
  background: #fff6f6;
}
.finance-alert-summary {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #ead9b8;
  border-radius: 15px;
  background: #fffaf0;
}
.finance-alert-summary > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.finance-alert-summary strong {
  color: #9a5b0b;
  font-size: 28px;
}
.finance-alert-summary span {
  color: #6d5533;
  font-weight: 700;
}
.finance-alert-summary p {
  margin: 0;
  color: #5f6871;
  line-height: 1.7;
}
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .simple-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .finance-login-view { grid-template-columns: 1fr; }
  .finance-login-intro { display: none; }
  .finance-login-panel {
    padding: 20px;
    background:
      radial-gradient(circle at 15% 12%, rgba(25, 184, 164, .15), transparent 30%),
      linear-gradient(145deg, #071827, #0b3043);
  }
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { padding: 20px; background: linear-gradient(145deg, #061523, #0b3344); }
  .login-card { background: rgba(255,255,255,.98); }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 25px 0 60px rgba(0,0,0,.25); }
  .app-shell:not(.sidebar-pinned) .main-shell { margin-left: 0; }
  .main-shell { margin-left: 0; }
  .mobile-only { display: grid; }
  .topbar { min-height: 78px; padding: 15px 18px; }
  .topbar-actions .user-chip, .topbar-actions .btn.ghost,
  .finance-sync-status { display: none; }
  .dashboard-welcome {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .topbar-actions #finance-command-button {
    display: inline-flex;
    padding: 7px 10px;
  }
  .topbar-actions #finance-command-button kbd { display: none; }
  .topbar-actions #finance-range-button {
    display: inline-flex;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .period-control > span:first-child { display: none; }
  .page-wrap { padding: 20px 15px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .simple-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip.five-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-filters, .toolbar-actions { width: 100%; }
  .simple-dashboard-grid .quick-action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-box { min-width: 0; flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .recipe-product-bar { align-items: stretch; flex-direction: column; }
  .recipe-line { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-welcome::after { animation: none; }
}
@media (min-width: 821px) {
  #finance-menu { display: grid; }
  .sidebar-hover-zone {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 19;
    width: 14px;
    cursor: pointer;
  }
  .sidebar-hover-zone span {
    position: absolute;
    left: 1px;
    top: 50%;
    width: 11px;
    height: 58px;
    transform: translateY(-50%);
    border-radius: 0 8px 8px 0;
    display: grid;
    place-items: center;
    color: #dffaf7;
    font-size: 18px;
    background: rgba(6, 36, 44, .88);
    box-shadow: 2px 0 10px rgba(7, 31, 58, .2);
    animation: finance-sidebar-breathe 2.8s ease-in-out infinite;
  }
}

@keyframes finance-sidebar-breathe {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: .72; }
  50% { transform: translateY(-50%) translateX(2px); opacity: 1; }
}
@media (max-width: 520px) {
  .login-card { padding: 26px 22px; }
  .topbar h1 { font-size: 19px; }
  .topbar-actions #finance-range-button { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
  .simple-kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 108px; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .dashboard-head { align-items: flex-start; flex-direction: column; }
  .simple-dashboard-head { align-items: flex-start; flex-direction: column; }
  .panel { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.full { grid-column: auto; }
  .simple-dashboard-grid .quick-action-list {
    grid-template-columns: 1fr;
  }
}

.payment-voucher-detail {
  display: grid;
  gap: 16px;
  color: #21333b;
}
.payment-voucher-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 16px;
  border-bottom: 2px solid #174957;
}
.payment-voucher-header p {
  margin: 0 0 6px;
  color: #54706f;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
}
.payment-voucher-header h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}
.payment-voucher-header > div > span {
  display: block;
  margin-top: 6px;
  color: #64767c;
}
.payment-voucher-identity {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 230px;
}
.payment-voucher-identity > span,
.payment-voucher-summary span {
  color: #6b7b80;
  font-size: 11px;
}
.payment-voucher-identity strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
}
.payment-voucher-identity small {
  color: #74858a;
}
.payment-voucher-summary {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d6e0dd;
  border-radius: 12px;
  background: #d6e0dd;
}
.payment-voucher-summary > div {
  display: grid;
  align-content: center;
  min-height: 78px;
  padding: 13px 16px;
  background: #fff;
}
.payment-voucher-summary > div > strong {
  margin-top: 5px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.payment-voucher-summary .payment-voucher-amount {
  background: #eef7f4;
}
.payment-voucher-summary .payment-voucher-amount strong {
  color: #174957;
  font-size: 25px;
}
.payment-voucher-summary .payment-voucher-amount small {
  color: #577174;
}
.payment-voucher-summary.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0;
  background: transparent;
}
.payment-voucher-summary.compact > div { min-height: 58px; }
.payment-voucher-section {
  padding: 16px;
  border: 1px solid rgba(36, 73, 80, .14);
  border-radius: 12px;
  background: #fff;
}
.payment-voucher-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}
.payment-voucher-section-head h3 {
  margin: 0;
  font-size: 15px;
}
.payment-voucher-section-head p {
  margin: 0;
  color: #6b7b80;
  font-size: 12px;
  text-align: right;
}
.payment-voucher-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.payment-voucher-tag {
  padding: 4px 8px;
  border: 1px solid #c8d7d3;
  border-radius: 6px;
  background: #f6f9f7;
  color: #385452;
  font-size: 12px;
}
.payment-voucher-documents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.payment-voucher-document {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-left: 3px solid #2f766d;
  background: #f6f9f7;
}
.payment-voucher-document span {
  color: #6b7b80;
  font-size: 11px;
}
.payment-voucher-document strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.payment-voucher-document small { color: #64767c; }
.payment-voucher-items td.description { min-width: 220px; }
.payment-voucher-ledger .data-table th:nth-child(1),
.payment-voucher-ledger .data-table td:nth-child(1),
.payment-voucher-ledger .data-table th:nth-child(2),
.payment-voucher-ledger .data-table td:nth-child(2) {
  white-space: nowrap;
}
.payment-voucher-reserve {
  border-color: rgba(202, 145, 55, .3);
  background: #fffaf0;
}
.payment-voucher-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: #52676c;
  font-size: 12px;
}
.payment-voucher-signatures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  padding: 18px 4px 4px;
  border-top: 1px solid #cedad7;
}
.payment-voucher-signatures > div {
  display: grid;
  gap: 8px;
}
.payment-voucher-signatures span {
  color: #6b7b80;
  font-size: 12px;
}
.payment-voucher-signatures i {
  display: block;
  height: 22px;
  border-bottom: 1px solid #8fa19f;
}
.payment-voucher-signatures strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body {
    background: #fff !important;
    color: #111 !important;
    font-size: 9pt;
  }
  body * { box-shadow: none !important; }
  .sidebar, .sidebar-hover-zone, .topbar, .toolbar, .table-tools, .toast-region,
  .drawer, .drawer-backdrop, .modal-backdrop, .print-sheet { display: none !important; }
  .app-shell { display: block !important; }
  .main-shell { margin: 0 !important; min-height: auto !important; }
  .page-wrap { padding: 0 !important; }
  .page-content { display: block !important; }
  .print-only {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #174957;
  }
  .print-only p { margin: 0 0 3px; color: #526773; font-size: 8pt; letter-spacing: .12em; }
  .print-only h1 { margin: 0; font-size: 18pt; }
  .print-only > span { color: #526773; font-size: 9pt; }
  .kpi-grid, .metric-strip, .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8mm !important;
  }
  .panel {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 8mm !important;
    border: 1px solid #cfd8dc !important;
  }
  .table-wrap {
    overflow: visible !important;
    max-height: none !important;
    border: 0 !important;
  }
  .data-table { min-width: 0 !important; width: 100% !important; }
  .data-table th {
    position: static !important;
    background: #edf2f4 !important;
    color: #243742 !important;
  }
  .data-table th, .data-table td { padding: 5px 6px !important; font-size: 7.5pt !important; }
  .data-table td.description {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
  }
  .data-table .actions, .data-table th:last-child:empty { display: none !important; }
  .status { border: 1px solid currentColor; }
  a { color: inherit !important; text-decoration: none !important; }
  body.print-table-mode .app-shell { display: none !important; }
  body.print-table-mode .print-sheet { display: block !important; }
  body.print-table-mode .sba-root,
  body.print-table-mode .sban-root,
  body.print-table-mode .sban-backdrop,
  body.print-table-mode .sb-security-backdrop,
  body.print-table-mode .attachment-preview-root {
    display: none !important;
  }
  .print-sheet-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 8mm;
    padding-bottom: 4mm;
    border-bottom: 2px solid #174957;
  }
  .print-sheet-head p { margin: 0 0 3px; color: #526773; font-size: 8pt; letter-spacing: .12em; }
  .print-sheet-head h1 { margin: 0; font-size: 18pt; }
  .print-sheet-meta { display: grid; justify-items: end; gap: 2px; color: #526773; font-size: 8pt; }
  .print-sheet-meta strong { color: #172f3a; font-size: 10pt; }
  .print-sheet .data-table { border-collapse: collapse; }
  .print-sheet .data-table th { position: static; }
  .print-sheet .data-table th, .print-sheet .data-table td { padding: 5px 6px; font-size: 7.5pt; }
  .print-sheet .data-table .actions { display: none; }

  .payment-voucher-print-sheet {
    display: flex;
    min-height: 178mm;
    flex-direction: column;
    gap: 4mm;
    color: #152b32;
  }
  .payment-voucher-print-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12mm;
    padding-bottom: 3mm;
    border-bottom: 2px solid #174957;
  }
  .payment-voucher-print-head p {
    margin: 0 0 1mm;
    color: #526b70;
    font-size: 7pt;
    font-weight: 600;
    letter-spacing: .12em;
  }
  .payment-voucher-print-head h1 {
    margin: 0;
    font-size: 19pt;
  }
  .payment-voucher-print-head > div:first-child > span {
    color: #526b70;
    font-size: 8pt;
  }
  .payment-voucher-print-head > div:last-child {
    display: grid;
    justify-items: end;
    gap: 1mm;
  }
  .payment-voucher-print-head > div:last-child span,
  .payment-voucher-print-head > div:last-child small {
    color: #60757a;
    font-size: 7pt;
  }
  .payment-voucher-print-head > div:last-child strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11pt;
  }
  .payment-voucher-print-summary {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 1px;
    border: 1px solid #bdcfca;
    background: #bdcfca;
  }
  .payment-voucher-print-summary > div {
    display: grid;
    align-content: center;
    gap: 1mm;
    min-height: 16mm;
    padding: 2.5mm 3mm;
    background: #fff;
  }
  .payment-voucher-print-summary span {
    color: #62767a;
    font-size: 7pt;
  }
  .payment-voucher-print-summary strong {
    font-size: 10pt;
    font-variant-numeric: tabular-nums;
  }
  .payment-voucher-print-summary .primary {
    background: #edf5f2;
  }
  .payment-voucher-print-summary .primary strong {
    color: #174957;
    font-size: 16pt;
  }
  .payment-voucher-print-band {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1mm 3mm;
    padding: 2.5mm 3mm;
    border-left: 3px solid #2d746b;
    background: #f5f8f6;
  }
  .payment-voucher-print-band span {
    color: #62767a;
    font-size: 7pt;
  }
  .payment-voucher-print-band strong {
    font-size: 8.5pt;
  }
  .payment-voucher-print-band small,
  .payment-voucher-print-band em {
    grid-column: 2;
    color: #586d71;
    font-size: 7.5pt;
    font-style: normal;
  }
  .payment-voucher-print-items {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
  .payment-voucher-print-items th,
  .payment-voucher-print-items td {
    padding: 1.7mm 2mm;
    border-bottom: .3mm solid #cad5d2;
    font-size: 7.3pt;
    text-align: left;
    vertical-align: top;
  }
  .payment-voucher-print-items th {
    background: #edf2f0;
    color: #2d474d;
  }
  .payment-voucher-print-items th:nth-child(1) { width: 20mm; }
  .payment-voucher-print-items th:nth-child(2) { width: 42%; }
  .payment-voucher-print-items th:nth-child(3) { width: 24%; }
  .payment-voucher-print-items th:nth-child(4) { width: 18%; }
  .payment-voucher-print-items th:nth-child(5) { width: 24mm; }
  .payment-voucher-print-items .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .payment-voucher-print-reserve {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 2mm 4mm;
    padding: 2mm 3mm;
    border: 1px solid #e0c995;
    background: #fffaee;
    font-size: 7.5pt;
  }
  .payment-voucher-print-flow {
    margin-top: auto;
  }
  .payment-voucher-print-flow h2 {
    margin: 0 0 2mm;
    font-size: 9pt;
  }
  .payment-voucher-print-flow-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border: 1px solid #cad5d2;
  }
  .payment-voucher-print-flow-grid > div {
    display: grid;
    gap: 1mm;
    padding: 2mm;
    border-right: 1px solid #d8e1de;
  }
  .payment-voucher-print-flow-grid > div:last-child { border-right: 0; }
  .payment-voucher-print-flow-grid span {
    color: #62767a;
    font-size: 6.8pt;
  }
  .payment-voucher-print-flow-grid strong {
    font-size: 8pt;
  }
  .payment-voucher-print-flow-grid small {
    color: #6b7d81;
    font-size: 6.5pt;
  }
  .payment-voucher-print-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5mm;
    padding-top: 3mm;
    border-top: 1px solid #9fb2ad;
    color: #52676c;
    font-size: 7pt;
  }
}

.account-browser {
  display: block;
}
.account-group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
}
.account-group {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .24);
  background: #f8fafc;
  color: #243447;
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.account-group:hover {
  border-color: rgba(13, 148, 136, .55);
  background: #f0fdfa;
}
.account-group.active {
  border-color: #0f766e;
  background: #ecfdf5;
  box-shadow: inset 3px 0 0 #0f766e;
}
.account-group small {
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}
.account-browser-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.account-browser-head h3 { margin: 0 0 3px; font-size: 15px; }
.account-browser-head p { margin: 0; color: #64748b; font-size: 12px; }
@media (max-width: 760px) {
  .account-group-list { grid-template-columns: 1fr; }
}

.filter-input {
  min-width: 140px;
  border: 1px solid rgba(148, 163, 184, .45);
  border-radius: 9px;
  background: #fff;
  padding: 9px 11px;
  color: #1e293b;
}
.reserve-metrics .metric strong { color: #0f766e; }
.reserve-panel { margin-bottom: 16px; }
.subtable-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 9px;
}
.subtable-head span { color: #64748b; font-size: 12px; }
.reimbursement-header {
  padding: 15px;
  margin-bottom: 16px;
  border: 1px solid rgba(13, 148, 136, .18);
  border-radius: 12px;
  background: #f0fdfa;
}
.reimbursement-lines-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0 9px;
}
.reimbursement-lines-head p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12px;
}
.reimbursement-line {
  padding: 13px;
  margin-bottom: 10px;
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 11px;
  background: #f8fafc;
}
.reimbursement-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.reimbursement-line .form-grid { gap: 11px; }
.reimbursement-line .field input,
.reimbursement-line .field select { padding: 9px 10px; }
.outbound-decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.outbound-decision {
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 16px;
  border: 1px solid #d9e1e2;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.outbound-decision:hover {
  border-color: #9fc9c3;
  background: #f8fbfa;
}
.outbound-decision.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px rgba(20, 118, 108, .12);
}
.outbound-decision.disabled {
  opacity: .55;
  cursor: not-allowed;
}
.outbound-decision-order {
  color: var(--teal-dark);
  font: 600 10px/1 var(--finance-num);
  letter-spacing: .08em;
}
.outbound-decision strong {
  font-size: 13px;
  font-weight: 600;
}
.outbound-decision small {
  max-width: 22em;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.outbound-advanced-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 8px 10px;
  border-top: 1px solid #e5e9e8;
  color: var(--muted);
  font-size: 10px;
}
.outbound-advanced-bar .btn.active {
  color: var(--teal-dark);
  border-color: #a9d2ca;
  background: var(--teal-soft);
}
.outbound-advanced-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 15px;
  padding: 14px;
  border: 1px solid #dbe4e2;
  border-radius: 11px;
  background: #f8fbfa;
}
.outbound-advanced-fields > .form-note { grid-column: 1 / -1; }
.reimbursement-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 15px;
  padding: 15px;
  border-radius: 12px;
  color: #e6fffb;
  background: linear-gradient(135deg, #0b3b3a, #0f766e);
}
.reimbursement-total > div:first-child {
  display: grid;
  gap: 2px;
}
.reimbursement-total span,
.reimbursement-total small { color: rgba(236, 254, 255, .76); }
.reimbursement-total strong { font-size: 24px; }
.reimbursement-payment-note {
  max-width: 240px;
  text-align: right;
  color: rgba(236, 254, 255, .78);
  font-size: 12px;
}
.reimbursement-file { margin-top: 15px; }
.reimbursement-table td:first-child,
.reimbursement-table td:nth-child(4) {
  min-width: 128px;
}
.reimbursement-table td:first-child small,
.reimbursement-table td:nth-child(4) small {
  display: block;
  margin-top: 3px;
}
.batch-detail {
  display: grid;
  gap: 6px;
  padding: 5px 2px;
}
.batch-detail-item {
  display: grid;
  grid-template-columns: 92px minmax(150px, 1.4fr) 150px 110px 140px 90px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}
.batch-detail-item strong { color: #1f2937; }
.batch-detail-item b { text-align: right; color: #0f766e; }
.monthly-reimbursement-detail {
  display: grid;
  gap: 10px;
  padding: 10px 4px;
}
.monthly-reimbursement-claim {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dfe5de;
  border-radius: 10px;
  background: #fffdf8;
}
.monthly-reimbursement-claim > header,
.monthly-reimbursement-claim > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.monthly-reimbursement-claim > header > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.monthly-reimbursement-claim > header small {
  color: #6b756f;
}
.monthly-reimbursement-claim > header b {
  color: #0d7165;
  font-variant-numeric: tabular-nums;
}
.monthly-reimbursement-claim > p {
  margin: 0;
}
@media (max-width: 760px) {
  .production-scope-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .production-scope-toggle {
    width: 100%;
    justify-content: flex-start;
  }
  .reimbursement-total {
    align-items: flex-start;
    flex-direction: column;
  }
  .reimbursement-payment-note {
    max-width: none;
    text-align: left;
  }
  .reimbursement-lines-head {
    align-items: stretch;
    flex-direction: column;
  }
  .outbound-decision-grid,
  .outbound-advanced-fields {
    grid-template-columns: 1fr;
  }
  .outbound-advanced-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .batch-detail-item { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .outbound-decision-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Unslop pass: industrial ledger, quiet chrome, one working chart.
   Unslop by Damir Sokolovsky (@heydamir), CC BY 4.0. */
:root {
  --navy: #171917;
  --navy-2: #222520;
  --teal: #14766c;
  --teal-dark: #0c5e56;
  --teal-soft: #e8f0ed;
  --ink: #24251f;
  --muted: #716f66;
  --line: #dedbd2;
  --surface: #fcfbf7;
  --canvas: #f1efe9;
  --amber: #b77720;
  --amber-soft: #fbf1df;
  --red: #b4413b;
  --red-soft: #fbebe8;
  --green: #23735f;
  --shadow: 0 10px 28px rgba(44, 42, 34, .07);
  --radius: 14px;
  --finance-ease: cubic-bezier(.22, 1, .36, 1);
  --finance-num: "Bahnschrift", "DIN Alternate", "Segoe UI", sans-serif;
}

html,
body {
  background: var(--canvas);
  color: var(--ink);
}

body {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", system-ui, sans-serif;
}

.finance-gate,
.finance-login-view,
.login-view {
  background: #18201e;
}

.finance-login-atmosphere,
.login-atmosphere,
.eyebrow::before,
.kpi-card::after {
  display: none;
}

.finance-gate-card,
.finance-login-card,
.login-card {
  border-color: #d8d5cc;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(19, 25, 23, .16);
}

.eyebrow,
.eyebrow.dark {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}

.sidebar {
  width: 280px;
  padding: 20px 16px 16px;
  color: #f2f1ea;
  background: #171917;
  border-right: 1px solid #282b26;
  box-shadow: none;
  transition: transform 220ms var(--finance-ease);
}

.app-shell.sidebar-pinned .main-shell {
  margin-left: 280px;
}

.sidebar-brand {
  gap: 10px;
  padding: 0 8px 20px;
}

.brand-mark {
  border-color: #3c4640;
  border-radius: 8px;
  background: #20241f;
}

.brand-mark svg {
  stroke: #b8d6cd;
}

.sidebar-brand strong {
  color: #f1f0e8;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .03em;
}

.sidebar-brand span {
  margin-top: 2px;
  color: #82968e;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
}

.nav-list {
  gap: 4px;
  scrollbar-color: #48524c transparent;
}

.nav-group {
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom-color: #2a2d28;
}

.nav-group-label {
  padding: 12px 10px 6px;
  color: #8d9b94;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.nav-group-items {
  gap: 2px;
}

.nav-active-highlight {
  right: 2px;
  height: 36px;
  border-radius: 8px;
  background: #2a3732;
  box-shadow: inset 3px 0 #79b8a7;
  transition: transform 180ms var(--finance-ease), height 180ms var(--finance-ease),
    width 180ms var(--finance-ease), opacity 120ms ease;
}

.nav-item {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  gap: 10px;
  color: #aeb8b2;
  font-size: 15px;
  line-height: 1.4;
  transition: color 140ms ease, background-color 140ms ease;
}

.nav-item:hover {
  color: #f4f3ec;
  background: #222621;
}

.nav-item.active {
  color: #f5f4ed;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 0;
  border-radius: 4px;
  color: #91a49b;
  font-size: 14px;
  font-weight: 500;
}

.nav-icon .finance-line-icon {
  width: 16px;
  height: 16px;
}

.nav-item.active .nav-icon {
  color: #a9d5c8;
}

.nav-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #c88932;
  color: #191914;
  font-size: 10px;
}

.finance-system-switch {
  margin-top: 8px;
  padding: 10px 0 8px;
  border-top-color: #30332e;
}

.system-switch-label {
  padding: 0 10px 6px;
  color: #76877f;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.system-switch-item {
  border-color: #313a35;
  background: #202720;
  font-size: 14px;
}

.system-switch-item:hover {
  background: #29342f;
}

.system-switch-item .switch-arrow {
  color: #82b2a3;
}

.sidebar-foot {
  padding: 12px 8px 0;
  border-top-color: #30332e;
}

.sidebar-note,
.sidebar-user span {
  color: #71827a;
  letter-spacing: 0;
}

.main-shell {
  transition: margin-left 220ms var(--finance-ease);
}

.topbar {
  min-height: 72px;
  padding: 12px clamp(24px, 3vw, 40px);
  gap: 20px;
  border-bottom-color: #d9d6ce;
  background: rgba(250, 249, 245, .95);
  backdrop-filter: blur(12px);
}

.topbar-title {
  gap: 10px;
}

.topbar h1 {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.01em;
}

.topbar-actions {
  gap: 8px;
}

.command-trigger kbd {
  border-color: #d4d1c8;
  border-radius: 4px;
  background: #f0eee8;
  color: #6e6c63;
}

.period-control {
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.period-select-stack small {
  color: #7f7c72;
  font-size: 9px;
}

.user-chip {
  min-width: 122px;
  padding: 6px 10px;
  border-left-color: #d9d6ce;
  color: #373831;
}

.user-chip span {
  color: #5c6c65;
}

.page-wrap {
  padding: 24px clamp(20px, 3vw, 40px) 56px;
}

.page-content {
  max-width: 1440px;
  animation: finance-page-enter 320ms var(--finance-ease) both;
}

@keyframes finance-page-enter {
  from { opacity: 0; transform: translateY(8px); }
}

.operations-brief {
  position: relative;
  display: block;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #d9d6cd;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(43, 40, 32, .04);
}

.operations-main {
  min-width: 0;
  min-height: 100%;
  margin-right: 360px;
  padding: 28px;
}

.operations-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.period-context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 500;
}

.period-context::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--teal);
}

.operations-heading h2 {
  margin: 10px 0 5px;
  color: #1f211d;
  font-size: clamp(26px, 2.1vw, 34px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.operations-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.operations-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.icon-button-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.finance-line-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.operations-total {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e4e1d9;
}

.operations-total > span {
  color: #68665d;
  font-size: 12px;
}

.operations-total > div {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.operations-total strong {
  color: #20221d;
  font-family: var(--finance-num);
  font-size: clamp(34px, 3.2vw, 46px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}

.operations-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 22px;
  border-top: 1px solid #e4e1d9;
  border-bottom: 1px solid #e4e1d9;
}

.operations-ledger button {
  min-width: 0;
  padding: 16px 18px 15px;
  border: 0;
  border-right: 1px solid #e4e1d9;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background-color 140ms ease;
}

.operations-ledger button:first-child {
  padding-left: 0;
}

.operations-ledger button:last-child {
  padding-right: 0;
  border-right: 0;
}

.operations-ledger button:hover {
  background: #f4f2ec;
}

.operations-ledger span,
.operations-ledger small,
.operations-ledger strong {
  display: block;
}

.operations-ledger span {
  color: #6f6d64;
  font-size: 11px;
}

.operations-ledger strong {
  margin: 5px 0 4px;
  color: #252620;
  font-family: var(--finance-num);
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.operations-ledger small {
  overflow: hidden;
  color: #8b887d;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: 360px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-left: 1px solid #d9d6cd;
  background: #f0ede5;
}

.trace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d9d5ca;
}

.trace-head span,
.trace-head strong {
  display: block;
}

.trace-head span {
  color: #756f63;
  font-size: 10px;
}

.trace-head strong {
  margin-top: 4px;
  color: #2a2b25;
  font-size: 14px;
  font-weight: 500;
}

.trace-head button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-size: 10px;
  white-space: nowrap;
}

.trace-head .finance-line-icon {
  width: 14px;
  height: 14px;
}

.trace-list {
  display: grid;
  margin-top: 6px;
}

.trace-row {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid #ddd8cd;
  background: transparent;
  color: #2b2c26;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}

.trace-row:hover {
  color: var(--teal-dark);
  background: #e9e5db;
}

.trace-row-icon {
  color: #65766e;
}

.trace-row-copy {
  min-width: 0;
}

.trace-row-copy b,
.trace-row-copy small {
  display: block;
}

.trace-row-copy b {
  font-size: 11px;
  font-weight: 500;
}

.trace-row-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: #858074;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-row > strong {
  font-family: var(--finance-num);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.trace-row-arrow {
  color: #8a8e84;
}

.trace-task {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 13px 14px;
  border: 0;
  border-radius: 10px;
  background: #232721;
  color: #f3f2ea;
  text-align: left;
  transition: background-color 140ms ease;
}

.operations-heading > div:first-child {
  min-width: 0;
}

.trace-task:hover {
  background: #30372f;
}

.trace-task-icon {
  color: #a5c9bd;
}

.trace-task b,
.trace-task small {
  display: block;
}

.trace-task b {
  font-size: 11px;
  font-weight: 500;
}

.trace-task small {
  margin-top: 2px;
  overflow: hidden;
  color: #a9afa7;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel,
.kpi-card {
  border-color: #ddd9d0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
}

.panel {
  padding: 20px;
}

.panel + .panel {
  margin-top: 16px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  color: #252620;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.01em;
}

.panel-head p {
  margin-top: 3px;
  color: #5c6c65;
  font-size: 11px;
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 500;
}

.factory-chart-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.factory-chart-grid > .panel {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  min-height: 0;
}

.operations-lower > .panel,
.dashboard-grid > .panel {
  margin-top: 0;
}

.factory-chart-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.factory-chart-top > div:first-child span,
.factory-chart-top > div:first-child strong {
  display: block;
}

.factory-chart-top > div:first-child span {
  color: #807d72;
  font-size: 10px;
}

.factory-chart-top > div:first-child strong {
  margin-top: 3px;
  color: #292a24;
  font-family: var(--finance-num);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.factory-chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 0;
  color: #737168;
  font-size: 11px;
}

.factory-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.factory-chart-legend i {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.factory-bar-chart {
  height: 214px;
  gap: 12px;
  padding: 14px 4px 0;
  border-bottom-color: #d8d5cc;
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 53px,
    #ebe8e1 54px
  );
}

.factory-month-column {
  gap: 6px;
}

.factory-bar-group {
  height: 148px;
  gap: 5px;
}

.factory-bar {
  width: min(14px, 36%);
  min-width: 5px;
  border-radius: 3px 3px 1px 1px;
  transition: filter 140ms ease, outline-color 140ms ease;
}

.factory-bar:hover,
.factory-bar:focus-visible {
  filter: brightness(.92);
  outline: 2px solid #fcfbf7;
  outline-offset: 1px;
  transform: none;
}

.series-operating {
  background: #a7afa9;
}

.series-production {
  background: #d2cab8;
}

.factory-month-column.is-current .series-operating {
  background: #146e65;
}

.factory-month-column.is-current .series-production {
  background: #b77927;
}

.factory-month-label {
  color: #7b786e;
  font-size: 11px;
}

.factory-month-column.is-current .factory-month-label {
  color: #2d3029;
  font-weight: 500;
}

.factory-chart-note {
  margin: 8px 0 0;
  color: #7b786e;
  font-size: 11px;
  line-height: 16px;
}

.factory-spend-list {
  margin-top: 4px;
  border-top: 1px solid #ddd9d0;
}

.factory-spend-header,
.factory-spend-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) 96px;
  align-items: center;
  gap: 16px;
}

.factory-spend-header {
  min-height: 32px;
  border-bottom: 1px solid #e4e1d9;
  color: #858177;
  font-size: 11px;
}

.factory-spend-header span:first-child {
  color: #6f6d64;
}

.factory-spend-header span:not(:first-child) {
  text-align: right;
}

.factory-spend-row {
  min-height: 54px;
  border-bottom: 1px solid #e9e6df;
}

.factory-spend-row:last-child {
  border-bottom: 0;
}

.factory-spend-month {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.factory-spend-month strong {
  color: #35372f;
  font-size: 12px;
  font-weight: 500;
}

.factory-spend-month small {
  color: #8a867c;
  font-size: 10px;
}

.factory-spend-row.is-current .factory-spend-month strong {
  color: var(--teal-dark);
}

.factory-spend-series {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
  padding: 4px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #3f4039;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.factory-spend-series-label {
  display: none;
}

.factory-spend-track {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 3px;
  background: #eeebe4;
}

.factory-spend-track i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
}

.factory-spend-series b,
.factory-spend-total {
  color: #35372f;
  font-family: var(--finance-num);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.factory-spend-total {
  color: #252620;
  font-size: 12px;
}

.factory-spend-row.is-current .factory-spend-total {
  color: var(--teal-dark);
}

.factory-spend-series:hover .factory-spend-track {
  background: #e8e4db;
}

.factory-spend-series:hover b {
  color: var(--teal-dark);
}

.factory-spend-series:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
}

.factory-sparse-chart {
  padding-top: 4px;
}

.factory-sparse-month {
  padding: 12px 0;
  border-top: 1px solid #e4e1d9;
}

.factory-sparse-month:first-child {
  border-top: 0;
}

.factory-sparse-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.factory-sparse-heading strong {
  color: #35372f;
  font-size: 12px;
  font-weight: 500;
}

.factory-sparse-heading span {
  color: #737168;
  font-family: var(--finance-num);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.factory-sparse-month.is-current .factory-sparse-heading strong {
  color: var(--teal-dark);
}

.factory-sparse-bars {
  display: grid;
  gap: 4px;
}

.factory-sparse-bar {
  display: grid;
  grid-template-columns: minmax(82px, 104px) minmax(64px, 1fr) minmax(72px, 88px);
  align-items: center;
  gap: 12px;
  min-height: 32px;
  padding: 4px 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3f4039;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.factory-sparse-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.factory-sparse-label i {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.factory-sparse-track {
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 3px;
  background: #edeae3;
}

.factory-sparse-track i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
}

.factory-sparse-bar b {
  color: #35372f;
  font-family: var(--finance-num);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.factory-sparse-bar:hover {
  background: #f6f4ef;
}

.factory-sparse-bar:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
}

.output-panel {
  min-width: 0;
}

.mini-line-block + .mini-line-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top-color: #e3e0d8;
}

.output-panel .mini-line-block {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.mini-line-head {
  color: #7c796f;
  font-size: 11px;
}

.mini-line-head strong {
  color: #2c2d27;
  font-family: var(--finance-num);
  font-size: 13px;
  font-weight: 500;
}

.mini-line-chart {
  flex: 1;
  min-height: 92px;
  height: auto;
}

.mini-line-chart .line-grid {
  stroke: #e5e2da;
}

.mini-line-chart .line-path {
  stroke-width: 2;
}

.mini-line-chart .line-area {
  fill: currentColor;
  opacity: .06;
  stroke: none;
}

.mini-line-chart .line-point {
  r: 3px;
}

.mini-line-chart .line-axis-label {
  fill: #858177;
  font-size: 11px;
}

.line-sales {
  color: #14766c;
}

.line-output {
  color: #a8691e;
}

.operations-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .72fr);
  gap: 16px;
  margin-bottom: 16px;
}

.change-summary,
.workbench {
  min-height: 100%;
}

.change-list {
  display: grid;
}

.change-list > button {
  min-height: 59px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid #e4e1d9;
  background: transparent;
  color: #292a24;
  text-align: left;
}

.change-list > button:last-child {
  border-bottom: 0;
}

.change-list > button:hover {
  background: #f5f3ed;
}

.change-list b,
.change-list small {
  display: block;
}

.change-list b {
  font-size: 12px;
  font-weight: 500;
}

.change-list small {
  margin-top: 3px;
  color: #858176;
  font-size: 9px;
}

.change-list > button > strong {
  font-family: var(--finance-num);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.trend-badge {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 500;
}

.trend-badge.good {
  color: #236450;
  background: #e5efea;
}

.trend-badge.bad {
  color: #94413b;
  background: #f6e9e6;
}

.trend-badge.neutral {
  color: #706d64;
  background: #edebe5;
}

.workbench-list {
  display: grid;
}

.workbench-list button {
  min-height: 47px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid #e4e1d9;
  background: transparent;
  color: #2a2b25;
  text-align: left;
}

.workbench-list button:last-child {
  border-bottom: 0;
}

.workbench-list button:hover {
  color: var(--teal-dark);
  background: #f5f3ed;
}

.workbench-list button > span {
  font-size: 12px;
  font-weight: 500;
}

.workbench-list button small {
  grid-column: 1;
  margin-top: -6px;
  color: #858176;
  font-size: 9px;
}

.workbench-list .finance-line-icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: #8d988f;
}

.data-warning-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-color: #dfc79e;
  border-radius: 12px;
  color: #65502f;
  background: #fbf1df;
  box-shadow: none;
}

.warning-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #b77720;
  font-size: 12px;
}

.data-warning-banner b {
  font-size: 11px;
  font-weight: 500;
}

.data-warning-banner small {
  color: #8e744f;
  font-size: 9px;
}

.data-warning-banner > strong {
  color: #8a5c1e;
  font-size: 9px;
  font-weight: 500;
}

.dashboard-grid {
  gap: 16px;
}

.simple-asset-list > button,
.category-row,
.quick-action-list button {
  transition: background-color 140ms ease, border-color 140ms ease;
}

.simple-asset-list > button {
  padding: 10px 2px;
  border-bottom-color: #e4e1d9;
}

.simple-asset-list > button:hover,
.category-row:hover,
.quick-action-list button:hover {
  background: #f3f1eb;
}

.category-row {
  border-radius: 6px;
}

.progress {
  height: 4px;
  border-radius: 2px;
  background: #e9e6de;
}

.progress > span {
  border-radius: 2px;
  background: #6f9e90;
}

.table-wrap {
  border-color: #dedad1;
  border-radius: 10px;
}

.data-table th {
  padding: 10px 12px;
  color: #77746a;
  background: #f3f1eb;
  border-bottom-color: #dcd8cf;
  font-size: 10px;
  font-weight: 500;
}

.data-table td {
  padding: 10px 12px;
  border-bottom-color: #e8e5dd;
  color: #34352e;
  font-size: 11px;
}

.data-table tbody tr:hover {
  background: #f8f6f0;
}

.data-table tbody tr.clickable-table-row:hover {
  background: #f0f5f1;
  box-shadow: inset 2px 0 0 var(--teal);
}

.status {
  border-radius: 4px;
  font-weight: 500;
}

.btn {
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: none;
}

.btn.primary {
  color: #f7f6f0;
  background: var(--teal-dark);
  box-shadow: none;
}

.btn.primary:hover {
  background: #084f49;
}

.btn.secondary {
  color: var(--teal-dark);
  background: #e7eeea;
  border-color: #cbd8d2;
}

.btn.ghost {
  border-color: #d7d4ca;
  color: #4e5048;
  background: #fcfbf7;
}

.btn.ghost:hover {
  border-color: #bfc5bb;
  background: #f2f0e9;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-color: #d8d5cb;
  border-radius: 8px;
  color: #62655c;
  background: #fcfbf7;
}

input,
select,
textarea {
  border-color: #d6d2c8;
  border-radius: 8px;
  background: #fcfbf7;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #66988b;
  box-shadow: 0 0 0 3px rgba(20, 118, 108, .1);
}

.kpi-grid,
.simple-kpi-grid {
  gap: 12px;
}

.kpi-card {
  min-height: 108px;
  padding: 16px;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.kpi-card:hover {
  transform: none;
  border-color: #c7c4ba;
  box-shadow: none;
}

.kpi-card.accent {
  color: #f5f4ed;
  border-color: #24362f;
  background: #24362f;
}

.kpi-value {
  font-family: var(--finance-num);
  font-weight: 500;
}

.flow-expense {
  background: #8b5a26;
}

.flow-inventory {
  background: #296e65;
}

.flow-asset {
  background: #415f72;
}

.flow-transfer {
  background: #665d77;
}

.dashboard-welcome,
.insight-panel {
  box-shadow: none;
}

.dashboard-welcome {
  background: #20332d;
}

.dashboard-welcome::before,
.dashboard-welcome::after {
  display: none;
}

.insight-panel {
  border-color: #ddd9d0;
  background: var(--surface);
}

.simple-kpi {
  min-height: 116px;
  padding: 16px;
  border-color: #ddd9d0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.simple-kpi:hover {
  transform: none;
  border-color: #c8c4ba;
  background: #f8f6f0;
  box-shadow: none;
}

.simple-kpi-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 6px;
  background: #e7eeea;
  color: var(--teal-dark);
  font-size: 12px;
}

.simple-kpi strong {
  font-family: var(--finance-num);
  font-weight: 500;
}

.sidebar-hover-zone span {
  border: 0;
  border-radius: 0 6px 6px 0;
  background: #25322d;
  box-shadow: none;
  color: #d7e7e1;
  animation: none;
}

.drawer,
.modal {
  background: #f6f4ee;
}

.drawer {
  box-shadow: -16px 0 40px rgba(25, 27, 23, .14);
}

.modal {
  border: 1px solid #d9d5cc;
  box-shadow: 0 24px 64px rgba(25, 27, 23, .2);
}

.drawer-backdrop,
.modal-backdrop {
  background: rgba(25, 27, 23, .38);
  backdrop-filter: none;
}

@media (max-width: 1400px) {
  .topbar-actions #finance-range-button,
  .topbar-actions .user-chip,
  .topbar-actions #finance-procurement-top,
  .topbar-actions #finance-warehouse-top {
    display: none;
  }

  .operations-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .operations-actions {
    align-self: flex-start;
  }
}

@media (max-width: 1600px) {
  .topbar {
    max-width: 940px;
    margin-left: 0;
  }

  .page-content {
    max-width: 820px;
    margin-left: 0;
  }
}

/* Light ledger palette: keep the industrial accent, remove the heavy charcoal chrome. */
:root {
  --surface: #fffdf9;
  --canvas: #f5f2eb;
  --ink: #28302b;
  --muted: #707a73;
  --line: #ddd9cf;
  --teal: #248f82;
  --teal-dark: #176f65;
  --teal-soft: #e7f0ec;
}

.sidebar {
  color: #35473f;
  background: #e8ede8;
  border-right-color: #ccd6cf;
}

.brand-mark {
  border-color: #bdcec5;
  background: #f6f8f5;
}

.brand-mark svg {
  stroke: #25786d;
}

.sidebar-brand strong {
  color: #22362e;
}

.sidebar-brand span {
  color: #6a7d74;
}

.nav-group {
  border-bottom-color: #d5ddd7;
}

.nav-group-label {
  color: #6f7e76;
}

.nav-active-highlight {
  background: #d5e5de;
  box-shadow: inset 3px 0 #327d6f;
}

.nav-item {
  color: #53665e;
}

.nav-item:hover {
  color: #20362d;
  background: #f4f6f2;
}

.nav-item.active {
  color: #174c43;
}

.nav-icon,
.nav-item.active .nav-icon {
  color: #668078;
}

.finance-system-switch {
  border-top-color: #d1dad4;
}

.system-switch-label {
  color: #708078;
}

.system-switch-item {
  border-color: #cbd6cf;
  background: #f3f6f2;
  color: #40574d;
}

.system-switch-item:hover {
  background: #fafbf8;
}

.system-switch-item .switch-arrow {
  color: #3e8073;
}

.sidebar-foot {
  border-top-color: #d1dad4;
}

.sidebar-note,
.sidebar-user span {
  color: #7d8b84;
}

.sidebar-user {
  color: #33483f;
}

.sidebar-hover-zone span {
  color: #f2faf6;
  background: #456d62;
}

.topbar {
  background: rgba(251, 249, 244, .96);
}

.operations-brief,
.panel {
  background: #fffdf9;
}

.trace-panel,
.operations-trace {
  background: #eef1eb;
}

.trace-task {
  background: #315b51;
}

.trace-task:hover {
  background: #3a6b60;
}

.btn.primary {
  background: #176f65;
}

.btn.primary:hover {
  background: #115d55;
}

.kpi-grid > .kpi-card.accent {
  background: #2e5f55;
}

.kpi-grid > .kpi-card.accent:hover {
  background: #386c61;
}

.receivables,
.text-positive {
  color: #1f7463;
}

@media (max-width: 700px) {
  .operations-brief {
    display: block;
  }

  .operations-main {
    margin-right: 280px;
  }

  .trace-panel {
    position: absolute;
    width: 280px;
    border-top: 0;
    border-left: 1px solid #d9d6cd;
  }

  .trace-list {
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
  }

  .trace-task {
    margin-top: 12px;
  }

  .factory-chart-grid,
  .operations-lower {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 68px;
    padding: 10px 16px;
  }

  .page-wrap {
    padding: 16px 14px 36px;
  }

  .operations-main,
  .trace-panel {
    padding: 20px;
  }

  .operations-heading {
    flex-direction: column;
    gap: 14px;
  }

  .operations-ledger {
    grid-template-columns: 1fr;
  }

  .operations-ledger button,
  .operations-ledger button:first-child,
  .operations-ledger button:last-child {
    padding: 13px 0;
    border-right: 0;
    border-bottom: 1px solid #e4e1d9;
  }

  .operations-ledger button:last-child {
    border-bottom: 0;
  }

  .trace-list {
    grid-template-columns: 1fr;
  }

  .factory-chart-grid > .panel {
    min-height: 0;
  }

  .sidebar {
    width: min(280px, 88vw);
  }
}

@media (max-width: 520px) {
  .trend-panel .panel-head {
    gap: 8px;
  }

  .trend-panel .panel-head > div {
    min-width: 0;
  }

  .trend-panel .panel-head > .btn {
    flex: 0 0 auto;
    padding-right: 10px;
    padding-left: 10px;
    white-space: nowrap;
  }

  .factory-chart-legend {
    gap: 6px 10px;
    font-size: 10px;
  }

  .factory-spend-header {
    display: none;
  }

  .factory-spend-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    min-height: 0;
    padding: 12px 0;
  }

  .factory-spend-month {
    grid-row: 1;
    grid-column: 1;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
  }

  .factory-spend-total {
    grid-row: 1;
    grid-column: 2;
  }

  .factory-spend-series {
    grid-column: 1 / -1;
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .factory-spend-series-label {
    display: inline;
    color: #77736a;
    font-size: 11px;
    white-space: nowrap;
  }

  .operations-total > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .operations-total strong {
    font-size: 36px;
  }

  .operations-actions {
    width: 100%;
  }

  .operations-actions .btn {
    flex: 1;
  }

  .change-list > button {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .change-list .trend-badge {
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  .operations-brief {
    display: grid;
    grid-template-columns: 1fr;
  }

  .operations-main {
    margin-right: 0;
  }

  .trace-panel {
    position: static;
    width: auto;
    border-top: 1px solid #d9d6cd;
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-content {
    animation: none;
  }

  .sidebar,
  .main-shell,
  .nav-active-highlight {
    transition: none;
  }
}

/* The operating brief uses normal flow so the trace rail never leaves the viewport. */
.operations-main {
  margin-right: 0;
}

.operations-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(288px, .58fr);
  align-items: stretch;
  gap: 24px;
  margin-top: 20px;
}

.operations-cost {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.operations-cost .operations-total {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.operations-trace {
  position: static;
  width: auto;
  min-width: 0;
  height: 100%;
  padding: 18px;
  border: 1px solid #d9d6cd;
  border-radius: 12px;
  background: #f2efe7;
}

@media (min-width: 981px) {
  .operations-trace .trace-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }

  .operations-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operations-ledger button {
    padding: 14px 18px;
    border-bottom: 1px solid #e4e1d9;
  }

  .operations-ledger button:nth-child(2n) {
    border-right: 0;
  }

  .operations-ledger button:nth-child(n + 3) {
    border-bottom: 0;
  }

  .operations-ledger button:first-child {
    padding-left: 0;
  }

  .operations-ledger button:last-child {
    padding-right: 0;
  }
}

@media (max-width: 980px) {
  .operations-body {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
  }

  .operations-trace {
    padding: 15px;
  }
}

@media (max-width: 640px) {
  .operations-body {
    grid-template-columns: 1fr;
  }

  .operations-trace {
    height: auto;
  }
}

/* 2026-11-16 · audit and small-screen overflow pass */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

.dashboard-grid,
.simple-dashboard-grid,
.two-col {
  min-width: 0;
}

.dashboard-grid > *,
.simple-dashboard-grid > *,
.two-col > *,
.panel {
  min-width: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
}

.drawer:not(.open) {
  visibility: hidden;
  pointer-events: none;
}

.drawer.open {
  visibility: visible;
  pointer-events: auto;
}

.table-sort-button {
  min-height: 28px;
  padding: 5px 0;
}

.finance-category-entry {
  cursor: text;
  -webkit-appearance: none;
  appearance: none;
}

.finance-category-entry::-webkit-calendar-picker-indicator {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.finance-empty-state {
  display: grid;
  gap: 6px;
  place-content: center;
  min-height: 180px;
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

.finance-empty-state strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.finance-empty-state span {
  font-size: 11px;
}

.finance-audit-table {
  table-layout: fixed;
  min-width: 980px;
}

.finance-audit-table th:nth-child(1) { width: 132px; }
.finance-audit-table th:nth-child(2) { width: 92px; }
.finance-audit-table th:nth-child(3) { width: 205px; }
.finance-audit-table th:nth-child(4) { width: 150px; }
.finance-audit-table th:nth-child(6) { width: 74px; }

.audit-action-label,
.audit-action-code {
  display: block;
}

.audit-cell-value {
  min-width: 0;
}

.audit-action-label {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
}

.audit-action-code {
  margin-top: 3px;
  color: #63757c;
  font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-summary {
  color: #465a60;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.audit-summary-disclosure {
  color: #465a60;
  line-height: 1.55;
}

.audit-summary-disclosure summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  cursor: pointer;
  list-style: none;
}

.audit-summary-disclosure summary::-webkit-details-marker {
  display: none;
}

.audit-summary-disclosure summary span {
  overflow-wrap: anywhere;
}

.audit-summary-disclosure summary b {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.audit-summary-disclosure > div {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #e1e6e3;
  border-radius: 8px;
  background: #f7f6f1;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .finance-audit-table {
    display: block;
    min-width: 0;
    width: 100%;
    table-layout: auto;
    background: transparent;
  }

  .finance-audit-table thead {
    display: none;
  }

  .finance-audit-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .finance-audit-table tbody tr {
    display: block;
    padding: 12px 13px;
    border: 1px solid #dfe5e1;
    border-radius: 12px;
    background: #fffdf9;
  }

  .finance-audit-table tbody td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 9px;
    width: auto;
    padding: 5px 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .finance-audit-table tbody td::before {
    content: attr(data-label);
    color: #66645c;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
  }

  .finance-audit-table tbody td:first-child {
    padding-top: 0;
    color: var(--ink);
    font-weight: 600;
  }

  .finance-audit-table tbody td:last-child {
    padding-bottom: 0;
  }

  .audit-summary-disclosure summary span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
  }

  .topbar-title {
    flex: 1 1 100%;
    min-width: 0;
  }

  .topbar-title > div {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 19px;
    line-height: 1.25;
  }

  .topbar-actions {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
  }

  .topbar-actions #finance-command-button,
  .topbar-actions #finance-print-page {
    min-height: 42px;
    white-space: nowrap;
  }

  .topbar-actions .period-control {
    min-width: 0;
  }

  .topbar-actions .period-select-stack {
    min-width: 0;
  }

  .topbar-actions #finance-period {
    width: 100%;
  }

  .chart.compact-chart {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
}

/* Secondary finance pages: one ledger band instead of repeated mini-cards. */
.simple-dashboard-head {
  align-items: flex-end;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #dedad1;
}

.simple-dashboard-head .eyebrow {
  margin-bottom: 4px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}

.simple-dashboard-head h2 {
  margin: 0 0 4px;
  color: #24251f;
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: -.02em;
}

.simple-dashboard-head p {
  color: #77746a;
  font-size: 12px;
}

.kpi-grid {
  gap: 0;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid #ddd9d0;
  border-radius: 14px;
  background: var(--surface);
}

.kpi-grid > .kpi-card {
  min-height: 96px;
  padding: 16px 20px;
  border: 0;
  border-right: 1px solid #e4e1d9;
  border-radius: 0;
  background: transparent;
}

.kpi-grid > .kpi-card:last-child {
  border-right: 0;
}

.kpi-grid > .kpi-card:hover {
  background: #f4f2ec;
}

.kpi-grid > .kpi-card.accent {
  border-right-color: #34443c;
  border-radius: 10px;
  color: #f5f4ed;
  background: #24362f;
}

.kpi-grid > .kpi-card.accent:hover {
  background: #2b4037;
}

.kpi-label {
  color: #77746a;
  font-size: 11px;
  font-weight: 400;
}

.kpi-value {
  margin: 10px 0 6px;
  color: #252620;
  font-family: var(--finance-num);
  font-size: clamp(21px, 1.8vw, 28px);
  font-weight: 500;
  letter-spacing: -.02em;
}

.kpi-card.accent .kpi-value {
  color: #f8f7f1;
}

.kpi-meta {
  color: #858176;
  font-size: 10px;
}

.kpi-card.accent .kpi-label,
.kpi-card.accent .kpi-meta {
  color: #b9cbc4;
}

.metric-strip {
  gap: 0;
  margin-bottom: 16px;
  border-top: 1px solid #dedad1;
  border-bottom: 1px solid #dedad1;
}

.metric {
  min-width: 0;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid #e4e1d9;
  border-radius: 0;
  background: transparent;
}

.metric:last-child {
  border-right: 0;
}

.metric:hover {
  background: #f5f3ed;
}

.metric span {
  color: #77746a;
  font-size: 10px;
}

.metric strong {
  font-family: var(--finance-num);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.metric.summary-filter {
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.metric.summary-filter.active {
  background: #f2f0e9;
  box-shadow: inset 0 -2px 0 var(--teal-dark);
}
.metric.summary-filter:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: -3px;
}
.expense-group-summary-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 0 8px;
}
.expense-group-summary-head > div {
  display: grid;
  gap: 3px;
}
.expense-group-summary-head strong {
  color: #252620;
  font-size: 12px;
  font-weight: 600;
}
.expense-group-summary-head span {
  color: #817e74;
  font-size: 10px;
}
.expense-group-summary-head .expense-group-total {
  color: #4f514a;
  font-family: var(--finance-num);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.expense-group-metrics {
  margin-bottom: 8px;
}
.expense-group-metric {
  min-height: 84px;
}
.expense-group-metric small {
  display: block;
  margin-top: 5px;
  color: #817e74;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.expense-group-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  margin: 0 0 14px;
}
.expense-group-link {
  padding: 5px 0;
  border: 0;
  color: #77746a;
  background: transparent;
  font: inherit;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #c8c4ba;
  text-underline-offset: 3px;
}
.expense-group-link:hover,
.expense-group-link.active {
  color: var(--teal-dark);
  text-decoration-color: currentColor;
}
.expense-group-link b {
  font-family: var(--finance-num);
  font-weight: 500;
}
.expense-group-link span {
  margin-left: 4px;
  color: #5e5b53;
  font-family: var(--finance-num);
}
.expense-group-link:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
  border-radius: 4px;
}
.attachment-hint {
  min-height: 20px;
  margin: 0;
  padding: 0 0 12px;
  color: #8a641f;
  font-size: 12px;
}

.metric-note {
  margin: 0 0 16px;
  color: #817e74;
  font-size: 10px;
}

.detail-filter-bar {
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 0;
  border-width: 1px 0;
  border-color: #dedad1;
  border-radius: 0;
  background: transparent;
}

.detail-filter-bar input {
  border-color: #d8d4ca;
  background: #fcfbf7;
}

.filter-chip-row {
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8d4ca;
  border-radius: 8px;
  background: #f2f0e9;
}

.filter-chip {
  min-height: 28px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  color: #6f6c63;
  background: transparent;
  font-size: 10px;
  transition: color 140ms ease, background-color 140ms ease;
}

.filter-chip:hover {
  color: #2c2e28;
  background: #e8e5dd;
}

.filter-chip.active {
  color: #f8f7f1;
  border-color: transparent;
  background: var(--teal-dark);
}

.toolbar {
  padding-bottom: 12px;
  border-bottom: 1px solid #dedad1;
}

.search-box input,
.toolbar-filters > select,
.filter-input {
  border-color: #d8d4ca;
  background: #fcfbf7;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 14px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 14px;
}

.data-table td {
  height: 42px;
}

.data-table .description small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
}

.status {
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 9px;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}

.drawer-head h2,
.modal-head h2 {
  color: #252620;
  font-size: 21px;
  font-weight: 500;
}

.drawer-head .eyebrow,
.modal-head .eyebrow {
  color: #77746a;
}

.detail-item {
  border-color: #ddd9d0;
  border-radius: 9px;
  background: #fcfbf7;
}

.detail-item span {
  font-size: 10px;
}

.detail-item strong {
  color: #2f302a;
  font-size: 12px;
  font-weight: 500;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid #5e988a;
  outline-offset: 2px;
}

@media (max-width: 820px) {
  .kpi-grid > .kpi-card {
    border-right: 0;
    border-bottom: 1px solid #e4e1d9;
    border-radius: 8px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 1px solid #e4e1d9;
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 1600px) {
  .topbar {
    max-width: 1440px;
    margin-right: auto;
    margin-left: auto;
  }

  .page-content {
    max-width: 1440px;
    margin-right: auto;
    margin-left: auto;
  }
}

.data-table.task-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.task-detail-table th:nth-child(1),
.task-detail-table td:nth-child(1) { width: 22%; }
.task-detail-table th:nth-child(2),
.task-detail-table td:nth-child(2) { width: 33%; }
.task-detail-table th:nth-child(3),
.task-detail-table td:nth-child(3) { width: 17%; }
.task-detail-table th:nth-child(4),
.task-detail-table td:nth-child(4) { width: 28%; }

.task-detail-table td { overflow-wrap: anywhere; }
.task-detail-table .actions {
  white-space: normal;
  text-align: right;
}
.task-detail-table .actions .btn {
  display: block;
  width: auto;
  margin: 2px 0 0 auto;
  padding: 6px 7px;
  font-size: 9px;
  white-space: nowrap;
}
.task-detail-table .status { white-space: normal; }
.task-drawer-list {
  display: grid;
  gap: 11px;
  margin-top: 14px;
}

.task-detail-page {
  min-height: calc(100vh - 150px);
}

.task-detail-page-head h3 {
  margin-top: 7px;
  font-size: 22px;
  letter-spacing: -.02em;
}

.task-detail-page-head p {
  max-width: 780px;
  font-size: 12px;
}

.task-detail-back {
  margin-bottom: 15px;
}

.task-detail-page-body {
  min-width: 0;
}

.task-detail-page .metric-strip {
  margin-bottom: 14px;
}

.task-detail-page .task-drawer-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-detail-page .task-drawer-list > .drawer-data-filter {
  grid-column: 1 / -1;
}

@media (max-width: 1050px) {
  .task-detail-page .task-drawer-list {
    grid-template-columns: 1fr;
  }
}

.task-drawer-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid #ddd9d0;
  border-radius: 12px;
  background: #fffdf9;
}

.task-drawer-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-drawer-item-head > div {
  min-width: 0;
}

.task-drawer-item-head strong,
.task-drawer-item-head small {
  display: block;
}

.task-drawer-item-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-drawer-item-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.task-drawer-item-head .status {
  flex: 0 0 auto;
}

.task-detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  border: 1px solid #e5e1d8;
  border-radius: 9px;
  overflow: hidden;
  background: #e5e1d8;
}

.task-detail-metrics > div {
  min-width: 0;
  padding: 9px 10px;
  background: #faf8f3;
}

.task-detail-metrics span,
.task-detail-metrics strong,
.task-detail-metrics small {
  display: block;
}

.task-detail-metrics span {
  color: var(--muted);
  font-size: 10px;
}

.task-detail-metrics strong {
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--finance-num);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-detail-metrics small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.task-drawer-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.task-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}

.task-drawer-actions .btn {
  min-height: 34px;
}

.drawer .form-actions {
  margin-top: 16px;
}

.modal.modal-wide {
  width: min(1120px, 100%);
  max-height: min(92vh, 900px);
}

.modal.modal-detail {
  width: min(860px, 100%);
  max-height: min(90vh, 900px);
}

.modal.modal-detail.modal-detail-wide {
  width: min(1080px, 100%);
}

#finance-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#finance-modal .modal-head {
  flex: 0 0 auto;
}

#finance-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.finance-native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.attachment-dropzone {
  min-height: 84px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed #c9c5bb;
  border-radius: 10px;
  color: #62655c;
  background: #fcfbf7;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.attachment-dropzone:hover,
.attachment-dropzone:focus-visible,
.attachment-dropzone.dragging {
  border-color: #66988b;
  background: #f1f5f2;
  outline: none;
}

.attachment-dropzone.invalid {
  border-color: #b85b47;
  background: #fff7f3;
  box-shadow: 0 0 0 2px rgba(184, 91, 71, .08);
}

.attachment-dropzone-empty,
.attachment-dropzone-preview {
  width: 100%;
}

.attachment-dropzone-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.attachment-dropzone-empty .finance-line-icon {
  width: 20px;
  height: 20px;
  color: #52756b;
}

.attachment-dropzone-empty strong {
  color: #3f413b;
  font-size: 11px;
  font-weight: 500;
}

.attachment-dropzone-empty small,
.attachment-dropzone-preview small {
  color: #858176;
  font-size: 10px;
}

.attachment-dropzone-preview {
  display: block;
}

.attachment-dropzone-preview[hidden] {
  display: none;
}

.attachment-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.attachment-selected-head strong {
  color: #3f413b;
  font-size: 11px;
  font-weight: 600;
}

.attachment-clear-all,
.attachment-selected-action {
  padding: 0;
  border: 0;
  color: #176f65;
  background: transparent;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.attachment-clear-all:hover,
.attachment-selected-action:hover {
  color: #0b544d;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.attachment-selected-files {
  display: grid;
  gap: 6px;
}

.attachment-selected-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #e0ddd4;
  border-radius: 9px;
  background: #fffefa;
}

.attachment-selected-thumb {
  width: 52px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: #ece9e1;
  cursor: zoom-in;
}

.attachment-selected-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-selected-copy {
  min-width: 0;
}

.attachment-selected-copy strong,
.attachment-selected-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-selected-copy strong {
  color: #303933;
  font-size: 11px;
  font-weight: 500;
}

.attachment-selected-copy small {
  margin-top: 2px;
  color: #858176;
  font-size: 10px;
}

.attachment-selected-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attachment-dropzone-remove {
  border: 1px solid #d7d4ca;
  border-radius: 7px;
  padding: 5px 8px;
  color: #6d5c48;
  background: #fff;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.attachment-file-mark {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #52756b;
  background: #eef3ef;
}

@media (max-width: 720px) {
  .attachment-selected-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .attachment-selected-thumb,
  .attachment-file-mark {
    width: 48px;
    height: 44px;
  }

  .attachment-selected-actions {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.modal-wide .task-drawer-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-drawer-list > .drawer-data-filter {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .modal-wide .task-drawer-list {
    grid-template-columns: 1fr;
  }
}

.warehouse-allocation-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dedbd2;
  border-radius: 10px;
  background: #fbfaf6;
}

.warehouse-allocation-list > .muted,
.warehouse-allocation-list > .form-error {
  margin: 2px 0 0;
}

.warehouse-allocation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  align-items: center;
}

.warehouse-allocation-row > span {
  display: grid;
  gap: 2px;
}

.warehouse-allocation-row small {
  color: #65736d;
}

.warehouse-allocation-row input {
  width: 100%;
}

.kpi-grid > .kpi-card.task-filter-active {
  background: #f1f5f2;
  box-shadow: inset 0 -3px 0 #0d7b73;
}

.kpi-grid > .kpi-card.accent.task-filter-active {
  background: #24362f;
  box-shadow: inset 0 -3px 0 #8fd7ca;
}

@media (max-width: 680px) {
  .warehouse-allocation-row {
    grid-template-columns: 1fr;
  }
}

/* Approval ledger: interactive figures stay flat and readable. */
.approval-kpis {
  padding: 4px;
  border-color: #dfdcd3;
  background: #fffefb;
  box-shadow: none;
}

.approval-kpis > .kpi-card,
.approval-kpis > .kpi-card.accent {
  appearance: none;
  width: 100%;
  color: #252620;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 0;
  border-right: 1px solid #e4e1d9;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.approval-kpis > .kpi-card:last-child {
  border-right: 0;
}

.approval-kpis > .kpi-card::after {
  display: none;
}

.approval-kpis > .kpi-card:hover,
.approval-kpis > .kpi-card.accent:hover {
  background: #f7f6f1;
  box-shadow: none;
}

.approval-kpis > .kpi-card.task-filter-active,
.approval-kpis > .kpi-card.accent.task-filter-active {
  color: #252620;
  background: #f1f5f2;
  box-shadow: inset 0 -3px 0 #0d7b73;
}

.approval-kpis .kpi-label,
.approval-kpis .kpi-meta,
.approval-kpis > .kpi-card.accent .kpi-label,
.approval-kpis > .kpi-card.accent .kpi-meta {
  color: #77746a;
}

.approval-kpis .kpi-value,
.approval-kpis > .kpi-card.accent .kpi-value {
  color: #252620;
}

.approval-kpis > .kpi-card:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #2e766b;
  outline-offset: -3px;
}

@media (max-width: 820px) {
  .approval-kpis > .kpi-card,
  .approval-kpis > .kpi-card.accent {
    border-right: 0;
    border-bottom: 1px solid #e4e1d9;
    border-radius: 0;
  }

  .approval-kpis > .kpi-card:last-child {
    border-bottom: 0;
  }
}

/* Finance metrics stay on the ledger surface; accent marks the value, not a dark tile. */
.kpi-grid > .kpi-card.accent,
.kpi-card.accent {
  color: #252620;
  border-color: #ddd9d0;
  background: #fffefb;
  box-shadow: none;
}

.kpi-grid > .kpi-card.accent:hover,
.kpi-card.accent:hover {
  color: #252620;
  border-color: #c9c5bb;
  background: #f7f6f1;
  box-shadow: none;
}

.kpi-card.accent::after {
  display: none;
}

.kpi-card.accent .kpi-value {
  color: #176f65;
}

.kpi-card.accent .kpi-label,
.kpi-card.accent .kpi-meta {
  color: #77746a;
}

.kpi-card.accent.task-filter-active,
.kpi-grid > .kpi-card.accent.task-filter-active {
  color: #252620;
  background: #f1f5f2;
  box-shadow: inset 0 -3px 0 #0d7b73;
}

.kpi-card.flow-card,
.kpi-card.flow-card:hover {
  color: #252620;
  border: 1px solid #ddd9d0;
  background: #fffefb;
  box-shadow: none;
}

.kpi-card.flow-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--flow-accent, #6a8d82);
}

.kpi-card.flow-expense {
  --flow-accent: #a36c34;
}

.kpi-card.flow-inventory {
  --flow-accent: #2f8276;
}

.kpi-card.flow-asset {
  --flow-accent: #547b92;
}

.kpi-card.flow-transfer {
  --flow-accent: #746986;
}

.kpi-card.flow-card .kpi-label,
.kpi-card.flow-card .kpi-meta {
  color: #77746a;
}

.kpi-card.flow-card .kpi-value {
  color: #252620;
}

.kpi-card.flow-card .flow-card-link {
  color: #176f65;
  font-weight: 500;
}

.metric .metric-breakdown,
.data-table .metric-breakdown {
  display: block;
  margin-top: 5px;
  color: #858176;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  font-variant-numeric: tabular-nums;
}

.payable-filter-bar select {
  flex: 0 0 150px;
  width: 150px;
}

@media (max-width: 720px) {
  .payable-filter-bar select {
    flex: 1 1 100%;
    width: 100%;
  }
}
