:root {
  --ink: #101a31;
  --ink-2: #182642;
  --ink-3: #263653;
  --primary: #6658e8;
  --primary-strong: #5142d2;
  --primary-soft: #eeecff;
  --mint: #20b7a5;
  --mint-soft: #e3f8f4;
  --amber: #f0a83a;
  --amber-soft: #fff4df;
  --rose: #e45a6f;
  --rose-soft: #ffecef;
  --blue: #3488e6;
  --blue-soft: #eaf4ff;
  --paper: #ffffff;
  --canvas: #f3f5f9;
  --line: #dde3ed;
  --line-dark: #cad2df;
  --muted: #68758a;
  --muted-2: #8e99a9;
  --shadow-sm: 0 2px 8px rgba(16, 26, 49, 0.06);
  --shadow-md: 0 14px 40px rgba(16, 26, 49, 0.12);
  --shadow-lg: 0 24px 70px rgba(16, 26, 49, 0.18);
  --radius: 15px;
  --radius-sm: 10px;
  --sidebar: 244px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.app-starting { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 700; }
.app-starting span { width: 18px; height: 18px; border: 2px solid var(--line-dark); border-top-color: var(--primary); border-radius: 50%; animation: appStartingSpin .8s linear infinite; }
@keyframes appStartingSpin { to { transform: rotate(360deg); } }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  color: #fff;
  background: var(--ink);
  border-inline-end: 1px solid rgba(255,255,255,.07);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 22px;
}
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}
.brand-mark::before,.brand-mark::after {
  content: "";
  position: absolute;
  width: 23px;
  height: 23px;
  border-radius: 7px;
}
.brand-mark::before { inset: 1px auto auto 1px; background: var(--primary); }
.brand-mark::after { inset: auto 1px 1px auto; background: var(--mint); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.brand-check { position: absolute; z-index: 2; inset: 18px 5px 5px 18px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.5px; }
.brand-name span { color: #a7ffe9; }
.brand-sub { display: block; margin-top: 1px; color: #9da9be; font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }

.nav-section-label { padding: 10px 12px 7px; color: #7f8ba2; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: grid; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  color: #b7c1d2;
  background: transparent;
  text-align: start;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(102,88,232,.27); box-shadow: inset 3px 0 0 #8d83ff; }
[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 #8d83ff; }
.nav-item svg { width: 18px; height: 18px; opacity: .94; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; }
.nav-badge { margin-inline-start: auto; min-width: 20px; padding: 2px 6px; border-radius: 999px; color: #ffdba4; background: rgba(240,168,58,.15); font-size: 10px; text-align: center; }
.sidebar-spacer { flex: 1; min-height: 12px; }
.trial-card { margin: 12px 4px 8px; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.055); }
.trial-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.trial-days { color: #a7ffe9; }
.progress { height: 5px; margin: 9px 0 8px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.11); }
.progress > span { display: block; width: 56%; height: 100%; background: var(--mint); }
.trial-copy { color: #96a3b8; font-size: 10.5px; line-height: 1.35; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--ink); background: #a7ffe9; font-size: 12px; font-weight: 850; }
.sidebar-user strong { display: block; max-width: 130px; overflow: hidden; color: #fff; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #8f9ab0; font-size: 10px; }

.main { min-height: 100vh; margin-inline-start: var(--sidebar); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 11px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(15px);
}
.mobile-brand { display: none; }
.global-search { position: relative; width: min(430px, 38vw); }
.global-search svg { position: absolute; top: 50%; inset-inline-start: 13px; width: 17px; height: 17px; color: var(--muted-2); transform: translateY(-50%); }
.global-search input { width: 100%; height: 40px; padding: 0 42px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #f8fafc; font-size: 12.5px; transition: .18s; }
.global-search input:focus { border-color: #9e95ff; background: #fff; box-shadow: 0 0 0 3px rgba(102,88,232,.11); }
.keycap { position: absolute; top: 50%; inset-inline-end: 9px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted-2); background: #fff; font-size: 9px; transform: translateY(-50%); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.status-pill { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; font-size: 10.5px; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.icon-button, .lang-button {
  display: inline-grid;
  height: 38px;
  min-width: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.icon-button:hover,.lang-button:hover { border-color: #aaa3f3; color: var(--primary); }
.icon-button svg { width: 17px; height: 17px; }
.lang-button { padding: 0 10px; font-size: 11px; font-weight: 800; }

.content { width: 100%; max-width: 1530px; margin: 0 auto; padding: 26px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 21px; }
.eyebrow { margin-bottom: 5px; color: var(--primary); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(23px, 2.4vw, 30px); line-height: 1.15; letter-spacing: -.8px; }
h2 { margin-bottom: 5px; font-size: 18px; letter-spacing: -.35px; }
h3 { margin-bottom: 4px; font-size: 14px; }
.page-sub { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-dark); border-radius: 10px; background: #fff; font-size: 12px; font-weight: 750; cursor: pointer; transition: .17s ease; }
.button:hover { transform: translateY(-1px); border-color: #a9a1f5; box-shadow: var(--shadow-sm); }
.button svg { width: 16px; height: 16px; }
.button.primary { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 6px 16px rgba(102,88,232,.19); }
.button.primary:hover { background: var(--primary-strong); }
.button.dark { color: #fff; border-color: var(--ink); background: var(--ink); }
.button.soft { color: var(--primary-strong); border-color: transparent; background: var(--primary-soft); }
.button.danger { color: var(--rose); border-color: #ffd1d8; background: var(--rose-soft); }
.button.small { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 10.5px; }
.button:disabled { opacity: .5; pointer-events: none; }

.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(5, minmax(132px, 1fr)); margin-bottom: 18px; }
.kpi-card { position: relative; min-height: 122px; overflow: hidden; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.kpi-card::after { content: ""; position: absolute; right: -21px; bottom: -27px; width: 70px; height: 70px; border: 13px solid var(--tone-soft); border-radius: 50%; }
[dir="rtl"] .kpi-card::after { right: auto; left: -21px; }
.kpi-head { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.kpi-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: var(--tone); background: var(--tone-soft); }
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value { position: relative; z-index: 1; margin-top: 13px; font-size: 21px; font-weight: 850; letter-spacing: -.6px; }
.kpi-note { position: relative; z-index: 1; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; }
.tone-violet { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.tone-mint { --tone: var(--mint); --tone-soft: var(--mint-soft); }
.tone-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.tone-rose { --tone: var(--rose); --tone-soft: var(--rose-soft); }
.tone-ink { --tone: var(--ink-3); --tone-soft: #edf0f5; }

.dashboard-grid { grid-template-columns: minmax(0, 1.75fr) minmax(280px, .72fr); align-items: start; }
.dashboard-flow { display: grid; gap: 14px; }
.dashboard-shortcuts { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 14px; }
.task-panel { overflow: hidden; transition: box-shadow .18s ease; }
.task-panel.open { box-shadow: var(--shadow-md); }
.task-toggle { display: flex; width: 100%; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 17px; border: 0; background: #fff; text-align: start; cursor: pointer; }
.task-toggle:hover { background: #fbfbff; }
.task-main,.task-toggle-end { display: flex; align-items: center; gap: 11px; }
.task-main strong { display: block; font-size: 13px; }
.task-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.task-symbol { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--amber); background: var(--amber-soft); }
.task-symbol svg { width: 18px; height: 18px; }
.task-count { display: grid; min-width: 29px; height: 29px; padding: 0 8px; place-items: center; border-radius: 9px; color: #fff; background: var(--ink); font-size: 11px; font-weight: 850; }
.task-chevron { color: var(--muted); transition: transform .2s ease; }
.task-panel.open .task-chevron { transform: rotate(180deg); }
.task-list { border-top: 1px solid var(--line); }
.task-row { display: grid; width: 100%; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; min-height: 67px; padding: 10px 17px; border: 0; border-bottom: 1px solid #edf0f4; background: #fff; text-align: start; cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #fafaff; }
.task-row strong { display: block; font-size: 11px; }
.task-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.task-row > b { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.task-alert { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--tone); background: var(--tone-soft); }
.task-alert svg { width: 16px; height: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 61px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.panel-body { padding: 17px; }
.panel-link { border: 0; color: var(--primary); background: none; font-size: 10.5px; font-weight: 750; cursor: pointer; }

.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 15px; color: var(--muted-2); background: #fafbfc; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-align: start; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 15px; border-top: 1px solid #edf0f4; font-size: 11px; white-space: nowrap; }
.data-table tbody tr { cursor: pointer; transition: .15s; }
.data-table tbody tr:hover { background: #fafaff; }
.doc-id { color: var(--ink); font-weight: 800; }
.doc-client { font-weight: 650; }
.amount { font-variant-numeric: tabular-nums; font-weight: 750; text-align: end; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 7px; font-size: 9.5px; font-weight: 750; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.paid,.status.accepted,.status.delivered { color: #168c7e; background: var(--mint-soft); }
.status.partial,.status.sent,.status.pending { color: #b27416; background: var(--amber-soft); }
.status.overdue,.status.refused { color: #c74359; background: var(--rose-soft); }
.status.draft { color: #6d788a; background: #eef1f5; }

.quick-stack { display: grid; gap: 12px; }
.quick-create { position: relative; overflow: hidden; min-height: 150px; padding: 20px; color: #fff; border-radius: var(--radius); background: var(--ink); box-shadow: var(--shadow-md); }
.quick-create::before,.quick-create::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; transform: rotate(11deg); }
.quick-create::before { right: -20px; top: -28px; width: 100px; height: 100px; }
.quick-create::after { right: 45px; bottom: -50px; width: 80px; height: 80px; background: rgba(102,88,232,.25); }
[dir="rtl"] .quick-create::before { right: auto; left: -20px; }
[dir="rtl"] .quick-create::after { right: auto; left: 45px; }
.quick-create h2,.quick-create p,.quick-create button { position: relative; z-index: 1; }
.quick-create h2 { margin-bottom: 6px; color: #fff; }
.quick-create p { max-width: 230px; margin-bottom: 15px; color: #aeb9ca; font-size: 10.5px; line-height: 1.45; }
.offline-card { display: flex; align-items: center; gap: 13px; padding: 14px; }
.offline-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: var(--mint); background: var(--mint-soft); }
.offline-icon svg { width: 19px; height: 19px; }
.offline-card strong { display: block; font-size: 11.5px; }
.offline-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.backup-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9.5px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: #f0f2f6; }
.segment { min-height: 29px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9.5px; font-weight: 700; cursor: pointer; }
.segment.active { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.toolbar-spacer { flex: 1; }
.field-inline { position: relative; }
.field-inline input,.field-inline select { height: 35px; min-width: 165px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fff; font-size: 10.5px; }

.barcode-value { color: #445168; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .03em; }
.barcode-svg { display: block; width: 100%; height: 100%; fill: #080b12; }
.label-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.68fr); gap: 16px; align-items: start; }
.label-catalog { min-width: 0; overflow: hidden; }
.label-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.label-search { position: relative; margin: 13px 15px; }
.label-search svg { position: absolute; top: 50%; inset-inline-start: 12px; color: var(--muted); transform: translateY(-50%); }
.label-search input { width: 100%; height: 39px; padding: 0 12px 0 39px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #f8fafc; font-size: 11px; }
[dir="rtl"] .label-search input { padding: 0 39px 0 12px; }
.label-search input:focus { border-color: #9d95ef; background: #fff; box-shadow: 0 0 0 3px rgba(102,88,232,.09); }
.label-product-list { max-height: calc(100vh - 295px); overflow: auto; border-top: 1px solid var(--line); }
.label-product-row { display: grid; grid-template-columns: 140px minmax(0,1fr) 74px; align-items: center; gap: 13px; min-height: 72px; padding: 10px 15px; border-bottom: 1px solid #edf0f4; }
.label-product-row:last-child { border-bottom: 0; }
.label-mini-code { height: 32px; padding: 2px 5px; border: 1px solid #e4e7ec; border-radius: 5px; background: #fff; }
.label-product-copy { min-width: 0; }
.label-product-copy strong,.label-product-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-product-copy strong { font-size: 11px; }
.label-product-copy small { margin-top: 4px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8.5px; }
.label-quantity span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 8.5px; font-weight: 750; }
.label-quantity input { width: 100%; height: 35px; padding: 0 8px; border: 1px solid var(--line-dark); border-radius: 8px; text-align: center; font-weight: 800; }
.label-options { position: sticky; top: 84px; }
.label-options .field { margin-bottom: 11px; }
.label-price-mode { margin-top: 10px; }
.check-row { display: flex; min-height: 37px; align-items: center; gap: 9px; border-bottom: 1px solid #edf0f4; color: #47546a; font-size: 10.5px; font-weight: 650; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.label-preview { display: grid; min-height: 188px; margin-top: 15px; place-items: center; padding: 20px; border: 1px dashed #b9c2d0; border-radius: 12px; background: #eef1f5; }
.product-label { display: flex; width: 100%; aspect-ratio: 70/37; min-width: 0; flex-direction: column; overflow: hidden; padding: 10px; border: 1px solid #cfd5df; border-radius: 4px; color: #0d1320; background: #fff; font-family: Arial, sans-serif; }
.product-label-top { display: flex; min-height: 17px; align-items: flex-start; justify-content: space-between; gap: 8px; }
.product-label-top > strong { max-width: 55%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.product-label-price { font-size: 12px; font-weight: 900; white-space: nowrap; }
.product-label-price small { font-size: 6px; font-weight: 700; }
.product-label-name { margin-top: 3px; overflow: hidden; font-size: 11px; font-weight: 850; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.product-label-ar { height: 13px; overflow: hidden; font-size: 8px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.product-label-code { min-height: 0; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; text-align: center; }
.product-label-code .barcode-svg { min-height: 24px; }
.product-label-code > span { margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 6.5px; letter-spacing: .09em; }
.product-label-ref { margin-top: 2px; overflow: hidden; color: #596274; font-size: 6.5px; text-overflow: ellipsis; white-space: nowrap; }
.label-print-button { width: 100%; margin-top: 15px; }
.label-print-sheet { display: none; }
.drawer-barcode { margin-bottom: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: #fff; }
.drawer-barcode .barcode-svg { height: 58px; }
.drawer-barcode strong { display: block; margin-top: 7px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .08em; }
.product-actions { grid-template-columns: 1fr 1fr; margin-top: 18px; }
.empty-symbol { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 13px; color: var(--primary); background: var(--primary-soft); }

.doc-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.doc-type-card { position: relative; min-height: 122px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; transition: .18s ease; text-align: start; }
.doc-type-card:hover { border-color: #958bf2; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-type-icon { display: grid; width: 34px; height: 34px; margin-bottom: 16px; place-items: center; border-radius: 10px; color: var(--tone); background: var(--tone-soft); }
.doc-type-icon svg { width: 17px; height: 17px; }
.doc-type-card strong { display: block; font-size: 12px; }
.doc-type-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.standalone-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; padding: 11px 13px; border-radius: 10px; color: #47546a; background: var(--blue-soft); font-size: 10px; line-height: 1.45; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; align-items: start; gap: 16px; }
.editor-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.editor-section { padding: 18px; border-bottom: 1px solid var(--line); }
.editor-section:last-child { border-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 11px; font-weight: 850; }
.step-dot { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 7px; color: var(--primary); background: var(--primary-soft); font-size: 9px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 11px; }
.field { grid-column: span 4; }
.field.span-6 { grid-column: span 6; }
.field.span-8 { grid-column: span 8; }
.field.span-12 { grid-column: 1/-1; }
.field label { display: block; margin-bottom: 6px; color: #4e5c73; font-size: 9.5px; font-weight: 750; }
.field input,.field select,.field textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fff; font-size: 11px; }
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus,.field select:focus,.field textarea:focus { border-color: #9d95ef; box-shadow: 0 0 0 3px rgba(102,88,232,.09); }
.input-with-action { display: flex; gap: 6px; }
.input-with-action input,.input-with-action select { flex: 1; min-width: 0; }
.mini-add { width: 39px; min-width: 39px; border: 1px solid var(--line); border-radius: 9px; color: var(--primary); background: var(--primary-soft); cursor: pointer; }

.line-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.line-table th { padding: 7px 6px; color: var(--muted); font-size: 8.5px; font-weight: 800; text-align: start; text-transform: uppercase; }
.line-table td { padding: 6px; border-top: 1px solid #edf0f4; vertical-align: middle; }
.line-table input,.line-table select { width: 100%; height: 34px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff; font-size: 9.5px; }
.line-table .col-product { width: 35%; }
.line-table .col-qty { width: 10%; }
.line-table .col-price { width: 15%; }
.line-table .col-tax { width: 11%; }
.line-table .col-total { width: 17%; text-align: end; }
.line-table .col-action { width: 38px; }
.line-total { font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.remove-line { display: grid; width: 29px; height: 29px; place-items: center; border: 0; border-radius: 7px; color: var(--rose); background: transparent; cursor: pointer; }
.remove-line:hover { background: var(--rose-soft); }
.add-line { margin-top: 10px; }

.summary-card { position: sticky; top: 84px; }
.summary-top { padding: 16px; border-radius: 15px 15px 0 0; color: #fff; background: var(--ink); }
.summary-top small { color: #a6b0c2; font-size: 9px; }
.summary-top strong { display: block; margin-top: 5px; font-size: 16px; }
.summary-body { padding: 15px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--muted); font-size: 10px; }
.sum-row strong { color: var(--ink); font-weight: 700; }
.sum-row.total { margin: 13px -15px -15px; padding: 14px 15px; border-top: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 850; }
.summary-actions { display: grid; gap: 8px; margin-top: 12px; }
.safe-note { display: flex; gap: 8px; margin-top: 11px; padding: 10px; border-radius: 9px; color: #557064; background: var(--mint-soft); font-size: 9px; line-height: 1.4; }

.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.entity-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); cursor: pointer; transition: .16s; }
.entity-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.entity-top { display: flex; align-items: center; gap: 11px; }
.entity-avatar { display: grid; width: 39px; height: 39px; overflow: hidden; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 850; }
.entity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.entity-card h3 { margin: 0 0 2px; font-size: 12px; }
.entity-card small { color: var(--muted); font-size: 9.5px; }
.entity-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.entity-meta span { color: var(--muted); font-size: 9px; }
.entity-meta strong { display: block; margin-top: 2px; color: var(--ink); font-size: 10px; }

.fiscal-hero { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 16px; padding: 23px 25px; overflow: hidden; color: #fff; border-radius: 17px; background: linear-gradient(125deg,#101a31 0%,#172845 68%,#173a45 100%); box-shadow: var(--shadow-md); }
.fiscal-hero > div:first-child { max-width: 720px; }
.fiscal-hero h2 { margin: 6px 0 7px; color: #fff; font-size: 19px; }
.fiscal-hero p { margin: 0; color: #b9c4d6; font-size: 10.5px; line-height: 1.55; }
.fiscal-kicker { color: #8ff0d9; font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.fiscal-flow { display: flex; min-width: 275px; align-items: center; justify-content: center; }
.fiscal-flow > span { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; color: #8290a7; background: rgba(255,255,255,.06); font-size: 13px; font-weight: 850; }
.fiscal-flow > span.done { color: #062c27; border-color: #8ff0d9; background: #8ff0d9; }
.fiscal-flow small { display: block; margin-top: -8px; font-size: 6.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.fiscal-flow i { width: 26px; height: 1px; background: rgba(255,255,255,.22); }
.fiscal-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 16px; }
.fiscal-kpi { display: flex; min-height: 96px; align-items: center; gap: 13px; padding: 15px; }
.fiscal-kpi-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: var(--tone); background: var(--tone-soft); }
.fiscal-kpi-icon svg { width: 19px; height: 19px; }
.fiscal-kpi small,.certificate-summary small { display: block; color: var(--muted-2); font-size: 7.5px; font-weight: 850; letter-spacing: .08em; }
.fiscal-kpi strong { display: block; margin: 5px 0 2px; font-size: 12px; }
.fiscal-kpi > div:last-child > span { display: block; color: var(--muted); font-size: 9px; }
.fiscal-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; align-items: start; gap: 15px; }
.fiscal-main { min-width: 0; overflow: hidden; }
.fiscal-side { position: sticky; top: 84px; }
.fiscal-panel-head { align-items: flex-end; flex-wrap: wrap; }
.fiscal-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 7px; }
.fiscal-toolbar label { color: var(--muted); font-size: 8.5px; font-weight: 750; }
.fiscal-toolbar input { display: block; min-height: 32px; margin-top: 4px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-size: 10px; }
.fiscal-table th,.fiscal-table td { padding-inline: 12px; }
.fiscal-table .button { white-space: nowrap; }
.fiscal-warning { display: flex; align-items: flex-start; gap: 9px; margin: 13px; padding: 11px 13px; border: 1px solid #f6d9a8; border-radius: 10px; color: #77521d; background: #fff8e9; font-size: 9.5px; line-height: 1.5; }
.fiscal-warning svg { flex: 0 0 auto; margin-top: 1px; }
.fiscal-check-list { display: grid; gap: 7px; }
.fiscal-check { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; align-items: center; gap: 8px; min-height: 38px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.fiscal-check > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; }
.fiscal-check.ok > span { color: #0a7d70; background: var(--mint-soft); }
.fiscal-check.missing > span { color: #a96d12; background: var(--amber-soft); }
.fiscal-check strong { font-size: 9px; }
.fiscal-check small { color: var(--muted-2); font-size: 7.5px; }
.fiscal-check-list.compact { grid-template-columns: 1fr 1fr; margin: 9px 0 15px; }
.fiscal-full-button { width: 100%; margin-top: 13px; }
.fiscal-electronic { margin-top: 15px; overflow: hidden; }
.connector-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; color: #68758a; background: #eef1f5; font-size: 8.5px; font-weight: 750; white-space: nowrap; }
.teif-steps { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 14px 17px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.teif-steps > div { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.teif-steps b { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: var(--muted); background: #eef1f5; font-size: 9px; }
.teif-steps .active { border-color: #b9e9e2; background: #f2fcfa; }
.teif-steps .active b { color: #fff; background: var(--mint); }
.teif-steps strong,.teif-steps small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teif-steps strong { font-size: 8.5px; }
.teif-steps small { margin-top: 2px; color: var(--muted); font-size: 7.5px; }
.empty-symbol { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 13px; color: var(--primary); background: var(--primary-soft); }
.withholding-form-intro { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; padding: 12px 13px; border-radius: 11px; color: #fff; background: var(--ink); }
.withholding-form-intro > svg { color: #8ff0d9; }
.withholding-form-intro strong,.withholding-form-intro small { display: block; }
.withholding-form-intro strong { font-size: 11px; }
.withholding-form-intro small { margin-top: 2px; color: #b8c2d2; font-size: 8.5px; }
.certificate-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; padding: 14px; border-radius: 12px; background: #f5f7fa; }
.certificate-summary strong { display: block; margin-top: 3px; font-size: 16px; }
.withholding-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 18px; }
.withholding-totals > div { display: flex; justify-content: space-between; gap: 9px; padding: 10px 11px; border-radius: 9px; background: #f5f7fa; font-size: 9px; }
.withholding-totals > div.grand { color: #fff; background: var(--primary); }
.withholding-totals span { color: inherit; opacity: .8; }
.editor-fiscal-status { display: grid; width: 100%; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; margin-top: 11px; padding: 10px; border: 1px solid #f0d9ae; border-radius: 10px; color: #77521d; background: #fff8e9; text-align: start; cursor: pointer; }
.editor-fiscal-status.ready { color: #0b7166; border-color: #b8e7df; background: #effbf8; }
.editor-fiscal-status > span:first-child { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: rgba(255,255,255,.7); }
.editor-fiscal-status strong,.editor-fiscal-status small { display: block; }
.editor-fiscal-status strong { font-size: 9px; }
.editor-fiscal-status small { margin-top: 2px; opacity: .75; font-size: 7.5px; }
.drawer-fiscal-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.drawer-fiscal-card > div { display: flex; align-items: center; gap: 9px; }
.drawer-fiscal-card > div > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.drawer-fiscal-card strong,.drawer-fiscal-card small { display: block; }
.drawer-fiscal-card strong { font-size: 9.5px; }
.drawer-fiscal-card small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.inline-link { padding: 0; border: 0; color: var(--primary-strong); background: none; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.module-card { position: relative; min-height: 180px; overflow: hidden; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow-sm); }
.module-card.base { color: #fff; border-color: var(--ink); background: var(--ink); }
.module-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 11px; color: var(--primary); background: var(--primary-soft); }
.base .module-icon { color: #fff; background: rgba(255,255,255,.13); }
.module-icon svg { width: 19px; height: 19px; }
.module-card h3 { margin: 16px 0 6px; font-size: 14px; }
.module-card p { margin-bottom: 14px; color: var(--muted); font-size: 9.5px; line-height: 1.48; }
.base p { color: #aeb7c7; }
.lock-badge,.active-badge { position: absolute; top: 14px; inset-inline-end: 14px; padding: 5px 8px; border-radius: 8px; font-size: 8.5px; font-weight: 800; }
.lock-badge { color: #9d6818; background: var(--amber-soft); }
.active-badge { color: #006f62; background: #bdf4eb; }
.module-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.module-footer small { color: var(--muted-2); font-size: 8.5px; }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 15px; align-items: start; }
.settings-nav { position: sticky; top: 84px; padding: 7px; }
.settings-tab { display: flex; width: 100%; align-items: center; gap: 9px; min-height: 39px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10.5px; font-weight: 650; text-align: start; cursor: pointer; }
.settings-tab.active { color: var(--primary-strong); background: var(--primary-soft); }
.settings-tab svg { width: 15px; height: 15px; }
.logo-drop { display: grid; width: 100%; min-height: 120px; overflow: hidden; place-items: center; padding: 12px; border: 1px dashed #b9c2d0; border-radius: 11px; color: var(--muted); background: #fafbfc; text-align: center; font-size: 9.5px; cursor: pointer; }
.logo-drop img { display: block; width: 100%; height: 110px; object-fit: contain; }
.logo-preview { display: grid; width: 55px; height: 55px; margin: 0 auto 8px; place-items: center; border-radius: 15px; color: #fff; background: var(--ink); font-weight: 850; }
.prefix-box { display: inline-flex; min-height: 36px; align-items: center; padding: 0 9px; border: 1px solid var(--line-dark); border-inline-end: 0; border-radius: 9px 0 0 9px; color: var(--muted); background: #f5f7fa; font-size: 10px; white-space: nowrap; }
[dir="rtl"] .prefix-box { border-inline: 1px solid var(--line-dark); border-inline-start: 0; border-radius: 0 9px 9px 0; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 8.5px; line-height: 1.4; }
.field-help strong { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.numbering-example { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid #d8d4ff; border-radius: 12px; background: linear-gradient(135deg,#f4f2ff,#fff); }
.numbering-example.compact { margin-bottom: 14px; }
.numbering-example-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.numbering-example strong { display: block; font-size: 11px; }
.numbering-example p { margin: 4px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.numbering-example b { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.numbering-grid { margin-top: 16px; }
.numbering-actions { margin-top: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 10.5px; }
.switch-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.switch { position: relative; width: 39px; height: 22px; flex: 0 0 auto; border: 0; border-radius: 99px; background: #ccd3df; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: .18s; }
.switch.on { background: var(--primary); }
.switch.on::after { left: 20px; }
[dir="rtl"] .switch::after { left: auto; right: 3px; }
[dir="rtl"] .switch.on::after { left: auto; right: 20px; }

.chart-box { padding: 15px; }
.chart { display: flex; align-items: flex-end; height: 175px; gap: 12px; padding: 12px 8px 23px; border-bottom: 1px solid var(--line); }
.bar-col { display: flex; flex: 1; height: 100%; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.bar { width: min(34px, 72%); min-height: 8px; border-radius: 7px 7px 3px 3px; background: var(--primary); transition: .4s ease; }
.bar.alt { background: var(--mint); }
.bar-col span { position: absolute; transform: translateY(22px); color: var(--muted); font-size: 8.5px; }
.report-grid { grid-template-columns: 1.4fr .6fr; }
.donut-wrap { display: grid; place-items: center; min-height: 218px; text-align: center; }
.donut { display: grid; width: 125px; height: 125px; place-items: center; border-radius: 50%; background: conic-gradient(var(--primary) 0 54%, var(--mint) 54% 78%, var(--amber) 78% 91%, #dce2ec 91%); }
.donut::after { content: ""; grid-area: 1/1; width: 78px; height: 78px; border-radius: 50%; background: #fff; }
.donut-label { position: absolute; z-index: 2; font-size: 17px; font-weight: 850; }

.backup-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 22px; padding: 23px; color: #fff; border-radius: 16px; background: var(--ink); box-shadow: var(--shadow-md); }
.backup-hero p { max-width: 600px; margin-bottom: 0; color: #aeb9ca; font-size: 10.5px; line-height: 1.55; }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.device-card { display: flex; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.device-icon { display: grid; width: 47px; height: 47px; flex: 0 0 auto; place-items: center; border-radius: 13px; color: var(--primary); background: var(--primary-soft); }
.device-icon svg { width: 22px; height: 22px; }
.device-card h3 { margin-top: 2px; }
.device-card p { margin: 4px 0 11px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.backup-stats { padding: 16px; margin-bottom: 0; }

.first-start { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; margin-bottom: 16px; border-color: #cbc6ff; background: linear-gradient(135deg,#f7f5ff 0%,#fff 62%); }
.first-start-copy { display: flex; min-width: 0; align-items: center; gap: 13px; }
.first-start-copy h2 { margin: 0 0 4px; font-size: 14px; }
.first-start-copy p { max-width: 640px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.first-start-icon { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: #fff; background: var(--primary); box-shadow: 0 7px 16px rgba(102,88,232,.25); }
.first-start-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.bottom-nav { display: none; }
.overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(8,15,29,.52); backdrop-filter: blur(4px); animation: fadeIn .16s ease; }
.modal { width: min(620px, 100%); max-height: min(86vh, 820px); overflow: auto; border: 1px solid rgba(255,255,255,.45); border-radius: 18px; background: #fff; box-shadow: var(--shadow-lg); animation: popIn .18s ease; }
.modal.wide { width: min(920px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 19px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-close { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: #f2f4f7; cursor: pointer; }
.modal-body { padding: 19px; }
.modal-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 13px 19px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
.mobile-menu-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.mobile-menu-card { display: grid; min-height: 112px; align-content: center; gap: 6px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fff; text-align: start; cursor: pointer; transition: .16s ease; }
.mobile-menu-card:hover { border-color: #bbb4ff; background: var(--primary-soft); transform: translateY(-1px); }
.mobile-menu-card > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.mobile-menu-card strong { font-size: 11px; }
.mobile-menu-card small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.mobile-menu-card.install-card { color: #fff; border-color: var(--ink); background: var(--ink); }
.mobile-menu-card.install-card > span { color: #fff; background: rgba(255,255,255,.13); }
.mobile-menu-card.install-card small { color: #b8c1d0; }

.drawer-wrap { position: fixed; inset: 0; z-index: 65; background: rgba(8,15,29,.33); animation: fadeIn .16s ease; }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(450px, 94vw); overflow: auto; background: #fff; box-shadow: var(--shadow-lg); animation: slideIn .22s ease; }
.drawer-head { padding: 20px; color: #fff; background: var(--ink); }
.drawer-head .modal-close { float: inline-end; color: #fff; background: rgba(255,255,255,.1); }
.drawer-head small { color: #aeb9ca; font-size: 9.5px; }
.drawer-head h2 { margin: 7px 0 2px; color: #fff; }
.drawer-photo { width: 58px; height: 58px; margin-top: 12px; border: 2px solid rgba(255,255,255,.35); border-radius: 15px; object-fit: cover; }
.drawer-body { padding: 20px; }
.detail-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 17px; }
.detail-stat > div { padding: 12px; border-radius: 10px; background: #f5f7fa; }
.detail-stat span { color: var(--muted); font-size: 8.5px; }
.detail-stat strong { display: block; margin-top: 3px; font-size: 11px; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; padding: 0 0 16px 21px; font-size: 9.5px; }
[dir="rtl"] .timeline-item { padding: 0 21px 16px 0; }
.timeline-item::before { content: ""; position: absolute; top: 3px; left: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.timeline-item::after { content: ""; position: absolute; top: 12px; bottom: 0; left: 6px; width: 1px; background: var(--line); }
[dir="rtl"] .timeline-item::before { left: auto; right: 3px; }
[dir="rtl"] .timeline-item::after { left: auto; right: 6px; }
.timeline-item:last-child::after { display: none; }
.timeline-item strong { display: block; }
.timeline-item small { color: var(--muted); font-size: 8.5px; }

.invoice-preview { width: min(760px, 100%); padding: 0; background: #e9edf3; }
.paper { width: 700px; max-width: calc(100% - 28px); min-height: 880px; margin: 20px auto; padding: 44px; color: #17223a; background: #fff; box-shadow: 0 8px 30px rgba(16,26,49,.13); }
.paper-top { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 3px solid var(--primary); }
.paper-logo { display: grid; width: 66px; height: 66px; place-items: center; border-radius: 16px; color: #fff; background: var(--ink); font-size: 17px; font-weight: 900; }
.paper-logo-image { display: block; width: 90px; height: 66px; object-fit: contain; object-position: left center; }
.paper-company { margin-top: 10px; font-size: 10px; line-height: 1.5; }
.paper-title { text-align: end; }
.paper-title h2 { margin: 0 0 7px; color: var(--primary); font-size: 25px; text-transform: uppercase; }
.paper-title strong { font-size: 12px; }
.paper-title small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.paper-reference { margin-top: 15px; padding: 8px 10px; border-radius: 7px; color: #536075; background: #f5f7fa; font-size: 9px; }
.paper-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin: 28px 0; }
.paper-label { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.paper-parties strong { display: block; margin: 7px 0 3px; font-size: 11px; }
.paper-parties p { margin: 0; color: #536075; font-size: 9px; line-height: 1.55; }
.paper-transport { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: -8px 0 22px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f7f7fc; }
.paper-transport > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.paper-transport span { flex: 0 0 auto; color: var(--primary); font-size: 8px; font-weight: 800; }
.paper-transport strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.paper-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.paper-table th { padding: 9px 7px; color: #fff; background: var(--ink); text-align: start; }
.paper-table td { padding: 10px 7px; border-bottom: 1px solid var(--line); }
.paper-table th:last-child,.paper-table td:last-child { text-align: end; }
.paper-totals { width: 270px; margin: 23px 0 0 auto; }
[dir="rtl"] .paper-totals { margin: 23px auto 0 0; }
.paper-total-row { display: flex; justify-content: space-between; padding: 6px 0; color: #5d697c; font-size: 9px; }
.paper-total-row.grand { margin-top: 5px; padding: 11px 10px; color: #fff; background: var(--primary); font-size: 12px; font-weight: 850; }
.paper-note { margin-top: 35px; padding: 12px; border-inline-start: 3px solid var(--mint); color: #536075; background: #f6f8fb; font-size: 8.5px; line-height: 1.55; }
.paper-bank { margin-top: 14px; color: #536075; font-size: 8.5px; line-height: 1.5; }
.paper-stamp { display: block; width: 145px; height: 90px; margin: 16px 0 0 auto; object-fit: contain; object-position: right center; }
[dir="rtl"] .paper-stamp { margin-inline: auto 0; object-position: left center; }
.share-actions { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); margin-top: 18px; }
.watermark { position: absolute; top: 53%; left: 50%; color: rgba(16,26,49,.045); font-size: 75px; font-weight: 900; transform: translate(-50%,-50%) rotate(-25deg); pointer-events: none; }
#document-print-root { display: none; }

#toast-root { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 9px; }
[dir="rtl"] #toast-root { right: auto; left: 18px; }
.toast { display: flex; align-items: center; gap: 10px; width: min(330px, calc(100vw - 36px)); padding: 12px 14px; color: #fff; border-radius: 11px; background: var(--ink); box-shadow: var(--shadow-lg); font-size: 10.5px; animation: toastIn .22s ease; }
.toast-icon { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; color: var(--ink); background: #a7ffe9; font-weight: 900; }
.toast.error .toast-icon { color: #fff; background: var(--rose); }
.empty { padding: 42px 20px; color: var(--muted); text-align: center; font-size: 11px; }
.empty-action { display: grid; min-height: 180px; place-items: center; align-content: center; gap: 9px; grid-column: 1/-1; }
.empty-action strong { color: var(--ink); font-size: 13px; }
.empty-action .button { margin-top: 4px; }
.mobile-only { display: none; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(8px); } }
@keyframes slideIn { from { opacity: .8; transform: translateX(22px); } }
[dir="rtl"] .drawer { animation-name: slideInRtl; }
@keyframes slideInRtl { from { opacity: .8; transform: translateX(-22px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1280px) {
  :root { --sidebar: 218px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .cards-grid,.module-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .main { margin: 0; padding-bottom: 71px; }
  .topbar { min-height: 60px; padding: 9px 14px; }
  .mobile-brand { display: flex; align-items: center; gap: 7px; margin-inline-end: 12px; font-size: 14px; font-weight: 850; }
  .mobile-brand .brand-mark { width: 29px; height: 29px; }
  .mobile-brand .brand-mark::before,.mobile-brand .brand-mark::after { width: 18px; height: 18px; border-radius: 5px; }
  .mobile-brand .brand-check { inset: 13px 3px 3px 13px; }
  .global-search { flex: 1; width: auto; }
  .keycap,.status-pill { display: none; }
  .content { padding: 18px 15px; }
  .bottom-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5,1fr); min-height: 64px; padding: 7px max(7px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(14px); box-shadow: 0 -8px 26px rgba(16,26,49,.08); }
  .bottom-item { display: grid; gap: 3px; place-items: center; border: 0; color: var(--muted-2); background: transparent; font-size: 8px; font-weight: 700; cursor: pointer; }
  .bottom-item svg { width: 18px; height: 18px; }
  .bottom-item.active { color: var(--primary); }
  .bottom-new { position: relative; top: -19px; display: grid; width: 47px; height: 47px; margin: auto; place-items: center; border: 4px solid var(--canvas); border-radius: 15px; color: #fff; background: var(--primary); box-shadow: 0 7px 18px rgba(102,88,232,.32); }
  .dashboard-grid,.dashboard-shortcuts,.editor-layout,.report-grid { grid-template-columns: 1fr; }
  .summary-card,.settings-nav { position: static; }
  .summary-card { order: -1; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; }
  .settings-tab { flex: 0 0 auto; width: auto; padding: 0 12px; }
  .label-layout { grid-template-columns: 1fr; }
  .label-options { position: static; }
  .label-product-list { max-height: none; }
  .fiscal-layout { grid-template-columns: 1fr; }
  .fiscal-side { position: static; }
  .first-start { align-items: stretch; flex-direction: column; }
  .first-start-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .topbar { gap: 6px; }
  .mobile-brand span { display: none; }
  .global-search input { height: 38px; padding-inline-end: 10px; }
  .top-actions { gap: 5px; }
  .lang-button { min-width: 36px; padding: 0 7px; }
  .top-actions .icon-button { display: none; }
  .top-actions .icon-button[data-route="settings"] { display: grid; }
  .page-head { align-items: flex-start; }
  .page-actions .button:not(.primary) { display: none; }
  .kpi-grid { display: flex; margin-inline: -15px; padding: 0 15px 4px; overflow-x: auto; scroll-snap-type: x mandatory; }
  .kpi-card { min-width: 155px; scroll-snap-align: start; }
  .dashboard-grid { gap: 13px; }
  .task-row { grid-template-columns: auto minmax(0,1fr) auto; }
  .task-row > b { display: none; }
  .cards-grid,.module-grid { grid-template-columns: 1fr; }
  .fiscal-hero { align-items: flex-start; flex-direction: column; padding: 19px; }
  .fiscal-flow { width: 100%; min-width: 0; justify-content: flex-start; }
  .fiscal-kpis { grid-template-columns: 1fr; }
  .fiscal-kpi { min-height: 82px; }
  .fiscal-panel-head { align-items: flex-start; }
  .fiscal-toolbar { width: 100%; }
  .fiscal-toolbar label { flex: 1 1 100%; }
  .fiscal-toolbar input { width: 100%; }
  .teif-steps { grid-template-columns: 1fr 1fr; padding: 12px; }
  .fiscal-check-list.compact { grid-template-columns: 1fr; }
  .withholding-totals { grid-template-columns: 1fr; }
  .doc-type-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { align-items: stretch; }
  .segmented { width: 100%; overflow-x: auto; }
  .segment { flex: 0 0 auto; }
  .toolbar-spacer { display: none; }
  .field-inline { flex: 1; }
  .field-inline input,.field-inline select { width: 100%; min-width: 0; }
  .label-product-row { grid-template-columns: 100px minmax(0,1fr) 65px; gap: 9px; padding-inline: 11px; }
  .label-mini-code { height: 29px; }
  .label-preview { min-height: 170px; padding: 15px; }
  .data-table { min-width: 700px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field,.field.span-6,.field.span-8 { grid-column: span 1; }
  .field.span-12 { grid-column: 1/-1; }
  .line-table { min-width: 650px; }
  .editor-section .table-wrap { margin-inline: -18px; padding-inline: 12px; }
  .backup-hero { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: 1fr; }
  .paper { min-height: 760px; padding: 25px; }
  .paper-top { flex-direction: column; }
  .paper-title { text-align: start; }
  .paper-parties { grid-template-columns: 1fr; gap: 14px; }
  .paper-transport { grid-template-columns: 1fr; gap: 7px; }
  .paper-table { font-size: 7.5px; }
  .paper-totals { width: 230px; }
  .modal { max-height: 92vh; }
  .mobile-menu-grid { grid-template-columns: 1fr 1fr; }
  .mobile-menu-card { min-height: 104px; padding: 12px; }
  .first-start-actions .button { flex: 1 1 135px; }
}

@media print {
  @page { size: A4; margin: 0; }
  html,body { background: #fff; }
  body * { visibility: hidden; }
  body:not(.printing-labels):not(.printing-document) .paper,body:not(.printing-labels):not(.printing-document) .paper * { visibility: visible; }
  body:not(.printing-labels):not(.printing-document) .paper { position: fixed; inset: 0; width: 210mm; max-width: none; min-height: 297mm; margin: 0; padding: 14mm; box-shadow: none; }
  body.printing-document #document-print-root,body.printing-document #document-print-root * { visibility: visible; }
  body.printing-document #document-print-root { position: absolute; inset: 0; display: block; width: 210mm; margin: 0; padding: 0; background: #fff; }
  body.printing-document .document-print-page { display: block; width: 210mm; height: 297mm; margin: 0; object-fit: fill; break-after: page; page-break-after: always; }
  body.printing-document .document-print-page:last-child { break-after: auto; page-break-after: auto; }
  body.printing-labels .label-print-sheet,body.printing-labels .label-print-sheet * { visibility: visible; }
  body.printing-labels .label-print-sheet { position: absolute; top: 0; left: 0; display: grid; align-content: start; gap: 0; padding: 0; background: #fff; }
  body.printing-labels .label-print-sheet.format-70x37 { width: 210mm; grid-template-columns: repeat(3,70mm); }
  body.printing-labels .label-print-sheet.format-50x30 { left: 5mm; width: 200mm; padding-top: 13mm; grid-template-columns: repeat(4,50mm); }
  body.printing-labels .product-label { width: 70mm; height: 37mm; aspect-ratio: auto; padding: 2.6mm 3mm; border: .2mm solid #b9bec7; border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
  body.printing-labels .format-50x30 .product-label { width: 50mm; height: 30mm; padding: 1.8mm 2mm; }
  body.printing-labels .product-label-top { min-height: 4mm; }
  body.printing-labels .product-label-top > strong { font-size: 7.5pt; }
  body.printing-labels .product-label-price { font-size: 10pt; }
  body.printing-labels .product-label-name { margin-top: .5mm; font-size: 9pt; }
  body.printing-labels .product-label-ar { height: 3.5mm; font-size: 7pt; }
  body.printing-labels .product-label-code .barcode-svg { min-height: 8mm; }
  body.printing-labels .product-label-code > span { margin-top: .4mm; font-size: 5.5pt; }
  body.printing-labels .product-label-ref { margin-top: .3mm; font-size: 5.5pt; }
  body.printing-labels .format-50x30 .product-label-top > strong { font-size: 6.5pt; }
  body.printing-labels .format-50x30 .product-label-price { font-size: 8.5pt; }
  body.printing-labels .format-50x30 .product-label-name { font-size: 7.5pt; }
  body.printing-labels .format-50x30 .product-label-ar { height: 3mm; font-size: 6pt; }
  body.printing-labels .format-50x30 .product-label-code .barcode-svg { min-height: 6mm; }
}
