:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --warning: #d97706;
  --success: #059669;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'Cairo', 'Inter', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[dir="ltr"] body, [dir="ltr"] {
  font-family: 'Inter', 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

svg { width: 18px; height: 18px; fill: currentColor; vertical-align: middle; }

/* ============================== LAYOUT ============================== */

#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #0891b2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-logo svg { width: 22px; height: 22px; }

.brand-name { color: #fff; font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.brand-sub { font-size: 0.72rem; color: #94a3b8; }

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.93rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(13, 148, 136, 0.4); }
.nav-icon { display: flex; opacity: 0.9; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-highlight { background: rgba(220, 38, 38, 0.15); color: #fca5a5; }
.nav-highlight:hover { background: rgba(220, 38, 38, 0.25); color: #fff; }
.nav-highlight.active { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4); }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.75rem; color: #64748b; }
.side-date { color: #94a3b8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.lang-toggle { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.lang-t { border: none; background: transparent; padding: 6px 14px; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; font-family: inherit; }
.lang-t.active { background: var(--primary); color: #fff; }

#content { flex: 1; padding: 24px; max-width: 1500px; width: 100%; }

/* ============================== PAGE HEADER ============================== */

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.55rem; font-weight: 800; }
.page-header p { color: var(--text-muted); font-size: 0.92rem; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

.page-head-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head-row h1 { font-size: 1.4rem; font-weight: 800; }
.page-head-row .spacer { flex: 1; }

/* ============================== BUTTONS ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 0.84rem; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; border-radius: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }

/* ============================== CARDS ============================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 1.02rem; font-weight: 700; }

/* ============================== TABLES ============================== */

.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-align: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f8fafc; }
tbody tr[data-id] { cursor: pointer; }
td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.r { text-align: end; }
th.c, td.c { text-align: center; }
.empty { text-align: center; color: var(--text-muted); padding: 28px !important; }
.strong { font-weight: 700; }
.cell-primary { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-sub { display: block; color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }
.actions-cell { white-space: nowrap; text-align: end; }
.text-danger { color: var(--danger) !important; font-weight: 700; }

.avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}

/* ============================== BADGES ============================== */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* ============================== TOOLBAR & SEARCH ============================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar-info { color: var(--text-muted); font-size: 0.9rem; margin-inline-start: auto; }

.search-box { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.search-box svg { position: absolute; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
[dir="rtl"] .search-box svg { right: 12px; }
[dir="ltr"] .search-box svg { left: 12px; }
.search-box .input { padding-inline-start: 36px; }
.search-box.big { max-width: none; }
.search-box.big svg { width: 20px; height: 20px; }

/* ============================== FORMS ============================== */

.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.93rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.input.big { padding: 12px 15px; font-size: 1.05rem; font-weight: 700; }
textarea.input { resize: vertical; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row.inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-row.inline label { min-width: 74px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; flex-shrink: 0; }
.form-row label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.muted { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.lang-buttons { display: flex; gap: 10px; }
.lang-btn { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-family: inherit; font-weight: 700; cursor: pointer; }
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================== STATS ============================== */

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stats-grid-small { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--accent, var(--primary));
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-label { color: var(--text-muted); font-size: 0.82rem; font-weight: 600; }
.stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-muted); font-size: 0.78rem; }

.mini-stat { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.mini-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.mini-val { font-size: 1.15rem; font-weight: 800; }
.mini-lbl { font-size: 0.78rem; color: var(--text-muted); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report-grid .card:nth-child(odd) { grid-column: 1 / -1; }

/* ============================== MODAL ============================== */

#modal-root { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal-backdrop.closing { animation: fadeOut 0.18s ease forwards; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-wide { max-width: 760px; }
.modal-body { padding: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.15rem; font-weight: 800; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.confirm-dialog { text-align: center; padding: 10px 6px; }
.confirm-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 50%;
  background: #fef3c7; color: var(--warning);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800;
}
.confirm-dialog p { margin-bottom: 20px; color: var(--text); font-weight: 500; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ============================== TOAST ============================== */

#toast-root { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #0f172a; color: #fff;
  padding: 12px 18px;
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem; font-weight: 500;
  opacity: 0; transform: translateY(12px);
  transition: all 0.25s;
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success .toast-icon { color: #34d399; }
.toast.error .toast-icon { color: #f87171; }
.toast-icon { font-weight: 800; }

/* ============================== POS ============================== */

.pos-layout { display: grid; grid-template-columns: 1fr 400px; gap: 18px; align-items: start; }
.pos-left { min-width: 0; }
.pos-search { margin-bottom: 14px; }
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding-bottom: 8px;
}
.pos-product {
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}
.pos-product:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pos-product-name { font-weight: 700; font-size: 0.9rem; line-height: 1.35; }
.pos-product-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pos-product-price { color: var(--primary-dark); font-weight: 800; font-size: 1rem; }
.pos-product-stock { font-size: 0.75rem; color: var(--text-muted); }

.pos-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}
.pos-cart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pos-cart-head h3 { font-size: 1.05rem; }
.pos-cart { overflow-y: auto; flex: 1; min-height: 40px; }

.pos-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: center;
}
.pos-line-name { font-weight: 600; font-size: 0.88rem; grid-column: 1 / -1; }
.pos-line-unit { color: var(--text-muted); font-weight: 400; font-size: 0.78rem; }
.pos-line-qty { display: flex; align-items: center; gap: 6px; grid-column: 1; grid-row: 2; }
.pos-line-price { font-size: 0.8rem; color: var(--text-muted); grid-row: 2; align-self: center; }
.pos-line-total { grid-row: 2; align-self: center; font-weight: 700; }
.pos-line-remove { grid-column: 3; grid-row: 2; }

.qty-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.qty-btn:hover { background: #e2e8f0; }
.qty-input { width: 52px; padding: 4px 6px; text-align: center; font-weight: 700; }

.pos-summary { border-top: 2px solid var(--border); margin-top: 10px; padding-top: 10px; }
.pos-sum-row { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 3px 0; color: var(--text-muted); }
.pos-sum-row.total { font-size: 1.15rem; font-weight: 800; color: var(--text); border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 8px; }

.pos-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

.pos-pay { margin-top: 12px; }
.pos-methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.method-btn {
  padding: 8px 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.method-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pos-pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pos-pay-row label { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.pos-pay-row .input { max-width: 170px; }
.pos-change { font-size: 1.2rem; font-weight: 800; color: var(--success); }

.receipt-preview { background: #f8fafc; border-radius: 10px; padding: 16px; }
.receipt-line { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; padding: 3px 0; }
.receipt-total { font-size: 1.6rem; font-weight: 800; text-align: center; color: var(--primary-dark); margin: 8px 0; }
.receipt-words { text-align: center; color: var(--text-muted); font-size: 0.82rem; margin-bottom: 10px; }

/* ============================== INVOICE EDITOR ============================== */

.editor-top .editor-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.editor-top .form-row.inline select { min-width: 200px; }
.editor-bottom { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.editor-table .line-qty, .editor-table .line-price { font-weight: 700; }
.editor-table tbody td:first-child { min-width: 200px; }

.totals { display: flex; flex-direction: column; gap: 8px; }
.total-row { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 0.95rem; }
.total-grand { font-size: 1.25rem; font-weight: 800; color: var(--text); border-top: 2px solid var(--border); padding-top: 10px; margin-top: 4px; }
.total-grand .num { color: var(--primary-dark); }

.payment-card h3 { margin-bottom: 14px; }
.change-row label { color: var(--text-muted); }
.change-row .num { font-size: 1.1rem; font-weight: 800; }

/* ============================== DETAIL ============================== */

.detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: start; }
.detail-main .detail-block { margin-bottom: 14px; }
.detail-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.detail-value { font-size: 1.02rem; font-weight: 700; }
.detail-sub { font-size: 0.84rem; color: var(--text-muted); }

.totals-box { margin-top: 16px; border-top: 2px solid var(--border); padding-top: 12px; }
.totals-box > div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--text-muted); }
.totals-box .grand { font-size: 1.2rem; font-weight: 800; color: var(--text); border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }
.totals-box .grand span:last-child { color: var(--primary-dark); }

.pay-summary { margin-top: 14px; border-top: 2px solid var(--border); padding-top: 12px; }
.pay-summary > div { display: flex; justify-content: space-between; padding: 4px 0; }
.pay-summary .grand { font-size: 1.15rem; font-weight: 800; }

/* ============================== REPORTS ============================== */

.chip {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.chip-main { background: var(--primary-light); color: var(--primary-dark); border-color: transparent; }
.report-totals { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================== MISC ============================== */

.loading { text-align: center; color: var(--text-muted); padding: 60px 0; }
.error-state { text-align: center; color: var(--danger); padding: 40px; background: #fee2e2; border-radius: var(--radius); margin-top: 20px; }

.settings-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

/* ============================== RESPONSIVE ============================== */

@media (max-width: 1100px) {
  .dash-grid, .report-grid, .detail-grid, .editor-bottom, .settings-grid { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-right { position: static; max-height: none; }
  .sidebar { width: 72px; }
  .brand-text, .nav-label, .sidebar-foot { display: none; }
  .brand { justify-content: center; padding: 18px 10px; }
  .nav-item { justify-content: center; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  #content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================== PRINT ============================== */

#print-root { display: none; }

.print-area {
  font-family: 'Cairo', 'Inter', Arial, sans-serif;
  background: #fff;
  color: #000;
  width: 210mm;
  margin: 0 auto;
  padding: 14mm;
  font-size: 12px;
  line-height: 1.5;
}

.p-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #000; padding-bottom: 10px; margin-bottom: 12px; }
.p-name { font-size: 19px; font-weight: 800; margin-bottom: 2px; }
.p-coords { font-size: 11px; }
.p-title-box { text-align: center; }
.p-doctype { font-size: 17px; font-weight: 800; border: 1.5px solid #000; padding: 4px 14px; margin-bottom: 8px; }
.p-meta { border-collapse: collapse; margin: 0 auto; font-size: 11.5px; }
.p-meta td { padding: 1px 8px; text-align: start; }
.m-label { color: #444; }
.m-value { font-weight: 700; border-bottom: 1px solid #999; min-width: 60px; }

.p-party-row { display: flex; justify-content: space-between; margin-bottom: 12px; }
.party-box { border: 1px solid #000; padding: 8px 12px; min-width: 200px; }
.party-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.party-name { font-weight: 800; font-size: 13px; }
.party-details { font-size: 11px; color: #333; }
.p-doc-label { text-align: center; align-self: flex-start; font-weight: 800; }
.p-doc-no { font-size: 16px; }

.p-lines { width: 100%; border-collapse: collapse; }
.p-lines th { background: #f1f5f9; border: 1px solid #000; padding: 5px 6px; font-size: 10.5px; }
.p-lines td { border: 1px solid #999; padding: 5px 6px; font-size: 11px; }
.p-lines .r { text-align: end; }
.p-lines .c { text-align: center; }

.p-totals { display: flex; justify-content: flex-end; margin: 10px 0; }
.p-totals-inner { width: 260px; }
.pt-row { display: flex; justify-content: space-between; border-bottom: 1px solid #ccc; padding: 3px 8px; font-size: 12px; }
.pt-grand { font-weight: 800; font-size: 14px; border: 2px solid #000; margin-top: 2px; }

.p-words { border: 1px solid #000; padding: 8px 12px; margin: 12px 0; font-size: 11.5px; }
.p-words-label { font-weight: 700; font-size: 10px; text-transform: uppercase; }
.p-words-value { margin-top: 2px; }

.p-note { text-align: center; font-size: 11.5px; font-style: italic; margin: 10px 0; }

.p-sign { display: flex; justify-content: space-between; margin-top: 40px; text-align: center; font-weight: 700; font-size: 11px; }
.p-sign-line { width: 130px; border-bottom: 1px solid #000; margin-top: 6px; }

.print-area.receipt { width: 80mm; padding: 6mm; font-size: 12px; }
.r-head { text-align: center; font-weight: 800; font-size: 14px; }
.r-meta, .r-cust { text-align: center; font-size: 11.5px; }
.r-dash { text-align: center; color: #000; letter-spacing: -1px; }
.r-line { display: flex; justify-content: space-between; font-size: 11.5px; }
.r-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 12.5px; }
.r-words { text-align: center; font-size: 10.5px; margin-top: 6px; }
.r-thanks { text-align: center; font-size: 11px; margin-top: 8px; font-weight: 600; }

@media print {
  body * { visibility: hidden !important; }
  #print-root, #print-root * { visibility: visible !important; }
  #print-root { display: block !important; position: absolute; inset: 0; }
  .print-area { box-shadow: none; }
}
