@font-face {
  font-family: "Estedad";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/estedad-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

.finance-page { display: grid; gap: 20px; }
.finance-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.finance-toolbar h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2.35rem); }
.finance-toolbar p { margin: 0; color: var(--muted); }
.finance-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.finance-metrics article { background: var(--white); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--soft-shadow); }
.finance-metrics span { display: block; color: var(--muted); margin-bottom: 10px; }
.finance-metrics strong, .finance-balance { font-size: 1.35rem; color: var(--ink); }
.amount-in { color: #14785b; font-weight: 800; }
.amount-out { color: #b94439; font-weight: 800; }
.payment-destination, .pos-payment-destination { border: 1px dashed var(--line); background: var(--green-100); border-radius: 14px; padding: 10px 12px; }
.payment-destination label, .pos-payment-destination label { display: grid; gap: 6px; font-weight: 700; }
.pos-payment-destination { margin-top: 8px; }

@media (max-width: 900px) {
  .finance-toolbar { align-items: stretch; flex-direction: column; }
  .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

@font-face {
  font-family: "Estedad";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/estedad-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #17231f;
  --muted: #64716d;
  --green-950: #102824;
  --green-900: #183b35;
  --green-800: #205047;
  --green-700: #28675b;
  --green-100: #e6f0ed;
  --cream: #f5f2e9;
  --sand: #e9e0ce;
  --gold: #d59a42;
  --gold-soft: #f3dfbc;
  --white: #fff;
  --red: #b9473e;
  --red-soft: #f9e5e2;
  --line: #dfe5e2;
  --shadow: 0 18px 50px rgba(17, 50, 43, .12);
  --soft-shadow: 0 8px 26px rgba(17, 50, 43, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #fafbf9;
  font-family: "Estedad", Tahoma, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.top-ribbon { background: var(--green-950); color: #d7e6e1; text-align: center; font-size: 12px; padding: 5px 16px; letter-spacing: .1px; }
.site-header {
  position: sticky; top: 0; z-index: 30;
  min-height: 78px; padding: 12px clamp(18px, 4vw, 64px);
  display: grid; grid-template-columns: auto minmax(240px, 680px) auto; align-items: center; gap: 24px;
  background: rgba(255,255,255,.93); border-bottom: 1px solid rgba(32,80,71,.09); backdrop-filter: blur(18px);
}
.site-header.logged-in { grid-template-columns: auto auto minmax(240px, 680px) auto; }
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); text-align: right; padding: 0; }
.brand-mark, .auth-brand > span { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px 14px 4px 14px; color: var(--white); background: var(--green-900); font-size: 25px; font-weight: 900; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08); }
.brand strong { display: block; font-size: 21px; letter-spacing: -.5px; }
.brand small { display: block; margin-top: -4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.header-search { height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 15px; color: var(--muted); background: #f3f6f4; border: 1px solid transparent; border-radius: 15px; transition: .2s; }
.header-search:focus-within { background: #fff; border-color: var(--green-700); box-shadow: 0 0 0 4px var(--green-100); }
.header-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-action, .login-button { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 14px; padding: 0 13px; }
.header-action { border: 1px solid var(--line); color: var(--green-900); background: #fff; }
.header-action b { min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 20px; color: #fff; background: var(--gold); font-size: 11px; }
.login-button { border: 0; color: #fff; background: var(--green-900); }
.menu-button { margin-left: -10px; }
.icon-button { width: 45px; height: 45px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px; }
.icon-button span { display: block; height: 2px; margin: 4px 0; background: var(--green-900); border-radius: 2px; }

#appView { min-height: calc(100vh - 108px); outline: none; }
.store-hero {
  position: relative; min-height: 440px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0,1.05fr) minmax(340px,.95fr); align-items: center; gap: 40px;
  padding: 70px clamp(24px, 7vw, 110px); color: #fff;
  background: radial-gradient(circle at 79% 30%, rgba(213,154,66,.24), transparent 27%), linear-gradient(135deg, var(--green-950), #214f47 72%, #2f6a5d);
}
.store-hero::before, .store-hero::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); }
.store-hero::before { width: 460px; height: 460px; left: -120px; top: -200px; }
.store-hero::after { width: 280px; height: 280px; left: 32%; bottom: -210px; }
.hero-copy { position: relative; z-index: 2; max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-soft); font-size: 13px; font-weight: 700; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--gold); }
.hero-copy h1 { margin: 12px 0 16px; font-size: clamp(38px, 5vw, 72px); line-height: 1.12; letter-spacing: -2px; }
.hero-copy p { max-width: 560px; margin: 0 0 28px; color: #d3e3de; font-size: 16px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { position: relative; z-index: 2; min-height: 310px; display: grid; place-items: center; }
.hero-product { position: relative; width: min(360px, 90%); aspect-ratio: 1.1; border-radius: 44% 44% 22% 44%; background: linear-gradient(145deg, #f8f4e9, #d7cbb5); transform: rotate(-5deg); box-shadow: 0 35px 80px rgba(0,0,0,.3); }
.hero-product::before { content: "NIVARO"; position: absolute; inset: 18%; display: grid; place-items: center; border: 2px solid rgba(24,59,53,.25); color: var(--green-900); font-size: clamp(22px,4vw,44px); font-weight: 900; letter-spacing: 5px; transform: rotate(5deg); }
.hero-badge { position: absolute; right: 5%; top: 10%; width: 88px; height: 88px; display: grid; place-items: center; text-align: center; border-radius: 50%; color: var(--green-950); background: var(--gold-soft); box-shadow: var(--shadow); font-size: 12px; font-weight: 800; transform: rotate(8deg); }
.primary-button, .secondary-button, .ghost-button, .danger-button { border-radius: 13px; padding: 11px 18px; font-weight: 700; border: 1px solid transparent; transition: .18s ease; }
.primary-button { color: #fff; background: var(--green-800); }
.primary-button:hover { background: var(--green-900); transform: translateY(-1px); }
.secondary-button { color: var(--green-950); background: var(--gold-soft); }
.secondary-button:hover { background: #f5d89f; }
.ghost-button { color: var(--green-900); background: #fff; border-color: var(--line); }
.ghost-button:hover { border-color: var(--green-700); background: var(--green-100); }
.danger-button { color: var(--red); background: var(--red-soft); }

.correction-banner, .invoice-return-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border: 1px solid color-mix(in srgb, var(--green-700) 28%, transparent);
  background: color-mix(in srgb, var(--green-700) 8%, var(--white));
}
.correction-banner div, .invoice-return-notice { line-height: 1.8; }
.correction-banner small, .invoice-return-notice span { display: block; color: var(--muted); }
.invoice-return-notice { margin: 14px 0; align-items: flex-start; flex-direction: column; border-radius: 16px; }
.invoice-correction-actions { display: inline-flex; }
.product-form-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: stretch; }
.product-form-actions .danger-button { min-width: 130px; }
@media (max-width: 620px) { .product-form-actions { grid-template-columns: 1fr; } }
.wide { width: 100%; }
.store-benefits { margin: -28px auto 0; position: relative; z-index: 3; max-width: 1120px; display: grid; grid-template-columns: repeat(3,1fr); background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.benefit { display: flex; align-items: center; gap: 14px; padding: 23px 28px; border-left: 1px solid var(--line); }
.benefit:last-child { border-left: 0; }
.benefit svg { color: var(--green-700); }
.benefit strong, .benefit small { display: block; }
.benefit small { color: var(--muted); font-size: 12px; }
.store-section { max-width: 1260px; margin: 0 auto; padding: 74px clamp(18px,4vw,42px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading h2 { margin: 2px 0 0; font-size: clamp(25px,3vw,36px); letter-spacing: -1px; }
.section-heading p { margin: 0; color: var(--muted); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip { border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; color: var(--muted); background: #fff; }
.filter-chip.active { border-color: var(--green-800); color: #fff; background: var(--green-800); }
.product-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 18px; }
.product-card { overflow: hidden; display: flex; flex-direction: column; background: #fff; border: 1px solid #e8ecea; border-radius: 20px; box-shadow: 0 8px 28px rgba(23,35,31,.05); transition: .22s; }
.product-card:hover { transform: translateY(-5px); box-shadow: var(--soft-shadow); border-color: #cfddd8; }
.product-visual { position: relative; aspect-ratio: 1.16; overflow: hidden; display: grid; place-items: center; background: linear-gradient(145deg,#f0f4f2,#e4ece8); }
.product-visual img { width: 100%; height: 100%; object-fit: cover; }
.product-placeholder { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 28px; color: var(--green-800); background: rgba(255,255,255,.78); font-size: 34px; font-weight: 900; box-shadow: var(--soft-shadow); }
.stock-badge { position: absolute; top: 12px; right: 12px; border-radius: 99px; padding: 4px 9px; color: var(--green-900); background: rgba(255,255,255,.9); font-size: 10px; }
.stock-badge.out { color: var(--red); background: var(--red-soft); }
.product-info { display: flex; flex-direction: column; flex: 1; padding: 17px; }
.product-meta { color: var(--muted); font-size: 11px; }
.product-info h3 { margin: 5px 0 12px; font-size: 16px; }
.product-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { color: var(--green-900); font-weight: 900; }
.price small { color: var(--muted); font-size: 10px; font-weight: 400; }
.add-cart { width: 39px; height: 39px; display: grid; place-items: center; border: 0; border-radius: 12px; color: #fff; background: var(--green-800); }
.add-cart:disabled { opacity: .4; cursor: not-allowed; }
.empty-state { padding: 60px 24px; text-align: center; border: 1px dashed #bdcac6; border-radius: var(--radius); background: #f7f9f8; }
.empty-icon { width: 70px; height: 70px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 22px; color: var(--green-800); background: var(--green-100); font-size: 28px; }
.empty-state h3 { margin: 0; }
.empty-state p { margin: 6px 0 18px; color: var(--muted); }

.app-page { max-width: 1440px; margin: 0 auto; padding: 38px clamp(18px,4vw,58px) 80px; }
.page-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-titlebar h1 { margin: 0; font-size: clamp(25px,3vw,38px); letter-spacing: -1px; }
.page-titlebar p { margin: 2px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.period-select { min-width: 155px; display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.period-select select { min-width: 105px; border: 0; padding: 5px; box-shadow: none; background: transparent; font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; margin-bottom: 24px; }
.dashboard-metrics { grid-template-columns: repeat(5,minmax(0,1fr)); }
.metric-card { padding: 22px; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: 0 7px 22px rgba(23,35,31,.04); }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.metric-top span:last-child { width: 38px; height: 38px; display: grid; place-items: center; color: var(--green-700); background: var(--green-100); border-radius: 12px; }
.metric-card strong { display: block; margin-top: 12px; font-size: 25px; }
.panel-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(280px,.7fr); gap: 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 7px 22px rgba(23,35,31,.04); overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .panel-heading h3 { margin: 0; font-size: 17px; }
.panel-body { padding: 20px; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th, .data-table td { padding: 13px 15px; text-align: right; border-bottom: 1px solid #edf0ee; white-space: nowrap; }
.data-table th { color: var(--muted); background: #f8faf9; font-size: 11px; font-weight: 700; }
.data-table td { font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.table-product { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.table-product-copy { min-width: 0; display: grid; gap: 3px; }
.table-product-name { display: block; direction: rtl; unicode-bidi: plaintext; line-height: 1.7; white-space: normal; }
.table-product-code { display: block; direction: ltr; unicode-bidi: isolate; text-align: right; line-height: 1.35; letter-spacing: .02em; }
.table-thumb { width: 42px; height: 42px; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; border-radius: 12px; color: var(--green-800); background: var(--green-100); font-weight: 900; }
.table-thumb img { width: 100%; height: 100%; object-fit: cover; }
.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 4px 9px; font-size: 10px; font-weight: 700; }
.status.good { color: #1f6d52; background: #e3f5ed; }
.status.warn { color: #956314; background: #fff2d7; }
.status.bad { color: var(--red); background: var(--red-soft); }
.status.neutral { color: #55645f; background: #edf1ef; }
.row-actions { display: flex; gap: 6px; }
.small-button { border: 1px solid var(--line); border-radius: 9px; padding: 5px 9px; color: var(--green-800); background: #fff; font-size: 11px; }
.link-button { border: 0; padding: 0; color: var(--green-800); background: transparent; font: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: #bfd2cb; text-underline-offset: 3px; }
.active-filter-banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: -10px 0 16px; padding: 11px 15px; border: 1px solid #cfe0da; border-radius: 14px; color: var(--green-900); background: var(--green-100); font-size: 12px; }
.category-create-form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f7faf8; }
.category-create-form .primary-button { min-height: 43px; }
.category-manager-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.category-manager-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; text-align: right; transition: .18s; }
.category-manager-item:hover, .category-manager-item.active { border-color: var(--green-700); background: var(--green-100); transform: translateY(-1px); }
.category-manager-item span, .category-manager-item strong, .category-manager-item small { display: block; }
.category-manager-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.category-manager-item i { color: var(--green-800); font-size: 10px; font-style: normal; white-space: nowrap; }
.category-admin-page { min-height: calc(100vh - 110px); }
.category-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.category-table { min-width: 980px; }
.category-name-cell { min-width: 260px; display: flex; align-items: center; gap: 11px; }
.category-name-cell .category-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: var(--green-800); background: var(--green-100); font-weight: 900; }
.category-name-cell strong, .category-name-cell small { display: block; }
.category-name-cell small { max-width: 330px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.category-delete { color: var(--red); }
.category-delete:disabled { cursor: not-allowed; opacity: .38; color: var(--muted); background: #f1f3f2; }
.two-column-page { display: grid; grid-template-columns: minmax(350px,.8fr) minmax(0,1.2fr); gap: 18px; align-items: start; }
.purchase-app-page { padding-top: 24px; }
.purchase-app-page > .page-titlebar { margin-bottom: 16px; }
.purchase-page { grid-template-columns: minmax(0,1fr); gap: 14px; }
.purchase-form-panel .panel-heading { padding: 12px 18px; }
.purchase-form-panel .panel-body { padding: 14px 16px; }
.purchase-form-panel .stack-form { gap: 10px; }
.purchase-form-panel .form-grid { gap: 10px; }
.stack-form { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
label { display: grid; gap: 6px; color: #40504b; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #d7dfdc; border-radius: 11px; padding: 10px 12px; outline: 0; transition: .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px var(--green-100); }
input.readonly-field { color: var(--green-900); background: #edf4f1; font-weight: 800; direction: ltr; text-align: left; }
.money-input { min-width: 145px; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; font-weight: 700; }
textarea { resize: vertical; }
.field-help { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.7; }
.choice-with-add { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.choice-with-add .small-button { min-height: 42px; white-space: nowrap; padding-inline: 12px; }
.autocomplete { position: relative; }
.suggestions { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; left: 0; max-height: 280px; overflow: auto; padding: 6px; border: 1px solid #cbd8d3; border-radius: 14px; background: #fff; box-shadow: 0 18px 48px rgba(18,51,44,.18); }
.suggestions button { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 0; border-radius: 9px; color: var(--ink); background: transparent; text-align: right; }
.suggestions button:hover { background: var(--green-100); }
.suggestions button small { color: var(--muted); }
.suggestions .create-suggestion { margin-top: 4px; border-top: 1px solid var(--line); color: var(--green-800); background: #f2f7f5; }
.suggestions .suggestion-status { padding: 10px 11px; color: var(--muted); font-size: .82rem; }
.suggestions .suggestion-status.error { color: #9f352d; }
.inline-create { display: grid; gap: 12px; padding: 14px; border: 1px dashed #b9cbc5; border-radius: 15px; background: #f3f7f5; }
.inline-create.hidden { display: none; }
.input-suffix { position: relative; }
.input-suffix input { padding-left: 48px; }
.input-suffix span { position: absolute; left: 10px; bottom: 10px; color: var(--muted); font-size: 10px; }
.form-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.form-card h3 { margin: 0 0 16px; }
.line-builder { display: grid; grid-template-columns: minmax(180px,1.7fr) minmax(80px,.55fr) minmax(150px,1fr) minmax(150px,1fr) minmax(82px,.55fr) auto; align-items: end; gap: 10px; padding: 15px; border-radius: 15px; background: #f3f6f4; }
.line-builder input, .line-builder select { min-height: 43px; }
.purchase-line-builder { grid-template-columns: minmax(350px,2fr) minmax(90px,.5fr) minmax(165px,.9fr) minmax(165px,.9fr) minmax(82px,.45fr) auto; padding: 10px; }
.purchase-product-choice { grid-template-columns: minmax(160px,1fr) auto; }
.purchase-product-choice .icon-label-button { min-height: 43px; }
.purchase-product-choice svg { width: 18px; height: 18px; }
.purchase-supplier-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.45fr); gap: 10px; align-items: end; }
.purchase-payment-card { min-height: 67px; display: grid; grid-template-columns: auto 190px; align-items: center; gap: 4px 12px; padding: 8px 11px; border: 1px solid #d7dfdc; border-radius: 12px; background: #f8faf9; }
.purchase-payment-card > span { color: #40504b; font-size: 11px; font-weight: 800; }
.purchase-payment-card small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.purchase-payment-tabs { display: grid; grid-template-columns: repeat(2,1fr); gap: 4px; padding: 3px; border-radius: 10px; background: #e8efec; }
.purchase-payment-tabs button { border: 0; border-radius: 8px; padding: 7px 9px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; }
.purchase-payment-tabs button.active { color: #fff; background: var(--green-800); box-shadow: 0 3px 10px rgba(16,67,56,.18); }
.purchase-option-selectors { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding: 10px 12px; border: 1px dashed #abc4bb; border-radius: 13px; background: var(--green-100); }
.purchase-option-selectors.hidden { display: none; }
.variant-label { display: inline-flex; padding: 4px 8px; border-radius: 8px; color: var(--green-900); background: var(--green-100); font-size: 10px; font-weight: 800; }
.auto-batch-note { min-height: 43px; display: grid; align-content: center; gap: 1px; padding: 7px 10px; border: 1px solid #d7dfdc; border-radius: 11px; color: var(--muted); background: #fff; }
.auto-batch-note span { font-size: 9px; }
.auto-batch-note strong { color: var(--green-800); font-size: 12px; }
.jalali-input-wrap { position: relative; display: grid; grid-template-columns: 1fr 44px; }
.jalali-input-wrap input { border-radius: 0 11px 11px 0; direction: ltr; text-align: left; font-weight: 700; }
.jalali-input-wrap button { border: 1px solid #d7dfdc; border-right: 0; border-radius: 11px 0 0 11px; color: var(--green-800); background: var(--green-100); }
.invoice-attachment { display: grid; grid-template-columns: minmax(0,1fr) 180px; gap: 14px; align-items: stretch; }
.invoice-image-preview { min-height: 105px; overflow: hidden; display: grid; place-items: center; border: 1px dashed #b9cbc5; border-radius: 14px; color: var(--muted); background: #f7faf8; font-size: 10px; }
.purchase-support-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(280px,.75fr); gap: 12px; align-items: stretch; }
.purchase-support-grid .invoice-image-preview { min-height: 72px; }
.purchase-support-grid textarea { min-height: 72px; }
.purchase-submit-row { display: grid; grid-template-columns: minmax(300px,.7fr) minmax(360px,1.3fr); gap: 12px; }
.purchase-submit-row > .primary-button { min-height: 56px; }
.inventory-variants { min-width: 190px; display: grid; gap: 5px; }
.inventory-variant { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 9px; color: var(--green-900); background: var(--green-100); font-size: 10px; }
.inventory-variant b { color: var(--green-800); }
.invoice-image-preview img { width: 100%; height: 100%; max-height: 150px; object-fit: cover; }
.purchase-image-view { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #f3f6f4; }
.purchase-image-view img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.invoice-total { display: flex; justify-content: space-between; align-items: center; padding: 17px; border-radius: 15px; color: #fff; background: var(--green-900); }
.invoice-total strong { font-size: 20px; }
.pos-workspace { direction: ltr; display: grid; grid-template-columns: minmax(285px,.72fr) minmax(330px,.9fr) minmax(430px,1.25fr); grid-template-areas: "lines lines catalog" "checkout customer catalog"; gap: 14px; align-items: stretch; min-height: 720px; }
.pos-workspace > .panel { direction: rtl; min-width: 0; overflow: visible; }
.pos-lines-panel { grid-area: lines; align-self: start; overflow: hidden !important; }
.pos-catalog-panel { grid-area: catalog; overflow: hidden !important; background: #f7faf8; }
.pos-customer-panel { grid-area: customer; }
.pos-checkout-panel { grid-area: checkout; }
.pos-catalog-heading { background: var(--green-950); color: #fff; }
.pos-catalog-heading .product-meta { color: #c8dbd5; }
.pos-catalog-body { display: grid; align-content: start; gap: 14px; max-height: 760px; overflow-y: auto; }
.pos-search { position: relative; }
.pos-search span { position: absolute; z-index: 1; right: 14px; top: 8px; color: var(--green-700); font-size: 24px; }
.pos-search input { padding-right: 43px; background: #fff; }
.pos-category-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.pos-category { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid #d8e2de; border-radius: 12px; color: var(--green-900); background: #fff; text-align: right; }
.pos-category strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pos-category small { min-width: 23px; padding: 2px 5px; border-radius: 99px; color: var(--muted); background: #edf3f0; text-align: center; }
.pos-category:hover, .pos-category.active { border-color: var(--green-700); color: #fff; background: var(--green-700); box-shadow: 0 7px 16px rgba(32,80,71,.18); }
.pos-category.active small { color: var(--green-900); background: #fff; }
.pos-products { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.pos-product { min-width: 0; min-height: 91px; position: relative; display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 9px; align-items: center; padding: 9px 9px 9px 34px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; text-align: right; box-shadow: 0 5px 12px rgba(17,50,43,.04); }
.pos-product:hover { border-color: #92b7aa; transform: translateY(-1px); box-shadow: var(--soft-shadow); }
.pos-product:disabled { opacity: .48; cursor: not-allowed; }
.pos-product-image { width: 58px; height: 58px; overflow: hidden; display: grid; place-items: center; border-radius: 11px; background: var(--green-100); }
.pos-product-image img { width: 100%; height: 100%; object-fit: cover; }
.pos-product-copy { min-width: 0; }
.pos-product-copy strong, .pos-product-copy small, .pos-product-copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-product-copy strong { font-size: 11px; }
.pos-product-copy small { color: var(--muted); font-size: 9px; }
.pos-product-copy b { margin-top: 5px; color: var(--green-800); font-size: 10px; }
.pos-product > i { position: absolute; left: 9px; bottom: 9px; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; color: #fff; background: var(--green-700); font-size: 17px; font-style: normal; }
.pos-invoice-table { min-height: 245px; max-height: 330px; overflow: auto; }
.pos-line-head, .pos-line-row { display: grid; grid-template-columns: 48px minmax(180px,1.7fr) minmax(110px,.8fr) 120px minmax(110px,.8fr) 38px; gap: 8px; align-items: center; padding: 9px 16px; }
.pos-line-head { position: sticky; top: 0; z-index: 2; color: var(--muted); background: #f2f6f4; font-size: 9px; font-weight: 700; }
.pos-line-row { min-height: 62px; border-top: 1px solid var(--line); font-size: 10px; }
.pos-line-row > div:nth-child(2) { min-width: 0; }
.pos-line-row strong, .pos-line-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-line-row small { color: var(--muted); }
.pos-line-row b { color: var(--green-900); font-size: 10px; }
.pos-empty-basket { min-height: 245px; display: grid; place-content: center; justify-items: center; gap: 5px; color: var(--muted); text-align: center; }
.pos-empty-basket > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: var(--green-700); background: var(--green-100); font-size: 23px; }
.pos-empty-basket strong { color: var(--ink); }
.pos-empty-basket small { font-size: 10px; }
.qty-control { display: flex; align-items: center; gap: 7px; }
.qty-control button { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qty-control span { min-width: 24px; text-align: center; }
.pos-remove-line { width: 28px; height: 28px; border: 0; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 17px; }
.pos-customer-body, .pos-checkout-body { display: grid; align-content: start; gap: 14px; }
.pos-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 12px; background: #edf3f0; }
.pos-segmented button { padding: 9px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 10px; }
.pos-segmented button.active { color: #fff; background: var(--green-700); box-shadow: 0 5px 11px rgba(32,80,71,.16); }
.pos-customer-search { z-index: 4; }
.pos-customer-details { min-height: 112px; }
.pos-cash-customer { height: 100%; min-height: 112px; display: grid; align-content: center; gap: 5px; padding: 15px; border: 1px dashed #aec4bd; border-radius: 14px; color: var(--muted); background: #f7faf8; }
.pos-cash-customer span { color: var(--green-900); font-weight: 800; }
.pos-cash-customer small { font-size: 10px; }
.pos-selected-customer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border: 1px solid #b9d0c8; border-radius: 14px 14px 0 0; background: #f2f8f5; }
.pos-selected-customer > div { min-width: 0; display: flex; align-items: center; gap: 9px; }
.pos-selected-customer strong, .pos-selected-customer small { display: block; }
.pos-selected-customer small { color: var(--muted); font-size: 9px; }
.pos-avatar { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 39px; border-radius: 12px; color: #fff; background: var(--green-800); font-size: 16px; font-weight: 800; }
.pos-customer-stats { display: grid; grid-template-columns: 1fr 1fr; border: solid #b9d0c8; border-width: 0 1px 1px; border-radius: 0 0 14px 14px; }
.pos-customer-stats > div { display: grid; gap: 3px; padding: 10px 12px; }
.pos-customer-stats > div + div { border-right: 1px solid #d4e1dc; }
.pos-customer-stats span { color: var(--muted); font-size: 9px; }
.pos-customer-stats strong { font-size: 10px; }
.amount-warn { color: var(--red); }
.pos-no-result { margin: 0; padding: 12px; color: var(--muted); font-size: 10px; }
.pos-adjustment { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f7faf8; }
.pos-adjustment-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pos-adjustment-title > span { font-weight: 800; }
.pos-mini-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: #e6eeeb; }
.pos-mini-tabs button { padding: 5px 8px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; }
.pos-mini-tabs button.active { color: #fff; background: var(--green-800); }
.pos-adjustment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pos-totals { display: grid; gap: 7px; padding: 12px; border-top: 1px dashed #c6d2ce; border-bottom: 1px dashed #c6d2ce; }
.pos-totals > div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.pos-totals strong { color: var(--ink); }
.pos-final-total { box-shadow: 0 10px 22px rgba(24,59,53,.18); }
.pos-submit { min-height: 48px; }
.pos-mode { overflow: hidden; background: #f3f6f4; }
.pos-mode .top-ribbon { display: none; }
.pos-menu-button { display: none; }
.internal-mode .site-header { display: none !important; }
.internal-mode .pos-menu-button {
  width: 46px; height: 46px; position: fixed; z-index: 55; top: 38px; right: 10px;
  display: block !important; margin: 0; border-color: #cbd8d3;
  box-shadow: 0 8px 22px rgba(17,50,43,.14);
}
.internal-mode #appView { min-height: calc(100vh - 29px); }
.pos-mode .site-header { display: none !important; }
.pos-mode .pos-menu-button { width: 46px; height: 46px; position: fixed; z-index: 55; top: 10px; right: 10px; display: block !important; margin: 0; border-color: #cbd8d3; box-shadow: 0 8px 22px rgba(17,50,43,.14); }
.pos-menu-button span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--green-900); }
.pos-mode #appView { height: 100vh; min-height: 0; overflow: hidden; }
.pos-page { width: 100%; height: 100vh; max-width: none; padding: 8px 10px; }
.pos-page .pos-workspace { height: 100%; min-height: 0; grid-template-columns: minmax(280px,.72fr) minmax(315px,.85fr) minmax(430px,1.25fr); grid-template-rows: minmax(0,55%) minmax(0,45%); gap: 8px; }
.pos-page .panel { border-radius: 15px; }
.pos-page .pos-catalog-body { height: 100%; max-height: none; gap: 9px; padding: 9px; overflow-y: auto; }
.pos-search-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: center; padding-right: 50px; }
.pos-search-line .pos-search input { min-height: 40px; }
.pos-search-line .status { white-space: nowrap; }
.pos-page .pos-category-list { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.pos-page .pos-category { min-height: 43px; padding: 6px 8px; border-radius: 10px; }
.pos-page .pos-products { gap: 6px; }
.pos-page .pos-product { min-height: 74px; grid-template-columns: 48px minmax(0,1fr); padding: 7px 7px 7px 48px; border-radius: 11px; }
.pos-page .pos-product-image { width: 48px; height: 48px; border-radius: 9px; }
.pos-product-copy em { display: block; margin-top: 2px; color: var(--gold); font-size: 8px; font-style: normal; }
.pos-product-action { position: absolute; top: 50%; left: 8px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green-700); transform: translateY(-50%); }
.pos-product-action svg { width: 20px; height: 20px; }
.pos-page .pos-invoice-table { height: 100%; min-height: 0; max-height: none; }
.pos-page .pos-line-head, .pos-page .pos-line-row { grid-template-columns: 42px minmax(165px,1.7fr) minmax(95px,.8fr) 110px minmax(95px,.8fr) 34px; padding: 7px 11px; }
.pos-page .pos-line-head { height: 42px; }
.pos-page .pos-line-row { min-height: 56px; }
.pos-trash-button { width: 29px; height: 29px; display: grid; place-items: center; padding: 5px; border: 0; border-radius: 8px; color: var(--red); background: var(--red-soft); }
.pos-trash-button svg { width: 17px; height: 17px; }
.pos-page .pos-empty-basket { min-height: calc(100% - 42px); }
.pos-page .pos-customer-body, .pos-page .pos-checkout-body { height: 100%; gap: 8px; padding: 10px; }
.pos-customer-search-line { display: grid; grid-template-columns: minmax(0,1fr) 42px; gap: 6px; }
.pos-customer-search-line input { min-height: 43px; }
.pos-customer-search-line button { display: grid; place-items: center; border: 0; border-radius: 11px; color: #fff; background: var(--green-700); }
.pos-customer-search-line button svg { width: 21px; height: 21px; }
.pos-page .pos-customer-details { min-height: 0; }
.pos-page .pos-selected-customer { border-radius: 12px; padding: 9px; }
.pos-adjustment-lines { display: grid; gap: 6px; }
.pos-adjustment-row { display: grid; grid-template-columns: minmax(75px,.7fr) 72px minmax(95px,1fr); gap: 6px; align-items: center; min-height: 43px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 11px; background: #f7faf8; }
.pos-adjustment-row > strong { font-size: 10px; }
.pos-adjustment-row > input:not([type="hidden"]) { min-height: 33px; padding: 5px 8px; text-align: left; direction: ltr; font-size: 11px; }
.pos-line-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 8px; background: #e6eeeb; }
.pos-line-tabs button { min-height: 29px; padding: 3px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 9px; }
.pos-line-tabs button.active { color: #fff; background: var(--green-800); }
.pos-line-tabs svg { width: 16px; height: 16px; vertical-align: middle; }
.pos-page .pos-totals { gap: 3px; padding: 7px 4px; }
.pos-page .pos-totals > div { font-size: 9px; }
.pos-payment-footer { display: grid; gap: 7px; margin-top: auto; }
.pos-final-total { display: flex; justify-content: space-between; align-items: center; min-height: 50px; padding: 8px 12px; border-radius: 12px; color: #fff; background: var(--green-950); }
.pos-final-total span { font-size: 10px; }
.pos-final-total strong { font-size: 18px; }
.pos-payment-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pos-payment-method { min-height: 52px; position: relative; margin: 0; }
.pos-payment-method > button, .pos-payment-actions .pos-submit { width: 100%; min-height: 52px; display: grid; grid-template-columns: 34px minmax(0,1fr) 20px; align-items: center; gap: 5px; margin: 0; padding: 6px; border: 1px solid #b9cbc5; border-radius: 12px; color: var(--green-900); background: #f4f8f6; text-align: right; }
.pos-payment-method > button > span, .pos-payment-actions .pos-submit > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--green-700); }
.pos-payment-method > button > span svg, .pos-payment-actions .pos-submit > span svg { width: 19px; height: 19px; }
.pos-payment-method > button > i { display: grid; place-items: center; color: var(--muted); }
.pos-payment-method > button > i svg { width: 17px; height: 17px; }
.pos-payment-menu { min-width: 265px; position: absolute; z-index: 30; right: 0; bottom: calc(100% + 7px); display: grid; gap: 4px; padding: 7px; border: 1px solid #cbd8d3; border-radius: 14px; background: #fff; box-shadow: 0 18px 45px rgba(17,50,43,.22); }
.pos-payment-menu > button { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: center; padding: 8px; border: 0; border-radius: 10px; color: var(--ink); background: transparent; text-align: right; }
.pos-payment-menu > button:hover, .pos-payment-menu > button.active { color: var(--green-900); background: var(--green-100); }
.pos-payment-menu > button > span { width: 36px; height: 36px; grid-row: 1 / 3; display: grid; place-items: center; border-radius: 10px; color: var(--green-800); background: #edf4f1; }
.pos-payment-menu > button > span svg { width: 19px; height: 19px; }
.pos-payment-menu > button b { font-size: 10px; }
.pos-payment-menu > button small { color: var(--muted); font-size: 8px; }
.pos-payment-actions .pos-submit { grid-template-columns: 34px 1fr; border: 0; color: #fff; background: var(--green-800); }
.pos-payment-actions .pos-submit > span { color: var(--green-900); background: var(--gold-soft); }
.pos-payment-actions .pos-submit b { font-size: 11px; }
.option-modal { width: min(650px,94vw); }
.option-picker-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.option-picker-head h2, .option-picker-head p { margin: 0; }
.option-picker-head p { color: var(--muted); font-size: 10px; }
.pos-option-form { display: grid; gap: 12px; }
.pos-option-form fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.pos-option-form legend { padding: 0 7px; color: var(--green-900); font-weight: 800; }
.pos-option-choices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.pos-option-choices label { display: flex; align-items: center; gap: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf9; }
.pos-option-choices input { width: auto; }
.pos-option-choices small { margin-right: auto; color: var(--green-700); font-size: 8px; }
.option-picker-total { display: flex; justify-content: space-between; padding: 12px; border-radius: 12px; color: #fff; background: var(--green-900); }
.product-options-editor { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #f7faf8; }
.product-options-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.product-options-editor h3, .product-options-editor small { display: block; margin: 0; }
.product-options-editor small { color: var(--muted); font-size: 9px; }
#productOptionGroups, .product-option-group, .product-option-list { display: grid; gap: 8px; }
.product-option-group { padding: 10px; border: 1px solid #cfddd8; border-radius: 12px; background: #fff; }
.product-option-group-head { display: grid; grid-template-columns: minmax(160px,1fr) auto 34px; gap: 7px; align-items: center; }
.product-option-group-head label { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 9px; }
.product-option-group-head label input { width: auto; }
.product-option-group-head > button, .product-option-row > button { height: 34px; border: 0; border-radius: 8px; color: var(--red); background: var(--red-soft); }
.product-option-row { display: grid; grid-template-columns: minmax(150px,1fr) minmax(150px,.8fr) 34px; gap: 7px; }
.option-add-row { justify-self: start; border: 0; color: var(--green-700); background: transparent; font-size: 10px; }
.sticky-panel { position: sticky; top: 100px; }
.low-stock-list { display: grid; gap: 9px; }
.low-stock-item { display: flex; justify-content: space-between; gap: 12px; padding: 11px; border-radius: 12px; background: #fff8e9; }
.chart-bars { height: 190px; display: flex; align-items: end; gap: 10px; padding-top: 20px; }
.chart-bar { flex: 1; min-width: 28px; border-radius: 8px 8px 2px 2px; background: linear-gradient(var(--green-700), var(--green-900)); position: relative; }
.chart-bar span { position: absolute; left: 50%; bottom: -25px; transform: translateX(-50%); color: var(--muted); font-size: 9px; white-space: nowrap; }
.dashboard-main { display: grid; grid-template-columns: minmax(0,2fr) minmax(300px,.72fr); gap: 18px; margin-bottom: 18px; }
.dashboard-secondary { grid-template-columns: minmax(0,1.35fr) minmax(390px,.75fr); }
.dashboard-side-stack { display: grid; gap: 18px; }
.dashboard-chart-scroll { overflow-x: auto; padding: 10px 2px 4px; }
.dashboard-chart { min-width: max(680px, calc(var(--chart-columns) * 31px)); height: 250px; display: grid; grid-template-columns: repeat(var(--chart-columns),minmax(23px,1fr)); gap: 7px; align-items: end; padding: 18px 6px 0; border-bottom: 1px solid #dce5e1; background: repeating-linear-gradient(to top,#eef2f0 0,#eef2f0 1px,transparent 1px,transparent 52px); }
.dashboard-chart-column { height: 230px; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; text-align: center; }
.dashboard-chart-column small { height: 22px; padding-top: 5px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.dashboard-chart-bar { min-height: 2px; max-height: 190px; position: relative; border-radius: 9px 9px 3px 3px; background: linear-gradient(180deg,var(--green-700),var(--green-900)); box-shadow: 0 7px 13px rgba(30,91,72,.15); transition: .2s; }
.dashboard-chart-bar:hover { filter: brightness(1.12); }
.dashboard-chart-bar i { position: absolute; top: 5px; right: 0; left: 0; color: rgba(255,255,255,.9); font-size: 9px; font-style: normal; }
.chart-value { position: absolute; z-index: 2; right: 50%; bottom: calc(100% - 12px); display: none; transform: translateX(50%); padding: 5px 7px; border-radius: 7px; color: #fff; background: var(--green-950); font-size: 9px; white-space: nowrap; }
.dashboard-chart-column:hover .chart-value { display: block; }
.breakdown-list { display: grid; gap: 18px; }
.breakdown-row > div:first-child { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf2f0; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--green-700)); }
.compact-table { min-width: 520px; }
.loading { min-height: 360px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--green-100); border-top-color: var(--green-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-menu { position: fixed; top: 0; right: 0; z-index: 60; width: 310px; height: 100vh; display: flex; flex-direction: column; color: #e7f1ed; background: var(--green-950); transform: translateX(105%); transition: .25s ease; box-shadow: -20px 0 60px rgba(0,0,0,.25); }
.app-menu.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5,18,15,.45); backdrop-filter: blur(3px); }
.menu-profile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 25px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.menu-profile > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--green-950); background: var(--gold-soft); font-weight: 900; }
.menu-profile strong, .menu-profile small { display: block; }
.menu-profile small { color: #9db6ae; font-size: 11px; }
.plain-icon { width: 36px; height: 36px; border: 0; color: inherit; background: transparent; font-size: 26px; }
.app-menu nav { flex: 1; overflow: auto; padding: 15px 11px; }
.menu-link { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 12px; padding: 11px 13px; color: #bcd0c9; background: transparent; text-align: right; }
.menu-link:hover, .menu-link.active { color: #fff; background: rgba(255,255,255,.09); }
.menu-link svg { width: 19px; }
.menu-footer { padding: 16px 20px 22px; border-top: 1px solid rgba(255,255,255,.1); }
.menu-footer span { display: block; color: #78968d; font-size: 10px; }
.menu-footer button { margin-top: 9px; border: 0; color: #ffc6bd; background: transparent; padding: 0; }
.cart-drawer { position: fixed; top: 0; left: 0; z-index: 70; width: min(410px,92vw); height: 100vh; display: flex; flex-direction: column; background: #fff; transform: translateX(-105%); transition: .25s ease; box-shadow: 20px 0 60px rgba(0,0,0,.2); }
.cart-drawer.open { transform: translateX(0); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px; border-bottom: 1px solid var(--line); }
.drawer-heading small { color: var(--muted); }
.drawer-heading h2 { margin: -2px 0 0; }
.cart-contents { flex: 1; overflow: auto; display: flex; flex-direction: column; padding: 20px; }
.cart-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 11px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cart-item .table-thumb { width: 60px; height: 60px; }
.cart-summary { margin-top: auto; padding-top: 20px; }
.cart-summary > div { display: flex; justify-content: space-between; margin-bottom: 13px; }

.modal { width: min(540px,94vw); max-height: 90vh; overflow: auto; border: 0; border-radius: 23px; padding: 28px; color: var(--ink); box-shadow: 0 30px 90px rgba(9,30,25,.28); }
.modal::backdrop { background: rgba(7,24,20,.55); backdrop-filter: blur(4px); }
.large-modal { width: min(860px,95vw); }
.wide-modal { width: min(1120px,96vw); }
.dialog-close { position: absolute; top: 13px; left: 13px; width: 35px; height: 35px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f4f2; font-size: 23px; }
.invoice-header { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 4px 0 20px; border-bottom: 1px solid var(--line); }
.invoice-header h2 { margin: 2px 0; font-size: 28px; }
.invoice-header p { margin: 0; color: var(--muted); }
.invoice-parties { display: grid; grid-template-columns: repeat(2,minmax(210px,1fr)); gap: 10px; }
.invoice-customer { min-width: 220px; display: grid; align-content: center; gap: 3px; padding: 14px 18px; border-radius: 15px; background: var(--green-100); }
.invoice-issuer { background: #f4f7f5; border: 1px solid var(--line); }
.invoice-customer span, .invoice-customer small { color: var(--muted); font-size: 11px; }
.invoice-summary-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.invoice-summary-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf9; }
.invoice-summary-grid span, .invoice-summary-grid strong { display: block; }
.invoice-summary-grid span { color: var(--muted); font-size: 10px; }
.invoice-summary-grid strong { margin-top: 6px; color: var(--green-900); font-size: 14px; }
.customer-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
.invoice-payments, .detail-section { margin-top: 24px; }
.invoice-payments h3, .detail-section h3 { margin: 0 0 12px; }
.ledger-list { display: grid; gap: 8px; }
.ledger-entry { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 11px 13px; border-radius: 12px; background: #f5f8f7; }
.ledger-entry strong, .ledger-entry small { display: block; }
.ledger-entry small { color: var(--muted); font-size: 10px; }
.empty-inline { padding: 13px 15px; border-radius: 12px; color: var(--muted); background: #f5f8f7; text-align: center; font-size: 11px; }
.empty-inline.success-inline { color: #1f6d52; background: #e3f5ed; font-weight: 800; }
.supplier-list-panel, .customer-list-panel { min-height: 360px; overflow: hidden; }
.customer-list-heading { align-items: center; }
.invoice-note { padding: 13px; border-radius: 12px; background: #fff8e9; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand small { color: var(--muted); }
.tab-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 20px; padding: 4px; border-radius: 13px; background: #eff3f1; }
.tab-switch button { border: 0; border-radius: 10px; padding: 9px; color: var(--muted); background: transparent; }
.tab-switch button.active { color: var(--green-900); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.07); font-weight: 700; }
.form-hint { margin: -4px 0 0; color: var(--muted); text-align: center; font-size: 11px; }
.form-hint code { direction: ltr; display: inline-block; padding: 1px 4px; border-radius: 5px; background: #eef2f0; }
.toast-region { position: fixed; z-index: 2147483647; left: 24px; bottom: 24px; display: grid; gap: 8px; pointer-events: none; isolation: isolate; }
.toast { min-width: 260px; max-width: 420px; padding: 13px 16px; border: 1px solid rgba(255,255,255,.25); border-radius: 13px; color: #fff; background: #123f36; box-shadow: 0 16px 44px rgba(5,24,19,.38); opacity: 1; filter: none; animation: toast-in .25s ease; }
.toast.error { background: #9f3f37; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.date-picker { display: none; position: absolute; z-index: 120; width: 292px; padding: 12px; border: 1px solid #cbd8d3; border-radius: 18px; color: var(--ink); background: rgba(255,255,255,.99); box-shadow: 0 22px 60px rgba(18,51,44,.22); }
.date-picker.in-dialog { position: fixed; z-index: 1000; }
.date-picker.active { display: block; }
.date-picker-head { display: grid; grid-template-columns: 38px 1fr 38px; gap: 8px; align-items: center; margin-bottom: 10px; }
.date-picker-head strong { text-align: center; color: var(--green-900); }
.date-picker-head button, .date-grid button { border: 1px solid var(--line); border-radius: 10px; color: var(--green-900); background: #f5f8f7; }
.date-picker-head button { height: 36px; font-size: 20px; }
.date-weekdays, .date-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.date-weekdays span { color: var(--muted); font-size: 11px; text-align: center; padding: 4px 0; }
.date-grid button, .date-empty { height: 34px; }
.date-grid button:hover { border-color: var(--green-700); color: #fff; background: var(--green-700); }

.role-list-panel { overflow: hidden; }
.role-table th:last-child, .role-table td:last-child { width: 250px; }
.table-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.permission-list { display: grid; gap: 8px; }
.permission-item { min-height: 62px; display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #f8faf9; }
.permission-item:has(input:checked) { border-color: #a6c8bc; background: var(--green-100); }
.permission-item input { width: 18px; height: 18px; accent-color: var(--green-700); }
.permission-item strong, .permission-item small { display: block; }
.permission-item small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.employee-page { grid-template-columns: minmax(360px,.72fr) minmax(680px,1.28fr); align-items: start; }
.employee-page .data-table { min-width: 0; }
.employee-page .data-table th, .employee-page .data-table td { padding-right: 8px; padding-left: 8px; white-space: normal; }
.system-access-toggle { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: center; padding: 14px; border: 1px solid #a8c8bd; border-radius: 15px; background: var(--green-100); }
.system-access-toggle input { width: 19px; height: 19px; accent-color: var(--green-700); }
.system-access-toggle strong, .system-access-toggle small { display: block; }
.system-access-toggle small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.access-fields { display: grid; gap: 12px; padding: 14px; border: 1px dashed #a8c8bd; border-radius: 15px; background: #f8faf9; }
.system-login-note { padding: 11px 13px; border-radius: 11px; color: var(--green-900); background: var(--green-100); font-size: 11px; font-weight: 800; }
.system-access-locked { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 15px; color: var(--green-900); background: var(--gold-soft); }
.system-access-locked span { color: var(--muted); font-size: 11px; }
.employee-account-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.employee-account-summary > div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf9; }
.employee-account-summary span, .employee-account-summary strong { display: block; }
.employee-account-summary span { color: var(--muted); font-size: 10px; }
.employee-account-summary strong { margin-top: 5px; color: var(--green-900); }
.employee-list-panel { min-height: 360px; overflow: hidden; }
.employee-list-heading { align-items: center; }
.icon-label-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.icon-label-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.compact-filter { display: flex; align-items: end; gap: 10px; padding: 12px; margin: 12px 0; border: 1px solid var(--line); border-radius: 14px; background: #f8faf9; }
.compact-filter label { flex: 1; min-width: 150px; }
.profit-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }
.calculation-stack { display: grid; gap: 12px; }
.calculation-stack > div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.calculation-stack .total { padding: 14px; border: 0; border-radius: 12px; background: var(--green-900); color: #fff; }
.personnel-ledger-section { margin-top: 18px; }
.report-filter-bar, .invoice-filter-panel { padding: 18px; }
.report-filter-bar .form-grid { align-items: end; }
.report-filter-bar .primary-button { min-height: 48px; }
.invoice-filter-panel { display: grid; gap: 14px; }
.holding-id { direction: ltr; font-size: 12px !important; overflow-wrap: anywhere; }
.employee-account-summary { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); }

@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(3,1fr); }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .pos-products { grid-template-columns: repeat(2,1fr); }
  .purchase-page { grid-template-columns: 1fr; }
  .purchase-supplier-row { grid-template-columns: minmax(0,1fr) minmax(250px,.55fr); }
  .line-builder { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .dashboard-metrics { grid-template-columns: repeat(3,1fr); }
  .dashboard-main, .dashboard-secondary { grid-template-columns: 1fr; }
  .employee-page { grid-template-columns: 1fr; }
  .profit-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .category-metrics { grid-template-columns: repeat(2,1fr); }
  .pos-workspace, .pos-page .pos-workspace { grid-template-columns: minmax(330px,.9fr) minmax(420px,1.1fr); grid-template-rows: minmax(0,45%) minmax(0,20%) minmax(0,35%); grid-template-areas: "lines catalog" "customer catalog" "checkout catalog"; }
  .pos-line-head, .pos-line-row { grid-template-columns: 35px minmax(135px,1.5fr) minmax(90px,.8fr) 105px minmax(90px,.8fr) 32px; padding-right: 10px; padding-left: 10px; }
}
@media (max-width: 820px) {
  .site-header { grid-template-columns: auto 1fr auto; gap: 10px; padding: 10px 14px; }
  .site-header.logged-in { grid-template-columns: auto 1fr auto; }
  .header-search { grid-column: 1 / -1; grid-row: 2; }
  .brand small, .header-action span, .login-button span { display: none; }
  .store-hero { grid-template-columns: 1fr; min-height: 0; padding: 55px 24px 95px; }
  .hero-art { min-height: 230px; }
  .hero-product { width: 260px; }
  .store-benefits { width: calc(100% - 28px); grid-template-columns: 1fr; margin-top: -55px; }
  .benefit { border-left: 0; border-bottom: 1px solid var(--line); }
  .product-grid { grid-template-columns: repeat(2,1fr); }
  .panel-grid, .two-column-page { grid-template-columns: 1fr; }
  .pos-mode { overflow: auto; }
  .pos-mode #appView { height: auto; min-height: 100vh; overflow: visible; }
  .pos-page { height: auto; min-height: 100vh; padding-top: 62px; }
  .pos-workspace, .pos-page .pos-workspace { height: auto; grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "catalog" "lines" "customer" "checkout"; min-height: 0; }
  .pos-catalog-body { max-height: none; }
  .sticky-panel { position: static; }
  .page-titlebar { align-items: flex-start; flex-direction: column; }
  .form-grid.three { grid-template-columns: 1fr 1fr; }
  .invoice-summary-grid, .customer-summary { grid-template-columns: repeat(2,1fr); }
  .invoice-header { flex-direction: column; }
  .purchase-support-grid, .purchase-submit-row { grid-template-columns: 1fr; }
  .purchase-supplier-row, .purchase-option-selectors { grid-template-columns: 1fr; }
  .invoice-parties { grid-template-columns: 1fr; }
  .pos-line-head { display: none; }
  .pos-line-row { grid-template-columns: minmax(125px,1fr) auto; gap: 7px 10px; padding: 12px; }
  .pos-line-row > span:first-child { display: none; }
  .pos-line-row > div:nth-child(2) { grid-column: 1; grid-row: 1; }
  .pos-line-row > b:nth-child(3) { grid-column: 1; grid-row: 2; }
  .pos-line-row > .qty-control { grid-column: 2; grid-row: 1; }
  .pos-line-row > b:nth-child(5) { grid-column: 2; grid-row: 2; }
  .pos-remove-line { grid-column: 2; grid-row: 3; justify-self: end; }
}
@media (max-width: 520px) {
  .brand strong { font-size: 18px; }
  .brand-mark { width: 39px; height: 39px; }
  .hero-copy h1 { font-size: 40px; }
  .hero-art { display: none; }
  .store-hero { padding-bottom: 90px; }
  .store-section, .app-page { padding-right: 14px; padding-left: 14px; }
  .product-grid, .metric-grid, .form-grid.two, .form-grid.three, .pos-products { grid-template-columns: 1fr; }
  .line-builder { grid-template-columns: 1fr 1fr; }
  .choice-with-add, .invoice-attachment { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .category-create-form, .category-manager-list { grid-template-columns: 1fr; }
  .active-filter-banner { align-items: flex-start; flex-direction: column; }
  .category-metrics { grid-template-columns: 1fr; }
  .compact-filter { align-items: stretch; flex-direction: column; }
  .profit-metrics { grid-template-columns: 1fr; }
}

.printing-page { display: grid; gap: 22px; }
.print-settings-panel .panel-body { padding: 22px; }
.print-error { color: #a23832; display: block; max-width: 280px; line-height: 1.7; }
.print-pairing-card { display: grid; justify-items: center; gap: 18px; max-width: 650px; margin: 0 auto; padding: 24px; text-align: center; }
.print-pairing-card h2 { margin: 0; }
.print-pairing-card ol { margin: 0; padding: 0 24px 0 0; text-align: right; line-height: 2; }
.print-pairing-card small { color: var(--muted); }
.pairing-code { direction: ltr; letter-spacing: .28em; font-size: clamp(42px,8vw,72px); line-height: 1; color: var(--green-900); background: var(--green-100); border: 1px dashed #8eb4a7; border-radius: 20px; padding: 22px 32px 22px 22px; }
.print-invoice-button { margin-top: 12px; }
.purchase-edit-quantity, .purchase-edit-cost { width: 110px; max-width: 100%; min-width: 80px; }
