:root {
  --bg: #f6f3fa; --card: #fff; --ink: #2a2335; --muted: #786f86; --line: #e7e1ef;
  --brand: #6b4e9b; --brand-soft: #efe8f8; --ok: #1f8a5b; --ok-soft: #e4f5ec; --warn: #b26b00; --warn-soft: #fff3df;
  --bad: #c0392b; --bad-soft: #fdecec; --wa: #1fa855; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Heebo", "Segoe UI", Arial, sans-serif; font-size: 16px; }
body { direction: rtl; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.hidden { display: none !important; }

.top { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; display: flex; align-items: center;
  gap: 12px; padding: 12px 18px; box-shadow: 0 2px 8px rgba(60, 30, 90, .18); }
.brand { font-weight: 800; font-size: 20px; }
.brand small { font-weight: 400; opacity: .85; font-size: 15px; margin-inline-start: 6px; }
.top .spacer { flex: 1; }
.who { font-size: 14px; opacity: .9; }
.who button { background: rgba(255, 255, 255, .15); border: 0; color: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; margin-inline-start: 6px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 14px 14px 80px; }
.fresh { font-size: 13.5px; color: var(--muted); line-height: 1.7; flex-basis: 100%; padding-top: 4px; }
.fresh .warn { color: var(--warn); font-weight: 600; }
.banner { background: var(--warn-soft); color: var(--warn); border: 1px solid #f0d29c; border-radius: 10px; padding: 7px 12px; margin-bottom: 10px; font-weight: 600; font-size: 14.5px; }

.tabs { display: flex; gap: 6px; margin-bottom: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 15px; white-space: nowrap; flex-shrink: 0; }
.chip b { font-weight: 700; color: var(--muted); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.on b { color: #fff; }
.tabnote { font-size: 14px; color: var(--muted); margin: 4px 2px 10px; line-height: 1.5; min-height: 1em; }

.bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.bar input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; }
.bar .btn.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.panel { display: flex; flex-wrap: wrap; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.panel select { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; flex: 1 1 160px; min-width: 0; }
.panel.menu .btn { flex: 1 1 220px; text-align: start; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cbbfdc; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 5px 10px; font-size: 14px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 14px;
  align-items: center; cursor: pointer; }
.row:hover { border-color: #cbbfdc; }
.r-main { flex: 1; min-width: 0; }
.r-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.r-name { font-weight: 700; font-size: 17px; }
.r-meta { color: var(--muted); font-size: 13.5px; }
.r-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 15px; align-items: center; }
.r-contact a { color: var(--ink); text-decoration: none; direction: ltr; unicode-bidi: isolate; }
.r-contact a:hover { color: var(--brand); text-decoration: underline; }
.r-contact .c-mail { color: #4b5a6b; font-size: 14px; }
.r-contact.big { font-size: 18px; gap: 6px 18px; }
.r-contact.big .c-mail { font-size: 15px; }
.r-info { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.5; }
.r-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.r-amt { font-weight: 700; font-size: 16px; white-space: nowrap; }
.r-amt small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-inline-start: 3px; }
.muted { color: var(--muted); font-size: 13px; }
.st { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-open { background: var(--bad-soft); color: var(--bad); }
.st-messaged, .st-waiting { background: var(--warn-soft); color: var(--warn); }
.st-agreed { background: #e8efff; color: #2f5bc4; }
.st-done, .st-paid { background: var(--ok-soft); color: var(--ok); }
.st-stopped, .st-left, .st-irrelevant, .st-tab { background: #f1eef4; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; background: var(--card); border-radius: var(--radius); border: 1px dashed var(--line); }
.more { text-align: center; margin: 12px 0; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(30, 15, 45, .35); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(620px, 100%); background: var(--bg); z-index: 41; overflow-y: auto;
  box-shadow: 4px 0 24px rgba(30, 15, 45, .25); }
.d-head { position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.d-head h2 { margin: 0; font-size: 20px; flex: 1; }
.d-body { padding: 12px 14px 60px; display: flex; flex-direction: column; gap: 12px; }
.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.sec h3 { margin: 0 0 10px; font-size: 16px; color: var(--brand); }
.d-facts { color: var(--muted); font-size: 14.5px; margin-top: 10px; line-height: 1.6; }
.d-facts b { color: var(--ink); font-weight: 600; }
details.sec > summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 16px; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: "◂"; color: var(--muted); font-size: 13px; transition: transform .15s; }
details.sec[open] > summary::before { transform: rotate(-90deg); }
details.sec[open] > summary { margin-bottom: 6px; }
a.btn { text-decoration: none; display: inline-block; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; font-size: 15px; }
.facts div span { display: block; color: var(--muted); font-size: 13px; }
.facts .wide { grid-column: 1 / -1; }
.line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.line > input, .line > select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; min-width: 0; }
.line > input { flex: 1 1 140px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 150px; resize: vertical; background: #fff; line-height: 1.55; }
textarea.note { min-height: 64px; }
.hint { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.okline { color: var(--ok); font-weight: 600; font-size: 14px; }
.warnline { color: var(--warn); font-weight: 600; font-size: 14px; }
.order { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-top: 8px; }
.order .t { font-weight: 600; }
.events { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.events li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events small { color: var(--muted); display: block; }
.live-row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 15, 45, .45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal { background: var(--card); border-radius: 16px; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal h3 { margin: 0 0 10px; font-size: 19px; }
.modal .what { background: var(--brand-soft); border-radius: 10px; padding: 12px; font-size: 16px; line-height: 1.6; }
.modal .warns { margin: 10px 0 0; padding: 0; list-style: none; }
.modal .warns li { background: var(--warn-soft); color: #7a4a00; border-radius: 10px; padding: 9px 11px; margin-top: 6px; font-size: 14.5px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-start; margin-top: 14px; flex-wrap: wrap; }
.modal label { display: block; margin-top: 10px; font-weight: 600; font-size: 14.5px; }
.modal label input[type=text], .modal label input[type=number], .modal label select { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.days label { display: inline-flex; gap: 4px; margin: 0; font-weight: 400; }
pre.preview { white-space: pre-wrap; background: #f4f6f4; border-radius: 10px; padding: 10px; font-family: inherit; font-size: 14.5px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #2a2335; color: #fff; padding: 10px 18px;
  border-radius: 12px; z-index: 90; font-size: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: 92vw; text-align: center; }
#toast.bad { background: var(--bad); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { background: var(--card); border-radius: 18px; padding: 26px 22px; width: min(380px, 100%); box-shadow: 0 8px 30px rgba(60, 30, 90, .12); }
.login h1 { margin: 0 0 6px; color: var(--brand); font-size: 24px; }
.login p { margin: 0 0 16px; color: var(--muted); }
.login input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 17px; margin-bottom: 12px; }
.login button { width: 100%; padding: 12px; font-size: 17px; }
.login .err { color: var(--bad); min-height: 22px; font-size: 14.5px; }

@media (max-width: 700px) {
  .top { padding: 10px 14px; }
  .brand { font-size: 18px; }
  .wrap { padding: 10px 10px 80px; }
  .row { padding: 11px 12px; gap: 10px; align-items: flex-start; }
  .r-side { gap: 6px; }
  .r-contact { flex-direction: column; align-items: flex-start; gap: 2px; }
  .r-contact.big { flex-direction: row; }
  .r-side .btn.wa { padding: 6px 9px; }
  .facts { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
}
