@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=IBM+Plex+Mono:wght@500;600&display=swap&subset=vietnamese,latin");

/*
 * AGRIBEACON FIELD COMMAND
 * A complete visual layer over the existing semantic UI contracts.
 */

:root {
  --background: #f3f1e9;
  --foreground: #17201a;
  --card: #fbfaf5;
  --card-foreground: #17201a;
  --muted: #edeee7;
  --muted-foreground: #667069;
  --primary: #4e9b3e;
  --primary-foreground: #f9fff5;
  --primary-soft: #e4f2dc;
  --primary-ink: #2f7029;
  --secondary: #e9ece4;
  --accent: #c9f55a;
  --border: #d8ddd3;
  --border-strong: #bdc6ba;
  --input: #cbd2c7;
  --ring: #4e9b3e;
  --sidebar: #152019;
  --sidebar-soft: #1e2b22;
  --sidebar-accent: #29382d;
  --sidebar-foreground: #edf3eb;
  --success: #31843a;
  --warning: #c66b16;
  --danger: #b73b35;
  --info: #356f8c;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(20, 32, 25, 0.05), 0 12px 30px rgba(20, 32, 25, 0.06);
  --shadow-hover: 0 2px 4px rgba(20, 32, 25, 0.06), 0 20px 44px rgba(20, 32, 25, 0.1);
  --shadow-floating: 0 28px 80px rgba(10, 18, 12, 0.22);
  --font-body: "Be Vietnam Pro", sans-serif;
  --font-display: "Bricolage Grotesque", "Be Vietnam Pro", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --fast: 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --enter: 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  scrollbar-color: #aeb9aa transparent;
  scrollbar-width: thin;
}

*::selection {
  background: var(--accent);
  color: #17201a;
}

html {
  background: var(--background);
}

body {
  position: relative;
  min-width: 320px;
  background:
    linear-gradient(rgba(29, 48, 34, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 48, 34, 0.026) 1px, transparent 1px),
    var(--background);
  background-size: 40px 40px;
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 88% 2%, rgba(201, 245, 90, 0.13), transparent 23%),
    radial-gradient(circle at 28% 100%, rgba(78, 155, 62, 0.08), transparent 28%);
  content: "";
  pointer-events: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  text-wrap: balance;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.045em;
}

h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button,
input,
select,
textarea {
  font-family: var(--font-body);
}

button,
a,
input,
select,
textarea {
  transition:
    border-color var(--fast),
    background-color var(--fast),
    color var(--fast),
    box-shadow var(--fast),
    transform var(--fast);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(78, 155, 62, 0.25);
  outline-offset: 2px;
}

/* Login */
.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, 0.82fr);
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
  background: var(--sidebar);
}

.login-story {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 4vw, 62px);
  background:
    linear-gradient(rgba(201, 245, 90, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 245, 90, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 76% 51%, rgba(78, 155, 62, 0.22), transparent 30%),
    #152019;
  background-size: 56px 56px, 56px 56px, auto, auto;
  color: var(--sidebar-foreground);
}

.login-story::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, transparent 0 47%, rgba(201, 245, 90, 0.08) 47.1% 47.25%, transparent 47.35%);
  content: "";
}

.brand-block {
  position: relative;
  z-index: 1;
  border: 0;
}

.login-brand {
  align-self: flex-start;
  padding: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(201, 245, 90, 0.62);
  border-radius: 12px 4px 12px 4px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(201, 245, 90, 0.08), 0 0 36px rgba(201, 245, 90, 0.22);
  color: #142017;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}

.brand-mark::after {
  position: absolute;
  right: -9px;
  bottom: -10px;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(21, 32, 25, 0.38);
  border-radius: 50%;
  content: "";
}

.brand-kicker,
.top-kicker,
.login-index,
.nav-group-label,
.environment-pill,
.brand-version {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand-kicker {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
}

.login-brand h1,
.shell-brand h1 {
  color: #f4f7f2;
  font-size: 20px;
}

.login-message {
  position: relative;
  z-index: 2;
  width: min(700px, 87%);
  margin: auto 0;
}

.login-index {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 11px;
}

.login-message h2 {
  max-width: 690px;
  color: #f5f8f3;
  font-size: clamp(42px, 5.2vw, 78px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.login-message h2 em {
  color: var(--accent);
  font-style: normal;
}

.login-message > p:last-child {
  max-width: 530px;
  margin-top: 28px;
  color: #aebcaf;
  font-size: clamp(14px, 1.3vw, 17px);
  font-weight: 400;
}

.beacon-visual {
  position: absolute;
  top: 50%;
  right: clamp(-160px, -8vw, -80px);
  width: min(42vw, 620px);
  aspect-ratio: 1;
  transform: translateY(-50%);
}

.beacon-ring,
.beacon-core {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.beacon-ring {
  border: 1px solid rgba(201, 245, 90, 0.18);
}

.ring-one { width: 100%; height: 100%; }
.ring-two { width: 68%; height: 68%; border-color: rgba(201, 245, 90, 0.28); }
.ring-three { width: 36%; height: 36%; border-color: rgba(201, 245, 90, 0.45); }

.beacon-ring::before,
.beacon-ring::after {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(201, 245, 90, 0.18);
  content: "";
  transform: translate(-50%, -50%);
}

.beacon-ring::before { width: 100%; height: 1px; }
.beacon-ring::after { width: 1px; height: 100%; }

.beacon-core {
  width: 18px;
  height: 18px;
  background: var(--accent);
  box-shadow: 0 0 0 13px rgba(201, 245, 90, 0.12), 0 0 44px rgba(201, 245, 90, 0.72);
  animation: beaconPulse 2.8s ease-in-out infinite;
}

.beacon-label {
  position: absolute;
  top: calc(50% + 24px);
  left: calc(50% + 28px);
  width: 160px;
  color: rgba(237, 243, 235, 0.55);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.login-system-strip {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 28px;
  color: #93a396;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-system-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-system-strip i,
.environment-pill i,
.status-pulse {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(201, 245, 90, 0.58);
}

.login-card {
  position: relative;
  align-content: center;
  width: auto;
  min-height: 100svh;
  gap: 22px;
  padding: clamp(36px, 7vw, 100px);
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 100% 0, rgba(78, 155, 62, 0.12), transparent 24%),
    var(--card);
  box-shadow: none;
}

.login-card::before {
  position: absolute;
  top: 44px;
  right: 44px;
  width: 42px;
  height: 42px;
  border-top: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
  content: "";
}

.login-card-head {
  margin-bottom: 12px;
}

.login-card-head .login-index {
  margin-bottom: 14px;
  color: var(--primary-ink);
}

.login-card-head h2 {
  margin-bottom: 8px;
  font-size: clamp(32px, 3vw, 46px);
}

.login-card-head > p:last-child {
  color: var(--muted-foreground);
  font-weight: 400;
}

.login-card label {
  gap: 9px;
  color: var(--foreground);
  font-size: 13px;
}

.login-card input {
  min-height: 52px;
  padding: 0 15px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.login-submit {
  min-height: 52px;
  justify-content: space-between;
  margin-top: 4px;
  padding-inline: 18px;
}

.login-footnote {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-error:not(:empty) {
  padding: 10px 12px;
  border: 1px solid rgba(183, 59, 53, 0.24);
  border-radius: 8px;
  background: rgba(183, 59, 53, 0.08);
}

/* Application shell */
.app-shell {
  grid-template-columns: 274px minmax(0, 1fr);
  min-height: 100svh;
  background: transparent;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: 274px;
  min-height: 100svh;
  gap: 0;
  overflow: hidden;
  padding: 0;
  border-right: 1px solid rgba(201, 245, 90, 0.08);
  background:
    linear-gradient(rgba(201, 245, 90, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 245, 90, 0.035) 1px, transparent 1px),
    var(--sidebar);
  background-size: 34px 34px;
  box-shadow: 14px 0 50px rgba(16, 28, 19, 0.08);
}

.sidebar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(201, 245, 90, 0.08);
  border-radius: 50% 0 0;
  content: "";
  transform: translate(38%, 38%);
  pointer-events: none;
}

.shell-brand {
  min-height: 86px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(237, 243, 235, 0.09);
}

.shell-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px 3px 10px 3px;
  font-size: 18px;
}

.shell-brand h1 { font-size: 18px; }

.brand-version {
  margin-left: auto;
  color: #77867a;
  font-size: 9px;
}

.sidebar-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 14px 14px 8px;
  padding: 9px 10px;
  border: 1px solid rgba(201, 245, 90, 0.12);
  border-radius: 8px;
  background: rgba(201, 245, 90, 0.04);
  color: #aab8ac;
  font-size: 10px;
}

.sidebar-status strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.side-nav {
  display: block;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 18px;
}

.nav-group + .nav-group {
  margin-top: 18px;
}

.nav-group-label {
  margin: 0 0 7px;
  padding: 0 10px;
  color: #68776b;
  font-size: 9px;
  font-weight: 600;
}

.side-nav button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: 30px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 7px;
  border: 0;
  border-radius: 9px;
  color: #bbc6bd;
  font-size: 13px;
  font-weight: 500;
}

.side-nav button:hover {
  background: rgba(255, 255, 255, 0.045);
  color: #f1f5ef;
  transform: translateX(2px);
}

.side-nav button.active {
  border-left: 0;
  background: linear-gradient(90deg, rgba(201, 245, 90, 0.14), rgba(201, 245, 90, 0.055));
  box-shadow: inset 0 0 0 1px rgba(201, 245, 90, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon-wrap {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  color: #829085;
}

.side-nav button:hover .nav-icon-wrap,
.side-nav button.active .nav-icon-wrap {
  background: rgba(201, 245, 90, 0.08);
  color: var(--accent);
}

.nav-icon-wrap .ui-icon {
  width: 17px;
  height: 17px;
}

.nav-active-mark {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.side-nav button.active .nav-active-mark {
  background: var(--accent);
  box-shadow: 0 0 9px rgba(201, 245, 90, 0.7);
}

.role-card {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 68px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 14px;
  padding: 10px;
  border: 1px solid rgba(237, 243, 235, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(201, 245, 90, 0.26);
  border-radius: 10px 4px 10px 4px;
  background: rgba(201, 245, 90, 0.1);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.user-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-copy strong,
.user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  color: #f2f5f0;
  font-size: 12px;
}

.side-label {
  color: #849187;
  font-size: 10px;
  font-weight: 500;
}

.user-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(201, 245, 90, 0.55);
}

.main {
  grid-column: 2;
  min-width: 0;
  padding: 0 26px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 86px;
  margin: 0 -26px 24px;
  padding: 14px 26px;
  border-bottom: 1px solid rgba(189, 198, 186, 0.74);
  background: rgba(243, 241, 233, 0.86);
  backdrop-filter: blur(18px) saturate(1.2);
}

.topbar-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.top-kicker {
  margin: 0 0 3px;
  color: var(--primary-ink);
  font-size: 9px;
  font-weight: 600;
}

.topbar h2 {
  font-size: 26px;
  line-height: 1.05;
}

.page-context {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 400;
}

.top-actions {
  gap: 8px;
}

.save-status,
.environment-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(251, 250, 245, 0.7);
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.save-status .ui-icon {
  width: 13px;
  height: 13px;
  color: var(--primary);
}

.environment-pill {
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.environment-pill i {
  width: 6px;
  height: 6px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(78, 155, 62, 0.5);
}

.mobile-menu-button {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--foreground);
}

.sidebar-backdrop {
  display: none;
}

.view-frame {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.view:not(.hidden) {
  animation: viewEnter var(--enter) both;
}

/* Controls */
.button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.button-primary {
  border: 1px solid #3d8333;
  background: linear-gradient(180deg, #5aa849, #438f37);
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2) inset, 0 5px 14px rgba(47, 112, 41, 0.18);
  color: #fff;
}

.button-primary:hover {
  background: linear-gradient(180deg, #61b24f, #438f37);
  box-shadow: 0 7px 20px rgba(47, 112, 41, 0.24);
  transform: translateY(-1px);
}

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

.button-secondary {
  border: 1px solid var(--border);
  background: rgba(251, 250, 245, 0.86);
  color: var(--foreground);
}

.button-secondary:hover {
  border-color: var(--border-strong);
  background: #fff;
  box-shadow: 0 5px 16px rgba(20, 32, 25, 0.08);
}

.logout-button {
  padding-inline: 11px;
}

.logout-button .ui-icon {
  width: 15px;
  height: 15px;
}

.text-button {
  color: var(--primary-ink);
  font-size: 12px;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--foreground);
  font-size: 11px;
}

.mini-button:hover {
  border-color: rgba(78, 155, 62, 0.45);
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

label {
  gap: 7px;
  color: #364139;
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  border: 1px solid var(--input);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 1px rgba(20, 32, 25, 0.025) inset;
}

input,
select {
  min-height: 42px;
  padding: 8px 11px;
}

textarea {
  padding: 11px 12px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #949e96;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(78, 155, 62, 0.13);
}

/* Surfaces and layout */
.panel {
  border: 1px solid rgba(189, 198, 186, 0.74);
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 245, 0.92);
  box-shadow: var(--shadow);
}

.panel:hover {
  border-color: var(--border-strong);
}

.form-panel,
.message-panel,
.preview-panel,
.queue-panel {
  padding: clamp(16px, 2vw, 24px);
}

.queue-panel {
  max-width: none;
  margin-top: 16px;
}

.standalone-queue {
  margin-top: 0;
}

.section-title {
  gap: 18px;
  margin-bottom: 18px;
}

.section-title h3 {
  position: relative;
  padding-left: 13px;
}

.section-title h3::before {
  position: absolute;
  top: 0.24em;
  bottom: 0.2em;
  left: 0;
  width: 4px;
  border-radius: 3px;
  background: var(--primary);
  content: "";
}

.section-title p {
  max-width: 660px;
  margin: 5px 0 0 13px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 400;
}

.workspace {
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  gap: 16px;
  max-width: none;
}

.side-stack {
  gap: 16px;
}

.form-grid {
  gap: 15px;
}

.stats-row {
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  min-height: 84px;
  padding: 16px 18px;
  border-color: rgba(189, 198, 186, 0.75);
  border-radius: 14px;
  background: rgba(251, 250, 245, 0.9);
  box-shadow: var(--shadow);
}

.stat strong {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--primary-ink);
}

.stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Data tables */
.item-table-shell,
.queue-table-shell,
.detail-table-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
}

.item-table th,
.queue-table th,
.detail-table th {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  background: #e9ece4;
  color: #536057;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.item-table td,
.queue-table td,
.detail-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(216, 221, 211, 0.72);
  background: rgba(255, 255, 255, 0.38);
  font-size: 12px;
}

.item-table tbody tr:last-child td,
.queue-table tbody tr:last-child td,
.detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.queue-table tbody tr:hover td,
.detail-table tbody tr:hover td {
  background: rgba(228, 242, 220, 0.58);
}

.queue-table tr.selected-row td {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.item-table input,
.item-table textarea {
  border-color: transparent;
  border-radius: 7px;
  background: rgba(243, 245, 239, 0.85);
}

.item-table input:focus,
.item-table textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.request-code {
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.status-badge {
  min-height: 25px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.status-pending {
  border-color: rgba(198, 107, 22, 0.25);
  background: #fff0dd;
  color: #944d0c;
}

.status-approved {
  border-color: rgba(49, 132, 58, 0.26);
  background: #e4f2dc;
  color: #296e31;
}

.status-rejected {
  border-color: rgba(183, 59, 53, 0.24);
  background: #f9e5e2;
  color: #9f302c;
}

.queue-actions {
  gap: 6px;
}

/* Dashboard */
.dash-header {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  background:
    linear-gradient(112deg, rgba(201, 245, 90, 0.1), transparent 38%),
    rgba(251, 250, 245, 0.94);
}

.dash-header::after {
  position: absolute;
  top: -62px;
  right: -42px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(78, 155, 62, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(78, 155, 62, 0.04), 0 0 0 68px rgba(78, 155, 62, 0.025);
  content: "";
}

.dash-title,
.dash-controls {
  position: relative;
  z-index: 1;
}

.dash-title h3 {
  font-size: 20px;
}

.dash-title p {
  max-width: 620px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 400;
}

.dash-controls {
  gap: 7px;
}

.dash-controls select,
.dash-controls input[type="date"] {
  min-height: 36px;
  padding: 6px 9px;
  border-color: var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 11px;
}

.kpi-row {
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.kpi {
  position: relative;
  min-height: 126px;
  justify-content: flex-end;
  gap: 5px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(189, 198, 186, 0.75);
  border-radius: 14px;
  background: rgba(251, 250, 245, 0.94);
  box-shadow: var(--shadow);
}

.kpi::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent) 54%, transparent 54%);
  content: "";
  opacity: 0.76;
}

button.kpi:hover {
  border-color: rgba(78, 155, 62, 0.5);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.kpi-label {
  order: 2;
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-value {
  order: 1;
  color: var(--foreground);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.kpi-sub,
.delta {
  order: 3;
  font-size: 10px;
}

.dash-main,
.charts-grid {
  gap: 16px;
}

.chart-panel {
  min-height: 260px;
  padding: 20px;
}

.chart-panel h3 {
  margin-bottom: 18px;
}

.hbar-chart {
  gap: 11px;
}

.hbar-row {
  grid-template-columns: 138px minmax(0, 1fr) 32px;
}

.hbar-label,
.hbar-value {
  font-size: 11px;
}

.hbar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #e4e8df;
}

.hbar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-ink), var(--primary));
}

.col-chart {
  gap: 10px;
  min-height: 190px;
  border-bottom: 1px solid var(--border);
}

.col-bar {
  max-width: 28px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.col-value {
  font-family: var(--font-mono);
  font-size: 10px;
}

.col-label {
  font-size: 10px;
}

.attention-panel,
.help-panel {
  margin-top: 16px;
  padding: 20px;
}

.attn-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.attn-group:first-of-type { padding-top: 0; }
.attn-group:last-child { padding-bottom: 0; border-bottom: 0; }

.attn-count {
  background: var(--muted);
  font-family: var(--font-mono);
}

.attn-row {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 8px;
}

.attn-row:hover {
  border-color: var(--border);
  background: rgba(228, 242, 220, 0.52);
  transform: translateX(2px);
}

.help-panel summary {
  color: var(--primary-ink);
}

/* Request, detail and paper */
.item-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 30px;
}

.item-title::before {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(78, 155, 62, 0.1);
  content: "";
}

.paste-box {
  border-color: var(--border);
  background: #f7f8f3;
}

.message-panel textarea,
.share-textarea {
  background: #f4f6f0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.request-detail {
  gap: 16px;
}

.detail-grid {
  gap: 10px;
}

.detail-grid div {
  padding: 12px;
  border-color: var(--border);
  border-radius: 10px;
  background: rgba(237, 238, 231, 0.62);
}

.detail-grid span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-grid strong {
  font-size: 12px;
}

.preview-panel {
  background:
    linear-gradient(45deg, rgba(23, 32, 26, 0.025) 25%, transparent 25%, transparent 75%, rgba(23, 32, 26, 0.025) 75%),
    rgba(251, 250, 245, 0.92);
  background-size: 16px 16px;
}

.paper {
  min-height: 600px;
  border: 1px solid #aab2a6;
  border-radius: 2px;
  box-shadow: 0 16px 34px rgba(25, 37, 28, 0.13);
}

.empty-preview {
  color: var(--muted-foreground);
  font-family: var(--font-body);
}

/* Leaves and roles */
.leave-chips {
  gap: 8px;
  margin: 14px 0 18px;
}

.leave-chip {
  min-width: 140px;
  padding: 10px 12px;
  border-color: var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.48);
}

.leave-chip:hover {
  border-color: rgba(78, 155, 62, 0.42);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.leave-badge {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--muted);
  font-size: 10px;
}

.process-grid {
  gap: 10px;
}

.process-grid div,
.role-row,
.permission-grid {
  border-color: var(--border);
  border-radius: 11px;
  background: rgba(237, 238, 231, 0.55);
}

.role-row {
  position: relative;
  padding: 15px 16px;
  overflow: hidden;
}

.role-row::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--primary);
  content: "";
  opacity: 0;
}

.role-row:hover {
  border-color: rgba(78, 155, 62, 0.42);
  background: var(--primary-soft);
}

.role-row:hover::after,
.role-row.selected-role::after {
  opacity: 1;
}

.permission-grid {
  padding: 14px;
}

.permission-option {
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 7px;
}

.permission-option:hover {
  background: rgba(255, 255, 255, 0.65);
}

/* Modal and toast */
.modal-backdrop {
  padding: 24px;
  background: rgba(10, 18, 12, 0.64);
  backdrop-filter: blur(8px);
  animation: fadeIn 180ms ease both;
}

.modal-panel {
  border: 1px solid rgba(216, 221, 211, 0.92);
  border-radius: 18px;
  background: #f9f8f2;
  box-shadow: var(--shadow-floating);
  animation: modalEnter 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-header,
.modal-actions {
  padding: 18px 22px;
}

.modal-header {
  background: linear-gradient(112deg, rgba(201, 245, 90, 0.11), transparent 42%);
}

.modal-header h3 {
  font-size: 20px;
}

.modal-body {
  padding: 22px;
}

.modal-actions {
  background: rgba(233, 236, 228, 0.55);
}

.toast {
  right: 22px;
  bottom: 22px;
  padding: 13px 16px 13px 20px;
  border: 1px solid rgba(201, 245, 90, 0.22);
  border-radius: 11px;
  background: #1b2a20;
  box-shadow: var(--shadow-floating);
  color: #f2f6f0;
  font-size: 12px;
}

.toast::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  content: "";
}

/* Motion */
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes beaconPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.88); opacity: 0.82; }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

/* Responsive */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    min-height: 100svh;
    transform: translateX(-104%);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    border: 0;
    background: rgba(10, 18, 12, 0.46);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(3px);
  }

  .sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-open {
    overflow: hidden;
  }

  .main {
    grid-column: 1;
  }

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

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

  .preview-panel {
    max-height: none;
  }

  .kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  }
}

@media (max-width: 860px) {
  .login-screen {
    grid-template-columns: 1fr;
    background: var(--card);
  }

  .login-story {
    min-height: 320px;
    padding: 28px;
  }

  .login-message {
    margin: 45px 0 30px;
  }

  .login-message h2 {
    font-size: clamp(38px, 10vw, 62px);
  }

  .login-message > p:last-child,
  .login-system-strip,
  .beacon-label {
    display: none;
  }

  .beacon-visual {
    right: -120px;
    width: 360px;
  }

  .login-card {
    min-height: auto;
    padding: 42px clamp(24px, 8vw, 70px) 54px;
  }

  .dash-main,
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background-size: 28px 28px;
  }

  .main {
    padding: 0 12px 24px;
  }

  .topbar {
    position: sticky;
    flex-direction: row;
    align-items: center;
    min-height: 72px;
    margin: 0 -12px 16px;
    padding: 10px 12px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .page-context,
  .environment-pill,
  .save-status,
  .logout-button span {
    display: none;
  }

  .logout-button {
    width: 40px;
    min-height: 40px;
    padding: 0;
  }

  .top-actions {
    flex-direction: row;
    align-items: center;
  }

  .section-title {
    align-items: stretch;
    gap: 14px;
  }

  .section-title .row-actions,
  .section-title > .button {
    width: 100%;
  }

  .row-actions {
    align-items: stretch;
  }

  .row-actions .button,
  .section-title > .button {
    width: 100%;
  }

  .button {
    width: auto;
  }

  .form-panel,
  .message-panel,
  .preview-panel,
  .queue-panel,
  .chart-panel,
  .attention-panel,
  .help-panel {
    padding: 16px;
  }

  .panel {
    border-radius: 14px;
  }

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

  .wide {
    grid-column: auto;
  }

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

  .kpi {
    min-height: 112px;
    padding: 13px;
  }

  .kpi-value {
    font-size: 31px;
  }

  .dash-header {
    padding: 17px;
  }

  .dash-controls,
  .dash-controls select,
  .dash-controls input[type="date"] {
    width: 100%;
    max-width: none;
  }

  .hbar-row {
    grid-template-columns: 95px minmax(0, 1fr) 28px;
    gap: 7px;
  }

  .attn-row {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .attn-age {
    display: none;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100svh - 20px);
    border-radius: 18px 18px 12px 12px;
  }

  .modal-header,
  .modal-actions,
  .modal-body {
    padding: 16px;
  }

  .modal-actions .button {
    flex: 1;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 460px) {
  .login-story {
    min-height: 270px;
  }

  .login-message {
    margin-bottom: 12px;
  }

  .login-message h2 {
    font-size: 38px;
  }

  .login-card {
    padding-inline: 22px;
  }

  .sidebar {
    width: min(294px, calc(100vw - 34px));
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-sub,
  .delta {
    font-size: 9px;
  }

  .paper {
    padding: 14px 9px 18px;
  }
}

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

@media print {
  body {
    background: #fff;
  }

  body::before,
  .sidebar-backdrop {
    display: none;
  }

  .paper {
    border: 0;
    box-shadow: none;
  }
}

/* Hardware digital thread */
.hardware-command {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(360px, .8fr);
  gap: 28px;
  padding: 28px;
  color: #f3f7ec;
  background:
    linear-gradient(115deg, rgba(21, 32, 25, .98), rgba(36, 66, 42, .93)),
    repeating-linear-gradient(90deg, transparent 0 59px, rgba(255,255,255,.05) 60px);
  border-color: rgba(255,255,255,.08);
}

.hardware-command::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -140px;
  border: 1px solid rgba(197, 237, 86, .28);
  border-radius: 50%;
  box-shadow: 0 0 0 36px rgba(197, 237, 86, .035), 0 0 0 72px rgba(197, 237, 86, .025);
}

.hardware-command-copy { position: relative; z-index: 1; }
.hardware-eyebrow { color: #c5ed56; font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.hardware-command h3, .trace-search h3 { margin: 8px 0; font-family: var(--font-display); font-size: clamp(25px, 3vw, 40px); line-height: 1; }
.hardware-command p { max-width: 640px; margin: 0; color: rgba(243, 247, 236, .68); }

.hardware-pulse-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  align-self: stretch;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.12);
}

.hardware-pulse-grid div { display: flex; flex-direction: column; justify-content: center; padding: 15px; background: rgba(14, 24, 18, .8); }
.hardware-pulse-grid strong { font-family: var(--font-display); color: #c5ed56; font-size: 28px; }
.hardware-pulse-grid span { color: rgba(255,255,255,.58); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }

.hardware-workspace { padding: 0; overflow: hidden; }
.hardware-tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); background: rgba(245, 246, 239, .7); }
.hardware-tabs button { min-width: max-content; padding: 17px 20px; border: 0; border-right: 1px solid var(--line); border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.hardware-tabs button span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; border-radius: 20px; background: #e2e7db; font-size: 10px; }
.hardware-tabs button.active { color: var(--ink); border-bottom-color: #6e9f39; background: #fff; }
.hardware-tabs button.active span { color: #23451d; background: #dff0c7; }
.hardware-section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 23px 24px 18px; }
.hardware-section-head h4 { margin: 0 0 3px; font-family: var(--font-display); font-size: 24px; }
.hardware-section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.hardware-table td { max-width: 290px; }
.hardware-table td:nth-child(2) { font-weight: 700; color: var(--ink); }
.hardware-status { display: inline-flex; padding: 5px 9px; border: 1px solid #d1dfc2; border-radius: 99px; color: #315225; background: #f2f8eb; font-size: 10px; font-weight: 800; white-space: nowrap; }
.hardware-empty { padding: 45px !important; text-align: center; }
.hardware-empty strong, .hardware-empty span { display: block; }
.hardware-empty span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.hardware-form .checkbox-line { min-height: 42px; margin-top: 22px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: #fafbf7; }

.trace-search { display: grid; grid-template-columns: 1fr 1.25fr; gap: 20px; align-items: center; padding: 22px 24px; }
.trace-search h3 { margin-bottom: 0; color: var(--ink); font-size: 23px; }
.trace-search-form { display: flex; gap: 8px; }
.trace-search-form input, .trace-search-form select { flex: 1; min-width: 0; }
#bomQuantityInput { flex: 0 0 110px; }
#traceResult { grid-column: 1 / -1; }
.trace-thread { display: grid; grid-template-columns: repeat(4, 1fr auto); align-items: center; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.trace-thread div { min-height: 86px; padding: 14px; border-left: 3px solid #86ad43; background: #f4f7ef; }
.trace-thread span, .trace-thread small, .trace-thread strong { display: block; }
.trace-thread span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.trace-thread strong { margin: 6px 0; font-size: 14px; }
.trace-thread small { color: var(--muted); }
.trace-thread i { color: #91a384; font-style: normal; }
.trace-error { margin: 4px 0 0; color: #a93426; font-size: 12px; }
.hardware-readiness { margin: 4px 0 12px; padding: 12px 14px; border-left: 4px solid #9a7423; background: #fff7df; }
.hardware-readiness.ready { border-left-color: #5f8e31; background: #eef8e4; }
.hardware-readiness.short { border-left-color: #b24a39; background: #fff0ec; }
.cost-rollup { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--line); }
.cost-rollup div { padding: 14px; background: #f4f7ef; }
.cost-rollup span, .cost-rollup strong { display: block; }
.cost-rollup span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.cost-rollup strong { margin-top: 5px; color: var(--ink); font-family: var(--font-display); font-size: 20px; }
.device-label { width: min(320px, 100%); margin: 0 auto; padding: 22px; border: 1px dashed #8a9981; text-align: center; background: #fff; }
.device-label-qr svg { display: block; width: 220px; height: 220px; margin: 0 auto 12px; }
.device-label span, .device-label strong, .device-label small { display: block; }
.device-label span { color: #5e6b59; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.device-label strong { margin: 7px 0 3px; font-family: var(--font-display); font-size: 22px; }
.device-label small { color: #70806a; }

@media (max-width: 920px) {
  .hardware-command, .trace-search { grid-template-columns: 1fr; }
  #traceResult { grid-column: auto; }
  .trace-thread { grid-template-columns: 1fr; }
  .trace-thread i { display: none; }
}

@media (max-width: 560px) {
  .hardware-command { padding: 21px; }
  .hardware-pulse-grid { grid-template-columns: 1fr 1fr; }
  .hardware-section-head { align-items: flex-start; flex-direction: column; padding: 18px 16px; }
  .hardware-section-head .button { width: 100%; }
  .trace-search { padding: 18px 16px; }
  .trace-search-form { flex-direction: column; }
  #bomQuantityInput { flex: 0 0 auto; width: 100%; }
  .cost-rollup { grid-template-columns: 1fr; }
}
