* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #0f766e; --primary-dark: #115e59; --bg: #f1f5f9; --card: #ffffff;
  --text: #1e293b; --muted: #64748b; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --border: #e2e8f0;
}
body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); direction: rtl; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.auth-card h1 { font-size: 20px; text-align: center; margin-bottom: 24px; }
.auth-card h2 { font-size: 16px; margin-bottom: 14px; color: var(--muted); }
.auth-card input { margin-bottom: 10px; }
.auth-card a { display: block; text-align: center; margin-top: 14px; color: var(--primary); font-size: 13px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* buttons */
.btn { border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; background: #e2e8f0; color: var(--text); }
.btn.primary { background: var(--primary); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 5px 12px; font-size: 13px; width: auto; }
.btn.danger { background: #fee2e2; color: var(--bad); }
.btn.ok { background: #dcfce7; color: var(--ok); }

/* layout */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab { border: none; background: none; padding: 8px 14px; font-size: 14px; border-radius: 8px; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; }
.me { display: flex; align-items: center; gap: 10px; font-size: 14px; }
main { max-width: 1100px; margin: 20px auto; padding: 0 16px; }

/* cards & tables */
.card { background: var(--card); border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 1 auto; }
.row > .grow { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fafc; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.done { background: #dcfce7; color: var(--ok); }
.badge.done_late { background: #fef3c7; color: var(--warn); }
.badge.late { background: #fee2e2; color: var(--bad); }
.badge.pending { background: #e2e8f0; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }

/* locations */
.loc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loc-head h3 { flex: 1; margin: 0; }
.checklist { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-top: 12px; background: #f8fafc; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.item-row .txt { flex: 1; }
.item-row input { width: auto; flex: 1; padding: 6px 10px; }
.assign-chip { display: inline-flex; align-items: center; gap: 6px; background: #e0f2fe; color: #0369a1; border-radius: 999px; padding: 4px 12px; font-size: 13px; margin: 3px; }
.assign-chip button { background: none; border: none; color: #0369a1; font-weight: 700; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-body { background: #fff; border-radius: 14px; padding: 22px; max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; }
.modal-body h3 { margin-bottom: 12px; }
.photo-thumb { max-width: 140px; border-radius: 8px; margin-top: 6px; cursor: pointer; }
.round-item { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 14px; z-index: 100; }

/* print */
.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { display: grid !important; grid-template-columns: 1fr 1fr; gap: 20px; position: absolute; inset: 0; padding: 20px; background: #fff; }
}
.qr-card { border: 2px dashed #94a3b8; border-radius: 12px; padding: 20px; text-align: center; page-break-inside: avoid; }
.qr-card h2 { font-size: 22px; margin-bottom: 12px; }
.qr-card svg { width: 220px; height: 220px; }

.period-btns { display: flex; gap: 8px; margin-bottom: 14px; }
.period-btns .btn.on { background: var(--primary); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: 12px; padding: 16px; text-align: center; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
