/* Ayar ERP — RTL design system (Bootstrap 5 RTL base) */
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(../vendor/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF; }

:root {
  --ay-brand: #0f766e;
  --ay-brand-600: #0d9488;
  --ay-brand-ink: #134e4a;
  --ay-brand-soft: #e6f3f1;
  --ay-bg: #f4f5f1;
  --ay-surface: #ffffff;
  --ay-line: #e4e7e1;
  --ay-text: #1b2422;
  --ay-muted: #66706c;
  --ay-side: #0f1e1c;
  --ay-side-text: #b9c7c3;
  --ay-warn: #b45309;
  --ay-danger: #b42318;
  --ay-radius: 10px;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-hover-color: #134e4a;
  --bs-body-font-family: "Plex Arabic", "Segoe UI", Tahoma, sans-serif;
  --bs-body-bg: #f4f5f1;
  --bs-body-color: #1b2422;
  --bs-border-color: #e4e7e1;
}

body { font-size: .925rem; background: var(--ay-bg); color: var(--ay-text); }
.num, td.num, th.num, .money { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: start; }
td.num, th.num { text-align: left; }

.btn-primary { --bs-btn-bg: var(--ay-brand); --bs-btn-border-color: var(--ay-brand); --bs-btn-hover-bg: var(--ay-brand-ink); --bs-btn-hover-border-color: var(--ay-brand-ink); --bs-btn-active-bg: var(--ay-brand-ink); --bs-btn-disabled-bg: var(--ay-brand); }
.btn-outline-primary { --bs-btn-color: var(--ay-brand); --bs-btn-border-color: var(--ay-brand); --bs-btn-hover-bg: var(--ay-brand); --bs-btn-hover-border-color: var(--ay-brand); --bs-btn-active-bg: var(--ay-brand-ink); }
.text-bg-primary { background-color: var(--ay-brand) !important; }
.form-control:focus, .form-select:focus { border-color: var(--ay-brand-600); box-shadow: 0 0 0 .2rem rgba(15,118,110,.15); }
.form-check-input:checked { background-color: var(--ay-brand); border-color: var(--ay-brand); }
.form-label { font-weight: 500; font-size: .85rem; color: #3b4542; margin-bottom: .3rem; }

/* ---------- shell */
.ay-shell { display: flex; min-height: 100vh; }
.ay-side { width: 252px; background: var(--ay-side); color: var(--ay-side-text); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ay-side .brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem; color: #fff; font-weight: 700; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.ay-side .brand .logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #14b8a6, #0f766e); display: grid; place-items: center; font-weight: 700; }
.ay-side .brand small { display: block; font-weight: 400; color: var(--ay-side-text); font-size: .72rem; }
.ay-side .sec { padding: .9rem 1.2rem .3rem; font-size: .7rem; letter-spacing: .02em; color: #6f8480; }
.ay-side a.item { display: flex; align-items: center; gap: .65rem; padding: .48rem 1.2rem; color: var(--ay-side-text); text-decoration: none; font-size: .88rem; border-inline-start: 3px solid transparent; }
.ay-side a.item:hover { background: rgba(255,255,255,.04); color: #fff; }
.ay-side a.item.active { background: rgba(20,184,166,.12); color: #fff; border-inline-start-color: #14b8a6; }
.ay-side a.item i { font-size: 1rem; opacity: .85; width: 1.1rem; }
.ay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ay-top { height: 58px; background: var(--ay-surface); border-bottom: 1px solid var(--ay-line); display: flex; align-items: center; gap: 1rem; padding: 0 1.4rem; position: sticky; top: 0; z-index: 20; }
.ay-top .search { max-width: 380px; flex: 1; }
.ay-top .search input { background: var(--ay-bg); border-color: transparent; }
.ay-content { padding: 1.4rem; flex: 1; }
.ay-toggle { display: none; }

@media (max-width: 991.98px) {
  .ay-side { position: fixed; inset-inline-start: -260px; z-index: 50; transition: inset-inline-start .2s; }
  .ay-side.open { inset-inline-start: 0; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .ay-toggle { display: inline-flex; }
  .ay-content { padding: 1rem; }
}

/* ---------- page parts */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--ay-muted); font-size: .85rem; margin-top: .15rem; }
.card { border: 1px solid var(--ay-line); border-radius: var(--ay-radius); box-shadow: 0 1px 2px rgba(16,24,22,.03); }
.card-header { background: transparent; border-bottom: 1px solid var(--ay-line); font-weight: 600; padding: .8rem 1rem; }
.kpi { padding: 1rem 1.1rem; }
.kpi .label { color: var(--ay-muted); font-size: .8rem; }
.kpi .value { font-size: 1.45rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .75rem; color: var(--ay-muted); }
.kpi.accent { border-top: 3px solid var(--ay-brand); }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; border-color: var(--ay-line); }
.table thead th { font-size: .76rem; font-weight: 600; color: var(--ay-muted); background: #fafbf8; border-bottom-width: 1px; white-space: nowrap; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f6faf9; }
.table tfoot td { font-weight: 700; background: #fafbf8; }
.filters { background: var(--ay-surface); border: 1px solid var(--ay-line); border-radius: var(--ay-radius); padding: .8rem; margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--ay-muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #a5b3af; }
.empty-state h6 { color: var(--ay-text); font-weight: 600; }
.banner { border-radius: var(--ay-radius); padding: .65rem 1rem; margin-bottom: 1rem; font-size: .88rem; display: flex; gap: .6rem; align-items: center; }
.banner.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.banner.danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.banner.info { background: var(--ay-brand-soft); color: var(--ay-brand-ink); border: 1px solid #b7dcd6; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; }
.dl dt { color: var(--ay-muted); font-weight: 500; }
.dl dd { margin: 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: .5rem; }
.bar-chart .bar { flex: 1; background: linear-gradient(180deg, #14b8a6, #0f766e); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar-chart .bar:hover::after { content: attr(data-label); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #0f1e1c; color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.bar-axis { display: flex; gap: 4px; font-size: .65rem; color: var(--ay-muted); }
.bar-axis span { flex: 1; text-align: center; }

/* document line editor */
.doc-lines td { vertical-align: middle; }
.doc-lines input.form-control-sm, .doc-lines select.form-select-sm { min-width: 70px; }
.doc-totals { max-width: 360px; margin-inline-start: auto; }
.doc-totals .row-t { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px dashed var(--ay-line); }
.doc-totals .grand { font-size: 1.15rem; font-weight: 700; border-bottom: 0; }
.product-picker { position: relative; }
.product-picker .results { position: absolute; z-index: 30; inset-inline: 0; top: 100%; background: #fff; border: 1px solid var(--ay-line); border-radius: 8px; max-height: 320px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.08); display: none; }
.product-picker .results a { display: flex; justify-content: space-between; padding: .5rem .75rem; color: var(--ay-text); text-decoration: none; border-bottom: 1px solid #f1f3ef; }
.product-picker .results a:hover, .product-picker .results a.active { background: var(--ay-brand-soft); }

/* matrix (apparel) */
.matrix td, .matrix th { text-align: center; }
.matrix td.zero { color: #b8c2bf; }

/* login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at 80% 20%, #14b8a6 0%, #0f766e 35%, #0f1e1c 100%); color: #e6f3f1; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-weight: 700; font-size: 2rem; line-height: 1.5; }
.auth-form { display: grid; place-items: center; padding: 2rem; }
.auth-form .box { width: 100%; max-width: 380px; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* print */
.print-only { display: none; }
@media print {
  .ay-side, .ay-top, .no-print, .btn, .filters, .banner, .alert, .page-head { display: none !important; }
  .print-only { display: block !important; }
  @page { size: A4; margin: 12mm; }
  table { page-break-inside: auto; } tr { page-break-inside: avoid; } thead { display: table-header-group; }
  .ay-content { padding: 0; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}
.receipt-80 { width: 76mm; margin: 0 auto; font-size: 12px; }
.receipt-80 table td { padding: 2px 0; }
