@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f5f8fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-solid: #ffffff;
  --surface-2: #f5f8fb;
  --ink: #0b1220;
  --muted: #697f92;
  --line: rgba(215, 224, 232, 0.92);
  --brand: #011c44;
  --brand-deep: #011036;
  --brand-2: #00b65f;
  --brand-3: #00b65f;
  --income: #00b65f;
  --expense: #e5484d;
  --profit: #011c44;
  --stock: #011c44;
  --shadow: 0 8px 24px rgba(1, 28, 68, 0.08);
  --shadow-soft: 0 8px 18px rgba(1, 28, 68, 0.07);
  --radius: 16px;
  --radius-button: 12px;
  --nav-width: 260px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Noto Sans, Arial, Helvetica, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.45;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

body::before {
  content: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  display: block;
  min-height: 100vh;
}

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 72px;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  color: #f8fbfc;
  box-shadow: 0 8px 24px rgba(1, 28, 68, 0.16);
  backdrop-filter: none;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 212px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 224, 232, 0.92);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(1, 28, 68, 0.16);
}

.brand-mark svg,
.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: none;
}

.brand-mark img {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
}

.brand-mark .djate-d {
  fill: #00285c;
}

.brand-mark .djate-green {
  fill: #00bf63;
}

.brand-name,
.brand-subtitle,
.eyebrow,
.metric-tile p,
.panel h2,
.operation-card p,
.product-card p {
  margin: 0;
}

.brand-name {
  font-size: 1.08rem;
  font-weight: 800;
}

.brand-subtitle {
  color: rgba(248, 251, 252, 0.72);
  font-size: 0.84rem;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item {
  position: relative;
  overflow: hidden;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  color: rgba(248, 251, 252, 0.72);
  background: transparent;
  text-align: left;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: auto 14px 6px;
  height: 3px;
  width: auto;
  border-radius: 999px;
  background: var(--brand-3);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

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

.nav-item .icon,
.icon-button .icon,
.primary-action .icon,
.secondary-action .icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.assist-strip {
  margin-left: auto;
  display: flex;
  gap: 10px;
  padding: 12px;
  min-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.12);
}

.assist-strip strong,
.assist-strip span {
  display: block;
}

.assist-strip strong {
  font-size: 0.9rem;
}

.assist-strip span {
  margin-top: 2px;
  color: rgba(248, 251, 252, 0.72);
  font-size: 0.78rem;
}

.main-area {
  min-width: 0;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 34px;
}

.top-bar {
  position: sticky;
  top: 72px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 24px;
  padding: 16px 0;
  background: transparent;
  isolation: isolate;
}

.top-bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: -1;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(1, 28, 68, 0.04);
  pointer-events: none;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: 2.05rem;
  font-weight: 800;
  line-height: 1.12;
}

.top-actions,
.inline-tools,
.form-actions,
.data-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.form-actions,
.data-actions {
  flex-wrap: wrap;
}

.icon-button,
.primary-action,
.secondary-action,
.text-button,
.segment,
.period-button {
  min-height: 42px;
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.icon-button:hover,
.primary-action:hover,
.secondary-action:hover,
.text-button:hover,
.segment:hover,
.period-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 44px;
  display: grid;
  place-items: center;
  background: var(--surface-solid);
  border-color: var(--line);
  color: var(--brand);
  box-shadow: var(--shadow-soft);
}

.icon-button.subtle {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: none;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-action {
  background: var(--brand-2);
  color: #ffffff;
  border-color: rgba(0, 158, 82, 0.4);
  box-shadow: 0 12px 24px rgba(0, 182, 95, 0.2);
}

.install-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid rgba(1, 28, 68, 0.12);
  border-radius: var(--radius-button);
  padding: 0 13px;
  background: #ffffff;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.install-action:hover {
  transform: translateY(-1px);
}

.install-action.installed {
  border-color: rgba(0, 158, 82, 0.28);
  background: rgba(0, 158, 82, 0.08);
  color: var(--brand-2);
  box-shadow: none;
}

.install-action.installing,
.install-action:disabled {
  cursor: progress;
  opacity: 0.72;
  transform: none;
}

.install-action img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.install-action[hidden] {
  display: none;
}

.secondary-action {
  background: var(--surface-solid);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 8px 18px rgba(1, 28, 68, 0.05);
}

.secondary-action.danger {
  color: var(--expense);
}

.primary-action.full {
  width: 100%;
}

.secondary-action.full {
  width: 100%;
}

.stacked-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.text-button {
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 0.32s ease both;
}

.period-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.period-bar,
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-button);
  background: #eef3f7;
  box-shadow: inset 0 0 0 1px var(--line);
}

.period-bar {
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.custom-range,
.history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  animation: riseIn 0.5s ease both;
}

.custom-range label {
  min-width: 150px;
  max-width: 180px;
}

.period-button,
.segment {
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.period-button.active,
.segment.active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

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

.metric-tile,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-tile {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: riseIn 0.52s ease both;
  transform-origin: center bottom;
}

.metric-tile::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--brand-2);
  opacity: 0.92;
}

.metric-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(1, 28, 68, 0.1);
}

.metric-tile:nth-child(2) {
  animation-delay: 0.04s;
}

.metric-tile:nth-child(3) {
  animation-delay: 0.08s;
}

.metric-tile:nth-child(4) {
  animation-delay: 0.12s;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}

.metric-tile p {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric-tile strong {
  margin-top: 8px;
  font-size: 1.48rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-tile.income .metric-icon {
  background: rgba(0, 182, 95, 0.12);
  color: var(--income);
}

.metric-tile.income::after {
  background: linear-gradient(90deg, var(--income), var(--brand-2));
}

.metric-tile.expense .metric-icon {
  background: rgba(229, 72, 77, 0.12);
  color: var(--expense);
}

.metric-tile.expense::after {
  background: var(--expense);
}

.metric-tile.profit .metric-icon {
  background: rgba(1, 28, 68, 0.1);
  color: var(--profit);
}

.metric-tile.profit::after {
  background: linear-gradient(90deg, var(--profit), var(--brand-3));
}

.metric-tile.stock .metric-icon {
  background: rgba(1, 28, 68, 0.1);
  color: var(--stock);
}

.metric-tile.stock::after {
  background: linear-gradient(90deg, var(--stock), var(--brand-2));
}

@media (min-width: 1101px) {
  .metric-grid {
    grid-template-columns: 1.28fr 1fr 1fr;
    grid-auto-rows: minmax(132px, auto);
  }

  .metric-tile.income {
    grid-row: span 2;
    min-height: 286px;
  }

  .metric-tile.income .metric-icon {
    width: 50px;
    height: 50px;
  }

  .metric-tile.income strong {
    font-size: 2.18rem;
  }

  .metric-tile.stock {
    grid-column: span 2;
  }
}

.dashboard-layout,
.work-layout,
.settings-layout,
.report-grid,
.documents-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

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

.panel {
  padding: 16px;
  min-width: 0;
  animation: panelIn 0.52s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.panel:hover {
  border-color: rgba(0, 182, 95, 0.26);
  box-shadow: 0 16px 36px rgba(1, 28, 68, 0.09);
}

.panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 1rem;
  line-height: 1.15;
}

.panel-head span,
.stock-summary {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.category-bars,
.watch-list,
.operation-list,
.report-lines,
.simple-table,
.product-grid,
.service-flow,
.result-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.6fr) minmax(0, 1fr) minmax(90px, auto);
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.bar-label {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ecea;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-2), var(--brand-3));
  transform-origin: left center;
  animation: growBar 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bar-value {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.empty-state {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  border: 1px dashed rgba(105, 127, 146, 0.32);
}

.watch-item,
.operation-card,
.product-card,
.report-line,
.table-row,
.result-line {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.watch-item:hover,
.operation-card:hover,
.product-card:hover,
.report-line:hover,
.table-row:hover,
.result-line:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 182, 95, 0.28);
  box-shadow: var(--shadow-soft);
}

.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.watch-item strong,
.operation-card strong,
.product-card strong {
  display: block;
}

.watch-item small,
.operation-card span,
.product-card span {
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf4ee;
  color: var(--income);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.warning {
  background: #fff4dc;
  color: var(--profit);
}

.status-pill.danger {
  background: #fdeceb;
  color: var(--expense);
}

.operation-list.compact .operation-card:nth-child(n + 6) {
  display: none;
}

.operation-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) minmax(136px, auto);
  gap: 10px;
  align-items: center;
  padding: 12px;
  animation: riseIn 0.34s ease both;
}

.operation-type-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.12);
}

.operation-type-icon.income {
  background: var(--income);
}

.operation-type-icon.expense {
  background: var(--expense);
}

.operation-main {
  min-width: 0;
}

.operation-meta,
.operation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.operation-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.operation-main strong,
.operation-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}

.operation-amount {
  display: grid;
  gap: 4px;
  justify-items: end;
  white-space: normal;
  text-align: right;
}

.operation-amount strong.income {
  color: var(--income);
}

.operation-amount strong.expense {
  color: var(--expense);
}

.delete-operation,
.edit-product,
.receipt-operation {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.receipt-operation {
  color: var(--brand);
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

form > * {
  min-width: 0;
}

.field-hint {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.operation-batch {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(1, 28, 68, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.operation-batch[hidden] {
  display: none;
}

.batch-head,
.batch-row,
.batch-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-head,
.batch-row {
  justify-content: space-between;
}

.batch-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.batch-list {
  display: grid;
  gap: 8px;
}

.batch-group {
  display: grid;
  gap: 7px;
}

.batch-group h3 {
  margin: 4px 0 0;
  color: var(--brand);
  font-size: 0.82rem;
  line-height: 1.2;
}

.batch-row {
  min-width: 0;
  padding: 9px;
  border-radius: 12px;
  background: var(--surface-2);
}

.batch-row div:first-child {
  min-width: 0;
}

.batch-row strong,
.batch-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.batch-row-side {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.batch-row-side span {
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  width: 100%;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input,
select {
  min-height: 44px;
}

textarea {
  min-height: 112px;
  padding-top: 10px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-2);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 182, 95, 0.14);
}

.search-input {
  width: min(220px, 44vw);
}

.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.product-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  animation: riseIn 0.42s ease both;
}

.product-card-head,
.product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.product-stat {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.product-stat span {
  font-size: 0.74rem;
  font-weight: 800;
}

.product-stat strong {
  font-size: 0.92rem;
  font-weight: 800;
}

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

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

.report-line,
.table-row,
.sale-row,
.result-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.table-row {
  grid-template-columns: minmax(0, 1.1fr) repeat(4, auto);
}

.sale-row {
  grid-template-columns: minmax(180px, 1.3fr) repeat(3, minmax(90px, auto));
}

.report-line strong,
.table-row strong,
.sale-row strong,
.result-line strong {
  overflow-wrap: anywhere;
}

.sale-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sale-row > div span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.sale-row > span {
  align-self: center;
  text-align: right;
  white-space: nowrap;
}

.report-line.total,
.result-line.total {
  border-color: rgba(38, 134, 83, 0.28);
  background: linear-gradient(135deg, rgba(232, 247, 238, 0.96), rgba(255, 255, 255, 0.92));
}

.report-line.total.negative {
  border-color: rgba(229, 72, 77, 0.28);
  background: linear-gradient(135deg, rgba(253, 236, 235, 0.96), rgba(255, 255, 255, 0.92));
}

.report-line.total.negative span {
  color: var(--expense);
}

.report-line.total.positive span {
  color: var(--income);
}

.result-line.negative span {
  color: var(--expense);
}

.result-line.positive span,
.result-line.total span {
  color: var(--income);
}

.result-line.strong {
  background: var(--surface-2);
}

.insight-box {
  min-height: 120px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: pre-line;
  animation: riseIn 0.44s ease both;
}

.service-flow > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.service-flow p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.flow-step {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 900;
}

.danger-zone {
  box-shadow: none;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.document-line-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.document-preview-panel {
  min-height: 420px;
}

.document-preview {
  min-height: 320px;
}

.proforma-paper {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 320px;
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

.proforma-head,
.proforma-line,
.proforma-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.proforma-head {
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(1, 28, 68, 0.16);
}

.proforma-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.paper-brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preview-logo,
.logo-fallback {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}

.logo-fallback {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-weight: 900;
}

.proforma-head > div:last-child {
  text-align: right;
  flex: 0 0 auto;
}

.proforma-head span,
.proforma-client span,
.proforma-line span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.proforma-client {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(237, 244, 242, 0.8);
}

.proforma-lines {
  display: grid;
  gap: 8px;
}

.proforma-line {
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(102, 116, 124, 0.3);
}

.proforma-line strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.proforma-line span,
.proforma-line b {
  flex: 0 0 auto;
}

.proforma-line b,
.proforma-total strong {
  color: var(--brand);
}

.proforma-total {
  margin-top: auto;
  padding-top: 12px;
  border-top: 2px solid rgba(1, 28, 68, 0.16);
  font-size: 1.15rem;
}

.subscription-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

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

.video-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.video-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-card strong {
  color: var(--brand);
}

.video-card span,
.video-placeholder {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.video-card video,
.video-card iframe,
.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: #eaf1f7;
}

.video-placeholder {
  display: grid;
  place-items: center;
}

.subscription-card > div,
.license-box {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.subscription-card span,
.license-box span,
.subscription-card small,
.license-box p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.subscription-card strong,
.license-box strong {
  color: var(--ink);
  font-size: 1rem;
}

.license-box {
  margin-bottom: 12px;
}

.license-box p {
  margin: 0;
}

.cloud-message {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.access-locked {
  overflow: hidden;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(1, 28, 68, 0.92), rgba(1, 16, 54, 0.9)),
    radial-gradient(circle at 20% 20%, rgba(0, 182, 95, 0.25), transparent 34%);
}

.access-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.access-card .brand-mark {
  width: 58px;
  height: 58px;
  background: #fff;
  overflow: hidden;
}

.access-card .brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.access-card h2,
.access-card p {
  margin: 0;
}

.access-card h2 {
  color: var(--brand);
  font-size: 1.5rem;
  line-height: 1.1;
}

.access-card p,
.access-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.access-card label {
  display: grid;
  gap: 7px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 900;
}

.access-card input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.access-card input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(0, 182, 95, 0.14);
}

.license-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 28, 35, 0.62);
  backdrop-filter: blur(14px);
}

.license-modal {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(237, 244, 242, 0.94));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.license-modal .brand-mark {
  margin: 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}

.license-modal h2,
.license-modal p {
  margin: 0;
}

.license-modal p {
  color: var(--muted);
  font-weight: 800;
}

.whatsapp-assistant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 999px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 900;
  background: linear-gradient(135deg, #128c7e, #25d366);
  box-shadow: 0 18px 40px rgba(18, 140, 126, 0.32);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.whatsapp-assistant:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 54px rgba(18, 140, 126, 0.38);
}

.whatsapp-assistant .icon,
.whatsapp-assistant .icon svg {
  width: 24px;
  height: 24px;
}

.icon svg[data-name="whatsapp"] {
  fill: currentColor;
  stroke: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 18px 45px rgba(1, 28, 68, 0.22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

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

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

@keyframes growBar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

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

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

  .dashboard-layout,
  .work-layout,
  .settings-layout,
  .report-grid,
  .documents-layout {
    grid-template-columns: 1fr;
  }

  .report-grid .wide {
    grid-column: auto;
  }

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

  .subscription-card,
  .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: 78px;
  }

  .side-nav {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 100vw;
    z-index: 8;
    height: auto;
    display: block;
    padding: 8px;
    min-height: 0;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  }

  .brand-block,
  .assist-strip {
    display: none;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .nav-item {
    min-height: 58px;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 5px;
    font-size: 0.72rem;
    min-width: 0;
    max-width: 100%;
    width: auto;
    flex: initial;
  }

  .nav-item .icon {
    width: 20px;
    height: 20px;
  }

  .nav-item span:not(.icon) {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-area {
    width: 100%;
    padding: 12px 10px 84px;
  }

  .top-bar {
    position: static;
    align-items: flex-start;
    margin: -2px 0 12px;
    padding: 0 2px;
  }

  h1 {
    font-size: 1.38rem;
  }

  .primary-action {
    padding: 0 12px;
  }

  .period-bar {
    width: 100%;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 4px;
    scroll-snap-type: x proximity;
  }

  .period-button {
    flex: 0 0 auto;
    min-height: 34px;
    min-width: 74px;
    padding: 0 9px;
    border-radius: 10px;
    font-size: 0.78rem;
    scroll-snap-align: start;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .metric-tile {
    min-height: 92px;
    padding: 10px;
    border-radius: 13px;
  }

  .metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

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

  .metric-tile p {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .metric-tile strong {
    margin-top: 5px;
    font-size: 0.98rem;
  }

  .panel {
    padding: 11px;
    border-radius: 13px;
    min-width: 0;
  }

  .dashboard-layout,
  .work-layout,
  .settings-layout,
  .report-grid,
  .documents-layout {
    gap: 12px;
  }

  .dashboard-layout + .dashboard-layout,
  .metric-grid + .dashboard-layout {
    margin-top: 12px;
  }

  .form-grid,
  .product-stats,
  .table-row,
  .sale-row,
  .document-line-editor,
  .subscription-card,
  .video-grid,
  .history-filters > * {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .custom-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px;
  }

  .custom-range label {
    min-width: 0;
    max-width: none;
    width: auto;
    gap: 3px;
  }

  .custom-range label span,
  .history-filters input::placeholder {
    font-size: 0.68rem;
  }

  .custom-range input,
  .custom-range button,
  .history-filters input,
  .history-filters select,
  .history-filters button {
    min-height: 38px;
    border-radius: 11px;
    font-size: 0.78rem;
  }

  .custom-range .secondary-action {
    min-width: 44px;
    padding: 0 10px;
    font-size: 0;
  }

  .custom-range .secondary-action::after {
    content: "OK";
    font-size: 0.78rem;
  }

  .history-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px;
  }

  .history-filters select {
    grid-column: 1 / -1;
  }

  .history-filters .secondary-action {
    min-width: 58px;
    padding: 0 10px;
    font-size: 0;
  }

  .history-filters .secondary-action::after {
    content: "OK";
    font-size: 0.78rem;
  }

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

  #productForm .form-grid label:first-child,
  .form-grid label:nth-child(3):last-child,
  .form-panel > label,
  .settings-layout .form-grid label {
    grid-column: 1 / -1;
  }

  .form-panel {
    gap: 10px;
  }

  label {
    gap: 4px;
    font-size: 0.78rem;
  }

  input,
  select {
    min-height: 40px;
    border-radius: 11px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  textarea {
    min-height: 86px;
    border-radius: 11px;
    font-size: 0.86rem;
  }

  .segmented {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment {
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.84rem;
  }

  .field-hint {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .form-actions,
  .data-actions {
    align-items: stretch;
    gap: 7px;
  }

  .panel-head {
    align-items: center;
    margin-bottom: 9px;
    gap: 8px;
  }

  .panel h2 {
    font-size: 0.94rem;
  }

  .panel-head span,
  .stock-summary {
    font-size: 0.74rem;
  }

  .inline-tools {
    width: auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .search-input {
    width: min(150px, 44vw);
    min-height: 38px;
  }

  .operation-card {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
    border-radius: 12px;
  }

  .operation-type-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .operation-type-icon .icon,
  .operation-type-icon .icon svg {
    width: 17px;
    height: 17px;
  }

  .operation-main {
    display: grid;
    gap: 4px;
  }

  .operation-main strong {
    font-size: 0.88rem;
    line-height: 1.15;
  }

  .operation-main p {
    margin: 0;
    color: var(--ink);
    font-size: 0.75rem;
    line-height: 1.25;
  }

  .operation-main small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
  }

  .operation-meta {
    gap: 4px;
  }

  .operation-meta span {
    min-height: 20px;
    padding: 0 6px;
    font-size: 0.66rem;
  }

  .operation-amount {
    grid-column: auto;
    align-self: stretch;
    justify-items: end;
    align-content: space-between;
    text-align: right;
  }

  .operation-amount strong {
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .operation-actions {
    justify-content: flex-end;
    gap: 3px;
  }

  .delete-operation,
  .receipt-operation,
  .edit-product {
    padding: 0;
    font-size: 0.68rem;
  }

  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 30px;
  }

  .bar-track {
    grid-column: 1 / -1;
    height: 7px;
  }

  .bar-value {
    text-align: right;
    font-size: 0.76rem;
  }

  .watch-item {
    padding: 9px;
    border-radius: 12px;
  }

  .watch-item strong {
    font-size: 0.86rem;
  }

  .status-pill {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .product-grid {
    gap: 9px;
  }

  .product-card {
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
  }

  .product-card-head,
  .product-card-foot {
    align-items: flex-start;
  }

  .product-card-head strong {
    font-size: 0.9rem;
    line-height: 1.18;
  }

  .product-card-head span,
  .product-card-foot span {
    font-size: 0.72rem;
  }

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

  .product-stat {
    min-height: 52px;
    padding: 7px;
    border-radius: 11px;
    overflow: hidden;
  }

  .product-stat span {
    font-size: 0.66rem;
  }

  .product-stat strong {
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .report-line,
  .table-row,
  .result-line {
    padding: 9px;
    border-radius: 12px;
    gap: 8px;
  }

  .sale-row {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-solid);
  }

  .sale-row > span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: right;
    font-size: 0.82rem;
  }

  .sale-row > span::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .insight-box {
    min-height: 96px;
    padding: 11px;
    font-size: 0.86rem;
  }

  .document-line-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .document-line-editor label:first-child,
  .document-line-editor label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .document-preview-panel {
    min-height: 0;
  }

  .document-preview {
    min-height: 220px;
  }

  .proforma-paper {
    gap: 10px;
    min-height: 220px;
    padding: 12px;
    border-radius: 12px;
  }

  .proforma-head {
    align-items: flex-start;
  }

  .paper-brand {
    gap: 8px;
  }

  .preview-logo,
  .logo-fallback {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .proforma-head strong {
    font-size: 0.86rem;
  }

  .proforma-head span,
  .proforma-client span,
  .proforma-line span {
    font-size: 0.68rem;
  }

  .settings-layout .panel {
    gap: 9px;
  }

  .settings-divider {
    margin: 2px 0;
  }

  .subscription-card > div,
  .license-box {
    padding: 10px;
    border-radius: 12px;
  }

  .proforma-head,
  .proforma-line,
  .proforma-total {
    gap: 8px;
  }

  .proforma-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .proforma-line b {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .whatsapp-assistant {
    right: 12px;
    bottom: 90px;
    width: 48px;
    min-height: 48px;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
  }

  .whatsapp-assistant span:not(.icon) {
    display: none;
  }

  .toast {
    right: 12px;
    bottom: 150px;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 420px) {
  .top-actions {
    gap: 6px;
  }

  .install-action {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .install-action img {
    width: 18px;
    height: 18px;
  }

  .top-actions .primary-action {
    font-size: 0;
    width: 44px;
    padding: 0;
  }

  .top-actions .primary-action .icon {
    margin: 0;
  }

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

  .metric-tile {
    min-height: 86px;
    padding: 9px;
  }

  .metric-tile strong {
    font-size: 0.9rem;
  }

  .metric-tile p {
    font-size: 0.68rem;
  }

  .custom-range {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  }

  .history-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 54px;
  }

  .nav-item {
    font-size: 0.66rem;
    padding: 5px 2px;
  }

  .nav-item .icon,
  .nav-item .icon svg {
    width: 18px;
    height: 18px;
  }

  .operation-card {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .operation-amount {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 36px;
  }

  .operation-actions {
    flex-wrap: nowrap;
  }

  .batch-row {
    align-items: flex-start;
  }

  .batch-row-side {
    display: grid;
    justify-items: end;
  }

  .batch-row small {
    white-space: normal;
  }

  .document-line-editor,
  .form-grid {
    gap: 7px;
  }

}

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