:root {
  color-scheme: dark;
  --bg: #050b14;
  --bg-deep: #030811;
  --surface: #091523;
  --surface-2: #0c1b2c;
  --surface-3: #102337;
  --surface-hover: #122a40;
  --line: #1a354a;
  --line-bright: #295066;
  --text: #e6f1f8;
  --text-soft: #93aabf;
  --text-muted: #5f7c93;
  --accent: #42e3dc;
  --accent-rgb: 66, 227, 220;
  --accent-2: #5e9dff;
  --good: #4ce2a0;
  --warning: #f1bc6b;
  --danger: #f58476;
  --violet: #8f83f6;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --display: "Bahnschrift", "DIN Alternate", "Arial Narrow", var(--font);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -10%, rgba(38, 117, 142, 0.12), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(94, 157, 255, 0.09), transparent 32rem),
    var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

.subtle {
  color: var(--text-soft);
}

.cyan-text {
  color: var(--accent) !important;
}

.good-text {
  color: var(--good) !important;
}

.warn-text {
  color: var(--warning) !important;
}

.danger-text {
  color: var(--danger) !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(2, 10px);
  gap: 3px;
  width: 23px;
  height: 23px;
  transform: rotate(-8deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 5px;
  transform: rotate(8deg);
}

.brand-mark i {
  display: block;
  background: var(--accent);
  border-radius: 1.5px;
  box-shadow: 0 0 11px rgba(var(--accent-rgb), 0.32);
}

.brand-mark i:nth-child(2) {
  opacity: 0.32;
}

.brand-mark i:nth-child(3) {
  opacity: 0.54;
}

.brand-mark i:nth-child(4) {
  opacity: 0.9;
}

.brand-mark.large {
  grid-template-columns: repeat(2, 20px);
  grid-template-rows: repeat(2, 20px);
  gap: 5px;
  width: 45px;
  height: 45px;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.brand-copy small {
  color: var(--text-muted);
  font-family: var(--display);
  font-size: 8px;
  line-height: 1.15;
  letter-spacing: 0.15em;
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  place-items: center;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  transition: 0.2s ease;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button.bordered {
  border: 1px solid var(--line);
  background: var(--surface);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(76, 226, 160, 0.11), 0 0 9px rgba(76, 226, 160, 0.7);
  animation: pulse-dot 2.4s infinite;
}

@keyframes pulse-dot {
  50% {
    opacity: 0.52;
    box-shadow: 0 0 0 6px rgba(76, 226, 160, 0), 0 0 12px rgba(76, 226, 160, 0.45);
  }
}

/* Authentication */
.auth-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 22% 58%, rgba(9, 72, 85, 0.32), transparent 36%),
    radial-gradient(ellipse at 83% 22%, rgba(25, 76, 124, 0.2), transparent 30%),
    linear-gradient(135deg, #030a13, #06111d 54%, #030a13);
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(66, 227, 220, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(66, 227, 220, 0.025) 1px, transparent 1px);
  background-size: 70px 70px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 12%, transparent 77%);
}

.auth-grid-bg {
  position: absolute;
  top: 15%;
  left: -8%;
  width: 66%;
  height: 76%;
  z-index: -1;
  opacity: 0.25;
  transform: perspective(500px) rotateX(56deg) rotateZ(-22deg);
  background-image:
    linear-gradient(rgba(66, 227, 220, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 227, 220, 0.12) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000, transparent 68%);
}

.auth-glow {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(66, 227, 220, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.auth-glow::before,
.auth-glow::after {
  content: "";
  position: absolute;
  border: inherit;
  border-radius: inherit;
}

.auth-glow-a {
  top: -260px;
  left: -200px;
  width: 720px;
  height: 720px;
}

.auth-glow-a::before {
  inset: 90px;
}

.auth-glow-a::after {
  inset: 190px;
}

.auth-glow-b {
  right: -180px;
  bottom: -310px;
  width: 630px;
  height: 630px;
}

.auth-glow-b::before {
  inset: 110px;
}

.auth-glow-b::after {
  inset: 230px;
}

.auth-brand {
  display: flex;
  width: min(1320px, calc(100% - 80px));
  margin: 0 auto;
  padding: 30px 0;
  align-items: center;
  justify-content: space-between;
}

.auth-edition {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-edition i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
}

.auth-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: clamp(60px, 10vw, 160px);
  width: min(1180px, calc(100% - 80px));
  margin: auto;
  padding: 44px 0 62px;
  align-items: center;
}

.auth-story {
  max-width: 600px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  color: var(--accent);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow > span {
  width: 22px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(var(--accent-rgb), 0.7);
}

.auth-story h1 {
  margin: 20px 0 22px;
  color: #f2f8fb;
  font-size: clamp(40px, 4.6vw, 67px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.045em;
}

.auth-story h1 em {
  color: var(--accent);
  font-style: normal;
  text-shadow: 0 0 35px rgba(var(--accent-rgb), 0.18);
}

.auth-story > p {
  max-width: 540px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.9;
}

.auth-live-card {
  position: relative;
  width: min(520px, 100%);
  margin-top: 42px;
  padding: 19px 20px 16px;
  border: 1px solid rgba(95, 143, 163, 0.23);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(12, 33, 48, 0.8), rgba(7, 21, 33, 0.72));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), 0 24px 70px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
}

.auth-live-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  width: 58px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 11px rgba(var(--accent-rgb), 0.7);
}

.auth-live-head,
.auth-live-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-live-head {
  color: var(--text-soft);
  font-size: 11px;
}

.auth-live-head span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.auth-live-head strong {
  color: var(--accent);
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.05em;
}

.auth-live-chart {
  display: flex;
  height: 72px;
  margin: 20px 0 13px;
  padding: 0 4px;
  align-items: flex-end;
  gap: 8px;
  border-bottom: 1px solid rgba(63, 109, 130, 0.2);
}

.auth-live-chart span {
  flex: 1;
  height: var(--h);
  min-height: 6px;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(to top, rgba(66, 227, 220, 0.15), rgba(66, 227, 220, 0.7));
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.06);
  animation: bar-grow 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transform-origin: bottom;
}

.auth-live-chart span:nth-child(2n) {
  animation-delay: 0.08s;
}

@keyframes bar-grow {
  from {
    transform: scaleY(0);
    opacity: 0;
  }
}

.auth-live-foot {
  color: var(--text-muted);
  font-size: 10px;
}

.auth-live-foot b {
  margin-left: 4px;
  color: var(--text);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
}

.auth-feature-row {
  display: flex;
  margin-top: 26px;
  gap: 24px;
  color: var(--text-muted);
  font-size: 11px;
}

.auth-feature-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.auth-feature-row svg {
  width: 14px;
  height: 14px;
  color: #7bb7c1;
}

.auth-card-wrap {
  position: relative;
}

.auth-card-glow {
  position: absolute;
  inset: 16% 5% -7%;
  z-index: -1;
  border-radius: 50%;
  background: rgba(51, 188, 194, 0.14);
  filter: blur(70px);
}

.auth-card {
  position: relative;
  padding: 34px 32px 26px;
  border: 1px solid rgba(85, 127, 145, 0.25);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(17, 30, 43, 0.96), rgba(8, 18, 29, 0.97));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.43), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(24px);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 34px;
  width: 64px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.6);
}

.auth-card-top {
  display: flex;
  margin-bottom: 26px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo {
  margin-bottom: 16px;
}

.login-kicker {
  color: var(--accent);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.auth-card h2 {
  margin: 7px 0 7px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.auth-card-top p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-field {
  display: block;
  margin-bottom: 17px;
}

.auth-field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 11px;
}

.auth-input-wrap {
  display: flex;
  height: 47px;
  align-items: center;
  border: 1px solid #213c50;
  border-radius: 6px;
  background: rgba(3, 12, 21, 0.55);
  transition: 0.2s ease;
}

.auth-input-wrap:focus-within {
  border-color: rgba(var(--accent-rgb), 0.75);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.07), inset 0 0 18px rgba(var(--accent-rgb), 0.025);
}

.auth-input-wrap > svg {
  width: 16px;
  height: 16px;
  margin: 0 12px 0 14px;
  color: var(--text-muted);
}

.auth-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
}

.auth-input-wrap input::placeholder {
  color: #527085;
}

.password-toggle {
  display: grid;
  width: 42px;
  height: 100%;
  flex: none;
  border: 0;
  place-items: center;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  width: 17px;
  height: 17px;
}

.auth-options {
  display: flex;
  margin: 4px 0 21px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.check-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-label span {
  display: inline-grid;
  width: 15px;
  height: 15px;
  border: 1px solid #315066;
  border-radius: 3px;
  place-items: center;
}

.check-label input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
}

.check-label input:checked + span::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 1.5px solid #041315;
  border-bottom: 1.5px solid #041315;
  transform: translateY(-1px) rotate(-45deg);
}

.text-button {
  padding: 0;
  border: 0;
  color: #79bcc5;
  background: transparent;
  font-size: inherit;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent);
}

.login-button {
  display: flex;
  width: 100%;
  height: 48px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(116, 251, 241, 0.55);
  border-radius: 6px;
  color: #03181a;
  background: linear-gradient(100deg, #34d2cc, #5af1e9);
  box-shadow: 0 10px 35px rgba(41, 210, 204, 0.17), inset 0 1px rgba(255, 255, 255, 0.3);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: 0.2s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(100deg, #4fe2dc, #79faf1);
  box-shadow: 0 14px 40px rgba(41, 210, 204, 0.23), inset 0 1px rgba(255, 255, 255, 0.35);
}

.login-button:active {
  transform: translateY(0);
}

.login-button svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.login-button:hover svg {
  transform: translateX(3px);
}

.demo-credential {
  display: flex;
  margin-top: 18px;
  padding: 11px 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(56, 105, 126, 0.26);
  border-radius: 5px;
  color: var(--text-muted);
  background: rgba(8, 28, 42, 0.48);
  font-size: 10px;
}

.demo-credential > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.demo-credential button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: inherit;
  cursor: pointer;
}

.demo-credential button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-legal {
  margin: 17px 0 0;
  color: #466276;
  font-size: 9px;
  text-align: center;
}

.auth-footer {
  display: flex;
  width: min(1320px, calc(100% - 80px));
  margin: 0 auto;
  padding: 18px 0 25px;
  align-items: center;
  gap: 28px;
  border-top: 1px solid rgba(65, 98, 118, 0.12);
  color: #486378;
  font-size: 10px;
}

.auth-footer span:last-child {
  display: inline-flex;
  margin-left: auto;
  align-items: center;
  gap: 8px;
}

/* Application shell */
.app-shell {
  position: relative;
  min-height: 100vh;
  padding-bottom: 36px;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(30, 101, 126, 0.075), transparent 45%),
    var(--bg);
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(72, 130, 151, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 130, 151, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(#000, transparent 80%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  height: 64px;
  padding: 0 24px;
  align-items: center;
  gap: 30px;
  border-bottom: 1px solid rgba(33, 66, 86, 0.7);
  background: rgba(4, 11, 20, 0.91);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(24px) saturate(130%);
}

.app-brand {
  min-width: 218px;
}

.app-brand .brand-mark {
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  width: 17px;
  height: 17px;
}

.app-brand .brand-copy strong {
  font-size: 14px;
}

.main-nav {
  display: flex;
  align-self: stretch;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: inline-flex;
  height: 100%;
  padding: 0 14px;
  align-items: center;
  gap: 7px;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-item svg {
  width: 16px;
  height: 16px;
}

.nav-item::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: -1px;
  left: 13px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
  opacity: 0;
  transform: scaleX(0.35);
  transition: 0.2s ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(36, 80, 99, 0.16);
}

.nav-item.is-active {
  color: var(--accent);
}

.nav-item.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.topbar-actions {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 9px;
}

.top-search {
  display: flex;
  width: clamp(150px, 16vw, 230px);
  height: 34px;
  padding: 0 10px;
  align-items: center;
  gap: 8px;
  border: 1px solid #192f42;
  border-radius: 5px;
  color: var(--text-muted);
  background: rgba(13, 30, 45, 0.6);
  font-size: 10px;
  cursor: pointer;
}

.top-search:hover {
  border-color: #31566b;
  color: var(--text-soft);
}

.top-search svg {
  width: 14px;
  height: 14px;
}

.top-search > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-search kbd {
  margin-left: auto;
  padding: 1px 4px;
  border: 1px solid #294053;
  border-radius: 3px;
  color: #57758b;
  background: #091522;
  font-family: inherit;
  font-size: 8px;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #618096;
  font-size: 9px;
  white-space: nowrap;
}

.has-notice .notice-count {
  position: absolute;
  top: 4px;
  right: 3px;
  display: grid;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border: 2px solid var(--bg-deep);
  border-radius: 999px;
  place-items: center;
  color: #fff;
  background: #d85d61;
  font-family: var(--display);
  font-size: 8px;
  font-weight: 700;
}

.user-area {
  position: relative;
}

.user-button {
  display: flex;
  padding: 4px 3px 4px 7px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 5px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.user-button:hover {
  background: var(--surface-hover);
}

.user-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  border: 1px solid #3e6776;
  border-radius: 6px;
  place-items: center;
  color: #bff7f2;
  background: linear-gradient(145deg, #183f4d, #102a3a);
  font-size: 12px;
  font-weight: 600;
}

.user-copy {
  display: grid;
  min-width: 60px;
  text-align: left;
}

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

.user-copy small {
  color: var(--text-muted);
  font-size: 8px;
}

.user-button > svg {
  width: 11px;
  height: 11px;
  color: var(--text-muted);
  transform: rotate(90deg);
}

.user-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 100;
  display: none;
  width: 164px;
  padding: 5px;
  border: 1px solid var(--line-bright);
  border-radius: 7px;
  background: #0a1827;
  box-shadow: var(--shadow);
}

.user-menu.is-open {
  display: grid;
  animation: menu-enter 0.16s ease;
}

@keyframes menu-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.user-menu button {
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  text-align: left;
  color: var(--text-soft);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.user-menu button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.user-menu button:last-child {
  color: #e88c87;
}

.user-menu span {
  height: 1px;
  margin: 4px;
  background: var(--line);
}

.mobile-menu-button {
  display: none;
}

.app-main {
  position: relative;
  z-index: 1;
  width: min(1680px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0;
}

.page-view {
  display: none;
  animation: page-in 0.28s ease both;
}

.page-view.is-active {
  display: block;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.page-heading {
  display: flex;
  min-height: 62px;
  margin-bottom: 20px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-heading .eyebrow {
  margin-bottom: 3px;
}

.page-heading h1 {
  margin: 0 0 3px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.page-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.page-heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.period-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.period-switch button {
  padding: 5px 11px;
  border: 0;
  border-radius: 3px;
  color: var(--text-muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.period-switch button.is-active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.update-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.update-time svg {
  width: 13px;
  height: 13px;
}

.update-time b {
  color: var(--text-soft);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.outline-button,
.primary-button {
  display: inline-flex;
  min-height: 34px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s ease;
}

.outline-button {
  border: 1px solid var(--line);
  color: var(--text-soft);
  background: var(--surface);
}

.outline-button:hover {
  border-color: var(--line-bright);
  color: var(--text);
  background: var(--surface-2);
}

.outline-button svg,
.primary-button svg {
  width: 14px;
  height: 14px;
}

.primary-button {
  border: 1px solid rgba(126, 251, 242, 0.48);
  color: #032222;
  background: linear-gradient(100deg, #39d8d1, #6feee7);
  box-shadow: 0 8px 22px rgba(var(--accent-rgb), 0.12);
  font-weight: 600;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.icon-button[aria-busy="true"] svg,
.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card {
  position: relative;
  min-width: 0;
  padding: 14px 14px 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(125deg, var(--surface-2), rgba(8, 20, 33, 0.92));
  transition: 0.2s ease;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  width: 24px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.7);
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -55px;
  width: 100px;
  height: 100px;
  border: 1px solid rgba(var(--accent-rgb), 0.05);
  border-radius: 50%;
}

.kpi-card:hover {
  border-color: #28536b;
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 10px;
}

.kpi-top svg {
  width: 15px;
  height: 15px;
  color: #5f899b;
}

.kpi-value {
  display: flex;
  margin: 8px 0 6px;
  align-items: baseline;
  gap: 4px;
  font-family: var(--display);
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.kpi-value strong {
  font-size: 29px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.kpi-value small {
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 400;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.trend-up {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--good);
  font-family: var(--display);
  font-weight: 600;
}

.trend-up svg {
  width: 9px;
  height: 9px;
}

.trend-warn {
  color: var(--warning);
}

.risk-card .kpi-top svg {
  color: var(--warning);
}

.sparkline {
  display: flex;
  width: 42px;
  height: 16px;
  margin-left: auto;
  align-items: flex-end;
  gap: 2px;
}

.sparkline b {
  flex: 1;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(to top, rgba(76, 226, 160, 0.15), rgba(76, 226, 160, 0.68));
}

.sparkline b:nth-child(1) {
  height: 30%;
}

.sparkline b:nth-child(2) {
  height: 47%;
}

.sparkline b:nth-child(3) {
  height: 37%;
}

.sparkline b:nth-child(4) {
  height: 61%;
}

.sparkline b:nth-child(5) {
  height: 50%;
}

.sparkline b:nth-child(6) {
  height: 80%;
}

.sparkline b:nth-child(7) {
  height: 67%;
}

.sparkline.cyan b {
  background: linear-gradient(to top, rgba(var(--accent-rgb), 0.12), rgba(var(--accent-rgb), 0.7));
}

.sparkline.amber b {
  background: linear-gradient(to top, rgba(241, 188, 107, 0.12), rgba(241, 188, 107, 0.64));
}

/* Main dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(205px, 0.92fr) minmax(530px, 2.6fr) minmax(225px, 0.97fr);
  gap: 12px;
  align-items: stretch;
}

.dashboard-side {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.012);
}

.panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.12);
  border-right: 1px solid rgba(var(--accent-rgb), 0.12);
  pointer-events: none;
}

.panel-head {
  display: flex;
  min-height: 44px;
  padding: 12px 13px 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head h2,
.factory-head h2 {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.065em;
}

.panel-head h2 > i,
.factory-head h2 > i {
  width: 3px;
  height: 11px;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(var(--accent-rgb), 0.4);
}

.panel-head > span {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.panel-body {
  padding: 13px;
}

.capacity-panel {
  flex: 1;
}

.load-row {
  margin: 13px 0;
}

.load-meta {
  display: flex;
  margin-bottom: 6px;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-soft);
  font-size: 9px;
}

.load-meta b {
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
}

.load-meta em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 400;
}

.is-high .load-meta b {
  color: var(--warning);
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: #07111c;
}

.progress-track i {
  position: relative;
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.26), var(--accent));
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.25);
}

.is-high .progress-track i {
  background: linear-gradient(90deg, rgba(241, 188, 107, 0.25), var(--warning));
}

.progress-track i::after,
.warehouse-list i > b::after,
.inventory-card > i::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 25%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  animation: shimmer 4.2s linear infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-140%);
  }
  to {
    transform: translateX(520%);
  }
}

.capacity-total {
  display: grid;
  margin-top: 16px;
  padding-top: 12px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 9px;
}

.capacity-total strong {
  font-family: var(--display);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
}

.capacity-total .status-chip {
  grid-column: 1 / -1;
  justify-self: start;
}

.status-chip {
  display: inline-flex;
  padding: 2px 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 8px;
  line-height: 1.5;
  white-space: nowrap;
}

.status-chip.good {
  border-color: rgba(76, 226, 160, 0.18);
  color: var(--good);
  background: rgba(76, 226, 160, 0.08);
}

.status-chip.warn {
  border-color: rgba(241, 188, 107, 0.18);
  color: var(--warning);
  background: rgba(241, 188, 107, 0.08);
}

.status-chip.danger {
  border-color: rgba(245, 132, 118, 0.2);
  color: var(--danger);
  background: rgba(245, 132, 118, 0.08);
}

.status-chip.teal {
  border-color: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.07);
}

.material-panel {
  flex: 0 0 auto;
}

.material-row {
  display: grid;
  min-height: 40px;
  padding: 7px 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  border-top: 1px solid rgba(26, 53, 74, 0.56);
}

.material-row:first-child {
  padding-top: 1px;
  border-top: 0;
}

.material-row > div {
  display: grid;
  min-width: 0;
}

.material-row > div span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-row > div small {
  overflow: hidden;
  color: #4e6e84;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-row > b {
  color: var(--text);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.material-row > b em {
  color: var(--text-muted);
  font-size: 8px;
  font-style: normal;
}

.panel-link {
  display: inline-flex;
  padding: 0;
  align-items: center;
  gap: 4px;
  border: 0;
  color: #6ebcc4;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.panel-link:hover {
  color: var(--accent);
}

.panel-link svg {
  width: 10px;
  height: 10px;
}

.material-panel .panel-link {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

/* Factory scene */
.factory-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(var(--accent-rgb), 0.07), transparent 54%),
    linear-gradient(150deg, #0a1826, #07121f);
}

.factory-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.32;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(66, 227, 220, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 227, 220, 0.018) 1px, transparent 1px);
  background-size: 24px 24px;
}

.factory-head {
  position: relative;
  z-index: 4;
  display: flex;
  padding: 13px 14px 6px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.factory-head p {
  display: flex;
  margin: 4px 0 0 11px;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 8px;
}

.factory-head p .live-dot {
  width: 4px;
  height: 4px;
}

.view-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(6, 17, 29, 0.8);
}

.view-switch button {
  min-height: 23px;
  padding: 0 9px;
  border: 0;
  border-radius: 2px;
  color: var(--text-muted);
  background: transparent;
  font-size: 8px;
  cursor: pointer;
}

.view-switch button.is-active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.view-switch button:last-child {
  display: grid;
  width: 25px;
  padding: 0;
  place-items: center;
  border-left: 1px solid var(--line);
}

.view-switch button svg {
  width: 11px;
  height: 11px;
}

.factory-stage {
  position: relative;
  min-height: 365px;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.factory-stage:active {
  cursor: grabbing;
}

.factory-stage::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 55%;
  border: 1px solid rgba(var(--accent-rgb), 0.055);
  border-radius: 50%;
  transform: translate(-50%, -50%) scaleY(0.36);
  box-shadow: 0 0 80px rgba(var(--accent-rgb), 0.08);
}

.factory-svg {
  position: absolute;
  inset: 8px 4px 0;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  filter: saturate(0.95);
  transform: translate(var(--pan-x, 0), var(--pan-y, 0)) scale(var(--scene-scale, 1));
  transition: transform 0.25s ease;
}

.factory-panel.is-detail .factory-svg {
  --scene-scale: 1.22;
}

.factory-svg .machine-node {
  cursor: pointer;
  transition: filter 0.18s ease;
}

.factory-svg .machine-node:hover {
  filter: brightness(1.18) drop-shadow(0 0 5px rgba(var(--accent-rgb), 0.5));
}

.factory-svg .machine-node.is-selected {
  filter: brightness(1.16) drop-shadow(0 0 7px rgba(var(--accent-rgb), 0.65));
}

.factory-svg .machine-node.is-selected .machine-tag rect {
  fill: #143c4a;
  stroke: var(--accent);
}

.factory-svg .machine-tag rect {
  fill: rgba(7, 23, 34, 0.92);
  stroke: rgba(86, 145, 161, 0.56);
  stroke-width: 0.8;
}

.factory-svg .machine-tag text,
.factory-svg .isometric-labels text,
.factory-svg .unit-label {
  fill: #89adb9;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.06em;
  stroke: none;
}

.factory-svg .machine-tag circle {
  fill: var(--good);
  stroke: none;
  filter: drop-shadow(0 0 3px var(--good));
}

.factory-svg .machine-tag.risk circle {
  fill: var(--warning);
  filter: drop-shadow(0 0 3px var(--warning));
}

.factory-svg .isometric-labels text {
  fill: #486b7a;
  font-size: 8px;
  text-transform: uppercase;
}

.factory-svg .unit-label {
  fill: #7b9cab;
  font-size: 7px;
}

.factory-svg .scene-compass text {
  fill: #7da3b8;
  font-family: var(--display);
  font-size: 8px;
  stroke: none;
}

.stage-hud {
  position: absolute;
  z-index: 3;
  display: grid;
  pointer-events: none;
}

.stage-hud-left {
  top: 14px;
  left: 14px;
}

.stage-hud-right {
  top: 14px;
  right: 15px;
  justify-items: end;
}

.stage-hud span {
  color: var(--text-muted);
  font-size: 8px;
}

.stage-hud strong {
  color: #b9dce5;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
}

.stage-hud small {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #577b8e;
  font-size: 7px;
}

.stage-hud small .live-dot {
  width: 3px;
  height: 3px;
}

.scene-tip {
  position: absolute;
  right: 15px;
  bottom: 9px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #405f70;
  font-size: 7px;
  pointer-events: none;
}

.scene-tip i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #405f70;
}

.asset-strip {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: rgba(6, 17, 28, 0.62);
}

.asset-strip button {
  display: flex;
  min-width: 0;
  padding: 7px 8px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: left;
  color: var(--text-soft);
  background: rgba(10, 29, 44, 0.56);
  cursor: pointer;
}

.asset-strip button:hover {
  border-color: var(--line-bright);
}

.asset-strip button.is-active {
  border-color: rgba(var(--accent-rgb), 0.37);
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.07);
}

.asset-strip .dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 6px rgba(76, 226, 160, 0.7);
}

.asset-strip .dot.warning {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(241, 188, 107, 0.7);
}

.asset-strip span {
  display: grid;
  min-width: 0;
  font-family: var(--display);
  font-size: 9px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
}

.asset-strip small {
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 7px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.factory-panel.is-expanded {
  position: fixed;
  inset: 24px;
  z-index: 300;
  min-height: 0;
  box-shadow: 0 40px 150px rgba(0, 0, 0, 0.65);
}

.factory-panel.is-expanded .factory-stage {
  min-height: 0;
}

.detail-toggle-active .factory-stage {
  min-height: 430px;
}

/* Dashboard side details */
.quality-panel {
  flex: 1;
}

.quality-summary {
  display: flex;
  padding: 14px 13px 12px;
  align-items: center;
  gap: 14px;
}

.quality-ring {
  --value: 98.62;
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  flex: none;
  border-radius: 50%;
  place-items: center;
  background:
    radial-gradient(circle at center, #091522 60%, transparent 61%),
    conic-gradient(var(--accent) calc(var(--value) * 1%), #152b3c 0);
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.06));
}

.quality-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 50%;
}

.quality-ring > div {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
}

.quality-ring strong {
  color: #dbfbfa;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.quality-ring span {
  color: var(--accent);
  font-family: var(--display);
  font-size: 9px;
}

.quality-ring small {
  width: 100%;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 7px;
  text-align: center;
}

.quality-stats {
  display: grid;
  width: 100%;
  gap: 7px;
}

.quality-stats > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 8px;
}

.quality-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quality-stats b {
  color: var(--text-soft);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--good);
}

.status-dot.warn {
  background: var(--warning);
}

.status-dot.danger {
  background: var(--danger);
}

.quality-reasons {
  padding: 0 13px 13px;
}

.reason-head {
  display: flex;
  margin-bottom: 5px;
  justify-content: space-between;
  color: #4d6b80;
  font-size: 7px;
}

.reason-row {
  display: grid;
  padding: 5px 0;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 8px;
}

.reason-row::after {
  content: "";
  display: block;
  height: 2px;
  grid-column: 1 / -1;
  background: linear-gradient(90deg, rgba(241, 188, 107, 0.65) var(--value), #102638 var(--value));
}

.reason-row b {
  color: var(--text-soft);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 500;
}

.risk-panel {
  flex: 1;
}

.risk-badge {
  display: grid;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  place-items: center;
  color: var(--danger) !important;
  background: rgba(245, 132, 118, 0.1);
  font-family: var(--display);
  font-size: 9px !important;
}

.risk-list {
  padding: 4px 13px 0;
}

.risk-item {
  display: grid;
  width: 100%;
  padding: 9px 0;
  grid-template-columns: 25px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-top: 1px solid rgba(26, 53, 74, 0.7);
  text-align: left;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
}

.risk-item:first-child {
  border-top: 0;
}

.risk-item:hover b {
  color: var(--accent);
}

.risk-icon {
  display: grid;
  width: 25px;
  height: 25px;
  border-radius: 4px;
  place-items: center;
  color: var(--danger);
  background: rgba(245, 132, 118, 0.08);
}

.risk-icon svg {
  width: 12px;
  height: 12px;
}

.risk-item.is-medium .risk-icon {
  color: var(--warning);
  background: rgba(241, 188, 107, 0.08);
}

.risk-item > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.risk-item b {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 8px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-item small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-item > svg {
  width: 10px;
  height: 10px;
  color: #466276;
}

.risk-panel > .panel-link {
  margin: 0 13px 11px;
}

/* Dashboard bottom */
.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(620px, 1.7fr);
  gap: 12px;
  margin-top: 12px;
}

.trend-panel,
.focus-panel {
  min-height: 235px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 8px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 10px;
  height: 2px;
  background: var(--accent);
}

.chart-legend span:nth-child(2) i {
  background: var(--accent-2);
}

.chart-legend small {
  padding-left: 9px;
  border-left: 1px solid var(--line);
}

.trend-chart {
  height: 180px;
  padding: 4px 8px 8px;
}

.trend-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trend-chart .grid-line {
  stroke: #183246;
  stroke-width: 0.7;
}

.trend-chart text {
  fill: #536f84;
  font-family: var(--font);
  font-size: 8px;
  stroke: none;
}

.trend-chart .line-a {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 3px rgba(var(--accent-rgb), 0.28));
}

.trend-chart .line-b {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 1.5;
}

.trend-chart .data-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1.5;
}

.focus-panel .panel-head {
  padding-bottom: 5px;
}

.panel-link.inline {
  color: #6aabb6;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-color: #254357 transparent;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.data-table th {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 9px;
  border-bottom: 1px solid rgba(26, 53, 74, 0.55);
  color: var(--text-soft);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: 0.16s ease;
}

.data-table tbody tr:hover {
  background: rgba(var(--accent-rgb), 0.035);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.compact-table th {
  padding-top: 4px;
  padding-bottom: 8px;
}

.compact-table td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.link-button {
  padding: 0;
  border: 0;
  color: #72d9dc;
  background: transparent;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.link-button:hover {
  color: #b1fffa;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table-product {
  display: grid;
  color: var(--text);
  font-size: 9px;
}

.table-product small {
  color: var(--text-muted);
  font-family: var(--display);
  font-size: 8px;
}

.table-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-progress > i {
  display: block;
  width: 54px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: #07111b;
}

.table-progress > i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.table-progress span {
  color: var(--text-soft);
  font-family: var(--display);
  font-size: 9px;
}

/* Common inner pages */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mini-stats > div,
.equipment-kpis > div {
  display: grid;
  padding: 16px 17px;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(125deg, var(--surface-2), var(--surface));
}

.mini-stats span,
.equipment-kpis span {
  color: var(--text-soft);
  font-size: 10px;
}

.mini-stats strong,
.equipment-kpis strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--text);
  font-family: var(--display);
  font-size: 25px;
  font-weight: 600;
}

.mini-stats small,
.equipment-kpis small {
  color: var(--text-muted);
  font-size: 8px;
}

.page-table-panel {
  margin-top: 12px;
}

.table-toolbar {
  display: flex;
  padding: 12px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.toolbar-search {
  display: flex;
  width: min(320px, 34%);
  height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #071320;
}

.toolbar-search:focus-within {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.toolbar-search svg {
  width: 14px;
  height: 14px;
  margin: 0 9px;
  color: var(--text-muted);
}

.toolbar-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 10px 0 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 10px;
}

.toolbar-search input::placeholder {
  color: #4d6c81;
}

.table-toolbar select,
.period-select {
  height: 34px;
  padding: 0 29px 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  color: var(--text-soft);
  background: #081522;
  font-size: 10px;
  cursor: pointer;
}

.toolbar-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 9px;
}

.order-table {
  min-width: 1100px;
}

.data-table input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
}

.owner-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.owner-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  place-items: center;
  color: #9ccdd2;
  background: #143142;
  font-size: 8px;
}

.row-action {
  display: inline-grid;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  place-items: center;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.row-action:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.table-footer {
  display: flex;
  padding: 13px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 9px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pagination button {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  place-items: center;
  color: var(--text-muted);
  background: #081522;
  font-size: 9px;
  cursor: pointer;
}

.pagination button:hover,
.pagination button.is-active {
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.07);
}

.pagination button svg {
  width: 10px;
  height: 10px;
}

.pagination span {
  padding: 0 3px;
}

.empty-row td {
  height: 130px;
  text-align: center;
  color: var(--text-muted);
}

/* Equipment */
.equipment-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.equipment-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  cursor: pointer;
  transition: 0.2s ease;
}

.equipment-card:hover {
  border-color: #2c556b;
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.14);
}

.equipment-card.warning {
  border-top-color: rgba(241, 188, 107, 0.55);
}

.equipment-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.equipment-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.equipment-icon {
  display: grid;
  width: 35px;
  height: 35px;
  border: 1px solid #23465b;
  border-radius: 6px;
  place-items: center;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
}

.equipment-icon svg {
  width: 18px;
  height: 18px;
}

.equipment-name > span {
  display: grid;
}

.equipment-name b {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.equipment-name small {
  color: var(--text-muted);
  font-size: 8px;
}

.equipment-oee {
  display: flex;
  margin: 18px 0 14px;
  align-items: flex-end;
  justify-content: space-between;
}

.equipment-oee > span {
  display: grid;
  color: var(--text-muted);
  font-size: 8px;
}

.equipment-oee strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
}

.equipment-oee strong small {
  color: var(--text-muted);
  font-size: 10px;
}

.equipment-gauge {
  width: 90px;
  height: 4px;
  margin-bottom: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: #07111b;
}

.equipment-gauge i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #258ca3, var(--accent));
}

.equipment-task {
  display: grid;
  padding: 10px 11px;
  gap: 3px;
  border: 1px solid #173246;
  border-radius: 5px;
  background: rgba(3, 12, 21, 0.34);
}

.equipment-task span {
  color: var(--text-muted);
  font-size: 8px;
}

.equipment-task b {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-meta {
  display: flex;
  margin-top: 12px;
  padding-top: 11px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 8px;
}

.equipment-meta span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Quality page */
.quality-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(370px, 0.85fr);
  gap: 12px;
}

.quality-big {
  display: grid;
  padding: 22px 18px 20px;
  grid-template-columns: 150px 1fr;
  gap: 25px;
  align-items: center;
}

.quality-ring.large {
  width: 142px;
  height: 142px;
}

.quality-ring.large::before {
  inset: 11px;
}

.quality-ring.large strong {
  font-size: 38px;
}

.quality-ring.large span {
  font-size: 13px;
}

.quality-ring.large small {
  font-size: 9px;
}

.quality-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quality-overview-grid > div {
  display: grid;
  padding: 11px 12px;
  border: 1px solid #173246;
  border-radius: 5px;
  background: rgba(4, 14, 24, 0.34);
}

.quality-overview-grid span {
  color: var(--text-muted);
  font-size: 8px;
}

.quality-overview-grid strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.quality-overview-grid small {
  color: var(--text-muted);
  font-size: 8px;
}

.pareto-panel {
  min-height: 270px;
}

.pareto-bars {
  display: grid;
  padding: 14px 16px;
  gap: 16px;
}

.pareto-bars > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: 9px;
}

.pareto-bars i {
  height: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: #07131e;
}

.pareto-bars i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bc7a40, var(--warning));
}

.pareto-bars strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

/* Inventory */
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.inventory-card {
  position: relative;
  display: grid;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
}

.inventory-card > span {
  color: var(--text-soft);
  font-size: 9px;
}

.inventory-card > strong {
  margin: 5px 0 2px;
  color: var(--text);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
}

.inventory-card > small {
  color: var(--text-muted);
  font-size: 8px;
}

.inventory-card > i {
  position: relative;
  display: block;
  width: var(--value);
  height: 2px;
  margin-top: 13px;
  overflow: hidden;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.25);
}

.inventory-card.warning > i {
  background: var(--warning);
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(650px, 1.95fr);
  gap: 12px;
}

.warehouse-list {
  display: grid;
  padding: 11px 14px 16px;
  gap: 14px;
}

.warehouse-list > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  color: var(--text-soft);
  font-size: 9px;
}

.warehouse-list span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.warehouse-list span b {
  display: grid;
  width: 22px;
  height: 20px;
  border: 1px solid #2a5064;
  border-radius: 3px;
  place-items: center;
  color: var(--accent);
  font-family: var(--display);
  font-size: 8px;
}

.warehouse-list strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
}

.warehouse-list i {
  height: 4px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 2px;
  background: #07131e;
}

.warehouse-list i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #257f93, var(--accent));
}

.warehouse-list small {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 7px;
}

.mini-search {
  width: 190px;
  height: 29px;
}

.stock-table-panel .panel-head {
  padding-bottom: 9px;
}

.stock-table-panel .data-table {
  min-width: 860px;
}

/* Reports */
.report-grid {
  display: grid;
  grid-template-columns: minmax(550px, 1.65fr) minmax(300px, 0.85fr);
  gap: 12px;
}

.bar-chart {
  display: flex;
  height: 300px;
  padding: 26px 25px 20px 42px;
  align-items: flex-end;
  gap: clamp(10px, 2vw, 22px);
  background-image: linear-gradient(#183246 1px, transparent 1px);
  background-size: 100% 25%;
  background-position-y: 23px;
}

.bar-group {
  display: flex;
  height: 100%;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  position: relative;
}

.bar-group i {
  display: block;
  width: 30%;
  max-width: 18px;
  height: var(--h);
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, rgba(var(--accent-rgb), 0.22), var(--accent));
  transform-origin: bottom;
  animation: bar-grow 0.7s ease both;
}

.bar-group i:nth-child(2) {
  background: linear-gradient(to top, rgba(94, 157, 255, 0.16), var(--accent-2));
  opacity: 0.62;
}

.bar-group span {
  position: absolute;
  bottom: -18px;
  color: var(--text-muted);
  font-size: 8px;
}

.business-metrics {
  display: grid;
  padding: 12px 16px 16px;
  gap: 13px;
}

.business-metrics > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  color: var(--text-muted);
  font-size: 8px;
}

.business-metrics strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--text);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
}

.business-metrics strong small {
  color: var(--text-muted);
  font-size: 8px;
}

.business-metrics em {
  font-style: normal;
  color: var(--good);
}

.business-metrics > div:nth-child(3) em {
  color: var(--warning);
}

.business-metrics i {
  height: 2px;
  grid-column: 1 / -1;
  overflow: hidden;
  background: #07131e;
}

.business-metrics i b {
  display: block;
  height: 100%;
  background: var(--accent);
}

.report-bottom {
  display: grid;
  grid-template-columns: minmax(500px, 1.2fr) minmax(300px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

.customer-rank {
  display: grid;
  padding: 8px 14px 15px;
}

.customer-rank > div {
  display: grid;
  padding: 8px 0;
  grid-template-columns: 25px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
}

.customer-rank > div:first-child {
  border-top: 0;
}

.customer-rank b {
  color: var(--text-muted);
  font-family: var(--display);
  font-size: 10px;
}

.customer-rank > div:nth-child(1) b {
  color: var(--warning);
}

.customer-rank > div > span {
  display: grid;
  color: var(--text-soft);
  font-size: 9px;
}

.customer-rank small {
  color: var(--text-muted);
  font-size: 7px;
}

.customer-rank strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 500;
  text-align: right;
}

.customer-rank i {
  height: 2px;
  grid-column: 2 / -1;
  overflow: hidden;
  background: #07131e;
}

.customer-rank em {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.2), var(--accent));
}

.cost-content {
  display: grid;
  padding: 15px 20px 20px;
  grid-template-columns: 145px 1fr;
  gap: 18px;
  align-items: center;
}

.cost-donut {
  display: grid;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  place-items: center;
  background: conic-gradient(var(--accent) 0 48%, var(--accent-2) 48% 72%, var(--warning) 72% 88%, var(--violet) 88% 100%);
  box-shadow: 0 0 25px rgba(var(--accent-rgb), 0.06);
}

.cost-donut > div {
  display: flex;
  width: 91px;
  height: 91px;
  border-radius: 50%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.cost-donut strong {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
}

.cost-donut small {
  color: var(--text-muted);
  font-size: 8px;
}

.cost-legend {
  display: grid;
  gap: 10px;
}

.cost-legend span {
  display: grid;
  grid-template-columns: 7px 1fr auto;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 8px;
}

.cost-legend i {
  width: 5px;
  height: 5px;
  border-radius: 1px;
}

.cost-legend b {
  color: var(--text-soft);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 500;
}

/* Drawers, modals and notifications */
.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(1, 7, 13, 0.68);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s 0.22s;
}

.drawer-backdrop.is-open,
.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.detail-drawer,
.notification-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 410;
  width: min(410px, 94vw);
  border-left: 1px solid var(--line-bright);
  background: #081522;
  box-shadow: -20px 0 70px rgba(0, 0, 0, 0.37);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform 0.26s cubic-bezier(0.2, 0.75, 0.2, 1), visibility 0s 0.26s;
}

.detail-drawer.is-open,
.notification-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition-delay: 0s;
}

.drawer-head {
  display: flex;
  min-height: 80px;
  padding: 20px 21px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, rgba(18, 41, 59, 0.8), transparent);
}

.drawer-head h2 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 500;
}

.drawer-eyebrow {
  color: var(--accent);
  font-family: var(--display);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.drawer-body {
  height: calc(100% - 80px);
  padding: 20px;
  overflow: auto;
}

.drawer-hero {
  padding: 15px;
  border: 1px solid #1c3e52;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.07), transparent);
}

.drawer-hero > span {
  color: var(--text-muted);
  font-size: 8px;
}

.drawer-hero h3 {
  margin: 3px 0 10px;
  font-size: 18px;
  font-weight: 500;
}

.drawer-hero-progress {
  display: flex;
  margin-top: 14px;
  align-items: center;
  gap: 9px;
}

.drawer-hero-progress i {
  height: 5px;
  flex: 1;
  overflow: hidden;
  border-radius: 3px;
  background: #07111b;
}

.drawer-hero-progress i b {
  display: block;
  height: 100%;
  background: var(--accent);
}

.drawer-hero-progress strong {
  color: var(--accent);
  font-family: var(--display);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  margin: 15px 0;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-grid > div {
  display: grid;
  padding: 12px;
  gap: 3px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-grid span {
  color: var(--text-muted);
  font-size: 8px;
}

.detail-grid b {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 400;
}

.timeline {
  display: grid;
  margin-top: 22px;
}

.timeline h4 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 500;
}

.timeline-item {
  position: relative;
  display: grid;
  padding: 0 0 20px 23px;
  grid-template-columns: 1fr auto;
  gap: 0 8px;
  border-left: 1px solid #204157;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 2px;
  left: -4px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: #081522;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item b {
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 400;
}

.timeline-item time {
  color: var(--text-muted);
  font-family: var(--display);
  font-size: 8px;
}

.timeline-item small {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 8px;
}

.drawer-actions {
  display: flex;
  margin-top: 20px;
  gap: 8px;
}

.drawer-actions button {
  flex: 1;
}

.modal-backdrop {
  display: grid;
  place-items: center;
  z-index: 500;
}

.modal {
  width: min(610px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line-bright);
  border-radius: 9px;
  background: #0a1827;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.53);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.22s ease;
}

.modal-backdrop.is-open .modal {
  transform: none;
}

.modal-head {
  display: flex;
  padding: 20px 22px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 500;
}

.modal form {
  padding: 20px 22px 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.form-grid label,
.full-field {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 9px;
}

.form-grid input,
.form-grid select,
.full-field textarea {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  color: var(--text);
  background: #071320;
  font-size: 10px;
}

.form-grid input:focus,
.form-grid select:focus,
.full-field textarea:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.full-field {
  margin-top: 15px;
}

.full-field textarea {
  height: auto;
  padding: 10px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 8px;
}

.notification-drawer {
  z-index: 430;
}

.notification-list {
  display: grid;
  padding: 7px 14px;
}

.notification-list button {
  display: grid;
  padding: 14px 5px;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
}

.notification-list button:hover {
  background: rgba(var(--accent-rgb), 0.025);
}

.notice-type {
  display: grid;
  width: 31px;
  height: 31px;
  border-radius: 5px;
  place-items: center;
  color: var(--danger);
  background: rgba(245, 132, 118, 0.08);
}

.notice-type svg {
  width: 14px;
  height: 14px;
}

.notice-type.warn {
  color: var(--warning);
  background: rgba(241, 188, 107, 0.08);
}

.notice-type.good {
  color: var(--good);
  background: rgba(76, 226, 160, 0.08);
}

.notification-list button > span:last-child {
  display: grid;
  gap: 2px;
}

.notification-list b {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
}

.notification-list small {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.6;
}

.notification-list em {
  color: #4d6c81;
  font-size: 8px;
  font-style: normal;
}

.notification-all {
  height: 34px;
  margin: 16px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-soft);
  background: var(--surface-2);
  font-size: 9px;
  cursor: pointer;
}

/* Command search */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  padding-top: 15vh;
  justify-content: center;
  background: rgba(1, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}

.cmdk.is-open {
  display: flex;
  animation: fade-in 0.16s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.cmdk-box {
  width: min(580px, calc(100vw - 32px));
  height: max-content;
  padding: 7px;
  border: 1px solid #31566c;
  border-radius: 8px;
  background: #081522;
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.62);
}

.cmdk-input {
  display: flex;
  height: 49px;
  padding: 0 10px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.cmdk-input svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.cmdk-input input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 12px;
}

.cmdk kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-muted);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 8px;
}

.cmdk-hint {
  padding: 12px 10px 5px;
  color: var(--text-muted);
  font-size: 8px;
}

.cmdk-box > button {
  display: grid;
  width: 100%;
  padding: 10px;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 5px;
  color: var(--text-soft);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.cmdk-box > button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.cmdk-box > button svg {
  width: 17px;
  height: 17px;
  justify-self: center;
  color: var(--accent);
}

.cmdk-box > button span {
  display: grid;
  font-size: 10px;
}

.cmdk-box > button small {
  color: var(--text-muted);
  font-size: 8px;
}

.cmdk-results {
  max-height: 270px;
  overflow: auto;
}

.cmdk-empty {
  padding: 35px 20px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

/* Toast */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 700;
  display: grid;
  width: min(340px, calc(100vw - 32px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  padding: 12px 13px;
  align-items: center;
  gap: 10px;
  border: 1px solid #2c5569;
  border-radius: 6px;
  color: var(--text-soft);
  background: rgba(9, 24, 38, 0.96);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.33);
  font-size: 10px;
  animation: toast-in 0.25s ease both;
  pointer-events: auto;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(15px);
  }
}

/* Responsive */
@media (max-width: 1320px) {
  .topbar {
    gap: 18px;
  }

  .app-brand {
    min-width: auto;
  }

  .app-brand .brand-copy small {
    display: none;
  }

  .nav-item {
    padding: 0 10px;
    font-size: 11px;
  }

  .system-status,
  .user-copy {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: 210px minmax(470px, 2.4fr) 230px;
  }

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

@media (max-width: 1100px) {
  .top-search {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-side {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-bottom {
    grid-template-columns: 1fr;
  }

  .quality-summary {
    min-height: 120px;
  }

  .quality-dashboard,
  .report-grid,
  .report-bottom,
  .inventory-layout {
    grid-template-columns: 1fr;
  }

  .inventory-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .auth-main {
    gap: 70px;
    grid-template-columns: minmax(0, 1fr) 410px;
  }
}

@media (max-width: 900px) {
  .topbar {
    height: 58px;
    padding: 0 14px;
  }

  .mobile-menu-button {
    display: grid;
  }

  .app-brand .brand-copy strong {
    max-width: 100px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-nav {
    position: fixed;
    top: 66px;
    right: 12px;
    left: 12px;
    z-index: 100;
    display: none;
    height: auto;
    padding: 6px;
    border: 1px solid var(--line-bright);
    border-radius: 7px;
    background: rgba(7, 20, 33, 0.98);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
  }

  .main-nav.is-open {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-item {
    height: 40px;
    border-radius: 4px;
  }

  .nav-item::after {
    display: none;
  }

  .nav-item.is-active {
    background: rgba(var(--accent-rgb), 0.08);
  }

  .topbar-actions {
    gap: 2px;
  }

  .app-main {
    width: calc(100% - 24px);
    padding-top: 17px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .factory-panel {
    grid-row: 1;
  }

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

  .mini-stats,
  .equipment-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .equipment-kpis > div:last-child {
    grid-column: 1 / -1;
  }

  .auth-shell {
    overflow: auto;
  }

  .auth-main {
    width: min(430px, calc(100% - 36px));
    grid-template-columns: 1fr;
    padding: 24px 0 40px;
  }

  .auth-story {
    display: none;
  }

  .auth-brand,
  .auth-footer {
    width: calc(100% - 36px);
  }

  .auth-footer span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 680px) {
  .auth-brand {
    padding-top: 20px;
  }

  .auth-edition {
    display: none;
  }

  .auth-card {
    padding: 29px 22px 24px;
  }

  .auth-footer {
    gap: 8px;
    font-size: 8px;
  }

  .user-button {
    padding: 0;
  }

  .user-button > svg {
    display: none;
  }

  .notification-button {
    width: 33px;
  }

  .app-brand .brand-copy {
    display: none;
  }

  .page-heading-actions {
    width: 100%;
  }

  .page-heading-actions .period-switch {
    order: 4;
  }

  .update-time {
    margin-left: auto;
  }

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

  .kpi-card {
    padding: 12px;
  }

  .kpi-value strong {
    font-size: 24px;
  }

  .kpi-foot .sparkline {
    display: none;
  }

  .dashboard-side,
  .right-side,
  .quality-dashboard,
  .report-grid,
  .report-bottom,
  .inventory-layout,
  .equipment-grid {
    grid-template-columns: 1fr;
  }

  .right-side {
    display: grid;
  }

  .factory-panel {
    min-height: 470px;
  }

  .factory-stage {
    min-height: 320px;
  }

  .factory-svg {
    inset: 24px -75px 0;
    width: 850px;
    height: calc(100% - 20px);
  }

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

  .asset-strip button:nth-child(n + 4) {
    display: none;
  }

  .stage-hud-right {
    display: none;
  }

  .quality-summary {
    min-height: auto;
  }

  .dashboard-bottom {
    display: block;
  }

  .focus-panel {
    margin-top: 12px;
  }

  .mini-stats,
  .equipment-kpis,
  .inventory-summary {
    grid-template-columns: 1fr 1fr;
  }

  .equipment-kpis > div:last-child {
    grid-column: 1 / -1;
  }

  .mini-stats > div,
  .equipment-kpis > div {
    padding: 13px;
  }

  .table-toolbar {
    flex-wrap: wrap;
  }

  .toolbar-search {
    width: 100%;
  }

  .toolbar-count {
    width: 100%;
    margin-left: 0;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .quality-big {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .quality-overview-grid {
    width: 100%;
  }

  .bar-chart {
    height: 250px;
    padding-right: 14px;
    padding-left: 30px;
    gap: 6px;
  }

  .cost-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .cost-legend {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .factory-panel.is-expanded {
    inset: 8px;
  }

  .factory-panel.is-expanded .factory-svg {
    inset: 34px 0 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
