﻿:root {
  --bg: #08090d;
  --bg-soft: rgba(8, 9, 13, 0.92);
  --panel: rgba(17, 19, 26, 0.96);
  --panel-2: rgba(21, 24, 36, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --grid: rgba(25, 168, 255, 0.045);
  --text: #f6f7fb;
  --muted: #b7bdca;
  --cyan: #19a8ff;
  --yellow: #d4a525;
  --pink: #a230ff;
  --orange: #5f7cff;
  --danger: #ff4d6d;
  --success: #22c55e;
  --purple: #a230ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --form-gap: 10px;
}

/* Identidad visual compartida con el sitio oficial MVSTAR EAS. */
:root {
  --bg: #08090d;
  --bg-soft: rgba(8, 9, 13, 0.92);
  --panel: #11131a;
  --panel-2: #151824;
  --card: #151824;
  --line: rgba(255, 255, 255, 0.12);
  --grid: transparent;
  --text: #f6f7fb;
  --muted: #b7bdca;
  --cyan: #19a8ff;
  --yellow: #d4a525;
  --pink: #a230ff;
  --orange: #a230ff;
  --danger: #ff7777;
  --success: #22c55e;
  --purple: #a230ff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 4% 0%, rgba(162, 48, 255, 0.14), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(25, 168, 255, 0.12), transparent 28%),
    var(--bg);
}

body::before {
  display: none;
}

.brand h1,
.hero h2,
.section-hero h2,
.panel h3,
.status-card h2,
.session-card strong,
.kpi-card strong,
.formula-builder-head h4,
.production-preview-head h4,
.production-draft-head strong,
.auth-copy h2,
.auth-art h3 {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.sidebar {
  background: rgba(8, 9, 13, 0.96);
  backdrop-filter: blur(18px);
}

.content {
  background: transparent;
}

.menu-toggle,
.submenu-link,
.status-card,
.panel,
.hero,
.section-hero,
.formula-builder,
.ingredient-row,
.production-preview,
.production-draft-box,
.lookup-dialog,
.workspace-dialog,
#materialEditor.material-editor-dialog,
.system-popup-box,
.permission-denied-box,
.session-card,
.kpi-card,
.production-component,
.production-instruction {
  clip-path: none;
  border-radius: 8px;
}

.status-card,
.panel,
.hero,
.section-hero,
.lookup-dialog,
.workspace-dialog {
  border-color: var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel:hover,
.kpi-card:hover,
.formula-card:hover,
.presentation-panel:hover {
  border-color: rgba(25, 168, 255, 0.42);
  box-shadow: var(--shadow);
}

.menu-toggle,
.submenu-link {
  clip-path: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.menu-toggle:hover,
.submenu-link:hover {
  border-color: rgba(25, 168, 255, 0.55);
  background: rgba(25, 168, 255, 0.08);
}

.menu-block.active .menu-toggle {
  border-color: rgba(25, 168, 255, 0.7);
  background: linear-gradient(135deg, rgba(162, 48, 255, 0.24), rgba(25, 168, 255, 0.2));
}

.submenu-link.workspace-selected,
.workspace-selected {
  color: var(--text);
  border-color: var(--blue, #19a8ff);
  background: rgba(25, 168, 255, 0.1);
}

button,
input,
textarea,
select,
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font-family: inherit;
  border-radius: 8px;
  clip-path: none;
}

input,
textarea,
select {
  background: var(--card);
  border-color: var(--line);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
  border-color: var(--cyan);
  box-shadow: none;
}

.accent-button,
.entry-button,
.presentation-save,
.save-formula-button,
#purchaseGenerateOrder,
#backupExportButton,
.login-primary-button {
  clip-path: none;
  border-radius: 8px;
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(25, 168, 255, 0.18);
}

.accent-button:hover,
.entry-button:hover,
.presentation-save:hover,
.save-formula-button:hover,
#purchaseGenerateOrder:hover,
#backupExportButton:hover,
.login-primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(25, 168, 255, 0.26);
}

.ghost-button,
.mini-button,
.workspace-card-tabs button,
.lookup-item,
.login-secondary-button,
#backupImportButton {
  border-radius: 8px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.ghost-button:hover,
.mini-button:hover,
.workspace-card-tabs button:hover,
.lookup-item:hover {
  border-color: var(--cyan);
  box-shadow: none;
}

.tag,
.eyebrow,
.brand-kicker {
  color: var(--yellow);
  font-weight: 900;
}

.formula-builder,
.ingredient-row,
.production-preview,
.production-draft-box,
.production-component,
.ingredient-adjustable,
.session-card {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.ingredient-drag-handle {
  border-radius: 8px;
  border-color: rgba(212, 165, 37, 0.55);
  background: rgba(212, 165, 37, 0.08);
  color: var(--yellow);
}

.ingredient-add {
  border-color: rgba(25, 168, 255, 0.55);
  background: rgba(25, 168, 255, 0.1);
  color: var(--cyan);
}

.ingredient-remove,
.danger {
  border-color: rgba(255, 119, 119, 0.45);
  background: rgba(255, 119, 119, 0.08);
  color: #ff9b9b;
}

.production-instruction {
  border-radius: 0 8px 8px 0;
  border-left-color: var(--cyan);
  background: rgba(25, 168, 255, 0.08);
  padding: 0 14px 11px;
}

table thead,
th {
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(25, 168, 255, 0.045);
}

[hidden], .hidden { display: none !important; }
.workspace-selected { color: var(--yellow); border-color: var(--yellow); }
.material-name-link { background: none; color: var(--text); border: 0; border-bottom: 1px dotted var(--muted); padding: 4px 0; text-align: left; font: inherit; cursor: pointer; }
.material-name-link:hover { color: var(--cyan); }
.material-direct-source { display: block; margin-top: 3px; color: var(--muted); }
.cadastro-form.is-direct-component :is(.cadastro-stock, .cadastro-min, .cadastro-monthly, .cadastro-cost, .cadastro-track-stock) { display: none; }
.material-source-picker { display: grid; gap: 8px; max-width: 620px; }
.material-source-picker > label { font-weight: 700; }
.material-source-picker > input[type="search"] { width: 100%; max-width: none; }
.material-source-picker > small { color: var(--muted); }
.material-source-results { max-height: 250px; overflow-y: auto; border: 1px solid var(--line); background: var(--panel-2); }
.material-source-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.material-source-option:hover, .material-source-option:focus-visible { background: rgba(25, 168, 255, 0.1); outline: none; }
.material-source-option small, .material-source-hint { color: var(--muted); }
.material-source-hint { margin: 0; padding: 12px 13px; }
.material-delete-confirm { margin-top: 18px; padding: 16px; border: 1px solid var(--danger); background: rgba(230, 50, 70, 0.08); }
.material-delete-confirm p { margin: 8px 0 12px; color: var(--muted); }
#materia-ingreso { min-height: auto; }
#materia-inventario { border-top: 0; margin-top: 0; padding-top: 0; }
#materialEditor { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); scroll-margin-top: 20px; }
#materialEditor.material-editor-dialog {
  width: min(1180px, 94vw);
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line);
}

#materialEditor.material-editor-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(3px);
}
.workspace-purchase-list { margin-top: 20px; }
.workspace-purchase-list input { display: block; width: min(100%, 520px); margin: 8px 0 16px; }
.workspace-dialog { width: min(1100px, 94vw); max-height: 88vh; overflow: auto; color: var(--text); background: #151824; border: 1px solid var(--line); padding: 28px; box-shadow: var(--shadow); }
.presentation-report-dialog { width: min(1000px, 96vw); }
.invoice-import-dialog { width: min(1050px, 96vw); }
.invoice-import-line { padding: 16px; margin: 12px 0; border: 1px solid var(--line); }
.invoice-import-line input { display: block; width: min(100%, 500px); margin: 8px 0; }
.invoice-import-line [data-results] { display: flex; flex-wrap: wrap; gap: 6px; }
.invoice-import-error { color: #ff6b7e; font-weight: 700; }
.presentation-report-heading { display: flex; align-items: center; gap: 18px; }
.presentation-report-logo { width: 150px; height: 64px; object-fit: contain; object-position: left center; }
.presentation-report-brand { color: var(--text); font-size: 1.3rem; }
.presentation-report-table { width: 100%; border-collapse: collapse; }
.presentation-report-table th, .presentation-report-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
.presentation-report-table td:last-child { white-space: nowrap; }
.workspace-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.workspace-dialog header, .workspace-document-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workspace-dialog header { margin-bottom: 24px; }
.workspace-dialog h3 { margin: 8px 0; }
.workspace-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.workspace-metrics > div { padding: 16px; border: 1px solid var(--line); }
.workspace-metrics small, .workspace-metrics strong, .workspace-metrics span { display: block; }
.workspace-metrics small, .workspace-hint { color: var(--muted); }
.workspace-metrics strong { font-size: 1.3rem; margin-top: 8px; }
.workspace-card-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.workspace-card-tabs button { padding: 10px 16px; background: transparent; color: var(--text); border: 1px solid var(--line); font: inherit; cursor: pointer; }
.workspace-card-tabs button[aria-pressed="true"] { border-color: var(--yellow); color: var(--yellow); }
.workspace-notes { white-space: pre-wrap; }
.workspace-document-footer { margin-top: 24px; }
.workspace-document-footer > div { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 700px) {
  .workspace-dialog { padding: 16px; }
  .workspace-metrics { grid-template-columns: 1fr; gap: 8px; }
  .workspace-document-footer { align-items: flex-start; flex-direction: column; }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Rajdhani", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(162, 48, 255, 0.24), transparent 30%),
    radial-gradient(circle at 96% 4%, rgba(25, 168, 255, 0.2), transparent 32%),
    radial-gradient(circle at 72% 105%, rgba(212, 165, 37, 0.13), transparent 30%),
    linear-gradient(180deg, #07080c 0%, #10131d 54%, #08090d 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  opacity: 0.6;
}

.page-shell {
  display: grid;
  grid-template-columns: clamp(240px, 22vw, 320px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar-toggle,
.sidebar-overlay {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(8, 9, 13, 0.98), rgba(7, 8, 12, 0.99)),
    linear-gradient(135deg, rgba(162, 48, 255, 0.12), rgba(25, 168, 255, 0.06), rgba(212, 165, 37, 0.04));
  backdrop-filter: blur(18px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand-kicker,
.eyebrow,
.tag,
th {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

.brand-kicker {
  display: block;
  text-align: center;
}

.brand h1,
.hero h2,
.panel h3,
.status-card h2 {
  font-family: "Orbitron", sans-serif;
}

.brand h1 {
  margin: 8px 0 6px;
  font-size: 2rem;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(212, 165, 37, 0.42), 0 0 32px rgba(25, 168, 255, 0.16);
}

.brand-logo-box {
  display: grid;
  place-items: center;
  min-height: 86px;
  margin: 6px 0 10px;
}

.brand-logo-image {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 86px;
  object-fit: contain;
}

.session-card {
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  background: rgba(255, 255, 255, 0.025);
}

.session-card strong {
  display: block;
  margin: 10px 0 4px;
  font-family: "Orbitron", sans-serif;
}

.session-card p {
  margin: 0;
  color: var(--muted);
}

.brand p,
.hero p,
small,
.timeline p,
.stack-list p {
  color: var(--muted);
  margin: 0;
  line-height: 1.2;
}

.menu {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.menu-block {
  display: grid;
  gap: 8px;
}

.menu-block .submenu {
  display: none;
}

.menu-block.open .submenu {
  display: grid;
}

.menu-toggle,
.submenu-link {
  color: var(--text);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(162, 48, 255, 0.08), rgba(25, 168, 255, 0.055));
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: 0.25s ease;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.menu-toggle:hover,
.submenu-link:hover,
.accent-button:hover,
.ghost-button:hover,
.entry-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(25, 168, 255, 0.22), 0 0 34px rgba(162, 48, 255, 0.12);
}

.menu-toggle {
  font-weight: 700;
  position: relative;
}

.menu-toggle::after {
  content: ">";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--yellow);
  font-size: 1rem;
}

.menu-block.active .menu-toggle {
  border-color: rgba(212, 165, 37, 0.62);
  background: linear-gradient(135deg, rgba(212, 165, 37, 0.16), rgba(25, 168, 255, 0.08));
}

.menu-block.open .menu-toggle::after {
  content: "v";
}

.logout-menu-button {
  width: 100%;
  margin-top: 10px;
}

.logout-menu-button::after {
  content: "x";
  color: var(--danger);
}

.submenu {
  gap: 8px;
  margin: 0;
  padding-left: 14px;
}

.submenu-link {
  border-color: rgba(212, 165, 37, 0.22);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.92rem;
  white-space: normal;
  line-height: 1.2;
}

.status-card,
.panel,
.hero {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(162, 48, 255, 0.08), rgba(25, 168, 255, 0.055), rgba(212, 165, 37, 0.025)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 32px rgba(25, 168, 255, 0.035);
}

.status-card {
  padding: 14px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.status-card > .tag {
  display: block;
  text-align: center;
}

.status-card h2 {
  margin: 10px 0 14px;
  font-size: 1.35rem;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  text-wrap: balance;
  hyphens: none;
  letter-spacing: 0.01em;
  max-width: 100%;
}

.status-card h2.is-compact {
  font-size: 1.22rem;
}

.status-card h2.is-long {
  font-size: 1.06rem;
}

.status-card h2.is-xlong {
  font-size: 0.92rem;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.status-grid strong {
  display: block;
  font-size: 1.12rem;
  color: var(--cyan);
}

.status-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  padding: clamp(16px, 2vw, 28px);
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
}

.view-section {
  display: none;
  gap: 22px;
}

.view-section.active {
  display: grid;
}

.subview-stack {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.subview-panel {
  display: none;
}

.subview-panel.active {
  display: block;
}

.section-hero {
  padding: 22px 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(73, 78, 174, 0.08), rgba(255, 238, 0, 0.035)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 28px rgba(73, 78, 174, 0.035);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}

.section-hero h2 {
  margin: 8px 0;
  font-family: "Orbitron", sans-serif;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: clamp(18px, 2.2vw, 28px);
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 26px 100%, 0 calc(100% - 26px));
}

.hero h2 {
  margin: 8px 0;
  font-size: clamp(2rem, 3.6vw, 3.4rem);
  max-width: 12ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.accent-button,
.ghost-button {
  border: 1px solid var(--cyan);
  background: linear-gradient(135deg, rgba(162, 48, 255, 0.28), rgba(25, 168, 255, 0.18));
  color: var(--text);
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.ghost-button {
  border-color: rgba(212, 165, 37, 0.56);
  background: linear-gradient(135deg, rgba(212, 165, 37, 0.14), rgba(255, 255, 255, 0.025));
}

.entry-button {
  border: 1px solid rgba(25, 168, 255, 0.68);
  background: linear-gradient(135deg, rgba(25, 168, 255, 0.22), rgba(162, 48, 255, 0.1));
  color: var(--text);
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.full {
  width: 100%;
}

.hidden {
  display: none;
}

.kpi-grid,
.panel-grid,
.two-col-section {
  display: grid;
  gap: 20px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.panel-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
}

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

.panel {
  padding: clamp(16px, 2vw, 22px);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  min-width: 0;
}

.wide {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.kpi-card {
  padding: 20px;
  min-height: 132px;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(73, 78, 174, 0.34), rgba(255, 238, 0, 0.12) 42%, transparent 68%);
}

.kpi-card strong {
  display: block;
  margin-top: 18px;
  font-family: "Orbitron", sans-serif;
  font-size: 2.2rem;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(73, 78, 174, 0.35);
}

.kpi-card span:last-child {
  color: var(--muted);
}

.data-form {
  display: grid;
  gap: var(--form-gap);
}

.cadastro-form {
  max-width: min(100%, 1180px);
  width: 100%;
}

.cadastro-grid {
  display: grid;
  grid-template-columns: 170px minmax(320px, 1.9fr) minmax(180px, 1fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr);
  gap: var(--form-gap);
  align-items: end;
  min-width: 0;
}

.cadastro-date,
.cadastro-name,
.cadastro-unit,
.cadastro-stock,
.cadastro-min,
.cadastro-monthly,
.cadastro-cost {
  min-width: 0;
}

.cadastro-monthly {
  grid-column: 1;
}

.cadastro-cost {
  grid-column: 2;
}

.cadastro-track-stock {
  grid-column: 3 / span 2;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.cadastro-track-stock legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.stock-control-options {
  display: flex;
  gap: 8px;
}

.stock-control-options label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-width: 82px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}

.stock-control-options input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
}

.cadastro-top {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--form-gap);
  align-items: start;
  min-width: 0;
}

.data-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.dashboard-order-form {
  display: grid;
  grid-template-columns: minmax(280px, 34ch) 16ch;
  gap: 12px;
  align-items: end;
}

.compact-actions {
  justify-content: start;
}

.production-order-formula,
.production-order-batches {
  min-width: 0;
}

.production-order-formula input,
.production-order-batches input {
  max-width: none;
}

.production-order-primary {
  max-width: 320px;
  border-color: rgba(73, 78, 174, 0.9);
  background:
    linear-gradient(135deg, rgba(73, 78, 174, 0.24), rgba(73, 78, 174, 0.08)),
    var(--panel-2);
  box-shadow: 0 0 24px rgba(73, 78, 174, 0.14);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.order-item {
  align-items: center;
}

.order-item .table-actions {
  justify-content: flex-end;
}

.security-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

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

.security-users-panel {
  display: grid;
  gap: 14px;
}

.branding-form {
  gap: 12px;
}

.branding-help {
  margin: 0;
  color: var(--muted);
}

.branding-preview-box {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 14px;
  border: 1px solid rgba(73, 78, 174, 0.16);
  background: rgba(255, 255, 255, 0.025);
}

.branding-preview-image {
  width: 100%;
  max-width: 260px;
  max-height: 110px;
  object-fit: contain;
}

.branding-preview-fallback {
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  color: var(--yellow);
  text-align: center;
  text-shadow: 0 0 18px rgba(255, 243, 106, 0.28);
}

.file-picker-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(73, 78, 174, 0.2);
  background: var(--panel-2);
}

.file-picker-name {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-active-line,
.permission-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.permission-active-line input,
.permission-item input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.permission-grid,
.permission-group-grid {
  display: grid;
  gap: 12px;
}

.permission-group {
  padding: 14px;
  border: 1px solid rgba(73, 78, 174, 0.16);
  background: rgba(255, 255, 255, 0.025);
}

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

.permission-denied-box {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: center;
}

.permission-denied-box p {
  margin: 6px 0 0;
}

.permission-alert-timer {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  border: 1px solid rgba(255, 77, 109, 0.22);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.permission-alert-progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(255, 243, 106, 0.92), rgba(255, 77, 109, 0.94));
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.2);
}

#systemConfirmModal[data-mode="confirm"] .permission-alert-timer {
  margin-top: 18px;
  height: 10px;
  border-color: rgba(255, 243, 106, 0.38);
  background: rgba(255, 243, 106, 0.06);
}

#systemConfirmModal[data-mode="confirm"] .permission-alert-progress {
  background: linear-gradient(90deg, rgba(73, 78, 174, 0.92), rgba(255, 243, 106, 0.96));
  box-shadow: 0 0 18px rgba(255, 243, 106, 0.22);
}

.permission-denied-art,
.auth-art pre {
  margin: 0;
  border: 1px solid rgba(255, 77, 109, 0.35);
  background: rgba(255, 77, 109, 0.08);
  color: var(--danger);
  padding: 14px;
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
}

.permission-denied-art {
  animation: warningPulse 0.9s ease-in-out infinite;
}

.system-popup-box {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: center;
}

.system-popup-box p {
  margin: 6px 0 0;
}

.system-popup-art {
  margin: 0;
  border: 1px solid rgba(116, 255, 207, 0.35);
  background: rgba(116, 255, 207, 0.08);
  color: var(--success);
  padding: 14px;
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  animation: warningPulse 1.1s ease-in-out infinite;
}

.auth-dialog {
  max-width: 460px;
}

.auth-modal .lookup-backdrop {
  background: rgba(1, 6, 12, 0.96);
}

.auth-modal .lookup-dialog {
  margin-top: 0;
  border-color: rgba(73, 78, 174, 0.28);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  min-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-modal {
  display: grid;
  place-items: center;
}

.auth-form {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.auth-form label,
.auth-copy,
.auth-feedback,
.auth-modal .lookup-head > div {
  width: min(100%, 320px);
  margin-left: auto;
  margin-right: auto;
}

.auth-modal .lookup-head {
  justify-content: center;
}

.auth-modal .lookup-head > div,
.auth-copy,
.auth-feedback {
  text-align: center;
}

.auth-form label {
  text-align: center;
}

.auth-form .accent-button.full {
  width: min(100%, 320px);
  justify-self: center;
}

.password-field {
  position: relative;
}

.caps-lock-indicator {
  position: absolute;
  right: 16px;
  bottom: 13px;
  display: inline-block;
  color: var(--warning);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 226, 74, 0.55);
  pointer-events: none;
}

.password-field input {
  padding-right: 48px;
}


.login-secondary-button {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  justify-self: center;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.auth-art,
.auth-copy,
.auth-feedback {
  align-self: center;
}

.auth-copy,
.auth-feedback {
  color: var(--muted);
}

.auth-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 77, 109, 0.24);
  background: rgba(255, 77, 109, 0.08);
}

body.auth-locked {
  overflow: hidden;
}

body.booting .page-shell {
  visibility: hidden;
}

body.auth-locked .sidebar,
body.auth-locked .sidebar-toggle,
body.auth-locked .sidebar-overlay,
body.auth-locked .content > .view-section,
body.auth-locked .content > .lookup-modal:not(#authModal) {
  opacity: 0.08;
  pointer-events: none;
  user-select: none;
}

body.auth-locked #authModal {
  pointer-events: auto;
}

.inline-quad {
  display: grid;
  grid-template-columns: minmax(360px, 2.1fr) minmax(180px, 0.95fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr);
  gap: var(--form-gap);
  align-items: end;
  min-width: 0;
}

.inline-triple {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(135px, 0.8fr) minmax(150px, 0.9fr);
  gap: var(--form-gap);
  align-items: end;
  min-width: 0;
}

.wide-field {
  min-width: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px));
  gap: var(--form-gap);
  align-items: end;
  min-width: 0;
  justify-content: start;
}

.form-row-single {
  grid-template-columns: 200px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.formula-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(150px, 170px) minmax(170px, 200px) minmax(150px, 170px);
  gap: 14px;
  align-items: end;
  min-width: 0;
  justify-content: start;
}

.formula-name {
  min-width: 0;
}

#formulaForm {
  max-width: min(100%, 1380px);
  width: 100%;
  gap: 14px;
}

#formulaForm label {
  gap: 6px;
}

#formulaForm small {
  display: block;
  margin-top: 4px;
}

.formula-builder {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  background: rgba(255, 255, 255, 0.02);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.formula-builder-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.formula-builder-head h4 {
  margin: 6px 0 0;
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
}

.ingredient-list {
  display: grid;
  gap: 12px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1.25fr) minmax(105px, 0.45fr) minmax(155px, 0.6fr) minmax(250px, 1.25fr) 116px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(73, 78, 174, 0.14);
  background: rgba(8, 16, 28, 0.74);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.ingredient-adjustable {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(73, 78, 174, 0.22);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.ingredient-adjustable input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--cyan);
}

.ingredient-adjustable span {
  line-height: 1.1;
}

.ingredient-instruction {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
  color: var(--muted);
}

.ingredient-instruction input,
.ingredient-instruction textarea {
  max-width: none;
}

.ingredient-instruction textarea {
  min-height: 72px;
  resize: vertical;
}

.ingredient-row.is-dragging {
  opacity: 0.45;
}

.ingredient-row.is-drag-target {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(46, 198, 255, 0.4), 0 0 18px rgba(46, 198, 255, 0.1);
}

.ingredient-drag-handle {
  min-height: 44px;
  padding: 0 8px;
  border: 1px dashed rgba(255, 196, 0, 0.5);
  color: var(--yellow);
  background: rgba(255, 196, 0, 0.06);
  cursor: grab;
}

.ingredient-drag-handle:active {
  cursor: grabbing;
}

.ingredient-order-controls {
  display: grid;
  grid-template-columns: repeat(2, 54px);
  gap: 6px;
  justify-content: end;
}

.ingredient-order-controls button {
  min-height: 44px;
}

.ingredient-row select,
.ingredient-row input,
.ingredient-row textarea {
  width: 100%;
  max-width: none;
}

.ingredient-row input[name="ingredientMaterialLookup"] {
  cursor: pointer;
  user-select: none;
  caret-color: transparent;
  background:
    linear-gradient(135deg, rgba(73, 78, 174, 0.08), rgba(73, 78, 174, 0.02)),
    var(--panel-2);
}

#productionFormulaLookup {
  cursor: pointer;
  user-select: none;
  caret-color: transparent;
  background:
    linear-gradient(135deg, rgba(73, 78, 174, 0.08), rgba(73, 78, 174, 0.02)),
    var(--panel-2);
}

.presentation-material-lookup {
  cursor: pointer;
  user-select: none;
  caret-color: transparent;
  background:
    linear-gradient(135deg, rgba(73, 78, 174, 0.08), rgba(73, 78, 174, 0.02)),
    var(--panel-2);
}

.production-top {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 10ch;
  gap: var(--form-gap);
  align-items: end;
  justify-content: start;
}

.production-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: var(--form-gap);
  align-items: start;
}

.production-box {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  background: rgba(255, 255, 255, 0.02);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.production-draft-box {
  align-content: start;
}

.production-draft-actions {
  display: grid;
  gap: 10px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.ingredient-add,
.ingredient-remove {
  width: 54px;
  height: 44px;
  border-radius: 999px;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.ingredient-add {
  border: 1px solid rgba(255, 243, 106, 0.5);
  background: linear-gradient(135deg, rgba(255, 243, 106, 0.18), rgba(255, 238, 0, 0.08));
  color: var(--yellow);
}

.ingredient-add:hover {
  box-shadow: 0 0 16px rgba(255, 243, 106, 0.24);
}

.ingredient-remove {
  border: 1px solid rgba(73, 78, 174, 0.5);
  background: linear-gradient(135deg, rgba(73, 78, 174, 0.18), rgba(73, 78, 174, 0.04));
  color: var(--pink);
}

.ingredient-remove:hover {
  box-shadow: 0 0 16px rgba(73, 78, 174, 0.24);
}

.add-ingredient-button {
  border-color: rgba(255, 243, 106, 0.5);
  background: linear-gradient(135deg, rgba(255, 243, 106, 0.16), rgba(255, 238, 0, 0.08));
  color: var(--yellow);
}

.add-ingredient-button:hover {
  box-shadow: 0 0 18px rgba(255, 243, 106, 0.22);
}

.save-formula-button {
  border-color: rgba(116, 255, 207, 0.55);
  background: linear-gradient(135deg, rgba(116, 255, 207, 0.2), rgba(116, 255, 207, 0.08));
  color: #bfffd0;
  box-shadow: 0 0 22px rgba(72, 255, 128, 0.12);
}

.save-formula-button:hover {
  box-shadow: 0 0 24px rgba(72, 255, 128, 0.22);
}

.lookup-modal.hidden {
  display: none;
}

.lookup-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}

.lookup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 7, 0.82);
}

.lookup-dialog {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  margin: 0 auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(162, 48, 255, 0.08), rgba(25, 168, 255, 0.04)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.confirm-dialog {
  width: min(520px, calc(100vw - 32px));
}

.confirm-dialog .form-actions {
  justify-content: center;
  align-items: center;
}

.confirm-message p {
  margin: 0;
}

.lookup-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}

.lookup-results {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.lookup-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.lookup-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.lookup-item-main {
  width: 100%;
}

.lookup-item:hover {
  border-color: rgba(25, 168, 255, 0.42);
  box-shadow: 0 0 18px rgba(25, 168, 255, 0.16);
}

.lookup-item span:last-child {
  color: var(--muted);
}

.top-gap {
  margin-top: 18px;
}

.full-span {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

input[type="file"] {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(25, 168, 255, 0.42);
  background: linear-gradient(135deg, rgba(25, 168, 255, 0.18), rgba(162, 48, 255, 0.08));
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

input[type="file"]::-webkit-file-upload-button {
  margin-right: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(25, 168, 255, 0.42);
  background: linear-gradient(135deg, rgba(25, 168, 255, 0.18), rgba(162, 48, 255, 0.08));
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

input[type="text"],
input[type="search"],
textarea {
  text-transform: uppercase;
}

.compact-field {
  max-width: 20ch;
  width: 100%;
}

.medium-field {
  max-width: 25ch;
  width: 100%;
}

.tiny-field {
  max-width: 10ch;
  width: 100%;
}

.search-field {
  max-width: 35ch;
  width: 100%;
}

.search-input-wrap {
  position: relative;
  display: block;
  width: min(100%, 35ch);
}

.search-input-wrap .search-field {
  max-width: none;
  padding-right: 42px;
}

.search-clear-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(25, 168, 255, 0.32);
  background: rgba(8, 9, 13, 0.7);
  color: var(--cyan);
  font: 700 1.2rem/1 sans-serif;
  cursor: pointer;
}

.search-clear-button:hover,
.search-clear-button:focus-visible {
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(25, 168, 255, 0.25);
}

.data-form input[type="text"]:not(#materialLookupSearch):not(.search-field) {
  max-width: 50ch;
  width: 100%;
}

.search-label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 600;
}

.purchase-toolbar,
.purchase-summary {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.purchase-toolbar {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.purchase-summary {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.purchase-summary-card,
.purchase-order {
  padding: 14px;
  border: 1px solid rgba(73, 78, 174, 0.16);
  background: rgba(255, 255, 255, 0.025);
}

.purchase-order-text {
  min-height: 180px;
  resize: vertical;
  text-transform: none;
  white-space: pre-wrap;
}

.purchase-summary-card strong {
  display: block;
  margin: 8px 0 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 1.8rem;
}

.purchase-summary-card p {
  margin: 0;
  color: var(--muted);
}

.purchase-checkline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.purchase-checkline.compact {
  justify-content: center;
}

.purchase-checkline input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #ffee00;
}

.purchase-order-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.inventory-filters {
  display: grid;
  grid-template-columns: minmax(240px, 35ch) 180px;
  gap: 14px;
  align-items: end;
}

.embedded-inventory {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid rgba(25, 168, 255, 0.24);
}

.embedded-section-head {
  margin-bottom: 8px;
}

.purchase-invoice-form {
  gap: 20px;
}

.purchase-invoice-head {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(260px, 1.5fr) 170px 130px 170px 150px;
  gap: 12px;
  align-items: end;
}

.purchase-invoice-head label,
.purchase-item-entry label {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-weight: 700;
}

.supplier-ruc-field {
  position: relative;
}

.supplier-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: min(480px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(25, 168, 255, 0.45);
  background: #0c101a;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.55);
}

.supplier-suggestions button {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.supplier-suggestions button:hover,
.supplier-suggestions button:focus-visible {
  background: rgba(25, 168, 255, 0.12);
  outline: 1px solid var(--cyan);
}

.supplier-suggestions span {
  color: var(--muted);
}

.purchase-item-entry {
  display: grid;
  grid-template-columns: minmax(160px, 0.65fr) minmax(280px, 1.8fr) 150px 180px auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(25, 168, 255, 0.22);
  background: rgba(8, 9, 13, 0.42);
}

.purchase-line-actions {
  display: flex;
  gap: 8px;
}

.purchase-line-add,
.purchase-line-clear {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font: 800 1.4rem/1 "Rajdhani", sans-serif;
  cursor: pointer;
}

.purchase-line-add {
  border: 1px solid rgba(34, 197, 94, 0.72);
  background: rgba(34, 197, 94, 0.18);
  color: #65ff9a;
}

.purchase-line-clear {
  border: 1px solid rgba(255, 77, 109, 0.62);
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
}

.purchase-items-table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.purchase-items-table-wrap tfoot th {
  color: var(--yellow);
  text-align: right;
}

.empty-table-cell {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.purchase-save-actions {
  justify-content: flex-end;
}

.purchase-history-search-wrap {
  width: min(100%, 60ch);
}

.purchase-history-dialog {
  width: min(1480px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
}

.purchase-history-table-wrap {
  max-height: min(62vh, 610px);
  margin-top: 16px;
  overflow: auto;
}

.purchase-history-table {
  min-width: 1580px;
}

.purchase-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #17192c;
}

.purchase-history-table tbody tr:hover {
  background: rgba(116, 255, 207, 0.06);
}

.purchase-history-invoice-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.supplier-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(320px, 1.5fr) minmax(220px, 1fr) minmax(200px, 0.9fr);
  gap: 14px;
}

.supplier-list-section {
  margin-top: 30px;
}

.supplier-list-section .search-filter {
  width: min(100%, 42ch);
}

@media (max-width: 1280px) {
  .supplier-form-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .purchase-invoice-head {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .purchase-item-entry {
    grid-template-columns: minmax(160px, 0.7fr) minmax(240px, 1.5fr) 150px 180px;
  }

  .purchase-line-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .supplier-form-grid {
    grid-template-columns: 1fr;
  }

  .purchase-invoice-head,
  .purchase-item-entry {
    grid-template-columns: 1fr;
  }

  .purchase-line-actions,
  .purchase-save-actions {
    justify-content: stretch;
  }

  .purchase-line-add,
  .purchase-line-clear {
    width: 50%;
  }
}

.search-filter {
  grid-column: auto;
}

.status-filter {
  grid-column: auto;
  justify-self: start;
}

.cadastro-form label input:not(.compact-field),
.cadastro-form label select:not(.compact-field),
.cadastro-form label textarea:not(.compact-field) {
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: 1px solid var(--cyan);
  box-shadow: 0 0 0 4px rgba(73, 78, 174, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
  font-size: 1rem;
}

@keyframes warningPulse {
  0% {
    opacity: 1;
    box-shadow: 0 0 0 rgba(255, 77, 109, 0);
  }

  50% {
    opacity: 0.45;
    box-shadow: 0 0 16px rgba(255, 77, 109, 0.28);
  }

  100% {
    opacity: 1;
    box-shadow: 0 0 0 rgba(255, 77, 109, 0);
  }
}

.state-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  border: 1px solid rgba(73, 78, 174, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mini-button.danger {
  border-color: rgba(255, 77, 109, 0.35);
  color: var(--danger);
}

.state-ok {
  background: rgba(116, 255, 207, 0.12);
  color: var(--success);
}

.state-warning {
  background: rgba(255, 77, 109, 0.14);
  color: var(--danger);
  animation: warningPulse 1.35s ease-in-out infinite;
}

.state-danger {
  background: rgba(255, 243, 106, 0.12);
  color: var(--yellow);
}

.state-neutral {
  background: rgba(25, 168, 255, 0.1);
  color: var(--cyan);
}

.alert-list,
.stack-list,
.formula-list,
.timeline {
  display: grid;
  gap: 12px;
}

.formula-summary-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.formula-summary-actions {
  justify-content: flex-end;
  margin-bottom: 14px;
}

.presentation-library-card > h4 {
  margin-top: 0;
}

.alert-item,
.stack-item,
.formula-card,
.timeline-item {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.alert-item {
  border-left: 4px solid var(--danger);
}

.alert-item.warning {
  border-left-color: var(--danger);
  animation: warningPulse 1.35s ease-in-out infinite;
}

.alert-item.ok {
  border-left-color: var(--success);
}

.production-shortage-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.production-shortage-list li {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, max-content);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 77, 109, 0.22);
  background: rgba(255, 77, 109, 0.06);
}

.production-shortage-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.alert-item strong,
.stack-item strong,
.formula-card h4,
.timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.formula-card h4 {
  margin-top: 0;
  font-family: "Orbitron", sans-serif;
}

.formula-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

#formula-registradas .formula-card-title > span:first-child {
  font-family: "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.formula-link-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.formula-link-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 10px rgba(192, 226, 255, 0.16);
}

.formula-link-indicator.is-linked {
  color: var(--success);
  border-color: rgba(116, 255, 207, 0.2);
}

.formula-link-indicator.is-linked .formula-link-dot {
  background: var(--success);
  box-shadow: 0 0 12px rgba(116, 255, 207, 0.55);
}

.formula-link-indicator.is-unlinked {
  color: var(--warning);
  border-color: rgba(255, 226, 74, 0.22);
}

.formula-link-indicator.is-unlinked .formula-link-dot {
  background: var(--warning);
  box-shadow: 0 0 12px rgba(255, 226, 74, 0.4);
}

.formula-card-discontinued {
  border-color: rgba(255, 77, 109, 0.3);
  background: rgba(255, 77, 109, 0.06);
}

#formulaForm .accent-button.full {
  margin-top: 2px;
  max-width: 320px;
}

.formula-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.formula-meta span {
  padding: 5px 10px;
  border: 1px solid rgba(73, 78, 174, 0.15);
  color: var(--cyan);
}

.formula-cost-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.formula-cost-breakdown span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 243, 106, 0.12);
  color: var(--muted);
  font-size: 0.9rem;
}

.presentation-panel {
  margin-top: 12px;
  border: 1px solid rgba(73, 78, 174, 0.16);
  background: rgba(8, 16, 28, 0.5);
}

.presentation-panel summary {
  padding: 11px 12px;
  color: var(--yellow);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presentation-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 12ch minmax(180px, 1fr) 10ch minmax(180px, 1fr) 10ch auto;
  gap: 10px;
  align-items: end;
  padding: 0 12px 12px;
}

.presentation-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.presentation-form input,
.presentation-form select {
  max-width: none;
}

.presentation-save {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(116, 255, 207, 0.8);
  background: linear-gradient(135deg, rgba(116, 255, 207, 0.26), rgba(116, 255, 207, 0.05));
  color: var(--success);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
}

.presentation-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.presentation-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(260px, 1.5fr) minmax(120px, auto) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.presentation-item span,
.presentation-empty {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.presentation-item > strong {
  color: var(--yellow);
  font-family: "Orbitron", sans-serif;
}

.presentation-empty {
  margin: 0;
  padding: 4px 0;
}

.presentation-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px;
}

.presentation-dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.presentation-main-fields {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 0.35fr);
  gap: 12px;
}

.presentation-components-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.presentation-components-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.presentation-component-rows {
  display: grid;
  gap: 10px;
}

.presentation-component-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 14ch auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(25, 168, 255, 0.18);
  background: rgba(255, 255, 255, 0.025);
}

.presentation-component-row label {
  display: grid;
  gap: 6px;
}

.presentation-component-remove {
  min-height: 44px;
}

.presentation-component-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.presentation-component-add,
.presentation-component-remove {
  min-height: 44px;
  white-space: nowrap;
}

#presentationModal {
  z-index: 70;
}

#materialLookupModal,
#systemConfirmModal {
  z-index: 80;
}

@media (max-width: 720px) {
  .presentation-main-fields,
  .presentation-component-row {
    grid-template-columns: 1fr;
  }

  .presentation-components-head {
    align-items: stretch;
    flex-direction: column;
  }

  .presentation-component-remove {
    width: 100%;
  }
}

.formula-status-on {
  border-color: rgba(116, 255, 207, 0.24);
  color: var(--success);
}

.formula-status-off {
  border-color: rgba(255, 77, 109, 0.34);
  color: var(--danger);
  background: rgba(255, 77, 109, 0.08);
}

.formula-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.formula-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.formula-toggle-track {
  position: relative;
  width: 52px;
  height: 28px;
  border: 1px solid rgba(255, 77, 109, 0.34);
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.12);
  transition: 0.2s ease;
}

.formula-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 77, 109, 0.25);
  transition: 0.2s ease;
}

.formula-toggle input:checked + .formula-toggle-track {
  border-color: rgba(116, 255, 207, 0.34);
  background: rgba(116, 255, 207, 0.14);
}

.formula-toggle input:checked + .formula-toggle-track::after {
  transform: translateX(24px);
  background: var(--success);
  box-shadow: 0 0 12px rgba(116, 255, 207, 0.25);
}

.formula-toggle-label {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.production-preview {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  background: rgba(255, 255, 255, 0.02);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.production-inline-notice {
  margin-bottom: 12px;
}

.production-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.production-preview-head h4 {
  margin: 6px 0 0;
  font-family: "Orbitron", sans-serif;
}

.production-component-list {
  display: grid;
  gap: 10px;
}

.production-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 78, 174, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.production-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.production-progress-head strong {
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
}

.production-progress-head span {
  color: var(--cyan);
  font-weight: 700;
}

.production-progress-track {
  width: 100%;
  height: 10px;
  border: 1px solid rgba(73, 78, 174, 0.18);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.production-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(73, 78, 174, 0.96), rgba(116, 255, 207, 0.96));
  box-shadow: 0 0 16px rgba(73, 78, 174, 0.22);
}

.production-draft-info {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 243, 106, 0.18);
  background: rgba(255, 243, 106, 0.05);
}

.production-draft-info.hidden {
  display: none;
}

.production-draft-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.production-draft-head strong {
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
  color: var(--yellow);
}

.production-draft-head span {
  color: var(--muted);
}

.production-draft-info p {
  margin: 0;
  color: var(--text);
}

.production-component {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 180px;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.production-component.has-instruction {
  grid-template-columns: 32px minmax(340px, 0.9fr) minmax(280px, 1.1fr) 180px;
}

.production-component-alert {
  border-color: rgba(255, 77, 109, 0.26);
  background: rgba(255, 77, 109, 0.06);
  animation: warningPulse 1s ease-in-out infinite;
}

.production-component-checked {
  border-color: rgba(116, 255, 207, 0.24);
  background: rgba(116, 255, 207, 0.05);
}

.production-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  cursor: pointer;
}

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

.production-check-box {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(73, 78, 174, 0.28);
  background: rgba(8, 16, 28, 0.92);
  box-shadow: inset 0 0 0 1px rgba(73, 78, 174, 0.05);
}

.production-check input:checked + .production-check-box {
  border-color: rgba(116, 255, 207, 0.4);
  background: linear-gradient(135deg, rgba(116, 255, 207, 0.24), rgba(116, 255, 207, 0.08));
  box-shadow: 0 0 12px rgba(116, 255, 207, 0.18);
}

.production-check input:checked + .production-check-box::after {
  content: "";
  display: block;
  width: 7px;
  height: 12px;
  margin: 2px auto 0;
  border-right: 2px solid var(--success);
  border-bottom: 2px solid var(--success);
  transform: rotate(45deg);
}

.production-component strong {
  display: block;
  margin-bottom: 4px;
}

.production-needed {
  margin: 4px 0 6px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 243, 106, 0.14);
}

.production-adjustable-field,
.production-adjustment-note {
  display: grid;
  gap: 6px;
  margin: 6px 0;
  color: var(--muted);
  font-weight: 700;
}

.production-adjustable-field > span {
  display: grid;
  grid-template-columns: minmax(120px, 180px) auto;
  gap: 8px;
  align-items: center;
}

.production-adjustable-field input,
.production-adjustment-note input {
  max-width: 360px;
  padding: 9px 11px;
}

.production-adjustable-field input {
  border-color: rgba(255, 243, 106, 0.5);
}

.production-adjustable-field b {
  color: var(--yellow);
}

.production-adjustment-note input {
  text-transform: uppercase;
}

.production-instruction {
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: start;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border-left: 3px solid var(--cyan);
  background: rgba(25, 168, 255, 0.07);
  color: var(--text);
}

.production-instruction-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.production-instruction-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 4px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.production-instruction-list li::before {
  content: "-";
  color: var(--cyan);
  font-weight: 900;
}

.production-component-values {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  align-content: start;
}

.production-component-values span {
  color: var(--muted);
}

.stack-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stack-item span:last-child {
  color: var(--yellow);
  font-weight: 700;
}

.timeline-item {
  position: relative;
  padding-left: 18px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 18px rgba(73, 78, 174, 0.5);
}

@media (max-width: 1500px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 1250px) {
  body {
    font-size: 0.95rem;
  }

  .brand h1 {
    font-size: 2rem;
  }

  .panel h3,
  .status-card h2 {
    font-size: 1.55rem;
  }

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

  .formula-grid {
    grid-template-columns: minmax(260px, 1.4fr) minmax(150px, 1fr) minmax(150px, 1fr);
  }

  .formula-builder-head {
    align-items: start;
    flex-direction: column;
  }

  .ingredient-row {
    grid-template-columns: 1fr;
  }

  .ingredient-instruction {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .ingredient-order-controls {
    justify-content: start;
  }

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

  .presentation-save {
    grid-column: 1 / -1;
  }

  .presentation-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .production-shortage-list li {
    grid-template-columns: 1fr 1fr;
  }

  .production-preview-head,
  .production-component,
  .production-component.has-instruction {
    grid-template-columns: 1fr;
    display: grid;
  }

  .production-progress-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .production-check {
    margin-top: 0;
  }

  .production-component-values {
    justify-items: start;
    text-align: left;
  }

  .cadastro-grid {
    grid-template-columns: 160px minmax(260px, 1.8fr) minmax(160px, 1fr) repeat(2, minmax(110px, 0.8fr));
  }

  .cadastro-top {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .inline-quad {
    grid-template-columns: minmax(280px, 1.9fr) minmax(160px, 1fr) repeat(2, minmax(110px, 0.8fr));
  }

  .inline-triple {
      grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(120px, 1fr));
    }

  .production-layout {
    grid-template-columns: 1fr;
  }
  }

@media (max-width: 1080px) {
  body {
    font-size: 0.92rem;
  }

  .brand h1 {
    font-size: 1.8rem;
  }

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

  .cadastro-name,
  .cadastro-monthly,
  .cadastro-cost,
  .cadastro-track-stock {
    grid-column: auto;
  }

  .cadastro-top {
    grid-template-columns: 1fr;
    gap: 14px;
  }

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

  .inline-triple {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .page-shell,
  .panel-grid,
  .two-col-section {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle {
    display: inline-flex;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 40;
    border: 1px solid rgba(73, 78, 174, 0.24);
    background: rgba(8, 16, 28, 0.94);
    color: var(--text);
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(1, 7, 13, 0.64);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
    width: min(340px, 88vw);
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
  }

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

  .content {
    padding-top: 74px;
    padding-left: 20px;
    padding-right: 20px;
  }

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

  .hero h2 {
    max-width: 9ch;
    font-size: clamp(1.8rem, 4.8vw, 2.8rem);
  }

  .hero-actions {
    width: auto;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .kpi-card {
    min-height: 118px;
  }

  .kpi-card strong {
    font-size: 1.9rem;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  body {
    font-size: 0.9rem;
  }

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

  .data-form,
  .formula-grid,
  .cadastro-grid,
  .form-row,
  .cadastro-top,
  .inline-quad,
  .inline-triple {
    grid-template-columns: 1fr;
  }

  .inventory-filters {
    grid-template-columns: 1fr;
  }

  .purchase-toolbar,
  .purchase-summary {
    grid-template-columns: 1fr;
  }

  .formula-summary-toolbar,
  .presentation-library-card {
    grid-template-columns: 1fr;
  }

  .formula-summary-actions {
    justify-content: flex-start;
    margin-bottom: 0;
  }

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

  .security-layout,
  .security-grid,
  .permission-group-grid,
  .permission-denied-box,
  .system-popup-box {
    grid-template-columns: 1fr;
  }

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

  .production-shortage-list li {
    grid-template-columns: 1fr;
  }

  .search-filter,
  .status-filter {
    grid-column: auto;
  }

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

  .kpi-card {
    min-height: 104px;
  }

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

  .menu-toggle,
  .submenu-link,
  .mini-button {
    width: 100%;
  }

  .sidebar-toggle {
    top: 12px;
    right: 12px;
  }

  .panel,
  .hero,
  .status-card {
    padding: 16px;
  }

  .hero h2 {
    max-width: 9ch;
    font-size: clamp(1.6rem, 6vw, 2.4rem);
  }

  .hero p {
    max-width: 60ch;
  }

  .hero-actions {
    width: auto;
    display: flex;
    flex-wrap: wrap;
  }

  .hero-actions .accent-button,
  .hero-actions .ghost-button {
    width: auto;
  }

  .brand h1 {
    font-size: 1.65rem;
  }

  .panel h3,
  .status-card h2 {
    font-size: 1.35rem;
  }

  .kpi-card strong {
    font-size: 1.7rem;
  }

  .table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 0.88rem;
  }

  .content {
    padding: 68px 14px 14px;
  }

  .sidebar {
    width: min(300px, 92vw);
    padding: 16px;
  }

  .inline-quad,
  .inline-triple,
  .cadastro-top,
  .form-row,
  .data-form {
    gap: var(--form-gap);
  }

  .compact-field,
  .tiny-field,
  .medium-field,
  .data-form input[type="text"]:not(#materialLookupSearch):not(.search-field) {
    max-width: 100%;
  }

  .hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero h2 {
    font-size: clamp(1.45rem, 7vw, 2.1rem);
  }

  .hero-actions .accent-button,
  .hero-actions .ghost-button {
    width: 100%;
  }

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

  th,
  td {
    padding: 10px 8px;
    font-size: 0.84rem;
  }

  .lookup-dialog {
    width: calc(100vw - 20px);
    margin-top: 4vh;
    padding: 16px;
  }
}



/* Tema MVStar premium extraido del sitio de referencia: negro, azul neon, morado y dorado. */
.brand-logo-box {
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.34));
}

.brand-logo-image {
  filter: drop-shadow(0 0 12px rgba(25, 168, 255, 0.18)) drop-shadow(0 0 10px rgba(212, 165, 37, 0.18));
}

.brand-kicker,
.eyebrow,
.tag,
th {
  color: rgba(246, 247, 251, 0.88);
}

.content {
  background:
    linear-gradient(90deg, rgba(162, 48, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(25, 168, 255, 0.035), transparent 28%);
}

.panel,
.hero,
.status-card,
.lookup-dialog,
.purchase-summary-card,
.purchase-order,
.formula-card,
.presentation-panel {
  border-color: rgba(255, 255, 255, 0.12);
}

.panel:hover,
.kpi-card:hover,
.formula-card:hover,
.presentation-panel:hover {
  border-color: rgba(25, 168, 255, 0.34);
  box-shadow: var(--shadow), 0 0 30px rgba(25, 168, 255, 0.08);
}

.kpi-card::after,
.panel::after {
  background: radial-gradient(circle, rgba(25, 168, 255, 0.22), rgba(162, 48, 255, 0.1) 38%, transparent 70%);
}

.accent-button,
.entry-button,
.presentation-save,
.save-formula-button,
#purchaseGenerateOrder,
#backupExportButton {
  border-color: rgba(25, 168, 255, 0.72);
  background: linear-gradient(135deg, rgba(162, 48, 255, 0.34), rgba(25, 168, 255, 0.24));
  box-shadow: 0 10px 28px rgba(25, 168, 255, 0.12);
}

.ghost-button,
.add-ingredient-button,
.login-secondary-button,
#backupImportButton {
  border-color: rgba(212, 165, 37, 0.55);
  background: linear-gradient(135deg, rgba(212, 165, 37, 0.13), rgba(255, 255, 255, 0.028));
}

.menu-block.active .menu-toggle,
.presentation-panel summary,
.formula-linked-dot,
.auth-art pre {
  color: var(--yellow);
}

input:focus,
textarea:focus,
select:focus {
  outline: 1px solid rgba(25, 168, 255, 0.78);
  border-color: rgba(25, 168, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(25, 168, 255, 0.09);
}

.auth-dialog {
  background:
    linear-gradient(135deg, rgba(162, 48, 255, 0.1), rgba(25, 168, 255, 0.055)),
    var(--panel);
}

.auth-art {
  border-color: rgba(255, 77, 109, 0.36);
  background: rgba(255, 77, 109, 0.055);
}

.system-progress-fill,
.modal-timer-fill {
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
}

/* Variante azul descartada; se conserva aislada para referencia de diseño. */
@media not all {
body {
  background:
    radial-gradient(circle at 8% 0%, rgba(82, 90, 255, 0.2), transparent 30%),
    radial-gradient(circle at 96% 4%, rgba(143, 217, 251, 0.17), transparent 32%),
    radial-gradient(circle at 72% 105%, rgba(74, 181, 181, 0.12), transparent 30%),
    linear-gradient(180deg, #070a12 0%, #10182a 54%, #080b13 100%);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(7, 10, 18, 0.98), rgba(8, 12, 21, 0.99)),
    linear-gradient(135deg, rgba(82, 90, 255, 0.13), rgba(143, 217, 251, 0.07), rgba(74, 181, 181, 0.05));
}

.content {
  background:
    linear-gradient(90deg, rgba(82, 90, 255, 0.075), transparent 30%),
    linear-gradient(180deg, rgba(143, 217, 251, 0.035), transparent 28%);
}

.menu-toggle,
.submenu-link {
  border-color: rgba(109, 139, 192, 0.3);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.11), rgba(109, 139, 192, 0.07));
}

.menu-toggle:hover,
.submenu-link:hover,
.accent-button:hover,
.ghost-button:hover,
.entry-button:hover {
  box-shadow: 0 0 24px rgba(143, 217, 251, 0.2), 0 0 34px rgba(82, 90, 255, 0.12);
}

.menu-block.active .menu-toggle {
  border-color: rgba(74, 181, 181, 0.78);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.25), rgba(74, 181, 181, 0.15));
  color: var(--sky);
}

.submenu-link {
  border-color: rgba(109, 139, 192, 0.24);
}

.workspace-selected,
.workspace-card-tabs button[aria-pressed="true"] {
  color: var(--sky);
  border-color: var(--teal);
  background: rgba(82, 90, 255, 0.1);
}

.status-card,
.panel,
.hero,
.section-hero,
.lookup-dialog,
.workspace-dialog {
  background:
    linear-gradient(135deg, rgba(82, 90, 255, 0.1), rgba(109, 139, 192, 0.065), rgba(74, 181, 181, 0.025)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel);
  border-color: rgba(109, 139, 192, 0.3);
  box-shadow: var(--shadow), inset 0 0 32px rgba(143, 217, 251, 0.035);
}

.panel:hover,
.kpi-card:hover,
.formula-card:hover,
.presentation-panel:hover {
  border-color: rgba(143, 217, 251, 0.45);
  box-shadow: var(--shadow), 0 0 30px rgba(82, 90, 255, 0.11);
}

.kpi-card::after,
.panel::after {
  background: radial-gradient(circle, rgba(143, 217, 251, 0.2), rgba(82, 90, 255, 0.11) 38%, transparent 70%);
}

.accent-button,
.entry-button,
.presentation-save,
.save-formula-button,
#purchaseGenerateOrder,
#backupExportButton {
  border-color: rgba(143, 217, 251, 0.74);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.62), rgba(109, 139, 192, 0.34));
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(82, 90, 255, 0.16);
}

.ghost-button,
.add-ingredient-button,
.login-secondary-button,
#backupImportButton {
  border-color: rgba(74, 181, 181, 0.62);
  background: linear-gradient(135deg, rgba(74, 181, 181, 0.18), rgba(109, 139, 192, 0.08));
  color: var(--sky);
}

.ingredient-add {
  border-color: rgba(74, 181, 181, 0.66);
  background: linear-gradient(135deg, rgba(74, 181, 181, 0.24), rgba(143, 217, 251, 0.08));
  color: var(--sky);
}

.ingredient-remove {
  border-color: rgba(109, 139, 192, 0.56);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.2), rgba(109, 139, 192, 0.08));
  color: var(--sky);
}

.ingredient-drag-handle {
  border-color: rgba(74, 181, 181, 0.66);
  color: var(--sky);
  background: rgba(74, 181, 181, 0.09);
}

.ingredient-row.is-drag-target {
  border-color: var(--sky);
  box-shadow: inset 0 0 0 1px rgba(143, 217, 251, 0.42), 0 0 18px rgba(82, 90, 255, 0.14);
}

input:focus,
textarea:focus,
select:focus {
  outline: 1px solid rgba(143, 217, 251, 0.82);
  border-color: rgba(143, 217, 251, 0.76);
  box-shadow: 0 0 0 3px rgba(82, 90, 255, 0.14);
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  border-color: rgba(143, 217, 251, 0.55);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.38), rgba(109, 139, 192, 0.18));
}

.search-clear-button {
  border-color: rgba(143, 217, 251, 0.42);
  color: var(--sky);
}

.search-clear-button:hover,
.search-clear-button:focus-visible,
.lookup-item:hover {
  border-color: var(--sky);
  box-shadow: 0 0 16px rgba(82, 90, 255, 0.18);
}

.auth-dialog {
  background:
    linear-gradient(135deg, rgba(82, 90, 255, 0.15), rgba(143, 217, 251, 0.065)),
    var(--panel);
}

.auth-art,
.auth-art pre {
  border-color: rgba(74, 181, 181, 0.56);
  background: linear-gradient(135deg, rgba(82, 90, 255, 0.16), rgba(74, 181, 181, 0.09));
  color: var(--teal);
}

.brand-logo-image {
  filter: drop-shadow(0 0 12px rgba(143, 217, 251, 0.2)) drop-shadow(0 0 10px rgba(82, 90, 255, 0.2));
}

.system-progress-fill,
.modal-timer-fill,
#systemConfirmModal[data-mode="confirm"] .permission-alert-progress {
  background: linear-gradient(90deg, var(--indigo), var(--sky));
  box-shadow: 0 0 18px rgba(82, 90, 255, 0.22);
}
}

/* Aplicación final del estándar del sitio oficial. */
body {
  font-family: "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 4% 0%, rgba(162, 48, 255, 0.14), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(25, 168, 255, 0.12), transparent 28%),
    var(--bg);
}

body::before { display: none; }

.brand h1,
.hero h2,
.section-hero h2,
.panel h3,
.status-card h2,
.session-card strong,
.kpi-card strong,
.formula-builder-head h4,
.production-preview-head h4,
.production-draft-head strong,
.auth-copy h2,
.auth-art h3 {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.sidebar { background: rgba(8, 9, 13, 0.96); }
.content { background: transparent; }

.menu-toggle,
.submenu-link,
.status-card,
.panel,
.hero,
.section-hero,
.formula-builder,
.ingredient-row,
.production-preview,
.production-draft-box,
.lookup-dialog,
.workspace-dialog,
#materialEditor.material-editor-dialog,
.system-popup-box,
.permission-denied-box,
.session-card,
.kpi-card,
.production-component,
.production-instruction {
  clip-path: none;
  border-radius: 8px;
}

.status-card,
.panel,
.hero,
.section-hero,
.lookup-dialog,
.workspace-dialog {
  border-color: var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel:hover,
.kpi-card:hover,
.formula-card:hover,
.presentation-panel:hover {
  border-color: rgba(25, 168, 255, 0.42);
  box-shadow: var(--shadow);
}

.menu-toggle,
.submenu-link {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.menu-toggle:hover,
.submenu-link:hover {
  border-color: rgba(25, 168, 255, 0.55);
  background: rgba(25, 168, 255, 0.08);
}

.menu-block.active .menu-toggle {
  border-color: rgba(25, 168, 255, 0.7);
  background: linear-gradient(135deg, rgba(162, 48, 255, 0.24), rgba(25, 168, 255, 0.2));
}

.submenu-link.workspace-selected,
.workspace-selected {
  color: var(--text);
  border-color: var(--cyan);
  background: rgba(25, 168, 255, 0.1);
}

button,
input,
textarea,
select,
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font-family: inherit;
  border-radius: 8px;
  clip-path: none;
}

input,
textarea,
select {
  background: var(--card);
  border-color: var(--line);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
  border-color: var(--cyan);
  box-shadow: none;
}

.accent-button,
.entry-button,
.presentation-save,
.save-formula-button,
#purchaseGenerateOrder,
#backupExportButton,
.login-primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(25, 168, 255, 0.18);
}

.accent-button:hover,
.entry-button:hover,
.presentation-save:hover,
.save-formula-button:hover,
#purchaseGenerateOrder:hover,
#backupExportButton:hover,
.login-primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(25, 168, 255, 0.26);
}

.ghost-button,
.mini-button,
.workspace-card-tabs button,
.lookup-item,
.login-secondary-button,
#backupImportButton {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.ghost-button:hover,
.mini-button:hover,
.workspace-card-tabs button:hover,
.lookup-item:hover {
  border-color: var(--cyan);
  box-shadow: none;
}

.tag,
.eyebrow,
.brand-kicker {
  color: var(--yellow);
  font-weight: 900;
}

.formula-builder,
.ingredient-row,
.production-preview,
.production-draft-box,
.production-component,
.ingredient-adjustable,
.session-card {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.ingredient-drag-handle {
  border-radius: 8px;
  border-color: rgba(212, 165, 37, 0.55);
  background: rgba(212, 165, 37, 0.08);
  color: var(--yellow);
}

.ingredient-add {
  border-color: rgba(25, 168, 255, 0.55);
  background: rgba(25, 168, 255, 0.1);
  color: var(--cyan);
}

.ingredient-remove,
.danger {
  border-color: rgba(255, 119, 119, 0.45);
  background: rgba(255, 119, 119, 0.08);
  color: #ff9b9b;
}

.production-instruction {
  border-radius: 0 8px 8px 0;
  border-left-color: var(--cyan);
  background: rgba(25, 168, 255, 0.08);
  padding: 0 14px 11px;
}

table thead,
th { color: var(--muted); }
tbody tr:hover { background: rgba(25, 168, 255, 0.045); }

/* Relieve suave compartido por los botones, conservando sus colores y estados. */
button:not([data-keep-shape]) {
  clip-path: none;
}

button:not(:disabled) {
  box-shadow: 5px 5px 11px rgba(0, 0, 0, 0.38),
    -3px -3px 9px rgba(255, 255, 255, 0.055),
    inset 1px 1px 0 rgba(255, 255, 255, 0.08);
  transition: box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

button:not(:disabled):hover,
button#purchaseGenerateOrder:not(:disabled):hover,
button#backupExportButton:not(:disabled):hover {
  transform: none;
  box-shadow: 6px 6px 14px rgba(0, 0, 0, 0.44),
    -4px -4px 10px rgba(255, 255, 255, 0.075),
    inset 1px 1px 0 rgba(255, 255, 255, 0.11);
}

button:not(:disabled):active,
button[aria-pressed="true"],
.menu-block.active > button.menu-toggle,
button.submenu-link.workspace-selected {
  transform: none;
  box-shadow: inset 4px 4px 9px rgba(0, 0, 0, 0.38),
    inset -3px -3px 8px rgba(255, 255, 255, 0.055);
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  button:not(:disabled) { transition: none; }
}

/* Vidrio limitado al dashboard y a la tarjeta de usuario. */
#dashboard .hero,
#dashboard .panel,
.sidebar .status-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.018) 58%),
    linear-gradient(145deg, rgba(34, 49, 71, 0.78), rgba(18, 25, 38, 0.84));
  border: 1px solid rgba(193, 218, 239, 0.18);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}

#dashboard .hero {
  background:
    linear-gradient(110deg, rgba(25, 168, 255, 0.1), transparent 55%),
    linear-gradient(145deg, rgba(36, 48, 67, 0.78), rgba(18, 25, 38, 0.84));
}

#dashboard .panel:hover {
  border-color: rgba(100, 198, 255, 0.42);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sidebar .status-card {
  background:
    linear-gradient(135deg, rgba(25, 168, 255, 0.1), transparent 60%),
    linear-gradient(145deg, rgba(39, 50, 68, 0.82), rgba(20, 26, 38, 0.88));
}

/* Superficies de vidrio del resto del sistema. */
.content .view-section:not(#dashboard) .panel,
.content .view-section:not(#dashboard) .hero,
.content .view-section:not(#dashboard) .section-hero,
.lookup-dialog,
.workspace-dialog,
#materialEditor.material-editor-dialog,
.purchase-summary-card,
.purchase-order,
.formula-card,
.presentation-panel,
.formula-builder,
.ingredient-row,
.production-preview,
.production-draft-box,
.production-component:not(.production-component-alert):not(.production-component-checked),
.session-card,
.permission-group,
.workspace-metrics > div,
.invoice-import-line {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.015) 58%),
    linear-gradient(145deg, rgba(34, 49, 71, 0.82), rgba(18, 25, 38, 0.9));
  border-color: rgba(193, 218, 239, 0.18);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}

.content .view-section:not(#dashboard) .panel:hover,
.formula-card:hover,
.presentation-panel:hover {
  border-color: rgba(100, 198, 255, 0.42);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Los colores de advertencia y chequeo siguen indicando su estado. */
.production-component-alert,
.production-component-checked,
.alert-item,
.stack-item,
.timeline-item {
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 8px 22px rgba(0, 0, 0, 0.18);
}

.production-component.production-component-alert {
  border-color: rgba(255, 110, 130, 0.5);
  background: linear-gradient(135deg, rgba(114, 43, 61, 0.45), rgba(30, 25, 38, 0.88));
}

.production-component.production-component-checked:not(.production-component-alert) {
  border-color: rgba(116, 255, 207, 0.42);
  background: linear-gradient(135deg, rgba(38, 102, 89, 0.4), rgba(20, 34, 39, 0.88));
}


