/* Balance ERP — plastics granulation workshop */
.erp-root {
  --erp-green: #0f6b4f;
  --erp-green-dark: #0a4d38;
  --erp-accent: #d97706;
  --erp-bg: #f4f2ec;
  --erp-card: #ffffff;
  --erp-ink: #1c2b26;
  --erp-muted: #6b7a73;
  --erp-line: #e3ded2;
  --erp-red: #b91c1c;
  --erp-blue: #1d4ed8;
  direction: rtl;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--erp-ink);
  background: var(--erp-bg);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}
.erp-root * { box-sizing: border-box; }
.erp-root button { font-family: inherit; }

/* login */
.erp-login { max-width: 380px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.erp-login-logo { font-size: 44px; margin-bottom: 6px; }
.erp-login h1 { font-size: 22px; margin: 0 0 4px; color: var(--erp-green-dark); }
.erp-login p { color: var(--erp-muted); margin: 0 0 26px; font-size: 13px; }
.erp-role-btns { display: grid; gap: 12px; }
.erp-role-btn {
  background: var(--erp-card); border: 2px solid var(--erp-line); border-radius: 14px;
  padding: 16px; font-size: 16px; font-weight: 700; cursor: pointer; color: var(--erp-ink);
}
.erp-role-btn small { display: block; font-weight: 400; color: var(--erp-muted); font-size: 12px; margin-top: 2px; }
.erp-role-btn:hover, .erp-role-btn:focus { border-color: var(--erp-green); }
.erp-pin-box { background: var(--erp-card); border-radius: 14px; padding: 20px; border: 1px solid var(--erp-line); }
.erp-pin-box input {
  width: 100%; font-size: 24px; text-align: center; letter-spacing: 8px; padding: 10px;
  border: 2px solid var(--erp-line); border-radius: 10px; margin: 10px 0;
}
.erp-err { color: var(--erp-red); font-size: 13px; min-height: 20px; margin: 4px 0; }

/* shell */
.erp-topbar {
  background: var(--erp-green-dark); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
}
.erp-topbar .erp-title { font-weight: 700; font-size: 16px; flex: 1; }
.erp-topbar .erp-user { font-size: 12px; opacity: .85; }
.erp-topbar button {
  background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.erp-body { max-width: 760px; margin: 0 auto; padding: 14px 14px 90px; }

.erp-nav {
  position: fixed; bottom: 0; right: 0; left: 0; background: var(--erp-card);
  border-top: 1px solid var(--erp-line); display: flex; z-index: 30;
}
.erp-nav button {
  flex: 1; border: 0; background: none; padding: 8px 2px 10px; font-size: 11px;
  color: var(--erp-muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.erp-nav button .ic { font-size: 19px; }
.erp-nav button.on { color: var(--erp-green); font-weight: 700; }

/* cards & lists */
.erp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.erp-card {
  background: var(--erp-card); border: 1px solid var(--erp-line); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 1px 6px rgba(28,43,38,.05);
}
.erp-card .k { font-size: 12px; color: var(--erp-muted); }
.erp-card .v { font-size: 19px; font-weight: 700; margin-top: 2px; }
.erp-card .v.pos { color: var(--erp-green); }
.erp-card .v.neg { color: var(--erp-red); }
.erp-card.wide { grid-column: 1 / -1; }

.erp-section { margin: 18px 0 8px; font-size: 14px; font-weight: 700; color: var(--erp-green-dark); }

.erp-list { display: grid; gap: 8px; }
.erp-row {
  background: var(--erp-card); border: 1px solid var(--erp-line); border-radius: 12px;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: right;
  width: 100%; font-size: 14px;
}
.erp-row:hover { border-color: var(--erp-green); }
.erp-row .main { flex: 1; min-width: 0; }
.erp-row .t { font-weight: 700; }
.erp-row .s { font-size: 12px; color: var(--erp-muted); }
.erp-row .amt { font-weight: 700; white-space: nowrap; }
.erp-row .amt.pos { color: var(--erp-green); }
.erp-row .amt.neg { color: var(--erp-red); }
.erp-badge { font-size: 11px; background: #eef2f0; color: var(--erp-muted); border-radius: 20px; padding: 1px 8px; }

/* tables */
.erp-table-wrap { overflow-x: auto; background: var(--erp-card); border: 1px solid var(--erp-line); border-radius: 12px; }
.erp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.erp-table th { background: #f0ede4; color: var(--erp-green-dark); padding: 8px 10px; text-align: right; white-space: nowrap; font-size: 12px; }
.erp-table td { padding: 7px 10px; border-top: 1px solid var(--erp-line); white-space: nowrap; }
.erp-table tr.total td { font-weight: 700; background: #f7f5ef; }

/* forms */
.erp-form { background: var(--erp-card); border: 1px solid var(--erp-line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.erp-form label { font-size: 12px; color: var(--erp-muted); display: block; margin-bottom: 3px; }
.erp-form input, .erp-form select, .erp-form textarea {
  width: 100%; padding: 9px 10px; border: 1.5px solid var(--erp-line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.erp-form input:focus, .erp-form select:focus, .erp-form textarea:focus { border-color: var(--erp-green); outline: none; }
.erp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.erp-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.erp-btn {
  background: var(--erp-green); color: #fff; border: 0; border-radius: 12px;
  padding: 12px 18px; font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
}
.erp-btn:hover { background: var(--erp-green-dark); }
.erp-btn.secondary { background: #e8e4d8; color: var(--erp-ink); }
.erp-btn.danger { background: var(--erp-red); }
.erp-btn.small { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.erp-btn:disabled { opacity: .5; cursor: default; }

.erp-calc {
  background: #f0f7f4; border: 1px solid #cde5db; border-radius: 12px; padding: 12px 14px;
  display: grid; gap: 4px; font-size: 14px;
}
.erp-calc .line { display: flex; justify-content: space-between; }
.erp-calc .line.big { font-weight: 700; font-size: 16px; color: var(--erp-green-dark); border-top: 1px dashed #bcd9cf; padding-top: 6px; margin-top: 4px; }

.erp-msg { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 10px; }
.erp-msg.ok { background: #e7f6ee; color: #146c43; border: 1px solid #bfe6cf; }
.erp-msg.warn { background: #fdf3e3; color: #8a5a00; border: 1px solid #f3ddb0; }

.erp-fab {
  position: fixed; bottom: 74px; left: 16px; z-index: 25;
  background: var(--erp-accent); color: #fff; border: 0; border-radius: 30px;
  padding: 12px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.erp-empty { text-align: center; color: var(--erp-muted); padding: 30px 10px; font-size: 13px; }
.erp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.erp-chip {
  border: 1.5px solid var(--erp-line); background: var(--erp-card); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.erp-chip.on { border-color: var(--erp-green); color: var(--erp-green-dark); font-weight: 700; background: #eef7f3; }
.erp-back { background: none; border: 0; color: var(--erp-green); font-size: 13px; cursor: pointer; padding: 0 0 10px; }
.erp-h2 { font-size: 17px; font-weight: 700; margin: 4px 0 10px; color: var(--erp-green-dark); }
.erp-muted { color: var(--erp-muted); font-size: 12px; }
textarea.erp-dump { direction: ltr; font-family: monospace; font-size: 11px; height: 140px; }

@media (min-width: 700px) {
  .erp-cards { grid-template-columns: repeat(3, 1fr); }
  .erp-root { font-size: 16px; }
}

/* ---------- cloud edition additions ---------- */
.erp-logo { height: 26px; width: auto; border-radius: 6px; vertical-align: middle; margin-left: 6px; }
.erp-login-img { max-height: 90px; border-radius: 12px; margin: 0 auto 8px; display: block; }
.erp-sync { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #dcfce7; color: #166534; }
.erp-sync.saving { background: #fef3c7; color: #92400e; }
.erp-sync.error { background: #fee2e2; color: #991b1b; }
.erp-entry-grid { display: flex; flex-direction: column; gap: 10px; }
.erp-entry-btn { display: flex; align-items: center; gap: 12px; text-align: right; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; cursor: pointer; font-family: inherit; }
.erp-entry-btn:active { background: #f1f5f9; }
.erp-entry-btn .ic { font-size: 26px; }
.erp-entry-btn b { display: block; font-size: 15px; color: #0f172a; }
.erp-entry-btn small { display: block; color: #64748b; font-size: 12px; margin-top: 2px; }
.erp-exportbar { display: flex; gap: 8px; margin: 8px 0 12px; }
.erp-user-row { padding: 10px 0; border-bottom: 1px solid #e2e8f0; }
.erp-user-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: flex !important; }
  .print-head { justify-content: space-between; align-items: center; border-bottom: 2px solid #0f172a; padding-bottom: 10px; margin-bottom: 14px; gap: 10px; }
  .print-head img { max-height: 70px; }
  .print-head .co div, .print-head .rep div { font-size: 12px; color: #334155; }
  .erp-body { padding: 0 !important; }
  .erp-report { direction: rtl; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
}

/* ---------- tile launcher home ---------- */
.erp-home-head { margin: 2px 0 14px; }
.erp-home-head .t { font-size: 21px; font-weight: 800; color: var(--erp-ink); }
.erp-home-head .s { font-size: 13px; color: var(--erp-muted); margin-top: 2px; }
.erp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; }
@media (max-width: 480px) { .erp-tiles { grid-template-columns: repeat(2, 1fr); } }
.erp-tile {
  border: 0; border-radius: 18px; padding: 20px 12px 16px; color: #fff; text-align: center; cursor: pointer;
  box-shadow: 0 5px 16px rgba(15,40,32,.16); display: flex; flex-direction: column; align-items: center; gap: 9px;
  font-family: inherit; transition: transform .08s ease, box-shadow .08s ease; min-height: 128px; justify-content: center;
}
.erp-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,40,32,.2); }
.erp-tile:active { transform: scale(.97); }
.erp-tile .ti { width: 52px; height: 52px; border-radius: 15px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 25px; }
.erp-tile .tt { font-size: 15.5px; font-weight: 800; line-height: 1.3; }
.erp-tile .ts { font-size: 12px; opacity: .88; font-weight: 400; }
.erp-g-orange { background: linear-gradient(160deg, #f97316, #c2410c); }
.erp-g-teal { background: linear-gradient(160deg, #14b8a6, #0f766e); }
.erp-g-slate { background: linear-gradient(160deg, #64748b, #334155); }
.erp-g-blue { background: linear-gradient(160deg, #3b82f6, #1e40af); }
.erp-g-brick { background: linear-gradient(160deg, #d97706, #92400e); }
.erp-g-amber { background: linear-gradient(160deg, #f59e0b, #b45309); }
.erp-g-green { background: linear-gradient(160deg, #22c55e, #15803d); }
.erp-g-dgreen { background: linear-gradient(160deg, #16a34a, #14532d); }
.erp-g-navy { background: linear-gradient(160deg, #475569, #1e293b); }
.erp-g-purple { background: linear-gradient(160deg, #8b5cf6, #6d28d9); }
.erp-g-brown { background: linear-gradient(160deg, #a16207, #713f12); }
.erp-g-cyan { background: linear-gradient(160deg, #06b6d4, #0e7490); }

/* ---------- مرفقات القيود (صور الفواتير) ---------- */
.erp-att-badge{background:none;border:none;cursor:pointer;font-size:14px;padding:2px 4px;border-radius:6px;line-height:1}
.erp-att-badge:hover{background:#e2e8f0}
.erp-att-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:80;display:flex;align-items:center;justify-content:center;padding:16px}
.erp-att-box{background:#fff;border-radius:14px;max-width:520px;width:100%;max-height:85vh;overflow:auto;padding:14px}
.erp-att-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.erp-att-close{background:none;border:none;font-size:18px;cursor:pointer;color:#64748b}
.erp-att-grid{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.erp-att-cell{width:110px;height:110px;border-radius:10px;border:1px dashed #cbd5e1;display:flex;align-items:center;justify-content:center;overflow:hidden}
.erp-att-thumb{width:110px;height:110px;object-fit:cover;border-radius:10px;border:1px solid #e2e8f0;cursor:pointer}
.erp-att-full{max-width:94vw;max-height:88vh;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,.4)}
