:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #101827;
  --muted: #5f6b7a;
  --line: #dde5ee;
  --navy: #071829;
  --cyan: #0284c7;
  --teal: #0f766e;
  --orange: #f97316;
  --magenta: #c026d3;
  --lime: #65a30d;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --glow-cyan: rgba(34, 211, 238, 0.28);
  --glow-teal: rgba(45, 212, 191, 0.22);
  --glow-warm: rgba(249, 115, 22, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.09), transparent 28%),
    linear-gradient(315deg, rgba(249, 115, 22, 0.07), transparent 30%),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 58%, #eef8f6 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

body.is-loading {
  overflow: hidden;
}

.ambient-tech {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-tech::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(2, 132, 199, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
  animation: gridDrift 24s linear infinite;
}

.ambient-tech::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 38%, rgba(34, 211, 238, 0.14) 49%, transparent 62% 100%);
  transform: translateX(-110%);
  animation: scanSweep 9s var(--ease-out) infinite;
}

.ambient-tech span {
  position: absolute;
  height: 1px;
  width: min(36vw, 420px);
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.42), rgba(249, 115, 22, 0.26), transparent);
  opacity: 0.7;
  --signal-angle: 0deg;
  transform-origin: left center;
  animation: signalRun 7s linear infinite;
}

.ambient-tech span:nth-child(1) {
  top: 14%;
  left: 42%;
}

.ambient-tech span:nth-child(2) {
  top: 57%;
  left: 10%;
  width: min(45vw, 540px);
  animation-delay: -2.8s;
  --signal-angle: 7deg;
}

.ambient-tech span:nth-child(3) {
  right: 7%;
  bottom: 12%;
  width: min(32vw, 360px);
  animation-delay: -4.5s;
  --signal-angle: -11deg;
}

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #e6faff;
  background:
    linear-gradient(145deg, rgba(8, 18, 32, 0.98), rgba(4, 17, 31, 0.94)),
    #04111f;
  transition: opacity 0.42s ease, visibility 0.42s ease;
}

body:not(.is-loading) .boot-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-loader::before {
  content: "";
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.1) 1px, transparent 1px);
  background-size: 52px 52px;
  transform: perspective(600px) rotateX(62deg) translateY(11%);
  animation: gridDrift 10s linear infinite;
}

.boot-matrix {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 28px,
      rgba(34, 211, 238, 0.06) 29px 30px,
      transparent 31px 64px
    );
  animation: matrixShift 1.8s steps(8) infinite;
  opacity: 0.75;
}

.boot-card {
  position: relative;
  width: min(320px, calc(100vw - 44px));
  min-height: 330px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: var(--radius);
  background: rgba(5, 20, 35, 0.72);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42), 0 0 60px rgba(34, 211, 238, 0.15);
  backdrop-filter: blur(18px);
}

.boot-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.14), transparent),
    linear-gradient(180deg, rgba(249, 115, 22, 0.12), transparent 35%);
  transform: translateX(-115%);
  animation: scanSweep 2.6s ease-in-out infinite;
}

.boot-logo {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.35), 0 0 30px rgba(34, 211, 238, 0.24);
  z-index: 1;
}

.boot-core {
  position: relative;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  z-index: 1;
}

.boot-core::before,
.boot-core::after,
.boot-core span {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.boot-core::before {
  background: conic-gradient(from 0deg, #22d3ee, #65a30d, #f97316, #c026d3, #22d3ee);
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  animation: loaderSpin 1.2s linear infinite;
}

.boot-core::after {
  inset: 22px;
  border: 1px solid rgba(125, 211, 252, 0.38);
  box-shadow: inset 0 0 26px rgba(34, 211, 238, 0.16), 0 0 26px rgba(249, 115, 22, 0.1);
  animation: corePulse 1.7s ease-in-out infinite;
}

.boot-core span {
  inset: 14px;
  border: 1px dashed rgba(229, 247, 255, 0.32);
  animation: loaderSpin 4.2s linear infinite reverse;
}

.boot-core span:nth-child(2) {
  inset: 34px;
  border-style: solid;
  border-color: rgba(101, 163, 13, 0.36);
  animation-duration: 2.8s;
}

.boot-core span:nth-child(3) {
  inset: 47px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.9), rgba(34, 211, 238, 0.1) 64%, transparent 70%);
  animation: corePulse 1.1s ease-in-out infinite;
}

.boot-card p {
  margin: 0;
  color: #d9f6ff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  z-index: 1;
}

.boot-progress {
  position: relative;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.13);
  z-index: 1;
}

.boot-progress span {
  position: absolute;
  inset: 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #65a30d, #f97316);
  animation: progressFlow 1.25s var(--ease-out) infinite;
}

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

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: opacity 0.42s ease, transform 0.42s var(--ease-out), filter 0.42s ease;
}

body.is-loading .app-shell {
  opacity: 0;
  filter: blur(4px);
  transform: translateY(12px) scale(0.99);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.1), transparent 22%),
    linear-gradient(160deg, #04111f 0%, var(--navy) 58%, #09241f 100%);
  color: #f8fbff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
  animation: gridDrift 18s linear infinite;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 0 40%, rgba(34, 211, 238, 0.12) 48%, transparent 58% 100%);
  transform: translateX(-120%);
  animation: scanSweep 7.2s ease-in-out infinite;
}

.brand {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  position: relative;
}

.brand-logo {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #12263a;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.22), 0 0 28px rgba(34, 211, 238, 0.18);
  animation: brandWake 0.7s var(--ease-out) both;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.2;
}

.brand span {
  color: #a9bdd3;
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-link,
.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.file-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.18s var(--ease-out),
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.nav-link::before,
.icon-button::before,
.primary-button::before,
.secondary-button::before,
.danger-button::before,
.file-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 0 32%, rgba(255, 255, 255, 0.32) 48%, transparent 64% 100%);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
}

.nav-link:hover::before,
.icon-button:hover::before,
.primary-button:hover::before,
.secondary-button:hover::before,
.danger-button:hover::before,
.file-button:hover::before {
  transform: translateX(120%);
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

button:active,
.file-button:active {
  transform: translateY(0) scale(0.98);
}

.nav-link {
  width: 100%;
  justify-content: flex-start;
  color: #dce8f6;
  background: transparent;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(2, 132, 199, 0.24);
  border-color: rgba(125, 211, 252, 0.42);
  box-shadow: 0 12px 34px rgba(2, 132, 199, 0.12);
}

.nav-link.is-active {
  color: #ffffff;
  animation: activeNavPulse 2.8s ease-in-out infinite;
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #22d3ee, #65a30d, #f97316);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.58);
}

.nav-link svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg,
.danger-button svg,
.file-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.workspace {
  padding: 24px;
  min-width: 0;
  animation: workspaceEnter 0.58s var(--ease-out) 0.12s both;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 2.4vw, 2.45rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.16rem;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.header-actions,
.form-actions,
.item-toolbar,
.backup-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #0284c7, #0f766e 62%, #65a30d);
  border-color: rgba(2, 132, 199, 0.75);
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, #0369a1, #0f766e 56%, #f97316);
  box-shadow: 0 16px 36px rgba(15, 118, 110, 0.22);
}

.secondary-button,
.icon-button,
.file-button {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.secondary-button:hover,
.icon-button:hover,
.file-button:hover {
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 13px 28px rgba(15, 23, 42, 0.09), 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.danger-button {
  background: #fff5f5;
  color: var(--danger);
  border-color: #fecaca;
}

.danger-button:hover {
  border-color: #fb7185;
  box-shadow: 0 13px 28px rgba(220, 38, 38, 0.12);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: viewEnter 0.42s var(--ease-out) both;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
    var(--panel);
  border: 1px solid rgba(191, 207, 224, 0.84);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(34, 211, 238, 0.14), transparent 22%, rgba(249, 115, 22, 0.1) 74%, transparent),
    linear-gradient(180deg, rgba(34, 211, 238, 0.08), transparent 34%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.stat-card:hover,
.panel:hover {
  border-color: rgba(2, 132, 199, 0.32);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(34, 211, 238, 0.08);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card:hover::before,
.panel:hover::before {
  opacity: 1;
}

.stat-card {
  min-height: 90px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 8px;
  border-top: 4px solid var(--teal);
  animation: statRise 0.42s var(--ease-out) both;
}

.stat-card:nth-child(1) {
  animation-delay: 0.04s;
}

.stat-card:nth-child(2) {
  border-top-color: var(--orange);
  animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
  border-top-color: var(--magenta);
  animation-delay: 0.16s;
}

.stat-card.accent {
  border-top-color: var(--lime);
  animation-delay: 0.22s;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card strong {
  font-size: 1.55rem;
  animation: numberPop 0.45s var(--ease-out) both;
}

.documents-layout {
  display: grid;
  grid-template-columns: minmax(390px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.inventory-filter {
  margin-bottom: 18px;
}

.inventory-panel table {
  min-width: 620px;
}

.full-inventory-panel {
  grid-column: 1 / -1;
}

.full-inventory-panel table {
  min-width: 760px;
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.55fr) minmax(520px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
  animation: panelEnter 0.48s var(--ease-out) both;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 0.78rem;
  color: #0f5132;
  background: linear-gradient(135deg, #d1fae5, #cffafe);
  border: 1px solid rgba(15, 118, 110, 0.16);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
  animation: pillPulse 2.4s ease-in-out infinite;
}

.form-grid,
.item-grid,
.settings-grid {
  display: grid;
  gap: 13px;
}

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

.item-grid {
  grid-template-columns: 1.05fr 1.3fr 0.75fr 0.85fr;
  margin-top: 12px;
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
  display: grid;
  gap: 12px;
}

legend {
  padding: 0 6px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: #263244;
  font-weight: 700;
  font-size: 0.86rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 41px;
  border: 1px solid #ccd7e4;
  border-radius: var(--radius);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.95)),
    #ffffff;
  padding: 10px 11px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16), 0 10px 24px rgba(2, 132, 199, 0.08);
  transform: translateY(-1px);
}

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

.item-builder,
.line-items,
.notes-label {
  margin-top: 16px;
}

.item-toolbar select {
  flex: 1 1 240px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  font-size: 0.91rem;
}

tbody tr {
  transition: background 0.16s ease, transform 0.16s var(--ease-out), box-shadow 0.16s ease;
}

tbody tr:not(:has(.empty-row)) {
  animation: rowEnter 0.28s var(--ease-out) both;
}

tbody tr:not(:has(.empty-row)):hover {
  background: rgba(236, 253, 245, 0.72);
  box-shadow: inset 3px 0 0 rgba(34, 211, 238, 0.72);
  transform: translateX(2px);
}

.item-name {
  font-weight: 800;
}

.item-description {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.empty-row {
  color: var(--muted);
  text-align: center;
  padding: 22px 8px;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.search-input {
  max-width: 260px;
}

.saved-documents {
  margin-top: 18px;
}

.preview-panel {
  position: sticky;
  top: 24px;
}

.document-preview {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(34, 211, 238, 0.06), transparent 20%),
    #ffffff;
  border: 1px solid #d7e0eb;
  min-height: 720px;
  padding: 30px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
  color: #162133;
}

.document-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(2, 132, 199, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2, 132, 199, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 65%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 65%);
}

.pdf-document {
  position: relative;
  z-index: 1;
  animation: documentMaterialize 0.38s var(--ease-out) both;
}

.doc-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 0.8fr);
  gap: 22px;
  align-items: start;
  border-bottom: 4px solid var(--doc-color, var(--cyan));
  padding-bottom: 16px;
}

.doc-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.doc-logo {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 6px;
}

.doc-logo.logo-compact {
  width: 72px;
  height: 72px;
}

.doc-logo.logo-wide {
  width: 118px;
  height: 118px;
}

.doc-brand h3 {
  font-size: 1.3rem;
  margin-bottom: 5px;
}

.doc-meta {
  text-align: right;
}

.doc-type {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  color: #ffffff;
  background: var(--doc-color, var(--cyan));
  border-radius: 6px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--doc-color, var(--cyan)) 28%, transparent);
}

.doc-slogan {
  color: var(--doc-color, var(--cyan));
  font-weight: 800;
  margin: 12px 0 0;
}

.doc-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 24px 0;
}

.doc-box {
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  padding: 13px;
}

.doc-box h4 {
  margin: 0 0 9px;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
}

.doc-box p {
  margin: 4px 0;
  line-height: 1.35;
}

.doc-table {
  margin-top: 10px;
}

.doc-table th {
  background: #eef5fb;
  border-bottom: 1px solid #cdddeb;
  color: #1f2a3d;
}

.doc-table td,
.doc-table th {
  padding: 10px;
}

.doc-table .numeric,
.totals-table .numeric {
  text-align: right;
}

.doc-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.doc-notes,
.doc-terms {
  color: #334155;
  line-height: 1.45;
}

.doc-notes strong,
.doc-terms strong {
  display: block;
  margin-bottom: 5px;
}

.totals-table {
  width: 100%;
}

.totals-table td {
  border-bottom: 1px solid #e5edf5;
}

.totals-table .grand-total td {
  border-bottom: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--doc-color, var(--cyan)), #0f766e);
  font-weight: 900;
}

.doc-footer {
  border-top: 1px solid #dbe4ee;
  margin-top: 26px;
  padding-top: 14px;
  color: #475569;
  line-height: 1.45;
}

.settings-panel {
  max-width: 1200px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(8, 47, 73, 0.98)),
    #0f172a;
  border-radius: var(--radius);
  border: 1px solid rgba(125, 211, 252, 0.22);
  box-shadow: var(--shadow), 0 0 38px rgba(34, 211, 238, 0.16);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
  animation: toastGlow 2.2s ease-in-out infinite;
}

@keyframes gridDrift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 46px 46px, 46px 46px;
  }
}

@keyframes matrixShift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 128px 0;
  }
}

@keyframes scanSweep {
  0% {
    transform: translateX(-120%);
    opacity: 0;
  }
  18%,
  62% {
    opacity: 1;
  }
  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

@keyframes signalRun {
  0% {
    opacity: 0;
    transform: rotate(var(--signal-angle)) translateX(-42%);
  }
  18%,
  78% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--signal-angle)) translateX(118%);
  }
}

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

@keyframes corePulse {
  0%,
  100% {
    opacity: 0.64;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

@keyframes progressFlow {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(245%);
  }
}

@keyframes brandWake {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes activeNavPulse {
  0%,
  100% {
    box-shadow: 0 12px 34px rgba(2, 132, 199, 0.12);
  }
  50% {
    box-shadow: 0 12px 34px rgba(2, 132, 199, 0.12), 0 0 0 3px rgba(34, 211, 238, 0.08);
  }
}

@keyframes workspaceEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes statRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes numberPop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rowEnter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes documentMaterialize {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pillPulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 211, 238, 0.13);
  }
}

@keyframes toastGlow {
  0%,
  100% {
    box-shadow: var(--shadow), 0 0 38px rgba(34, 211, 238, 0.16);
  }
  50% {
    box-shadow: var(--shadow), 0 0 48px rgba(249, 115, 22, 0.2);
  }
}

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

@media (max-width: 1180px) {
  .documents-layout,
  .inventory-grid,
  .catalog-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-link {
    justify-content: center;
  }

  .nav-link.is-active::after {
    left: 50%;
    top: auto;
    bottom: 4px;
    width: 34px;
    height: 3px;
    transform: translateX(-50%);
  }

  .workspace {
    padding: 16px;
  }

  .workspace-header,
  .view.is-active {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

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

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

  .form-grid,
  .item-grid,
  .doc-header,
  .doc-info-grid,
  .doc-summary {
    grid-template-columns: 1fr;
  }

  .doc-meta {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .brand {
    grid-template-columns: 56px 1fr;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .main-nav {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .form-actions,
  .item-toolbar,
  .backup-actions,
  .row-actions {
    width: 100%;
    gap: 8px;
  }

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

  .header-actions > *,
  .form-actions > *,
  .item-toolbar > *,
  .backup-actions > * {
    min-width: 0;
    flex: 1 1 0;
  }

  .header-actions > * {
    width: 100%;
  }

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

  .document-preview {
    padding: 18px;
    min-height: auto;
  }
}
