:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #68706f;
  --line: #d9dedb;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --soft: #f6edf8;
  --accent: #b81ed7;
  --accent-strong: #8611a3;
  --accent-rgb: 184 30 215;
  --coral: #b84a3b;
  --amber: #94651f;
  --violet: #6d2b86;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(30, 42, 38, 0.11);
  --shadow-strong: 0 22px 60px rgba(30, 42, 38, 0.16);
  --shine: rgba(255, 255, 255, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(var(--accent-rgb) / 0.14), transparent 22rem),
    repeating-linear-gradient(115deg, rgb(var(--accent-rgb) / 0.052) 0 1px, transparent 1px 4rem),
    repeating-linear-gradient(25deg, rgba(24, 32, 31, 0.04) 0 1px, transparent 1px 5rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), transparent 30rem),
    var(--paper);
  background-attachment: fixed;
  background-size: auto, 78px 78px, 92px 92px, auto, auto;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(120deg, transparent 0 16%, rgb(var(--accent-rgb) / 0.12) 23%, transparent 31% 100%),
    linear-gradient(78deg, transparent 0 58%, rgba(24, 32, 31, 0.06) 64%, transparent 72% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent 24rem);
  opacity: 0.9;
  transform: translate3d(-18%, 0, 0);
}

body::after {
  position: fixed;
  inset: auto -12rem -16rem auto;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(45deg, transparent 45%, rgb(var(--accent-rgb) / 0.12) 45% 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(24, 32, 31, 0.08) 45% 55%, transparent 55%);
  mask-image: linear-gradient(135deg, transparent, black 28%, black 70%, transparent);
  opacity: 0.55;
  transform: rotate(8deg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .access-screen {
  display: none;
}

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.access-card {
  position: relative;
  overflow: hidden;
  width: min(76rem, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9)),
    var(--panel);
  padding: clamp(1rem, 4vw, 2rem);
  box-shadow: var(--shadow-strong);
}

.access-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-strong), transparent);
  background-size: 220% 100%;
}

.access-logo {
  width: min(12rem, 52vw);
  height: auto;
  object-fit: contain;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 16px 22px rgb(var(--accent-rgb) / 0.18));
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.access-panel {
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62)),
    var(--paper);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body[data-space="client"] [data-enterprise-only],
body[data-space="client"] [data-action="portal-confirm-request"] {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    linear-gradient(135deg, rgb(var(--accent-rgb) / 0.08), transparent 18rem);
  backdrop-filter: blur(14px);
  padding: 1rem;
  box-shadow: 8px 0 34px rgba(30, 42, 38, 0.06);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 4rem;
  margin-bottom: 1.5rem;
}

.brand-logo {
  width: 4.5rem;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgb(var(--accent-rgb) / 0.14));
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.15rem;
}

.nav-list {
  display: grid;
  gap: 0.35rem;
}

.nav-item {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.nav-item::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(110deg, transparent 0 36%, var(--shine) 48%, transparent 60% 100%);
  opacity: 0;
  transform: translateX(-100%);
}

.nav-item span:first-child {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgb(var(--accent-rgb) / 0.28);
  background: var(--soft);
}

.nav-item.is-active {
  box-shadow: 0 12px 26px rgb(var(--accent-rgb) / 0.12);
}

.nav-item.is-active span:first-child {
  background: var(--accent);
  color: white;
}

.workspace {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding: 1.4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.topbar-logo {
  width: 5.75rem;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgb(var(--accent-rgb) / 0.15));
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

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

h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.topbar-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.delivery-date-field {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric {
  position: relative;
  min-height: 7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.88)),
    var(--panel);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metric::after {
  position: absolute;
  inset: 0 0 auto auto;
  width: 4.8rem;
  height: 0.32rem;
  border-radius: 0 var(--radius) 0 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgb(var(--accent-rgb) / 0.5));
  clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%);
  opacity: 0.75;
}

.metric span {
  color: var(--muted);
  font-size: 0.85rem;
}

.metric strong {
  display: block;
  margin-top: 0.65rem;
  font-size: 1.7rem;
}

.metric small {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 1rem;
  align-items: start;
}

.live-layout {
  grid-template-columns: minmax(20rem, 0.75fr) minmax(0, 1.25fr);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 0.3rem;
  margin-bottom: 1rem;
}

.segmented-control button {
  min-height: 2.45rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.segmented-control button.is-active {
  border-color: rgba(15, 118, 110, 0.22);
  background: white;
  color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(30, 42, 38, 0.08);
}

.live-mode-panel {
  display: none;
  gap: 0.85rem;
}

.live-mode-panel.is-active {
  display: grid;
}

.prep-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 0.75fr);
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.9)),
    rgba(255, 255, 255, 0.94);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, rgb(var(--accent-rgb) / 0.36), transparent 72%);
  opacity: 0.85;
}

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

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

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.compact-label {
  min-width: min(14rem, 100%);
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 0.65rem 0.75rem;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(var(--accent-rgb) / 0.16);
}

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

.form-hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.danger-button,
.chip-button {
  position: relative;
  overflow: hidden;
  min-height: 2.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.6rem 0.85rem;
  font-weight: 800;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-button {
  background:
    linear-gradient(135deg, rgb(var(--accent-rgb) / 0.98), var(--accent-strong)),
    var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgb(var(--accent-rgb) / 0.18);
}

.primary-button::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(110deg, transparent 0 34%, var(--shine) 48%, transparent 62% 100%);
  opacity: 0;
  transform: translateX(-120%);
}

.primary-button:hover {
  background:
    linear-gradient(135deg, var(--accent), var(--accent-strong)),
    var(--accent-strong);
  box-shadow: 0 16px 34px rgb(var(--accent-rgb) / 0.24);
}

.ghost-button,
.chip-button {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

a.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.ghost-button:hover,
.chip-button:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(30, 42, 38, 0.08);
}

.danger-button {
  border-color: rgba(184, 74, 59, 0.35);
  background: #fff4f1;
  color: var(--coral);
}

.small {
  min-height: 2.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.search-input {
  max-width: 18rem;
}

.interac-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgb(var(--accent-rgb) / 0.28);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 0.85rem;
}

.interac-card.is-compact {
  margin-top: 0.75rem;
}

.invoice-tools {
  align-items: center;
}

.invoice-tools .search-input {
  min-width: 10.5rem;
}

.data-grid,
.stack-list,
.draft-list {
  display: grid;
  gap: 0.65rem;
}

.record {
  position: relative;
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9)),
    white;
  padding: 0.85rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  content-visibility: auto;
  contain-intrinsic-size: 8rem;
}

.record.is-selected {
  border-color: rgb(var(--accent-rgb) / 0.48);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.12);
}

.branding-editor {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 0.85rem;
}

.branding-preview {
  display: grid;
  place-items: center;
  min-height: 6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 0.65rem;
}

.branding-preview img {
  width: min(100%, 10rem);
  max-height: 5rem;
  object-fit: contain;
}

.branding-fields {
  display: grid;
  gap: 0.65rem;
}

.brand-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.brand-swatch {
  width: 2.35rem;
  height: 2.35rem;
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
}

.brand-swatch.is-active {
  box-shadow: 0 0 0 2px var(--ink);
}

body[data-space="client"] #business-settings-panel,
body[data-space="client"] #business-data-panel,
body[data-space="client"] #drop-points-panel,
body:not([data-space="client"]) #client-settings-panel {
  display: none;
}

.status-hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.portal-profile {
  display: grid;
}

.portal-profile-card p {
  margin-bottom: 0;
}

.client-avatar,
.profile-photo-preview {
  width: 5.25rem;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
}

.client-avatar,
.profile-photo-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  object-fit: cover;
}

.client-avatar img,
.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.portal-catalog-actions {
  align-items: end;
  justify-content: flex-start;
}

.product-photo-editor {
  display: grid;
  justify-items: start;
  gap: 0.6rem;
}

.receipt-photo-editor {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.receipt-photo-preview,
.receipt-thumb {
  width: 7rem;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.receipt-photo-preview,
.receipt-thumb.is-empty {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
}

.receipt-photo-preview img,
.receipt-thumb {
  display: block;
  object-fit: cover;
}

.receipt-photo-preview img,
.receipt-thumb {
  width: 100%;
  height: 100%;
}

.expense-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.expense-data-table th,
.expense-data-table td {
  border-top: 1px solid var(--line);
  padding: 0.42rem 0.35rem;
  text-align: left;
}

.product-photo-preview,
.product-thumb {
  width: 5.25rem;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.product-photo-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
}

.product-photo-preview img,
.product-thumb {
  display: block;
  object-fit: cover;
}

.product-photo-preview img {
  width: 100%;
  height: 100%;
}

.product-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.product-record-main {
  display: grid;
  align-items: start;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.client-finance-summary {
  display: grid;
  gap: 0.2rem;
  justify-items: end;
  color: var(--muted);
  font-size: 0.84rem;
}

.quantity-field {
  width: min(5.5rem, 100%);
}

.quantity-field input {
  min-height: 2.15rem;
}

.record-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.record-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.record-title strong {
  font-size: 1rem;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.line-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.line-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}

.progress-track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.prep-lines {
  display: grid;
  gap: 0.5rem;
}

.prep-line {
  display: grid;
  grid-template-columns: 1.2rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

.prep-line input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: var(--accent);
}

.prep-line.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.prep-sheet {
  display: grid;
  gap: 0.85rem;
}

.prep-sheet-header {
  display: grid;
  gap: 0.35rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.8rem;
}

.prep-sheet-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prep-sheet-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.invoice-detail-panel {
  margin-top: 1rem;
}

.invoice-detail {
  overflow-x: auto;
}

.invoice-paper {
  display: grid;
  gap: 1rem;
  min-width: 34rem;
}

.invoice-header,
.invoice-client {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
}

.invoice-header strong,
.invoice-header span,
.invoice-client strong,
.invoice-client span {
  display: block;
}

.invoice-header > div:last-child {
  text-align: right;
}

.invoice-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.invoice-brand img {
  width: 5rem;
  height: auto;
  object-fit: contain;
}

.invoice-client {
  display: grid;
  justify-content: stretch;
}

.invoice-client > span,
.invoice-header span,
.invoice-draft,
.invoice-terms p,
.invoice-payments p {
  color: var(--muted);
}

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

.invoice-table th,
.invoice-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.invoice-table th:nth-child(n+2),
.invoice-table td:nth-child(n+2) {
  text-align: right;
}

.invoice-totals {
  display: grid;
  gap: 0.4rem;
  justify-self: end;
  min-width: min(18rem, 100%);
  margin: 0;
}

.invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.invoice-totals dt,
.invoice-totals dd {
  margin: 0;
}

.invoice-totals .balance {
  border-top: 2px solid var(--ink);
  font-weight: 800;
  padding-top: 0.45rem;
}

.invoice-terms {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.invoice-terms p {
  margin: 0.35rem 0 0;
}

.invoice-payments {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.invoice-payments p {
  margin: 0.35rem 0 0;
}

.invoice-payment-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
}

.invoice-payment-list li {
  display: grid;
  grid-template-columns: minmax(5rem, 0.8fr) minmax(6rem, 1fr) minmax(0, 1.4fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0;
}

.invoice-payment-list span {
  color: var(--muted);
}

.invoice-draft textarea {
  margin-top: 0.35rem;
  color: var(--ink);
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  padding: 0.18rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 800;
}

.tag.warn,
.status-pill.warn {
  background: #fff4d8;
  color: var(--amber);
}

.tag.danger {
  background: #fff0ec;
  color: var(--coral);
}

.tag.violet,
.status-pill.violet {
  background: #f0efff;
  color: var(--violet);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 1.25rem;
  text-align: center;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(24rem, calc(100vw - 2rem));
  transform: translateY(1rem);
  opacity: 0;
  pointer-events: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.data-actions {
  justify-content: flex-start;
}

.draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 0.65rem 0.75rem;
}

.draft-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.6rem;
}

.readiness-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 0.75rem;
}

.readiness-item strong,
.readiness-item small {
  display: block;
}

.readiness-item small {
  margin-top: 0.15rem;
  color: var(--muted);
  line-height: 1.3;
}

.readiness-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  margin-top: 0.25rem;
  background: var(--accent);
}

.readiness-item.is-warn .readiness-dot {
  background: var(--amber);
}

.batch-actions {
  align-items: end;
  grid-column: span 1;
}

.invoice-select-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.invoice-select-row input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: var(--accent);
}

button:focus-visible,
a.ghost-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(var(--accent-rgb) / 0.34);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .access-panel:hover,
  .metric:hover,
  .panel:hover,
  .record:hover {
    border-color: rgb(var(--accent-rgb) / 0.26);
    box-shadow: var(--shadow-strong);
    transform: translateY(-2px);
  }

  .nav-item:hover {
    transform: translateX(2px);
  }

  .nav-item:hover::after,
  .primary-button:hover::after {
    opacity: 1;
    transform: translateX(120%);
    transition: opacity 160ms ease, transform 680ms ease;
  }

  .primary-button:hover,
  .ghost-button:hover,
  .danger-button:hover,
  .chip-button:hover {
    transform: translateY(-1px);
  }

  .nav-item:hover span:first-child {
    transform: scale(1.06);
  }
}

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: page-atmosphere 18s ease-in-out infinite alternate;
  }

  body::before {
    animation: soft-sweep 16s ease-in-out infinite alternate;
  }

  body::after {
    animation: pattern-drift 22s ease-in-out infinite alternate;
  }

  .access-card::before {
    animation: brand-scan 4.8s ease-in-out infinite;
  }

  .access-logo {
    animation: logo-float 6s ease-in-out infinite;
  }

  .view.is-active > .metric-grid,
  .view.is-active > .panel,
  .view.is-active > .split-layout,
  .view.is-active > .prep-layout,
  .view.is-active > .live-layout {
    animation: fade-rise 360ms ease both;
  }

  .nav-item.is-active span:first-child {
    animation: active-breathe 3s ease-in-out infinite;
  }
}

@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;
  }
}

@keyframes page-atmosphere {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  }

  to {
    background-position: 0 0, 42px 18px, -36px 28px, 0 0, 0 0;
  }
}

@keyframes soft-sweep {
  from {
    transform: translate3d(-20%, 0, 0);
  }

  to {
    transform: translate3d(10%, 0, 0);
  }
}

@keyframes pattern-drift {
  from {
    transform: translate3d(0, 0, 0) rotate(8deg);
  }

  to {
    transform: translate3d(-3rem, -2rem, 0) rotate(13deg);
  }
}

@keyframes brand-scan {
  0%,
  100% {
    background-position: 160% 0;
  }

  50% {
    background-position: -60% 0;
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes active-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.2);
  }

  50% {
    box-shadow: 0 0 0 7px rgb(var(--accent-rgb) / 0);
  }
}

@media (max-width: 920px) {
  .access-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
    padding-bottom: calc(4.15rem + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: fixed;
    z-index: 10;
    inset: auto 0 0;
    height: auto;
    border-top: 1px solid var(--line);
    border-right: 0;
    padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
  }

  .brand {
    display: none;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(14, minmax(3.9rem, 1fr));
    overflow-x: auto;
    gap: 0.25rem;
    scroll-snap-type: x proximity;
  }

  body[data-space="client"] .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 3.25rem;
    padding: 0.32rem 0.3rem;
    font-size: 0.7rem;
    scroll-snap-align: start;
  }

  .nav-item span:first-child {
    width: 1.5rem;
    height: 1.5rem;
  }

  body[data-space="client"] .app-shell {
    padding-bottom: calc(3.55rem + env(safe-area-inset-bottom));
  }

  body[data-space="client"] .sidebar {
    padding: 0.25rem 0.35rem calc(0.25rem + env(safe-area-inset-bottom));
  }

  body[data-space="client"] .nav-item {
    min-height: 2.95rem;
    gap: 0.18rem;
    padding: 0.24rem 0.2rem;
    font-size: 0.66rem;
  }

  body[data-space="client"] .nav-item span:first-child {
    width: 1.35rem;
    height: 1.35rem;
  }

  .workspace {
    padding: 1rem;
  }

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

  .topbar-logo {
    width: 4.75rem;
    height: auto;
  }

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

  .topbar-actions button {
    width: 100%;
  }

  .topbar-actions .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .metric-grid,
  .split-layout,
  .live-layout,
  .prep-layout,
  .form-grid,
  .branding-editor,
  .profile-photo-editor,
  .receipt-photo-editor,
  .segmented-control {
    grid-template-columns: 1fr;
  }

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

  .invoice-tools,
  .batch-actions,
  .portal-catalog-actions {
    width: 100%;
  }

  .invoice-tools .search-input,
  .invoice-tools select {
    width: 100%;
  }

  .search-input {
    max-width: none;
  }

  .record-main,
  .line-list li,
  .prep-sheet-list li,
  .invoice-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .client-finance-summary {
    justify-items: start;
  }

  .product-record-main {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .invoice-paper {
    min-width: 0;
  }

  .invoice-header > div:last-child,
  .invoice-table th:nth-child(n+2),
  .invoice-table td:nth-child(n+2) {
    text-align: left;
  }

  .invoice-brand {
    align-items: flex-start;
  }

  .invoice-table,
  .invoice-table thead,
  .invoice-table tbody,
  .invoice-table tr,
  .invoice-table th,
  .invoice-table td {
    display: block;
  }

  .invoice-table th {
    display: none;
  }

  .invoice-table td {
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 0.75rem;
    padding: 0.45rem 0;
  }

  .invoice-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
  }

  .invoice-payment-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .prep-line {
    grid-template-columns: 1.2rem minmax(0, 1fr);
  }

  .prep-line strong {
    grid-column: 2;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions button {
    flex: 1;
  }

  .draft-item {
    display: grid;
  }
}

@media print {
  body {
    background: white;
  }

  body::before,
  body::after {
    display: none;
  }

  body[data-print-mode="prep"] .sidebar,
  body[data-print-mode="prep"] .topbar,
  body[data-print-mode="prep"] .panel:not(.prep-sheet-panel),
  body[data-print-mode="prep"] .toast,
  body[data-print-mode="invoice"] .sidebar,
  body[data-print-mode="invoice"] .topbar,
  body[data-print-mode="invoice"] .panel:not(.invoice-detail-panel),
  body[data-print-mode="invoice"] .toast {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .prep-layout {
    display: block;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
  }

  body[data-print-mode="prep"] .view,
  body[data-print-mode="invoice"] .view {
    display: none !important;
  }

  body[data-print-mode="prep"] #preparation,
  body[data-print-mode="invoice"] #invoices {
    display: block !important;
  }

  .prep-sheet-panel,
  .invoice-detail-panel {
    border: 0;
    box-shadow: none;
  }

  .prep-sheet-panel .panel-heading button,
  .invoice-detail-panel .panel-heading button,
  .invoice-draft {
    display: none;
  }

  .invoice-paper {
    min-width: 0;
  }
}
