:root {
  color-scheme: light;
  --bg: #f5f3f1;
  --ink: #23191a;
  --text: #23191a;
  --muted: #7e7272;
  --line: #e9e4e2;
  --panel: #ffffff;
  --brand: #7f2335;
  --brand-dark: #651b2a;
  --brand-soft: #f6ecef;
  --accent: #b78993;
  --red: #a3162d;
  --amber: #a56712;
  --shadow: 0 24px 70px rgba(51, 36, 38, 0.08);
  --shadow-soft: 0 10px 30px rgba(51, 36, 38, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 20%),
    radial-gradient(circle at bottom right, rgba(127, 35, 53, 0.05), transparent 22%),
    linear-gradient(180deg, #f7f6f4 0%, #f1efed 100%);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

button.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.mini {
  min-height: 30px;
  padding: 0 10px;
  margin-top: 6px;
  font-size: 13px;
}

button.danger {
  background: #fff;
  border: 1px solid #f0c8d0;
  color: var(--red);
}

button.danger:hover {
  background: #fff1f4;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf9;
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(127, 35, 53, 0.35);
  box-shadow: 0 0 0 4px rgba(127, 35, 53, 0.08);
  outline: none;
}

label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 12px 0 6px;
}

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

.hidden {
  display: none !important;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 4px;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  margin: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.sidebar {
  align-self: start;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.sidebar-brand {
  margin-bottom: 18px;
}

.sidebar h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 4px;
}

.sidebar p {
  color: var(--muted);
  margin-bottom: 0;
}

.sidebar nav {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: auto;
}

.sidebar button[data-icon] {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 34px 1fr;
}

.sidebar button[data-icon]::before {
  align-items: center;
  color: inherit;
  content: "";
  display: grid;
  font-size: 17px;
  height: 34px;
  justify-items: center;
  line-height: 1;
  width: 34px;
}

.sidebar button[data-icon="cart"]::before { content: "🧾"; }
.sidebar button[data-icon="clock"]::before { content: "⏱"; }
.sidebar button[data-icon="box"]::before { content: "📦"; }
.sidebar button[data-icon="truck"]::before { content: "🚚"; }
.sidebar button[data-icon="wallet"]::before { content: "💳"; }
.sidebar button[data-icon="building"]::before { content: "🏢"; }
.sidebar button[data-icon="undo"]::before { content: "↩"; }
.sidebar button[data-icon="hand"]::before { content: "🤝"; }
.sidebar button[data-icon="edit"]::before { content: "✎"; }
.sidebar button[data-icon="ledger"]::before { content: "🧮"; }
.sidebar button[data-icon="users"]::before { content: "👥"; }
.sidebar button[data-icon="spark"]::before { content: "✨"; }
.sidebar button[data-icon="chart"]::before { content: "📊"; }
.sidebar button[data-icon="logout"]::before { content: "⎋"; }

.sidebar nav button {
  position: relative;
  text-align: left;
  background: transparent;
  color: #4e4243;
  border: 1px solid transparent;
  border-radius: 16px;
  min-height: 50px;
  padding: 0 10px;
  font-weight: 500;
}

.sidebar nav button::after {
  background: var(--brand);
  border-radius: 999px;
  content: "";
  height: 0;
  left: -6px;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: height 160ms ease, opacity 160ms ease;
  width: 4px;
}

.sidebar nav button.active,
.sidebar nav button:hover {
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.sidebar nav button.active::after,
.sidebar nav button:hover::after {
  height: 28px;
  opacity: 1;
}

.sidebar .logout-btn {
  border-color: var(--line);
  color: #4e4243;
  text-align: left;
  border-radius: 16px;
  margin-top: 28px;
  font-weight: 500;
}

.sidebar .logout-btn:hover {
  background: #fff;
}

.mobile-menu-fab,
.mobile-menu-backdrop {
  display: none;
}

.content {
  background: linear-gradient(180deg, rgba(248, 247, 246, 0.92), rgba(244, 241, 240, 0.92));
  padding: 18px 22px 24px;
  min-width: 0;
}

.topbar {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(233, 228, 226, 0.9);
  border-radius: 20px;
  min-height: 72px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}

.topbar-status {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  width: 100%;
}

.topbar-status > div:first-child {
  align-items: flex-start;
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
}

.topbar-status strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.topbar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.topbar-link {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--brand);
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-link:hover {
  background: #fff8f9;
  border-color: rgba(127, 35, 53, 0.18);
}

#notice {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--amber);
  font-weight: 700;
  min-height: 38px;
  padding: 9px 14px;
}

#notice:empty {
  display: none;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.panel h3,
.metric strong,
.product-panel h3,
.edit-panel h3 {
  letter-spacing: -0.01em;
}

.panel h3,
.product-panel h3,
.edit-panel h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
}

form.panel,
.accounting-owner-panel form {
  align-content: start;
  display: grid;
  gap: 14px;
}

form.panel > h3,
.accounting-owner-panel form > h3 {
  margin-bottom: 0;
}

form.panel > .help-text,
.accounting-owner-panel form > .help-text {
  margin: -2px 0 0;
}

form.panel > .grid,
form.panel > .price-edit-grid,
form.panel > .purchase-grid,
form.panel > .pay-grid,
.accounting-owner-panel form > .grid {
  margin: 0;
}

form.panel .grid.two,
.accounting-owner-panel form .grid.two {
  gap: 14px 16px;
}

form.panel > button[type="submit"],
.accounting-owner-panel form > button[type="submit"] {
  justify-self: start;
  margin-top: 2px;
  min-width: 180px;
}

form.panel label.checkbox-line,
.accounting-owner-panel form label.checkbox-line {
  margin: 2px 0 0;
}

.shift-overview {
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

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

.supplier-grid:has(> .supervisor-only.hidden) {
  grid-template-columns: 1fr;
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.section-head {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
}

.section-head.compact {
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h3 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-head .help-text {
  margin: 0;
  max-width: 58ch;
}

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

.section-stat {
  background: linear-gradient(180deg, #ffffff 0%, #faf8f7 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  min-width: 0;
  padding: 12px 14px;
}

.section-stat span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.section-stat strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 8px;
}

.product-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.product-toolbar button {
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
}

.product-toolbar button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.product-toolbar button:hover {
  transform: none;
}

.product-panel,
.edit-panel {
  display: none;
}

.product-panel.active,
.edit-panel.active {
  display: block;
}

.report-panel {
  display: none;
}

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

.product-panel.active > .grid.two,
.edit-panel.active > .grid.two,
#tab-cashiers > .grid.two {
  align-items: start;
}

.checkbox-line {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  min-height: 42px;
}

.checkbox-line input {
  min-height: auto;
  width: auto;
}

.price-edit-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
}

.price-summary {
  background: linear-gradient(180deg, #fbf6f7 0%, var(--brand-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--brand-dark);
  font-weight: 700;
  margin: 14px 0;
  padding: 12px;
}

.ai-result {
  background: #fff8f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  margin: 0;
  min-height: 180px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.pos-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.panel-accent {
  background: linear-gradient(180deg, #ffffff 0%, #fbf7f7 100%);
}

.list,
.cart,
.table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.row strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.row small {
  color: var(--muted);
  line-height: 1.45;
}

.row-meta {
  color: var(--muted);
  display: inline-block;
  line-height: 1.5;
}

.row-value {
  white-space: nowrap;
}

.row-tag {
  align-items: center;
  background: linear-gradient(180deg, #fbf6f7 0%, var(--brand-soft) 100%);
  border: 1px solid rgba(127, 35, 53, 0.08);
  border-radius: 999px;
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  white-space: nowrap;
}

.empty-state {
  background: linear-gradient(180deg, #fcfbfa 0%, #f8f6f5 100%);
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  padding: 14px;
  text-align: center;
}

.automation-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.automation-section + .automation-section {
  margin-top: 20px;
}

.automation-section-head {
  margin-bottom: 10px;
}

.automation-section-head h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.automation-row {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  padding: 10px 12px;
}

.automation-row--briefing {
  background: linear-gradient(180deg, #fffefd 0%, #fbf7f8 100%);
  border-color: rgba(127, 35, 53, 0.16);
  box-shadow: var(--shadow-soft);
  gap: 14px;
  padding: 14px;
}

.automation-briefing-meta {
  display: grid;
  gap: 10px;
}

.automation-note {
  align-items: start;
  background: rgba(127, 35, 53, 0.05);
  border: 1px solid rgba(127, 35, 53, 0.08);
  border-radius: 14px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.automation-note small {
  color: var(--muted);
  line-height: 1.45;
}

.automation-time-field {
  margin: 0;
}

.automation-time-field span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

.automation-row input[type="number"],
.automation-row input[type="time"] {
  margin: 0;
  min-height: 34px;
  padding: 6px 8px;
}

.switch-line {
  align-items: flex-start;
  display: flex;
  gap: 9px;
  margin: 0;
}

.checkbox-line input[type="checkbox"],
.switch-line input[type="checkbox"] {
  accent-color: var(--brand);
  flex: 0 0 auto;
  height: 16px;
  margin: 2px 0 0;
  min-height: 16px;
  padding: 0;
  width: 16px;
}

.switch-line strong,
.switch-line small {
  display: block;
}

.switch-line strong {
  color: var(--text);
  margin-bottom: 3px;
}

.switch-line small {
  color: var(--muted);
  line-height: 1.4;
}

.automation-status {
  display: grid;
  gap: 10px;
}

.llm-action-stack {
  display: grid;
  gap: 10px;
}

.llm-automation-grid {
  align-items: start;
}

.llm-status-panel .row {
  min-height: 52px;
}

.product-result {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
}

.product-result:hover {
  background: #fff9fa;
  border-color: #d8a8b3;
}

.product-result strong,
.product-result small {
  display: block;
}

.product-result small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}

.product-result b {
  color: var(--brand-dark);
  font-size: 14px;
}

.cart-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  display: grid;
  grid-template-columns: 1fr 88px 68px;
  gap: 8px;
  align-items: center;
}

.cart-row.wide {
  grid-template-columns: 1fr 130px 120px 68px;
}

.cart-row button {
  margin-top: 0;
  min-height: 32px;
}

.cart-product-name {
  display: inline-block;
  font-size: 18px;
  line-height: 1.25;
}

.receipt-modal {
  align-items: center;
  background: rgba(42, 16, 21, 0.52);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.receipt-dialog {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(42, 16, 21, 0.26);
  max-height: calc(100vh - 36px);
  overflow: auto;
  width: min(420px, 100%);
}

.receipt-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
}

.receipt-toolbar h3 {
  margin: 0;
}

.receipt-toolbar div {
  display: flex;
  gap: 8px;
}

.receipt-paper {
  color: #1d1416;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  margin: 0 auto;
  max-width: 300px;
  padding: 18px 14px 22px;
}

.receipt-store {
  border-bottom: 1px dashed #999;
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  text-align: center;
}

.receipt-store strong {
  font-size: 15px;
  text-transform: uppercase;
}

.receipt-meta,
.receipt-items,
.receipt-totals {
  border-bottom: 1px dashed #999;
  display: grid;
  gap: 6px;
  padding: 10px 0;
}

.receipt-line,
.receipt-item {
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.receipt-line strong,
.receipt-item strong {
  text-align: right;
}

.receipt-item span,
.receipt-item small {
  grid-column: 1 / -1;
}

.receipt-item small {
  color: #5f5558;
}

.receipt-footer {
  padding-top: 12px;
  text-align: center;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
  font-size: 22px;
}

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

.purchase-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.purchase-row {
  display: grid;
  gap: 10px;
}

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

.purchase-row-bottom {
  align-items: end;
  grid-template-columns:
    minmax(220px, 1.5fr)
    minmax(76px, 92px)
    minmax(96px, 120px)
    minmax(86px, 96px)
    minmax(140px, 1fr)
    minmax(140px, 160px)
    minmax(132px, 150px);
}

.purchase-col-qty input,
.purchase-col-multiplier input {
  text-align: center;
}

.purchase-col-unit input {
  text-align: left;
}

.purchase-grid label {
  margin-top: 0;
}

.purchase-preview {
  background: linear-gradient(180deg, #fcfbfa 0%, #f8f6f5 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: #584d4e;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
  padding: 12px 14px;
}

.purchase-action {
  align-self: end;
}

.purchase-action button {
  width: 100%;
}

.change-box {
  background: linear-gradient(180deg, #fcf7f8 0%, var(--brand-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 42px;
  padding: 6px 10px;
}

.change-box span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.change-box strong {
  color: var(--brand-dark);
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: -4px 0 12px;
}

.report-filter {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 120px;
  gap: 10px;
  margin-bottom: 12px;
}

.accounting-header {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  margin-bottom: 8px;
}

.accounting-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.accounting-header .help-text {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  max-width: 60ch;
}

.accounting-filter {
  align-items: end;
  background: linear-gradient(180deg, #fcfbfa 0%, #f8f6f5 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) 110px;
  padding: 12px;
}

.accounting-filter input,
.accounting-filter select {
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}

.accounting-filter-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.accounting-filter-actions button {
  background: #fff;
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
}

.accounting-actions {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
  padding: 10px;
}

.accounting-actions button {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: #5d5152;
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
}

.accounting-actions button:hover {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  transform: none;
}

.accounting-actions button.active {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: none;
  color: #fff;
}

.accounting-metrics {
  margin: 6px 0 14px;
}

.metric.compact strong {
  font-size: 22px;
}

.accounting-status {
  font-size: 14px;
  line-height: 1.5;
  border-radius: 16px;
  font-weight: 600;
  padding: 12px 14px;
}

.accounting-status.ok {
  background: #edf8ef;
  border: 1px solid #b8dec0;
  color: #1d6a33;
}

.accounting-status.warn {
  background: #fff4e0;
  border: 1px solid #efcf91;
  color: #8a5a00;
}

.accounting-trend-panel {
  overflow: hidden;
}

.accounting-chart-legend {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.accounting-chart-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
}

.accounting-chart-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 4px;
  width: 28px;
}

.accounting-chart-legend .sales-line {
  background: var(--red);
}

.accounting-chart-legend .profit-line {
  background: #d6861c;
}

.accounting-trend-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.accounting-chart {
  background: linear-gradient(180deg, #fff 0%, #fcfaf9 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 280px;
  overflow-x: auto;
  padding: 12px;
}

.accounting-chart-svg {
  display: block;
  height: auto;
  min-width: 720px;
  width: 100%;
}

.chart-grid-line {
  stroke: rgba(127, 35, 53, 0.08);
  stroke-dasharray: 4 6;
  stroke-width: 1;
}

.chart-zero-line {
  stroke: rgba(35, 25, 26, 0.22);
  stroke-width: 1.2;
}

.chart-grid-label,
.chart-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-line {
  fill: none;
  opacity: 0.95;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.35;
}

.chart-line-sales {
  stroke: var(--red);
}

.chart-line-profit {
  stroke: #d6861c;
}

.chart-point {
  stroke: #fff;
  stroke-width: 1.8;
}

.chart-point-sales {
  fill: var(--red);
}

.chart-point-profit {
  fill: #d6861c;
}

.accounting-grid {
  align-items: start;
}

.accounting-complete-report {
  background: #fff;
}

.accounting-owner-panel form h3,
.accounting-owner-panel > .grid > div > h3,
.accounting-complete-report h3,
#cashFlowDetailPanel h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.accounting-owner-panel label,
.accounting-owner-panel input,
.accounting-owner-panel select,
.accounting-owner-panel textarea {
  font-size: 14px;
}

.print-report-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.print-report-head strong {
  color: var(--brand);
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.print-report-head h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.print-report-head small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.accounting-print-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.accounting-print-grid section {
  background: linear-gradient(180deg, #ffffff 0%, #fbfaf9 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-width: 0;
  padding: 16px;
}

.statement-card h3 {
  margin-bottom: 10px;
}

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

.statement-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.statement-section h4 {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.statement-line,
.statement-cash-row {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 8px 0;
}

.statement-line span,
.statement-cash-row span,
.statement-list small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.statement-line strong,
.statement-cash-row strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.statement-total {
  border-top: 1px solid var(--line);
  font-weight: 700;
  margin-top: 6px;
  padding-top: 12px;
}

.statement-cash-row {
  border-bottom: 1px solid var(--line);
}

.statement-cash-row div:last-child {
  display: grid;
  gap: 2px;
  text-align: right;
}

.table-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.1fr repeat(5, minmax(100px, 1fr));
  padding: 10px;
}

.table-row.head {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.table-row span,
.table-row strong {
  font-size: 13px;
  line-height: 1.45;
  min-width: 0;
}

.table-row span:not(:first-child),
.table-row strong:not(:first-child) {
  text-align: right;
}

.table-row.total-row {
  border-color: var(--brand);
  font-weight: 800;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
  margin-top: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.metric strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .shell,
  .pos-layout,
  .section-head,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .sidebar {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(233, 228, 226, 0.96);
    border-right: 0;
    border-top: 1px solid var(--line);
    border-radius: 26px 26px 0 0;
    bottom: 0;
    box-shadow: 0 -12px 34px rgba(35, 25, 26, 0.14);
    height: auto;
    left: 0;
    max-height: min(72vh, 640px);
    overflow-y: auto;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    pointer-events: none;
    position: fixed;
    right: 0;
    transform: translateY(calc(100% + 20px));
    transition: transform 180ms ease, opacity 180ms ease;
    opacity: 0;
    z-index: 40;
  }

  body.mobile-menu-open .sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .shell {
    border-radius: 22px;
    margin: 0;
    min-height: 100vh;
    padding-bottom: 90px;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar nav {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin: 0;
    padding-bottom: 2px;
  }

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

  .sidebar nav button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    gap: 10px;
    grid-template-columns: 28px 1fr;
    justify-items: start;
    min-height: 48px;
    padding: 0 12px;
    text-align: left;
  }

  .sidebar button[data-icon]::before {
    font-size: 16px;
    height: 24px;
    width: 24px;
  }

  .sidebar nav button span {
    font-size: 13px;
    line-height: 1.25;
  }

  .sidebar nav button::after {
    display: none;
  }

  .sidebar nav button.active,
  .sidebar nav button:hover {
    background: linear-gradient(180deg, rgba(127, 35, 53, 0.95), rgba(104, 28, 44, 0.96));
    color: #fff;
  }

  .sidebar nav #logoutBtn {
    background: #fff8f8;
    border-color: #f0d9dd;
    color: var(--red);
    grid-column: 1 / -1;
  }

  .sidebar nav #logoutBtn.active,
  .sidebar nav #logoutBtn:hover {
    background: linear-gradient(180deg, rgba(163, 22, 45, 0.96), rgba(127, 24, 42, 0.98));
    color: #fff;
  }

  .mobile-menu-fab {
    align-items: center;
    background: linear-gradient(180deg, rgba(127, 35, 53, 0.98), rgba(101, 27, 42, 1));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 18px 32px rgba(51, 36, 38, 0.24);
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    position: fixed;
    right: 16px;
    z-index: 45;
  }

  .mobile-menu-fab::before {
    content: "☰";
    font-size: 16px;
    line-height: 1;
  }

  body.mobile-menu-open .mobile-menu-fab::before {
    content: "×";
    font-size: 20px;
  }

  body.mobile-menu-open .mobile-menu-fab {
    background: linear-gradient(180deg, rgba(101, 27, 42, 0.98), rgba(127, 35, 53, 1));
  }

  .mobile-menu-backdrop {
    background: rgba(35, 25, 26, 0.22);
    border: 0;
    display: block;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 180ms ease;
    z-index: 35;
  }

  body.mobile-menu-open .mobile-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

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

  .purchase-grid,
  .section-stats,
  .purchase-row-top,
  .purchase-row-bottom,
  .pay-grid,
  .report-filter,
  .accounting-header,
  .accounting-filter,
  .accounting-print-grid,
  .statement-line,
  .statement-cash-row,
  .price-edit-grid,
  .form-actions,
  .automation-row,
  .topbar,
  .cart-row.wide {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    border-radius: 22px;
    margin-bottom: 14px;
    padding: 14px;
  }

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

  .topbar-status strong {
    font-size: 16px;
    line-height: 1.35;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .topbar-link {
    justify-content: center;
    width: 100%;
  }

  .topbar-status > div:first-child {
    text-align: left;
  }

  .panel,
  .tab .panel {
    border-radius: 22px;
    padding: 16px;
  }

  #tab-cashier .pos-layout {
    gap: 14px;
  }

  #tab-cashier .pos-layout > .panel:first-child {
    position: sticky;
    top: 12px;
    z-index: 5;
  }

  #tab-cashier h3 {
    margin-bottom: 10px;
  }

  #productSearch {
    font-size: 17px;
    min-height: 52px;
    padding: 0 16px;
  }

  #productResults {
    gap: 10px;
    max-height: 42vh;
    overflow-y: auto;
    padding-right: 2px;
  }

  .product-result {
    border-radius: 18px;
    grid-template-columns: 1fr;
    min-height: 72px;
    padding: 14px;
  }

  .product-result strong {
    font-size: 15px;
  }

  .product-result b {
    display: inline-block;
    font-size: 16px;
    margin-top: 8px;
  }

  #tab-cashier .panel-accent {
    padding-bottom: 18px;
  }

  #cartItems {
    gap: 12px;
    max-height: none;
  }

  .cart-row,
  .cart-row.wide {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .cart-row button {
    min-height: 38px;
    width: 100%;
  }

  .cart-product-name {
    font-size: 16px;
  }

  .total-row {
    align-items: flex-start;
    background: rgba(127, 35, 53, 0.06);
    border: 1px solid rgba(127, 35, 53, 0.1);
    border-radius: 18px;
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding: 14px;
  }

  .total-row strong {
    font-size: 24px;
  }

  .pay-grid {
    gap: 10px;
    margin-top: 12px;
  }

  #paymentMethod,
  #cashReceived {
    min-height: 50px;
  }

  .change-box {
    align-items: flex-start;
    border-radius: 18px;
    min-height: 0;
    padding: 14px;
  }

  .change-box strong {
    font-size: 22px;
  }

  #checkoutBtn {
    bottom: calc(92px + env(safe-area-inset-bottom));
    box-shadow: 0 18px 36px rgba(127, 35, 53, 0.2);
    font-size: 16px;
    left: 14px;
    min-height: 54px;
    position: sticky;
    right: 14px;
    width: 100%;
  }

  .section-head {
    gap: 12px;
  }

  .section-head h3,
  .panel h3 {
    font-size: 18px;
  }

  .metric strong {
    font-size: 24px;
  }

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

  .product-toolbar button {
    min-width: 0;
  }

  .list,
  .table,
  .cart {
    gap: 10px;
  }

  .cart-row,
  .table-row {
    border-radius: 18px;
    padding: 12px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

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

  .accounting-trend-meta {
    grid-template-columns: 1fr;
  }

  .accounting-chart-legend {
    justify-content: flex-start;
  }

  .accounting-filter-actions {
    flex-direction: column;
  }

  .accounting-filter-actions button {
    width: 100%;
  }

  .accounting-actions button,
  .print-button {
    width: 100%;
  }

  .print-button {
    margin-left: 0;
  }

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

  .table-row span:not(:first-child),
  .table-row strong:not(:first-child) {
    text-align: left;
  }
}

@media print {
  body.print-receipt * {
    visibility: hidden;
  }

  body.print-receipt #receiptPaper,
  body.print-receipt #receiptPaper * {
    visibility: visible;
  }

  body.print-receipt #receiptPaper {
    left: 0;
    margin: 0;
    max-width: none;
    padding: 0;
    position: absolute;
    top: 0;
    width: 72mm;
  }

  body.print-receipt .receipt-modal {
    background: transparent;
    display: block;
    padding: 0;
    position: static;
  }

  body.print-receipt .receipt-dialog {
    box-shadow: none;
    max-height: none;
    overflow: visible;
    width: auto;
  }

  body.print-receipt .receipt-toolbar {
    display: none;
  }

  body.print-receipt .receipt-paper {
    font-size: 11px;
  }

  body.print-accounting {
    background: #fff;
    color: #111;
  }

  body.print-accounting .sidebar,
  body.print-accounting .topbar,
  body.print-accounting #tab-accounting > .panel:first-child,
  body.print-accounting .accounting-owner-panel,
  body.print-accounting .tab:not(#tab-accounting) {
    display: none !important;
  }

  body.print-accounting .shell,
  body.print-accounting .content,
  body.print-accounting #tab-accounting {
    display: block !important;
    margin: 0;
    padding: 0;
  }

  body.print-accounting .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  body.print-accounting .accounting-print-grid {
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.print-accounting .statement-line,
  body.print-accounting .statement-cash-row {
    padding: 3px 0;
  }

  body.print-accounting .statement-section {
    padding-top: 7px;
  }

  body.print-accounting .table-row {
    border-radius: 0;
    grid-template-columns: 1.1fr repeat(5, minmax(80px, 1fr));
    padding: 6px;
  }

  body.print-accounting button {
    display: none;
  }
}
