@font-face { font-family: Vazirmatn; src: url(/admin/fonts/Vazirmatn-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/admin/fonts/Vazirmatn-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* One palette: the brand teal and six roles (brand, success, warning, danger, info, special). Colours elsewhere come from these. */
  --primary: #0F766E; --primary-weak: #CCFBF1; --on-primary: #fff; --bg: #F4F7F7; --surface: #fff; --text: #12201F; --muted: #5B6B6A;
  --border: #E2E8E8; --danger: #DC2626; --danger-weak: #FEE2E2; --warn: #B45309; --warn-weak: #FEF3C7; --ok: #15803D; --ok-weak: #DCFCE7;
  --info: #2563EB; --info-weak: #DBEAFE; --viol: #7C3AED; --viol-weak: #EDE9FE;
  --radius: 16px; --shadow: 0 1px 2px rgba(18, 32, 31, .04), 0 6px 20px rgba(18, 32, 31, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --primary: #2DD4BF; --primary-weak: #123A36; --on-primary: #04201E; --bg: #0B1514; --surface: #121F1E; --text: #E6EFEE; --muted: #93A7A5;
    --border: #243433; --danger: #F87171; --danger-weak: #3A1717; --warn: #FBBF24; --warn-weak: #33270B; --ok: #4ADE80; --ok-weak: #0F2E1D;
    --info: #60A5FA; --info-weak: #12243F; --viol: #A78BFA; --viol-weak: #25194A; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Vazirmatn, Tahoma, sans-serif; font-size: 15px; line-height: 1.8; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 48px 16px; }

/* layout */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--primary); font-size: 18px; margin-left: 8px; }
.spacer { flex: 1; }
.tabs { display: none; gap: 4px; padding: 8px 16px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 20px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--primary-weak); color: var(--primary); font-weight: 700; }
main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 64px; }
h2 { font-size: 20px; margin: 4px 0 16px; }
h3 { font-size: 16px; margin: 0 0 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; }
.stat.danger b { color: var(--danger); } .stat.warn b { color: var(--warn); } .stat.ok b { color: var(--ok); } .stat.info b { color: var(--info); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

/* controls */
.btn { border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: 20px; cursor: pointer; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
input:not([type]), input[type=text], input[type=password], input[type=tel], input[type=search], input[type=date], input[type=number], input[type=time], select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 2px; }
.form-error { background: var(--danger-weak); color: var(--danger); padding: 8px 12px; border-radius: 10px; margin-top: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: var(--bg); position: sticky; top: 0; }
tr:hover td { background: color-mix(in srgb, var(--primary-weak) 40%, transparent); }
.chip { display: inline-block; padding: 1px 10px; border-radius: 12px; font-size: 12px; background: var(--primary-weak); color: var(--primary); white-space: nowrap; }
.chip.danger { background: var(--danger-weak); color: var(--danger); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.muted { background: var(--bg); color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; }

/* modal & toast */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 20; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 20px; padding: 20px; width: min(560px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 18px; flex-direction: row-reverse; }
.toast { position: fixed; bottom: 24px; right: 50%; transform: translateX(50%); background: #263232; color: #fff; padding: 10px 20px; border-radius: 22px; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

/* login */
.login { max-width: 400px; margin: 10vh auto; }
.login h1 { color: var(--primary); text-align: center; margin: 0 0 4px; }
.seg { display: flex; background: var(--bg); border-radius: 22px; padding: 4px; margin: 16px 0; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 12px; border-radius: 18px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--primary); font-weight: 700; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.list-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.list-item:hover { background: var(--bg); }
.list-item.active { border-color: var(--primary); background: var(--primary-weak); }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 150px); min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* Phones: one panel at a time — the list, or the open conversation with a back button. */
.chat-back { display: none; }
@media (max-width: 800px) {
  .chat { grid-template-columns: 1fr; border-radius: 0; border-left: 0; border-right: 0; }
  .chat-list { border-left: 0; }
  .chat.has-open .chat-list { display: none; }
  .chat:not(.has-open) .chat-main { display: none; }
  .chat-back { display: inline-block; }
  .chat-head { padding: 8px 10px; gap: 6px; }
  .chat-head .avatar { width: 34px; height: 34px; }
  .chat-head-actions { gap: 4px; }
  .chat-head .btn.icon { padding: 6px 8px; min-width: 36px; }
  #ws-status:empty { display: none; }
  .msgs { padding: 8px 10px; }
  .bubble { max-width: 85%; }
  .img-wrap img { max-width: 100%; }
  .file { max-width: 100%; }
  .voice audio { max-width: 100%; }
  .composer { padding: 8px; gap: 6px; }
  main:has(.chat) { padding: 0 0 0; }
  main:has(.chat) > .chat { margin: 0; }
}
/* Compact header on phones. */
@media (max-width: 600px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar .muted { display: none; }
  #org-select { min-width: 0 !important; flex: 1; }
  .tabs { padding: 6px 8px; }
  .tabs button { padding: 6px 10px; }
}
/* Browser-notification banner. */
.notif-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--primary-weak); color: var(--text); padding: 8px 16px; border-bottom: 1px solid var(--border); }
.notif-banner span { flex: 1; min-width: 200px; }
.chat-list { border-left: 1px solid var(--border); overflow-y: auto; padding: 8px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv { display: flex; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; align-items: center; }
.conv:hover { background: var(--bg); } .conv.active { background: var(--primary-weak); }
.conv-body { flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { font-size: 12px; }
.badge { background: var(--primary); color: var(--on-primary); border-radius: 12px; padding: 0 8px; font-size: 12px; }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.typing { color: var(--primary); }
.msgs { flex: 1; overflow-y: auto; padding: 12px 16px; background: var(--bg); }
.day { text-align: center; margin: 10px 0; } .day span { background: var(--surface); border-radius: 12px; padding: 2px 12px; font-size: 12px; color: var(--muted); }
.msg { display: flex; margin: 4px 0; }
.msg.mine { justify-content: flex-start; }  /* own messages on the right (Persian messenger convention) */
.msg.theirs { justify-content: flex-end; }
.bubble { max-width: min(560px, 75%); padding: 7px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); position: relative; }
.mine .bubble { background: var(--primary-weak); border-color: transparent; }
.sender { font-size: 12px; color: var(--primary); font-weight: 700; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { font-size: 11px; color: var(--muted); text-align: left; margin-top: 2px; }
.tick.read { color: var(--info); } .tick.failed { color: var(--danger); }
.reply-quote { border-right: 3px solid var(--primary); background: color-mix(in srgb, var(--surface) 60%, transparent); padding: 2px 8px; border-radius: 6px; margin-bottom: 4px; font-size: 13px; }
.actions { display: none; gap: 4px; margin-top: 4px; }
.bubble:hover .actions, .bubble:focus-within .actions { display: flex; }
.actions button { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: 12px; padding: 0 4px; }
.img-wrap img { max-width: 280px; max-height: 260px; border-radius: 10px; cursor: zoom-in; display: block; }
.file { display: flex; gap: 6px; align-items: center; max-width: 360px; }
.voice audio { max-width: 260px; }
.reply-bar { display: flex; gap: 8px; align-items: center; padding: 6px 14px; border-top: 1px solid var(--border); background: var(--bg); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.composer textarea { resize: none; min-height: 40px; }
.attach { cursor: pointer; }
.pick-list { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; margin-top: 6px; }
.pick { display: block; padding: 4px 0; margin: 0; color: var(--text); font-size: 14px; }
.seg label { margin: 0; text-align: center; color: var(--text); font-size: 14px; }
.chat-list .seg { margin: 0 0 8px; flex-wrap: wrap; } .chat-list .seg button { font-size: 13px; padding: 2px 6px; flex: 1 0 auto; }

/* ---------- member pages ---------- */
.stat.link, tr.link, .list-item[data-route] { cursor: pointer; }
.stat.link:hover { border-color: var(--primary); }
.list-item.active[data-notif] { border-color: transparent; background: var(--primary-weak); }
details summary { cursor: pointer; }
.modal table th { position: static; }

/* Touch screens have no hover: tapping a message shows its actions. */
.bubble.show-actions .actions { display: flex; flex-wrap: wrap; }
@media (max-width: 600px) {
  .notif-banner { padding: 6px 10px; gap: 6px; font-size: 13px; }
  .notif-banner span { min-width: 100%; }
}

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; margin-bottom: 4px; }
.powered { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }
.install-hint { margin-top: 14px; background: var(--primary-weak); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

/* ---------- phone: bottom navigation, safe areas (iPhone notch / home bar) ---------- */
body { padding-top: env(safe-area-inset-top); }
.bottom-nav { display: none; }
@media (max-width: 600px) {
  .tabs { display: none; }
  .bottom-nav { display: flex; position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottom-nav button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 0; font-size: 11px; color: var(--muted); cursor: pointer; }
  .bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav button.active { color: var(--primary); }
  .bottom-nav button.active svg { background: var(--primary-weak); border-radius: 14px; padding: 2px 12px; width: 48px; box-sizing: content-box; height: 22px; }
  main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* iOS zooms into smaller inputs */
  .more-list .list-item { display: block; width: 100%; text-align: right; border: 0; background: transparent; font-size: 16px; padding: 12px; }
}
@media (max-width: 600px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .stat { padding: 10px; } .stat b { font-size: 22px; } }

/* ---------- voice messages & calls ---------- */
.rec-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--border); background: var(--danger-weak); }
.rec-dot, .call-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); display: inline-block; animation: tfpulse 1s infinite; }
.call-dot { background: var(--ok); }
@keyframes tfpulse { 50% { opacity: .3; } }
#call-root { position: fixed; z-index: 40; inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px; display: flex; justify-content: center; pointer-events: none; }
#call-root > * { pointer-events: auto; }
.call-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.25); text-align: center; min-width: 260px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.call-card.ringing { border-color: var(--primary); }
.call-avatar { font-size: 32px; }
.call-bar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--primary); border-radius: 16px; padding: 8px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 760px; width: 100%; }
@media (max-width: 600px) { #call-root { bottom: calc(80px + env(safe-area-inset-bottom)); } .call-bar { flex-wrap: wrap; } }

/* ---------- chat search ---------- */
.search-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px; border-top: 1px solid var(--border); }
.search-hit mark { background: var(--warn-weak); color: inherit; border-radius: 3px; padding: 0 1px; }
.msg.flash .bubble { outline: 3px solid var(--primary); outline-offset: 2px; transition: outline-color 1s; }

/* ---------- video calls ---------- */
.call-panel { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 980px; }
.call-stage { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); background: #0b0f10; border-radius: 16px; padding: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); max-height: 34vh; overflow: auto; }
.call-stage.big { max-height: 68vh; }
.call-tile { position: relative; border-radius: 12px; overflow: hidden; background: #1b2122; aspect-ratio: 16 / 9; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-tile.screen { grid-column: 1 / -1; aspect-ratio: auto; }
.call-tile.screen video { object-fit: contain; max-height: 60vh; }
.call-stage:not(.big) .call-tile.screen video { max-height: 28vh; }
.call-tile-name { position: absolute; inset: auto 8px 6px auto; color: #fff; font-size: 12px; background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 8px; }
@media (max-width: 600px) { .call-stage { grid-template-columns: 1fr 1fr; } .call-stage.big { max-height: 55vh; } }

/* Chat header: one row on any width — the title shrinks (…), the icon buttons never wrap. */
.chat-head-title { min-width: 0; overflow: hidden; }
.chat-head-title > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.chat-head .btn { white-space: nowrap; flex-shrink: 0; }
.chat-head .btn.icon { font-size: 16px; line-height: 1; }
.call-stage[hidden] { display: none; }
/* Phones: the call bar shows icons only (labels stay as tooltips), name/time on the first line. */
@media (max-width: 600px) {
  .call-bar .lbl { display: none; }
  .call-bar { flex-wrap: wrap; justify-content: space-around; row-gap: 10px; }
  .call-bar > .grow { flex: 1 1 0; min-width: 0; }
  .call-break { flex-basis: 100%; height: 0; } /* name and time on row 1, all buttons on row 2 */
  .call-bar .btn { padding: 8px 14px; font-size: 18px; min-height: 0; flex: 0 0 auto; }
}
.call-break { display: none; }
@media (max-width: 600px) { .call-break { display: block; } }

/* ---------- live location ---------- */
.loc-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 12px; align-items: start; }
.loc-map { height: 68vh; min-height: 360px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.loc-list { max-height: 68vh; overflow: auto; }
.loc-row { cursor: pointer; } .loc-row.off { cursor: default; opacity: .65; }
.loc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ok); }
.loc-dot.off { background: var(--danger); } .loc-warn { color: var(--danger); }
.loc-dot.stale { background: var(--warn); } .loc-dot.none { background: var(--border); }
.loc-pin { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
  font-weight: 700; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.loc-pin { font-size: 14px; }
.loc-pin.stale { background: var(--muted); }
@media (max-width: 800px) { .loc-wrap { grid-template-columns: 1fr; } .loc-map { height: 50vh; } .loc-list { max-height: none; } }

/* ---------- pinned messages and seen status ---------- */
.pin-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pin-bar .pin-body { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 2px 6px; border-inline-start: 3px solid var(--primary); display: flex; flex-direction: column; cursor: pointer; font: inherit; color: inherit; }
.tick-btn { background: none; border: 0; padding: 0 2px; cursor: pointer; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 3px; }
.tick.read, .receipt-read { color: var(--info); }
.seen-count { font-size: 11px; opacity: .75; }
.receipt-delivered, .receipt-sent { color: var(--muted, #7a8585); }

/* reactions, mentions, message → task */
.rxs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rx { border: 1px solid var(--border); background: var(--surface); color: inherit; border-radius: 999px; padding: 0 8px; font: inherit; font-size: 13px; cursor: pointer; line-height: 22px; }
.rx.mine { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.rx-pick { display: inline-flex; gap: 2px; margin-inline-end: 6px; }
.actions .rx-pick button { font-size: 16px; padding: 0 2px; }
.mention { color: var(--primary); font-weight: 600; }
.mention.me { background: color-mix(in srgb, var(--primary) 18%, transparent); border-radius: 4px; padding: 0 2px; }
.msg.mentioned .bubble { box-shadow: inset 3px 0 0 var(--primary); }
/* «قرعه‌کشی» result card in chat */
.draw-card { min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.draw-head { display: flex; align-items: center; gap: 10px; }
.draw-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-weak); display: grid; place-items: center; font-size: 22px; flex: none; }
.draw-winner { text-align: center; border: 1px solid var(--primary); background: var(--primary-weak); color: var(--primary); border-radius: 14px; padding: 6px 12px; }
.draw-winner b { font-size: 20px; display: block; }
.draw-winner.me { box-shadow: 0 0 0 2px var(--primary) inset; }
.draw-people { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.draw-people .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.task-chip { display: block; margin-top: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); border-radius: 8px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.mention-box { border-top: 1px solid var(--border); background: var(--surface); max-height: 180px; overflow: auto; }
.mention-box button { display: block; width: 100%; text-align: start; border: 0; background: none; color: inherit; font: inherit; padding: 8px 14px; cursor: pointer; }
.mention-box button:hover, .mention-box button:first-child { background: color-mix(in srgb, var(--primary) 10%, transparent); }

/* kanban board, checklist */
.kb { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.kb-col { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 160px; }
.kb-col.over { outline: 2px dashed var(--primary); }
.kb-head { padding: 4px 6px 8px; }
.kb-cards { display: flex; flex-direction: column; gap: 5px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.6; }
.kb-card.dragging { opacity: .5; }
.kb-card .kb-move { width: auto; font-size: 12px; padding: 2px 6px; margin-top: 2px; }
@media (max-width: 760px) { .kb { grid-template-columns: repeat(4, 62vw); scroll-snap-type: x mandatory; } .kb-col { scroll-snap-align: start; } }

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--muted, #6b7a76); padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--surface); overflow: hidden; }
.cal-cell.off { background: transparent; border-color: transparent; }
.cal-task.ghost { opacity: .65; border-style: dashed; }
.cal-cell.rest, .cal-col.rest { background: color-mix(in srgb, var(--muted, #6b7a76) 12%, var(--surface)); }
.cal-cell.hol, .cal-col.hol { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.cal-hol { font-size: 10px; color: var(--danger); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
.cal-key.hol { background: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
.cal-key.rest { background: color-mix(in srgb, var(--muted, #6b7a76) 35%, var(--surface)); }
.cal-cell.today, .cal-col.today { outline: 2px solid var(--primary); }
.cal-num { font-size: 12px; font-weight: 700; cursor: pointer; }
.cal-task { font-size: 11px; border-radius: 5px; padding: 1px 5px; margin-top: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--primary) 14%, transparent); }
.cal-task.danger { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.cal-task.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); text-decoration: line-through; opacity: .8; }
.cal-task.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.cal-task.muted { background: color-mix(in srgb, var(--border) 60%, transparent); }
.cal-task.wide { white-space: normal; font-size: 13px; padding: 4px 8px; margin-top: 6px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 6px; overflow-x: auto; }
.cal-col { border: 1px solid var(--border); border-radius: 8px; padding: 6px; min-height: 160px; background: var(--surface); }
.cal-more { cursor: pointer; }
@media (max-width: 760px) { .cal-cell { min-height: 64px; } .cal-task { font-size: 10px; } }


/* =====================================================================
   Layout: right-hand sidebar, top bar, dashboard (desktop and tablet),
   and the phone / iPhone-PWA layout (bottom bar, safe areas, 16px inputs).
   ===================================================================== */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side { width: 252px; flex: none; position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--surface);
  border-inline-end: 1px solid var(--border); padding: 18px 12px 24px; padding-inline-start: max(12px, env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 4px; }
.side-brand { padding: 4px 10px 16px; }
.side-brand .brand { font-size: 21px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group + .side-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.side-title { font-size: 12px; color: var(--muted); padding: 4px 14px; letter-spacing: .02em; }
.side-nav button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; border-radius: 12px; background: transparent;
  color: var(--muted); cursor: pointer; text-align: start; font-size: 14.5px; min-height: 44px; }
.side-nav button svg, .icon-btn svg, .hero svg, .quick-item svg, .stat-ico svg, .feed-ico svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav button:hover { background: var(--bg); color: var(--text); }
.side-nav button.active { background: var(--primary-weak); color: var(--primary); font-weight: 700; }
.side-nav button.active::before { content: ''; position: absolute; inset-block: 8px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--primary); }
.side-nav button:focus-visible, .icon-btn:focus-visible, .quick-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.topbar-brand { display: none; }
.org-select { width: auto; min-width: 200px; border-radius: 12px; background: var(--surface); }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.user-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.user-meta small { color: var(--muted); font-size: 12px; }
.tabs button { min-height: 40px; }

/* dashboard */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 28px 30px; min-height: 190px; color: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 220' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' fill-opacity='.14' d='M0 220V150L170 70l120 70 160-100 170 120 140-80 190 90 250-70v140z'/%3E%3Cpath fill='%23ffffff' fill-opacity='.2' d='M0 220v-60l220 20 200-60 210 70 200-40 370 70v-0z'/%3E%3C/svg%3E") bottom / 100% 60% no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 72%, #04201E), color-mix(in srgb, var(--primary) 46%, #04201E)); }
.hero-text { position: relative; max-width: 560px; }
.hero-date { font-size: 13px; opacity: .92; margin-bottom: 4px; }
.hero h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.4; }
.hero p { margin: 0; opacity: .95; font-size: 15px; }
.hero-actions { position: relative; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 18px; font-weight: 700; }
.hero .btn svg { width: 18px; height: 18px; }
.btn.light { background: #fff; color: color-mix(in srgb, var(--primary) 85%, #000); border-color: #fff; }
.btn.light:hover { border-color: #fff; filter: brightness(.96); }
.btn.glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .45); backdrop-filter: blur(4px); }
.btn.glass:hover { border-color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 16px 0; }
.stat-card { --ink: var(--info); display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card.green, .quick-item.green { --ink: var(--ok); }
.stat-card.red, .quick-item.red { --ink: var(--danger); }
.stat-card.purple, .quick-item.purple, .feed-ico.purple { --ink: var(--viol); }
.stat-card.orange, .quick-item.orange { --ink: var(--warn); }
.quick-item.blue, .feed-ico.blue { --ink: var(--info); }
.stat-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 16%, var(--surface)); color: var(--ink); flex: none; }
.stat-ico svg { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.stat-body b { font-size: 28px; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-body span { font-size: 13px; color: var(--text); opacity: .85; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 17px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed-av { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.feed-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-ico { --ink: var(--info); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 14%, var(--surface)); color: var(--ink); flex: none; }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-item { --ink: var(--info); display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: start; min-height: 56px; font-size: 14px; }
.quick-item .stat-ico { width: 36px; height: 36px; }
.quick-item .stat-ico svg { width: 18px; height: 18px; }
.quick-item:hover { filter: brightness(.97); }

/* tablet: the sidebar shrinks to icons */
@media (max-width: 1100px) {
  .side { width: 76px; padding-inline: 10px; align-items: center; }
  .side-brand { padding-inline: 0; }
  .side-brand .brand { font-size: 0; gap: 0; }
  .side-brand .brand-logo { width: 38px; height: 38px; }
  .side-nav button span, .side-title { display: none; }
  .side-nav button { justify-content: center; padding: 10px 0; }
  .side-group + .side-group { margin-top: 6px; }
  .dash-cols { grid-template-columns: 1fr; }
  main { padding: 20px 18px 56px; }
}
/* small tablet / large phone landscape: no sidebar, a scrolling tab strip instead */
@media (max-width: 899px) {
  .side { display: none; }
  .tabs { display: flex; }
  .topbar-brand { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .tabs button { border-radius: 999px; }
}
/* phones, including the iPhone home-screen app: bottom bar, safe areas, big targets */
@media (max-width: 600px) {
  .user-meta { display: none; }
  .user-chip { padding: 0; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .org-select { min-width: 0; flex: 1; }
  .topbar .spacer { display: none; }
  main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .hero { padding: 20px 18px; min-height: 160px; border-radius: 20px; }
  .hero h1 { font-size: 22px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .stat-body b { font-size: 24px; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; border-radius: 16px; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; }
}
/* phones: the bottom bar stays above the iPhone home indicator */
.bottom-nav { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
.bottom-nav button { min-height: 52px; }
@media (hover: none) { .side-nav button:hover { background: transparent; } .side-nav button.active:hover { background: var(--primary-weak); } .quick-item:hover { filter: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* fixes after the first look */
main { width: 100%; }
.stat-card.link, .feed li.link { cursor: pointer; }
.stat-card.link:hover { filter: brightness(.98); box-shadow: var(--shadow); }
.feed li.link:hover { background: color-mix(in srgb, var(--primary-weak) 45%, transparent); }
.icon-btn { position: relative; }
.icon-btn[data-count]::after { content: attr(data-count); position: absolute; top: -6px; inset-inline-start: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.hero .btn span { color: inherit; }
@media (max-width: 600px) { .tabs { display: none; } }

/* dark mode: brand colours are tuned for light surfaces, so text/tints derived from them are re-mixed here */
:root { --primary-ink: var(--primary); }
@media (prefers-color-scheme: dark) {
  :root { --primary-ink: color-mix(in srgb, var(--primary) 50%, #fff); --primary-weak: color-mix(in srgb, var(--primary) 24%, var(--surface)) !important; }
}
a, .brand, .chip, .side-nav button.active, .tabs button.active, .seg button.active, .user-avatar, .feed-av, .sender, .mention, .typing, .actions button, .task-chip { color: var(--primary-ink); }
.chip.danger { color: var(--danger); } .chip.warn { color: var(--warn); } .chip.ok { color: var(--ok); } .chip.muted { color: var(--muted); }
.btn.primary, .badge, .avatar { color: var(--on-primary); }
@media (prefers-color-scheme: dark) { .side { scrollbar-color: var(--border) transparent; } }
.side { scrollbar-width: thin; }

/* small iPhones (SE / XS / mini): nothing may push the page sideways */
.shell-main { overflow-x: clip; }
.seg { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; }
.table-wrap, .card { max-width: 100%; }
.hero .btn span { white-space: nowrap; }
@media (max-width: 400px) {
  .hero { padding: 18px 16px; }
  .hero h1 { font-size: 20px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .stat-card { padding: 12px; }
  .stat-body b { font-size: 22px; }
  .stat-body span { font-size: 12px; }
  .org-select { font-size: 14px; padding-inline: 8px; }
  .icon-btn { width: 40px; height: 40px; }
  main { padding-inline: 10px; }
}

/* dashboard widgets */
.dash-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 14px; }
.dash-row > .card { margin-bottom: 0; }
.seg.small { margin: 0; padding: 3px; }
.seg.small button { padding: 3px 12px; font-size: 13px; min-height: 30px; }
.ch-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.ch-legend i, .ring-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; }
.ch-svg { width: 100%; height: auto; display: block; direction: ltr; }
.ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.ch-x, .ch-y { fill: var(--muted); font-size: 11px; font-family: inherit; }
.ch-x { text-anchor: middle; } .ch-y { text-anchor: end; }
.ch-line { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.ch-created { --c: var(--info); } .ch-completed { --c: var(--ok); } .ch-overdue { --c: var(--danger); }
.ch-line.ch-created, .ch-line.ch-completed, .ch-line.ch-overdue { stroke: var(--c); }
.ch-legend .ch-created, .ch-legend .ch-completed, .ch-legend .ch-overdue { background: var(--c); }
.ch-dot { fill: var(--surface); stroke: var(--c); stroke-width: 2; }
.ch-area { fill: color-mix(in srgb, var(--ok) 14%, transparent); }
.ring-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ring-svg { width: 150px; height: 150px; flex: none; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: color-mix(in srgb, var(--muted) 20%, transparent); stroke-width: 14; }
.ring-seg { fill: none; stroke-width: 14; }
.ring-pct { transform: rotate(90deg); transform-origin: 70px 70px; text-anchor: middle; fill: var(--text); font-size: 26px; font-weight: 700; font-family: inherit; }
.ring-done { --c: var(--ok); } .ring-doing { --c: var(--info); } .ring-todo { --c: var(--muted); } .ring-late { --c: var(--danger); }
.ring-seg.ring-done, .ring-seg.ring-doing, .ring-seg.ring-todo, .ring-seg.ring-late { stroke: var(--c); }
.ring-legend i.ring-done, .ring-legend i.ring-doing, .ring-legend i.ring-todo, .ring-legend i.ring-late { background: var(--c); }
.ring-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; }
.ring-legend li { display: flex; align-items: center; gap: 4px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ring-legend li span { flex: 1; } .ring-legend li:last-child { border-bottom: 0; } .ring-total { font-weight: 700; }
.mc-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mc-bar .icon-btn { width: 32px; height: 32px; font-size: 18px; border-radius: 10px; }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mc-head { font-size: 12px; color: var(--muted); padding: 2px 0; }
.mc-day { position: relative; border: 0; background: transparent; color: var(--text); border-radius: 10px; min-height: 36px; font-size: 13px; cursor: pointer; padding: 0; }
.mc-day:hover { background: var(--bg); }
.mc-day.today { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.mc-day.hol { color: var(--danger); } .mc-day.rest { color: var(--muted); }
.mc-day i { position: absolute; bottom: 4px; inset-inline: 0; margin: 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--info); }
.mc-day i.late { background: var(--danger); } .mc-day.today i { background: var(--on-primary); }
.mini-title { margin: 14px 0 4px; font-size: 14px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.tl li:last-child { border-bottom: 0; } .tl li:hover { background: color-mix(in srgb, var(--primary-weak) 45%, transparent); }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info); flex: none; } .tl-dot.late { background: var(--danger); } .tl-dot.done { background: var(--ok); }
.tl-body { flex: 1; min-width: 0; overflow-wrap: anywhere; } .tl-done { text-decoration: line-through; opacity: .7; }
@media (max-width: 1100px) { .dash-row { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .dash-row { gap: 10px; margin-bottom: 10px; } .ring-svg { width: 130px; height: 130px; } .mc-day { min-height: 34px; } }
@media (prefers-reduced-motion: no-preference) { .ring-seg { transition: stroke-dasharray .4s ease; } }

@media (max-width: 480px) { .ch-x, .ch-y { font-size: 11px; } .ch-line { stroke-width: 2.4; } }

/* ---------- sign-in screens: brand panel next to the form ---------- */
.auth { display: grid; grid-template-columns: minmax(400px, 560px) minmax(0, 1fr); grid-template-areas: "main hero"; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.auth-main { grid-area: main; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left)); gap: 16px; }
.auth-main .login { width: min(440px, 100%); max-width: none; margin: 0; padding: 28px; border-radius: 22px; box-shadow: var(--shadow), 0 20px 50px rgba(23, 32, 51, .08); }
.auth-main .login h1 { font-size: 24px; margin: 0 0 4px; color: var(--text); }
.auth-main .login h3 { font-size: 20px; margin: 0 0 8px; }
.auth-main .login .btn.primary { min-height: 46px; font-size: 16px; font-weight: 700; }
.auth-main .login .seg { margin: 14px 0 6px; }
.auth-hero { grid-area: hero; position: relative; overflow: hidden; color: #fff; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 400' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' fill-opacity='.12' d='M0 400V260L160 150l130 90 170-130 190 150 150-100 200 120 200-90v250z'/%3E%3Cpath fill='%23ffffff' fill-opacity='.18' d='M0 400v-80l240 30 200-90 230 90 210-60 320 90v20z'/%3E%3C/svg%3E") bottom / 100% 45% no-repeat,
    radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .22), transparent 38%),
    linear-gradient(150deg, color-mix(in srgb, var(--primary) 74%, #04201E), color-mix(in srgb, var(--primary) 44%, #04201E)); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; position: relative; }
.auth-logo { width: 46px; height: 46px; border-radius: 13px; object-fit: cover; background: #fff; }
.auth-copy { position: relative; max-width: 460px; }
.auth-copy h2 { font-size: 34px; line-height: 1.5; margin: 0 0 10px; }
.auth-copy p { margin: 0 0 22px; opacity: .95; font-size: 16px; }
.auth-copy ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-copy li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.auth-copy svg { width: 22px; height: 22px; flex: none; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; color: var(--primary-ink); }
.auth-mobile-brand .auth-logo { width: 40px; height: 40px; }
@media (max-width: 1000px) { .auth-hero { padding: 36px 32px; } .auth-copy h2 { font-size: 28px; } }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-main { justify-content: flex-start; padding-top: calc(36px + env(safe-area-inset-top)); }
}
@media (max-width: 400px) { .auth-main { padding-inline: 12px; } .auth-main .login { padding: 20px 16px; border-radius: 18px; } }

/* ---------- stories ---------- */
.st-bar { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.st-bar::-webkit-scrollbar { display: none; }
.st-bar:empty { display: none; }
.st-item { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; width: 76px; padding: 0; color: var(--text); }
.st-ring { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; padding: 3px; background: conic-gradient(from 200deg, var(--primary), var(--viol), var(--warn), var(--primary)); }
.st-ring.seen { background: var(--border); }
.st-ring.add { background: transparent; border: 2px dashed var(--primary); padding: 3px; }
.st-av { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--primary-weak); color: var(--primary-ink); font-weight: 700; font-size: 22px; border: 3px solid var(--surface); overflow: hidden; }
.st-av img { width: 100%; height: 100%; object-fit: cover; }
.st-plus { font-size: 30px; font-weight: 400; border: 0; }
.st-ring.small { width: 40px; height: 40px; padding: 2px; } .st-ring.small .st-av { font-size: 16px; border-width: 2px; }
.st-name { font-size: 12px; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 12px; }
.st-viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.st-stage { position: relative; width: min(100vw, 440px, calc((100dvh - 24px) * 9 / 16)); aspect-ratio: 9 / 16; max-height: 100dvh; background: var(--bg, #0f766e); border-radius: 18px; overflow: hidden; color: #fff; display: flex; flex-direction: column; }
.st-progress { position: absolute; inset: 10px 10px auto; display: flex; gap: 4px; z-index: 3; direction: ltr; }
.st-progress i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.st-progress b { display: block; height: 100%; background: #fff; }
.st-head { position: absolute; inset: 22px 10px auto; display: flex; align-items: center; gap: 10px; z-index: 3; }
.st-who { display: flex; flex-direction: column; line-height: 1.4; } .st-who small { opacity: .85; font-size: 12px; }
.st-btn { border: 0; background: rgba(0, 0, 0, .35); color: #fff; min-width: 40px; height: 40px; border-radius: 20px; padding: 0 12px; cursor: pointer; font-size: 15px; }
.st-body { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; background: var(--bg, #0f766e); }
.st-img { width: 100%; height: 100%; object-fit: contain; background: #000; position: absolute; inset: 0; }
.st-text { font-size: 28px; line-height: 1.7; font-weight: 700; text-align: center; padding: 70px 26px; overflow-wrap: anywhere; position: relative; }
.st-caption { position: absolute; inset: auto 0 0; padding: 40px 18px 22px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.st-zone { position: absolute; top: 70px; bottom: 0; width: 50%; border: 0; background: transparent; cursor: pointer; z-index: 2; }
.st-prev { right: 0; } .st-next { left: 0; }
.st-viewers { list-style: none; margin: 0; padding: 0; } .st-viewers li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.st-preview { margin-top: 8px; } .st-preview img { max-width: 100%; max-height: 240px; border-radius: 12px; display: block; }
.st-colors { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.st-color { width: 34px; height: 34px; border-radius: 50%; margin: 0; position: relative; cursor: pointer; display: block; }
.st-color input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.st-color span { position: absolute; inset: -3px; border-radius: 50%; border: 3px solid transparent; }
.st-color input:checked + span { border-color: var(--text); }
.st-color input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.st-sample { border-radius: 16px; min-height: 120px; display: grid; place-items: center; color: #fff; font-weight: 700; padding: 16px; text-align: center; overflow-wrap: anywhere; }
@media (max-width: 600px) { .st-stage { border-radius: 0; width: 100vw; height: 100dvh; aspect-ratio: auto; } .st-item { width: 68px; } .st-ring { width: 62px; height: 62px; } }
@media (prefers-reduced-motion: reduce) { .st-progress b { transition: none; } }

.st-video { background: #000; }
.st-zone.with-reply { bottom: 64px; }
.st-reply { position: absolute; inset: auto 10px 10px; z-index: 4; display: flex; gap: 8px; }
.st-reply input { flex: 1; border: 1px solid rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .35); color: #fff; border-radius: 22px; padding: 10px 16px; font-size: 16px; }
.st-reply input::placeholder { color: rgba(255, 255, 255, .8); }
.st-send { border: 0; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #111; font-size: 18px; cursor: pointer; flex: none; }

.tick-seal { width: 1.05em; height: 1.05em; vertical-align: -.16em; margin-inline-start: .3em; flex: none; }
.tick-seal.business { color: var(--info); }
.tick-seal.platform { color: var(--warn); }

.stat-card.add-card { background: var(--surface-2, var(--bg)); border: 1.5px dashed var(--border, #cbd5d5); color: var(--primary); cursor: pointer; font: inherit; text-align: inherit; }
.stat-card.add-card .stat-body b { font-size: 26px; }

.as-level { display: inline-block; width: 120px; height: 8px; background: var(--border, #dde3e3); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-inline-start: 10px; }
.as-level i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .1s linear; }

#as-fab { position: fixed; z-index: 60; width: 58px; height: 58px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); cursor: grab; touch-action: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--viol), color-mix(in srgb, var(--viol) 62%, #000)); box-shadow: 0 8px 22px color-mix(in srgb, var(--viol) 45%, transparent); transition: left .2s, top .2s; animation: as-glow 2.4s ease-in-out infinite; }
#as-fab svg { width: 28px; height: 28px; }
#as-fab.drag { cursor: grabbing; transition: none; opacity: .88; animation: none; }
@keyframes as-glow { 50% { box-shadow: 0 8px 30px rgba(109,74,255,.7); } }
#as-fab-panel { position: fixed; z-index: 61; width: 260px; background: var(--surface, #fff); border-radius: 22px; padding: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.25); display: grid; gap: 8px; }
.as-fab-head { display: flex; align-items: center; gap: 8px; color: var(--viol); }
.as-fab-head svg { width: 22px; height: 22px; }
.as-fab-head b { flex: 1; font-size: 14px; }
.as-fab-head button { border: 0; background: none; cursor: pointer; color: var(--muted, #777); font-size: 16px; }
.as-fab-q { border: 0; border-radius: 14px; padding: 12px; background: var(--surface-2, #eef1f1); font: inherit; text-align: start; cursor: pointer; }
.as-fab-q.open { background: var(--viol-weak); color: var(--viol); font-weight: 700; }

/* ---- payslip (فیش حقوقی) ---- */
.ps-layout { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
.ps-periods { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.ps-periods h4 { margin: 0 0 8px; }
.ps-periods button { display: block; width: 100%; text-align: right; background: transparent; border: 0; border-radius: 10px; padding: 10px 12px; margin-bottom: 4px; cursor: pointer; color: var(--text); font: inherit; }
.ps-periods button.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.ps-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-radius: var(--radius); margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #000)); }
.ps-name { font-size: 20px; font-weight: 700; }
.ps-sub { opacity: .85; margin-top: 4px; }
.ps-badge { background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 5px 14px; font-size: 13px; white-space: nowrap; }
.ps-badge.ok { background: var(--ok-weak); color: var(--ok); }
.ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.ps-card h4 { margin: 0 0 10px; }
.ps-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ps-pos { color: var(--ok); }
.ps-neg { color: var(--danger); }
.ps-net { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--primary-weak); font-weight: 700; font-size: 16px; }
.ps-table { width: 100%; border-collapse: collapse; }
.ps-table th { font-size: 12px; color: var(--muted); text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--border); font-weight: 600; }
.ps-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.ps-table .amt { text-align: left; white-space: nowrap; }
.ps-total td { font-weight: 700; padding: 10px 8px; }
.ps-total.pos td { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.ps-total.neg td { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.ps-row { display: flex; gap: 6px; margin-bottom: 6px; }
.ps-row .ps-t { flex: 1; min-width: 0; }
.ps-row .ps-a { width: 150px; }
.ps-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ps-tools select { flex: 1; min-width: 180px; }
.ps-tools input { width: 70px; }
.ps-totals { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px; margin-top: 8px; border-radius: 10px; background: var(--primary-weak); }
@media (max-width: 800px) {
  .ps-layout { grid-template-columns: 1fr; }
  .ps-periods { display: flex; gap: 6px; overflow-x: auto; }
  .ps-periods h4 { display: none; }
  .ps-periods button { width: auto; white-space: nowrap; margin: 0; }
  .ps-grid { grid-template-columns: 1fr; }
  .ps-row .ps-a { width: 110px; }
}

/* ---- org chart (چارت سازمانی) ---- */
.oc-node { margin-top: 8px; }
.oc-children { margin-inline-start: 22px; padding-inline-start: 14px; border-inline-start: 2px solid var(--border); }
.oc-card { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); max-width: 760px; }
.oc-card.vacant { border-style: dashed; background: transparent; }
.oc-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.oc-card.vacant .oc-avatar { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.oc-info { flex: 1; min-width: 0; }
.oc-name { font-weight: 700; }
.oc-title { color: var(--muted); }
.oc-toggle { width: 22px; flex: none; background: transparent; border: 0; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0; }
.oc-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.oc-unit { padding: 12px 14px; margin-bottom: 8px; }
@media (max-width: 800px) { .oc-card { flex-wrap: wrap; } .oc-children { margin-inline-start: 8px; padding-inline-start: 8px; } }

.oc-card[draggable=true] { cursor: grab; }
.oc-card.drop, .oc-root-drop.drop { outline: 2px dashed var(--primary); background: var(--primary-weak); }
.oc-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.oc-avatar[data-user] { cursor: grab; }
.oc-root-drop { border: 1px dashed var(--border); border-radius: 10px; padding: 6px; text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 8px; }

/* ---- payslip editor: stepper beside a live preview ---- */
.pe-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pe-preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; position: sticky; top: 0; max-height: 78vh; overflow: auto; }
.pe-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.pe-steps button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border: 0; border-radius: 999px; background: var(--bg); color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.pe-steps button i { width: 22px; height: 22px; border-radius: 50%; background: var(--border); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; }
.pe-steps button.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.pe-steps button.active i { background: var(--on-primary); color: var(--primary); }
.pe-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.pe-tiles div { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.pe-tiles span, .pe-tiles small { color: var(--muted); font-size: 12px; }
.pe-h { margin: 12px 0 6px; }
.pe-h.pos { color: var(--ok); } .pe-h.neg { color: var(--danger); }
.pe-nav { margin-top: 12px; }
.pe-switch { display: flex; align-items: center; gap: 8px; margin-top: 10px; cursor: pointer; }
.pe-switch input { display: none; }
.pe-switch span { width: 40px; height: 22px; border-radius: 999px; background: var(--border); position: relative; flex: none; transition: background .15s; }
.pe-switch span::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.pe-switch input:checked + span { background: var(--primary); }
.pe-switch input:checked + span::after { inset-inline-start: 20px; }
.pv { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.pv .lh { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 3px solid var(--pv); margin-bottom: 10px; }
.pv .lh-logo { width: 48px; height: 48px; border-radius: 10px; background: var(--pv); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; overflow: hidden; flex: none; }
.pv .lh-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pv .lh-id { flex: 1; } .pv .lh-name { font-weight: 700; font-size: 16px; color: var(--pv); } .pv .lh-org { color: var(--muted); font-size: 12px; }
.pv .lh-meta { font-size: 12px; color: var(--muted); text-align: left; line-height: 1.6; }
.pv-who { display: flex; justify-content: space-between; margin-bottom: 6px; }
.pv-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--pv); color: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.pv-hero-id { display: flex; flex-direction: column; } .pv-hero-id span { opacity: .85; font-size: 13px; }
.pv-hero-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; opacity: .9; }
.pv-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.pv-tiles div { background: var(--bg); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; font-size: 12px; }
.pv-tiles span { color: var(--muted); }
.pv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-col { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pv-col h5 { margin: 0; padding: 8px 10px; font-size: 13px; }
.pv-col.pos h5 { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pv-col.neg h5 { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.pv-col .ps-table td, .pv-col .ps-table th { font-size: 12px; padding: 6px 8px; }
.pv-net { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--pv); color: #fff; font-size: 16px; }
.pv-net.classic { background: var(--primary-weak); color: var(--text); }
.pv-foot { margin-top: 8px; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) { .pe-grid { grid-template-columns: 1fr; } .pe-preview { position: static; max-height: none; } .pv-cols { grid-template-columns: 1fr; } }

.modal.wide:has(.pe-grid) { width: min(1180px, 100%); }
.modal-body:has(.pe-grid) { max-height: 74vh; overflow: auto; }

/* ---- org chart as a diagram ---- */
.og-wrap { position: relative; }
.og-canvas { background-color: var(--bg); background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 16px 16px; border: 1px solid var(--border); border-radius: 16px; overflow: auto; padding: 30px 24px 50px; min-height: 440px; }
.og-stage { transform-origin: top center; width: max-content; margin: 0 auto; }
.og-node { display: flex; flex-direction: column; align-items: center; }
.og-down { width: 2px; height: 26px; background: #2b2f3a; }
.og-row { display: flex; justify-content: center; gap: 30px; padding-top: 26px; position: relative; }
.og-roots { padding-top: 0; }
.og-col { position: relative; display: flex; flex-direction: column; align-items: stretch; width: 232px; }
.og-row:not(.og-roots) > .og-col::before { content: ''; position: absolute; top: -26px; inset-inline-start: 50%; height: 26px; border-inline-start: 2px solid #2b2f3a; }
.og-row:not(.og-roots) > .og-col::after { content: ''; position: absolute; top: -26px; inset-inline: -15px; border-top: 2px solid #2b2f3a; }
.og-row:not(.og-roots) > .og-col:first-child::after { inset-inline-start: 50%; }
.og-row:not(.og-roots) > .og-col:last-child::after { inset-inline-end: 50%; }
.og-row:not(.og-roots) > .og-col:only-child::after { display: none; }
.og-pill { background: var(--uc); color: #fff; border-radius: 8px; text-align: center; padding: 7px 10px; font-weight: 700; font-size: 13px; margin-bottom: 14px; position: relative; }
.og-pill::after { content: ''; position: absolute; bottom: -14px; inset-inline-start: 50%; height: 14px; border-inline-start: 2px solid #2b2f3a; }
.og-card { display: flex; align-items: center; gap: 10px; width: 100%; background: #fff; border: 1px solid #e4e6ec; border-radius: 12px; padding: 9px 11px; box-shadow: 0 1px 4px rgba(16, 24, 40, .08); cursor: pointer; }
.og-card[draggable=true] { cursor: grab; }
.og-card.vacant { border-style: dashed; background: transparent; box-shadow: none; }
.og-card.drop { outline: 2px dashed var(--primary); background: var(--primary-weak); }
.og-av { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--uc, var(--primary)) 18%, #fff); color: var(--uc, var(--primary)); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; overflow: hidden; }
.og-av img { width: 100%; height: 100%; object-fit: cover; }
.og-card.vacant .og-av { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.og-tx { min-width: 0; display: flex; flex-direction: column; } .og-tx b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .og-tx small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.og-stack { position: relative; margin-top: 14px; padding-inline-start: 28px; display: flex; flex-direction: column; gap: 12px; }
.og-stack::before { content: ''; position: absolute; inset-inline-start: 12px; top: -14px; bottom: 24px; border-inline-start: 2px solid #9aa1ad; }
.og-item { position: relative; display: flex; flex-direction: column; }
.og-item::before { content: ''; position: absolute; inset-inline-start: -16px; top: 28px; width: 16px; border-top: 2px solid #9aa1ad; }
.og-item > .og-stack { margin-top: 12px; }
.og-zoom { position: absolute; bottom: 14px; inset-inline-end: 14px; display: flex; flex-direction: column; gap: 6px; }
.og-zoom button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #12141c; color: #fff; font-size: 18px; cursor: pointer; }

.og-node > .og-card { width: 232px; }

/* ---- the new sidebar: a rail, a business card, folding sections, warm icon colours ---- */
:root { --warm-ink: var(--muted); --warm-bg: var(--surface); --warm-bg2: var(--bg); } /* the old cream names, now neutral */
.side { width: auto; flex-direction: row; gap: 0; padding: 0; background: var(--surface); overflow: visible; }
.side-rail { width: 58px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 0; background: var(--warm-bg2); border-inline-end: 1px solid var(--border); position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side-rail button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: background .15s; }
.side-rail button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-rail button:hover { background: var(--bg); color: var(--text); }
.side-rail button.active { background: var(--primary-weak); color: var(--primary); }
.side-col { width: 256px; padding: 18px 12px 24px; display: flex; flex-direction: column; gap: 4px; height: 100vh; height: 100dvh; overflow-y: auto; position: sticky; top: 0; scrollbar-width: thin; }
.org-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin: 0 0 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: right; font: inherit; color: var(--text); box-shadow: 0 1px 3px rgba(18, 32, 31, .06); }
.org-card[data-single] { cursor: default; }
.org-card-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; flex: none; }
.org-card svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.org-card-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; } .org-card-tx b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .org-card-tx small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-title { display: flex !important; justify-content: space-between; align-items: center; width: 100%; padding: 8px 14px !important; margin-top: 4px; font-size: 13px !important; font-weight: 700; color: var(--warm-ink) !important; background: transparent !important; cursor: pointer; border-radius: 10px !important; }
.side-title:hover { background: var(--bg) !important; }
.side-title svg { width: 16px !important; height: 16px !important; transition: transform .15s; stroke: currentColor !important; }
.side-group.closed .side-title svg { transform: rotate(90deg); }
.side-group.closed .side-items { display: none; }
.side-items { display: flex; flex-direction: column; gap: 2px; }
.side-group + .side-group { border-top: 0; margin-top: 4px; padding-top: 0; }
.side-nav button[data-tab] svg { color: var(--muted); }
.side-nav button[data-tab]:hover { background: var(--bg); }
.side-nav button[data-tab].active { background: var(--primary-weak); color: var(--primary); }
.side-nav button[data-tab].active svg { color: var(--primary); }
.side-nav button[data-tab].active::before { background: var(--primary); }
.search-pill { display: flex; align-items: center; gap: 8px; min-width: 260px; max-width: 420px; flex: 1; padding: 9px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; }
.search-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-pill span { flex: 1; text-align: right; }
.search-pill kbd { border: 1px solid var(--border); border-radius: 8px; padding: 1px 8px; font-size: 11px; background: var(--bg); }
.search-pill:hover { border-color: var(--primary); }
@media (max-width: 1100px) {
  .side { width: 76px; } .side-rail { display: none; } .side-col { width: 76px; padding-inline: 10px; align-items: center; }
  .side-group.closed .side-items { display: flex; } .side-title, .org-card { display: none !important; }
  .search-pill span, .search-pill kbd { display: none; } .search-pill { min-width: 0; flex: none; padding: 9px 11px; }
}

/* ---- print and PDF of any page ---- */
.export-bar { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.print-letterhead { display: none; }
@media print {
  body.printing .side, body.printing .topbar, body.printing .tabs, body.printing .bottom-nav, body.printing .export-bar, body.printing .toolbar,
  body.printing #assistant-fab, body.printing .fab, body.printing .btn { display: none !important; }
  body.printing .shell, body.printing .shell-main { display: block !important; margin: 0 !important; padding: 0 !important; }
  body.printing { background: #fff !important; }
  body.printing .card, body.printing .stat { box-shadow: none !important; break-inside: avoid; border: 1px solid #ccc; }
  body.printing .print-letterhead { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--primary); padding-bottom: 8px; margin-bottom: 12px; }
  body.printing .print-letterhead img { height: 48px; width: auto; }
  body.printing .print-letterhead span { margin-inline-start: auto; color: #555; }
}

/* ---- set-up checklist ---- */
.onb .progress { height: 8px; border-radius: 999px; background: var(--line, #e3e8ee); overflow: hidden; }
.onb .progress > i { display: block; height: 100%; background: var(--accent, #0f766e); border-radius: 999px; }

/* ---- the menu: a rail of sections and a rich panel ---- */
.side.nav2 { width: 76px; padding: 12px 6px; flex-direction: column; align-items: center; gap: 4px; background: var(--surface); border-inline-end: 1px solid var(--border); }
.nav2-brand { padding: 2px 0 10px; } .nav2-brand .brand { font-size: 0; gap: 0; } .nav2-brand .brand-logo { width: 38px; height: 38px; }
.nav2-rail { display: flex; flex-direction: column; gap: 4px; align-items: center; width: 64px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.nav2-foot { width: 100%; display: flex; justify-content: center; padding-top: 8px; border-top: 1px solid var(--border); }
.nav-sec { position: relative; width: 62px; border: 0; background: none; border-radius: 14px; padding: 8px 0 5px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font: inherit; font-size: 10.5px; line-height: 1.3; }
.nav-sec span:not(.nbadge) { color: var(--muted); max-width: 58px; text-align: center; }
.nav-sec svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-sec:hover, .nav-sec.open { background: var(--bg); color: var(--text); }
.nav-sec.active { background: var(--primary-weak); color: var(--primary); } .nav-sec.active span:not(.nbadge) { color: var(--primary); font-weight: 700; }
.nav-sec:focus-visible, .fitem:focus-visible, .fly-qa button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nbadge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; font-weight: 700; margin-inline-start: auto; }
.nbadge.rail { position: absolute; top: 1px; inset-inline-end: 4px; min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; margin: 0; }
.nav-fly { position: fixed; top: 0; bottom: 0; inset-inline-start: 76px; width: min(400px, calc(100vw - 90px)); background: var(--surface); border-inline-end: 1px solid var(--border); box-shadow: 0 10px 40px rgba(18, 32, 31, .16); z-index: 30; overflow-y: auto; display: flex; flex-direction: column; animation: nav-pop .14s ease-out; }
.nav-fly[hidden] { display: none; }
@keyframes nav-pop { from { opacity: 0; transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .nav-fly { animation: none; } }
.fly-head { display: flex; gap: 12px; align-items: center; padding: 18px 16px 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 10%, var(--surface)), transparent); }
.fly-head .big { width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.fly-head .big svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fly-head h4 { margin: 0; font-size: 18px; } .fly-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.fly-qa { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.fly-qa button { font: inherit; font-size: 13px; border: 1px solid var(--primary); background: none; color: var(--primary); border-radius: 999px; padding: 3px 14px; cursor: pointer; }
.fly-qa button.primary { background: var(--primary); color: var(--on-primary); }
.fly-list { padding: 2px 10px; display: grid; gap: 2px; }
.fitem { display: flex; gap: 12px; align-items: center; padding: 9px 8px; border-radius: 12px; cursor: pointer; }
.fitem:hover { background: var(--bg); } .fitem.active { background: var(--primary-weak); }
.fitem .fi { width: 36px; height: 36px; border-radius: 11px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; flex: none; }
.fitem.active .fi { background: var(--primary); color: var(--on-primary); }
.fitem .fi svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fitem .ft b { display: block; font-size: 14.5px; line-height: 1.5; } .fitem .ft small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.fitem .fstar { margin-inline-start: auto; border: 0; background: none; cursor: pointer; color: var(--border); font-size: 18px; padding: 2px 4px; line-height: 1; }
.fitem .nbadge + .fstar { margin-inline-start: 4px; } .fitem .fstar.on, .fitem .fstar:hover { color: var(--warn); }
.fly-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 16px 16px; font-size: 12.5px; color: var(--muted); }
.fly-foot .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.fly-foot .chips button { font: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 11px; color: var(--text); cursor: pointer; }
@media (max-width: 899px) { .nav-fly { display: none !important; } }

/* ---- touch screens (iPhone, iPad): date and time fields big enough to read and to hit ---- */
@media (pointer: coarse), (max-width: 700px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea { font-size: 16px; min-height: 46px; }
  input[name$="__d"] { min-width: 10.5em; flex: 1 1 10.5em !important; }                 /* the Jalali day field (۱۴۰۵/۰۷/۲۸) */
  input[type=time], input[type=date] { -webkit-appearance: none; appearance: none; min-width: 7.5em; flex: 0 1 8em !important; text-align: center; }
  #perf-from, #perf-to, #au-from, #au-to { max-width: none !important; min-width: 10.5em; flex: 1 1 10.5em; }  /* the range filters */
  .row > .btn.small[data-jtoday] { min-height: 46px; padding-inline: 14px; font-size: 14px; }
}

/* ---- the Jalali calendar picker (a sheet at the bottom on phones) ---- */
.btn.icon { display: inline-grid; place-items: center; padding: 0 10px; min-width: 40px; }
.jpick-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; padding: 12px; }
.jpick { width: min(340px, 100%); background: var(--surface); color: var(--text); border-radius: 20px; padding: 14px; box-shadow: 0 16px 48px rgba(0, 0, 0, .3); }
.jp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.jp-head b { flex: 1; text-align: center; font-size: 16px; }
.jp-head button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--bg); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.jp-head button:hover, .jp-head button:focus-visible { background: var(--primary-weak); color: var(--primary); }
.jp-week, .jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.jp-week span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.jp-week span:last-child { color: var(--danger); }
.jp-day { height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 15px; cursor: pointer; font-variant-numeric: tabular-nums; }
.jp-day:hover { background: var(--primary-weak); }
.jp-day.fri { color: var(--danger); }
.jp-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.jp-day.sel { background: var(--primary); color: var(--on-primary); font-weight: 700; box-shadow: none; }
.jp-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.jp-foot { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
@media (max-width: 600px) {
  .jpick-backdrop { align-items: flex-end; padding: 0; }
  .jpick { width: 100%; border-radius: 22px 22px 0 0; padding: 16px 14px calc(14px + env(safe-area-inset-bottom)); }
  .jp-day { height: 46px; font-size: 16px; }
}

/* ---- phones: the look of the app (cards, big titles, sheets) ---- */
@media (max-width: 700px) {
  /* the install / notification notice: one compact card */
  .notif-banner { margin: 8px 12px 0; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.7; display: flex; gap: 10px; align-items: center; }
  .notif-banner span { flex: 1; min-width: 0; }
  .notif-banner .btn { flex: none; min-height: 34px; }
  /* the title of a page, large like the app's header */
  main > h2:first-child, main > .toolbar + h2 { font-size: 24px; font-weight: 800; margin: 4px 2px 12px; }
  /* wide tables become a list of cards */
  .table-wrap { overflow: visible; }
  table[data-cards] { display: block; background: transparent; }
  table[data-cards] thead { display: none; }
  table[data-cards] tbody { display: grid; gap: 10px; }
  table[data-cards] tr { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
  table[data-cards] td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 4px 0; text-align: end; min-width: 0; overflow-wrap: anywhere; }
  table[data-cards] td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; text-align: start; }
  table[data-cards] td:first-child { justify-content: flex-start; text-align: start; font-weight: 700; font-size: 15px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  table[data-cards] td:first-child::before, table[data-cards] td[data-label=""]::before { display: none; }
  table[data-cards] td:empty { display: none; }
  table[data-cards] td.row, table[data-cards] td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; text-align: start; }
  table[data-cards] tr:hover td { background: transparent; }
  /* the dashboard tiles: the icon beside the number, low */
  .stat-card { flex-direction: row; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; }
  .stat-ico { width: 40px; height: 40px; }
  .stat-body b { font-size: 22px; line-height: 1.2; }
  .stat-body { font-size: 12.5px; }
  /* a dialog is a sheet from the bottom */
  .backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--surface); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin-inline: -4px; }
  /* long filter rows scroll sideways instead of wrapping into a pile */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  .toolbar input[type=search], .toolbar input[type=text] { min-width: 180px; }
  /* words never push a card wider */
  .card, .stat-card, .modal, .conv, .feed-item { overflow-wrap: anywhere; }
  img, video, canvas, svg { max-width: 100%; }
}

/* ---- older iPhones (Safari before 16.2 has no color-mix): plain colours for the tinted parts ---- */
@supports not (color: color-mix(in srgb, red, blue)) {
  .topbar { background: var(--surface); }
  .stat-ico, .feed-ico { background: var(--primary-weak); }
  .quick-item { background: var(--surface); }
  tr:hover td { background: var(--primary-weak); }
  .cal-cell.rest, .cal-col.rest { background: var(--bg); }
  .cal-cell.hol, .cal-col.hol { background: var(--danger-weak); border-color: var(--danger); }
  .hero, .auth-hero, .ps-hero { background: var(--primary); color: var(--on-primary); }
  .org-card-ic { background: var(--primary-weak); }
  .side-nav button[data-tab].active, .nav-sec.active { background: var(--primary-weak); }
  .nav-fly .fly-head { background: var(--primary-weak); }
}

/* ---- shift planning ---- */
.sh-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.sh-nav b { min-width: 11em; text-align: center; }
.sh-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sh-chip { display: inline-block; border-radius: 10px; padding: 2px 8px; font-size: 12.5px; line-height: 1.7; white-space: nowrap; background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.sh-chip b { font-weight: 700; margin-inline-end: 3px; }
.sh-usual { background: transparent; color: var(--muted); border-style: dashed; }
.sh-rest { background: transparent; color: var(--muted); border: 0; }
.sh-off { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.sh-leave { background: var(--info-weak); color: var(--info); border-color: transparent; }
.sh-custom { background: var(--surface); color: var(--text); border-color: var(--primary); }
.sh-c-teal { background: var(--primary-weak); color: var(--primary); border-color: transparent; }
.sh-c-info { background: var(--info-weak); color: var(--info); border-color: transparent; }
.sh-c-ok { background: var(--ok-weak); color: var(--ok); border-color: transparent; }
.sh-c-warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.sh-c-viol { background: var(--viol-weak); color: var(--viol); border-color: transparent; }
.sh-c-danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }
.sh-sub { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; margin-top: 1px; }
.sh-week { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.sh-row { display: grid; grid-template-columns: 150px repeat(7, minmax(112px, 1fr)); border-bottom: 1px solid var(--border); }
.sh-row:last-child { border-bottom: 0; }
.sh-head { background: var(--bg); position: sticky; top: 0; }
.sh-name, .sh-dh, .sh-cell { padding: 8px 10px; min-width: 0; }
.sh-name { font-weight: 700; position: sticky; inset-inline-start: 0; background: inherit; }
.sh-row:not(.sh-head) .sh-name { background: var(--surface); }
.sh-dh { text-align: center; } .sh-dh small { display: block; color: var(--muted); font-size: 11.5px; } .sh-dh.off b { color: var(--danger); }
.sh-cell.can { cursor: pointer; } .sh-cell.can:hover { background: var(--primary-weak); }
.sh-day, .sh-strip { display: none; }
.sh-pick { display: flex; gap: 6px 14px; flex-wrap: wrap; max-height: 180px; overflow-y: auto; padding: 4px 0; }
.sh-pick .pick { margin: 0; font-size: 14px; color: var(--text); }
.sh-types { display: grid; gap: 8px; }
.sh-type { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; }
.sh-type .grow { flex: 1; }
@media (max-width: 899px) {
  .sh-week { display: none; }
  .sh-day { display: block; }
  .sh-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .sh-strip button { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 6px 0; display: grid; gap: 0; justify-items: center; color: var(--text); font: inherit; cursor: pointer; }
  .sh-strip button small { color: var(--muted); font-size: 12px; } .sh-strip button.off b { color: var(--danger); }
  .sh-strip button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .sh-strip button.on small { color: inherit; opacity: .85; }
  .sh-person { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-top: 8px; box-shadow: var(--shadow); }
  .sh-person > div { text-align: end; min-width: 0; }
  .sh-person.can { cursor: pointer; }
  .sh-nav b { min-width: 0; flex: 1 1 100%; order: -1; }
}

/* ---- forms in dialogs: an icon tile, a title and its line, a close button; soft fields; chips; a primary button with a tick ---- */
.modal { padding: 0; display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh; overflow: hidden; }
.mh { display: flex; align-items: center; gap: 12px; padding: 18px 20px 10px; }
.mh-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; flex: none; }
.mh-ic.danger { background: var(--danger-weak); color: var(--danger); }
.mh-ic svg, .mh-x svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mh-tx { flex: 1; min-width: 0; }
.mh-tx h3 { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.5; }
.mh-tx p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mh-x { width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--bg); color: var(--text); cursor: pointer; display: grid; place-items: center; flex: none; }
.mh-x:hover, .mh-x:focus-visible { background: var(--primary-weak); color: var(--primary); }
.modal-body { padding: 2px 20px 10px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-body > p:first-child { margin-top: 4px; }
.modal label { font-weight: 700; font-size: 13.5px; color: var(--text); margin: 14px 0 6px; }
.modal input:not([type=checkbox]):not([type=radio]):not([type=file]), .modal select, .modal textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; min-height: 46px; padding: 10px 14px; }
.modal textarea { min-height: 96px; line-height: 1.8; }
.modal input:focus, .modal select:focus, .modal textarea:focus { background: var(--surface); outline: 2px solid var(--primary); border-color: transparent; }
.modal label.pick { font-weight: 500; margin: 0; }
.modal .pick-list { border-radius: 14px; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; max-height: 32vh; }
.modal .pick-list .pick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; }
.modal .pick-list .pick:has(input:checked) { background: var(--primary-weak); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.modal-actions { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; margin: 0; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.modal-actions .btn { min-height: 46px; border-radius: 14px; padding-inline: 18px; }
.modal-actions .btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.modal-actions .btn.go { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 15.5px; }
.modal-actions .btn.go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chips-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-choice .co { flex: 1 1 0; min-width: 5.5em; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; cursor: pointer; }
.chips-choice .co svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chips-choice .co.on { font-weight: 700; }
.chips-choice .t-teal.on { background: var(--primary-weak); border-color: var(--primary); color: var(--primary); }
.chips-choice .t-info.on { background: var(--info-weak); border-color: var(--info); color: var(--info); }
.chips-choice .t-warn.on { background: var(--warn-weak); border-color: var(--warn); color: var(--warn); }
.chips-choice .t-danger.on { background: var(--danger-weak); border-color: var(--danger); color: var(--danger); }
.chips-choice .co:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 700px) {
  .modal, .modal.wide { padding: 0; max-height: 92vh; max-height: 92dvh; overflow: hidden; }
  .modal-actions { position: static; margin: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-body { padding-inline: 16px; }
  .mh { padding: 16px 16px 8px; }
}

/* chips never break inside a word; on phones two in a row, and two-column field groups stack */
.chips-choice .co { flex: 1 1 auto; white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
@media (max-width: 700px) {
  .modal .chips-choice { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }  /* in a dialog: 2 or 3 in a row */
  .modal .chips-choice .co { min-width: 0; padding: 0 6px; font-size: 14px; }
  .modal .grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 700px) { .row > .btn[data-jtoday] { display: none; } } /* the calendar has its own «امروز» */

/* ---- shared pieces: a page's line under its title, classes pages use, touch sizes ---- */
.page-sub { color: var(--muted); margin: -6px 0 14px; font-size: 14px; line-height: 1.8; max-width: 72ch; }
.stack { display: grid; gap: 14px; }
.td-title { font-size: 15px; font-weight: 700; }
.td-note { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.pe-form { display: grid; gap: 12px; }
.pe-panel { display: grid; gap: 8px; }
.pe-panel[hidden] { display: none; }
@media (pointer: coarse) { .btn.small { min-height: 40px; padding-inline: 14px; } }

.filter-bar { align-items: center; gap: 10px; }
.filter-bar .seg { margin: 0; }
.filter-bar input[type=search] { flex: 1 1 180px; max-width: 280px; }
@media (max-width: 700px) { .filter-bar input[type=search] { max-width: none; flex-basis: 100%; } }
table.no-cards { min-width: 760px; }
.filter-bar select { width: auto; max-width: 220px; }
.filter-bar label { white-space: nowrap; }
@media (max-width: 700px) { .filter-bar select { max-width: none; flex: 1 1 140px; } }
@media (max-width: 700px) { .table-wrap:has(> table.no-cards) { overflow-x: auto; } }
table.no-cards td, .table-wrap table.no-cards th { white-space: nowrap; }
table.no-cards { min-width: 920px; }
.st-form { display: grid; gap: 14px; }
.st-sec { margin: 0; }
.st-sec h3 { margin: 0 0 2px; }
.st-sec > .muted { margin: 0 0 10px; }
.st-days { display: grid; gap: 6px; }
.st-day { display: grid; grid-template-columns: 84px 1fr 1fr; gap: 8px; align-items: center; }
.st-day input { min-width: 0; }

/* ---- the same soft form look for forms that sit in a page (not only in dialogs) ---- */
main form:not(.composer):not(.st-reply) label:not(.pick):not(.check) { font-weight: 700; font-size: 13.5px; color: var(--text); margin: 14px 0 6px; }
main form:not(.composer):not(.st-reply) input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), main form:not(.composer):not(.st-reply) select, main form:not(.composer):not(.st-reply) textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; min-height: 46px; padding: 10px 14px; }
main form:not(.composer):not(.st-reply) textarea { min-height: 96px; line-height: 1.8; }
main form:not(.composer):not(.st-reply) input:focus, main form:not(.composer):not(.st-reply) select:focus, main form:not(.composer):not(.st-reply) textarea:focus { background: var(--surface); outline: 2px solid var(--primary); border-color: transparent; }
main form .card > h3:first-child, main form.card > h3:first-child { margin-top: 0; }
main .card > .pick-list, main form .pick-list { display: flex; flex-wrap: wrap; gap: 8px; }
main .card .pick-list label.pick, main form .pick-list label.pick { margin: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-weight: 500; }
.chips-choice .t-ok.on { background: var(--ok-weak); border-color: var(--ok); color: var(--ok); }
.chips-choice .t-viol.on { background: var(--viol-weak); border-color: var(--viol); color: var(--viol); }
.modal h4.sec, .modal h3.sec { margin: 22px 0 -2px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--primary); letter-spacing: 0; }
.modal h4.sec:first-child { margin-top: 4px; padding-top: 0; border-top: 0; }
.modal table { width: 100%; }
.tpl-add { display: grid; gap: 10px; margin-top: 12px; padding: 14px; border: 1px dashed var(--border); border-radius: 16px; background: var(--bg); }
.tpl-add input, .tpl-add select { background: var(--surface) !important; }
.kv-list { display: grid; gap: 10px; margin-top: 12px; }
.kv { background: var(--bg); border-radius: 14px; padding: 10px 14px; }
.kv .k { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.kv .v { line-height: 1.9; }
.guest-form { display: grid; gap: 8px; }
.guest-form .btn { justify-self: start; }
.btn.block { display: flex; width: 100%; justify-content: center; margin-top: 8px; min-height: 46px; }
.modal input.color-input { width: 72px; min-height: 46px; padding: 4px; cursor: pointer; }
.logo-prev { width: 56px; height: 56px; border-radius: 14px; }
:root { --c-teal: #14B8A6; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex: none; }
.composer .btn.small, .composer label.attach { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; }
.draw-icon .ic { width: 28px; height: 28px; }
.ic.ic-s { width: 1.1em; height: 1.1em; margin-inline-end: 4px; vertical-align: -0.18em; }
/* a row of tabs plus an action button: on phones the button gets its own full row instead of scrolling away with the tabs */
@media (max-width: 700px) {
  .toolbar:has(> .seg) { flex-wrap: wrap; }
  .toolbar > .seg { flex: 1 1 100%; min-width: 0; }
  .toolbar > .seg ~ .spacer { display: none; }
  .toolbar > .seg ~ .btn.primary { flex: 1 1 100%; justify-content: center; min-height: 46px; }
}
.task-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.task-card { margin: 0; cursor: pointer; display: grid; gap: 10px; align-content: start; border-inline-start: 4px solid var(--border); }
.task-card.is-late { border-inline-start-color: var(--danger); }
.task-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.tc-top { display: grid; gap: 8px; }
.tc-title { font-size: 15.5px; line-height: 1.7; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.tc-meta span { display: inline-flex; align-items: center; }
.tc-actions { display: flex; gap: 8px; justify-content: flex-end; }
.more-sheet { display: grid; gap: 14px; }
.more-group { display: grid; gap: 6px; }
.more-gh { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 6px 4px 2px; }
.more-gi svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.more-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 10px 12px; min-height: 60px; cursor: pointer; }
.more-row:active { background: var(--bg); }
.more-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; }
.more-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.more-tx { display: grid; gap: 2px; flex: 1; min-width: 0; }
.more-tx b { font-size: 15px; }
.more-tx small { color: var(--muted); font-size: 12.5px; line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.more-badge { background: var(--danger); color: #fff; border-radius: 999px; min-width: 22px; padding: 1px 7px; font-size: 12px; text-align: center; }
.more-go { color: var(--muted); font-size: 22px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.facts > div { background: var(--bg); border-radius: 14px; padding: 10px 12px; line-height: 1.8; }
.facts > .wide { grid-column: 1 / -1; }
#rem-add { display: grid; gap: 10px; }
#rem-add .chips-choice { width: 100%; }
#rem-add .btn { justify-self: start; }
.item-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.item-card { margin: 0; display: grid; gap: 10px; align-content: start; }
.item-card[data-open] { cursor: pointer; }
.item-card.is-off { opacity: .7; }
.ic-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ic-top .ic-title { font-size: 15.5px; line-height: 1.7; flex: 1 1 auto; min-width: 0; }
.ic-who { display: grid; flex: 1; min-width: 0; }
.ic-av { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.ic-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ic-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.ic-meta span { display: inline-flex; align-items: center; }
.ic-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- the assistant page as a chat ---- */
.asx { display: flex; flex-direction: column; gap: 12px; min-height: calc(100vh - 170px); max-width: 860px; margin-inline: auto; }
.asx-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, var(--primary-weak), var(--surface)); border-radius: 22px; border: 1px solid var(--border); }
.asx-bot { flex: none; width: 52px; height: 52px; display: block; filter: drop-shadow(0 4px 10px rgba(20, 184, 166, .35)); }
.asx-bot.sm { width: 36px; height: 36px; filter: none; align-self: flex-end; }
.asx-bot svg { width: 100%; height: 100%; display: block; }
.asx-ht { display: grid; gap: 2px; min-width: 0; }
.asx-ht b { font-size: 17px; display: flex; align-items: center; gap: 6px; }
.asx-spark svg { width: 18px; height: 18px; fill: var(--viol); display: block; }
.asx-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.asx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.asx-digest { background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); border-radius: 18px; padding: 12px 14px; display: grid; gap: 6px; white-space: pre-wrap; line-height: 1.9; }
.asx-log { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 4px 2px 10px; min-height: 200px; }
.asx-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 92%; }
.asx-msg.me { align-self: flex-start; }
.asx-msg.bot { align-self: flex-end; flex-direction: row-reverse; }
.asx-bub { border-radius: 20px; padding: 10px 14px; line-height: 1.95; display: grid; gap: 8px; min-width: 0; }
.asx-msg.me .asx-bub { background: linear-gradient(135deg, #d8f3ee, #eafaf6); border: 1px solid #bfe9e0; border-end-start-radius: 6px; }
.asx-msg.bot .asx-bub { background: var(--surface); border: 1px solid var(--border); border-end-end-radius: 6px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); }
.asx-tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.asx-bub .card { margin: 0; }
.asx-bub.typing { display: flex; gap: 5px; padding: 14px 16px; }
.asx-bub.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; animation: asxd 1s infinite ease-in-out; }
.asx-bub.typing i:nth-child(2) { animation-delay: .15s; } .asx-bub.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes asxd { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-5px); opacity: 1; } }
.asx-empty { text-align: center; color: var(--muted); display: grid; gap: 12px; padding: 14px 6px; }
.asx-sugs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.asx-sug { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 9px 14px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text); }
.asx-sug:hover { border-color: var(--primary); color: var(--primary); }
.asx-bar { position: sticky; bottom: 76px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 8px 8px 8px 10px; box-shadow: 0 6px 22px rgba(15, 23, 42, .1); flex-wrap: wrap; }
.asx-bar textarea { flex: 1 1 160px; min-width: 0; border: 0 !important; background: transparent !important; min-height: 44px !important; max-height: 140px; resize: none; padding: 10px 12px !important; outline: none !important; line-height: 1.8; }
.asx-bar .muted { flex: 1 1 100%; order: -1; padding-inline: 8px; }
.asx-bar .muted:empty { display: none; }
.asx-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.asx-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.asx-btn.mic { background: var(--primary); color: var(--on-primary, #fff); }
.asx-btn.mic.rec { background: var(--danger); }
.asx-btn.send { background: var(--primary-weak); color: var(--primary); }
.asx-btn:disabled { opacity: .5; }
@media (min-width: 701px) { .asx-bar { bottom: 12px; } }
.as-level[hidden] { display: none; }
.mnav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 14px; }
.mnav b { min-width: 9em; text-align: center; font-size: 16px; }
.mnav-b { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; color: var(--primary); }
.mnav-b:active { background: var(--primary-weak); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat-tiles .card { margin: 0; display: grid; gap: 4px; }
.stat-tiles .card b { font-size: 17px; }
.mnav-b .ic { width: 22px; height: 22px; margin: 0; }
.mnav-b { display: grid; place-items: center; padding: 0; }
.kb-col { border-radius: 18px; padding: 10px; }
.kb-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.kb-count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 9px; font-size: 12px; color: var(--muted); }
.kb-card { border-radius: 14px; padding: 10px 12px; gap: 6px; font-size: 13.5px; border-inline-start: 4px solid var(--border); box-shadow: 0 1px 4px rgba(15, 23, 42, .05); }
.kb-card.pr-urgent { border-inline-start-color: var(--danger); } .kb-card.pr-high { border-inline-start-color: var(--warn); } .kb-card.pr-normal { border-inline-start-color: var(--primary); } .kb-card.pr-low { border-inline-start-color: var(--info); }
.kb-card.late { background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.kb-card .kb-move { border-radius: 999px; min-height: 36px; padding: 4px 12px; background: var(--bg); border: 1px solid var(--border); font-size: 12.5px; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cal-bar .mnav { margin: 6px 0; }
.cal-modes { display: flex; align-items: center; gap: 8px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; flex: 1 1 100%; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 700px) { .cal-bar { justify-content: center; } .cal-modes { width: 100%; justify-content: space-between; } }
.cal-legend { margin: 4px 2px 12px; }
.filter-bar { flex-wrap: wrap; }
.team-pills { display: grid; gap: 8px; }
.team-pill { border: 1px solid var(--border); border-radius: 16px; padding: 10px 14px; cursor: pointer; background: var(--surface); }
.team-pill.active { border-color: var(--primary); background: var(--primary-weak); }
@media (max-width: 700px) {
  .team-list { padding: 10px; }
  .team-pills { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 6px; scrollbar-width: none; margin-top: 8px; }
  .team-pills::-webkit-scrollbar { display: none; }
  .team-pill { flex: 0 0 auto; min-width: 120px; }
}
.empty-state { text-align: center; color: var(--muted); padding: 28px 16px; display: grid; gap: 6px; background: var(--surface); border: 1px dashed var(--border); border-radius: 18px; }
.sec-h { margin: 18px 2px 8px; font-size: 14px; color: var(--muted); }
.card.center.muted { border: 1px dashed var(--border); box-shadow: none; background: color-mix(in srgb, var(--surface) 60%, transparent); padding: 28px 16px; }
.split > * { min-width: 0; }
.team-list { min-width: 0; max-width: 100%; }
.role-perms { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-list { display: grid; gap: 8px; margin-top: 8px; }
.perm-row { display: flex; align-items: flex-start; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; margin: 0 !important; font-weight: 500 !important; cursor: pointer; }
.perm-row input { margin-top: 4px; }
.perm-row span { display: grid; gap: 2px; }
.perm-row small { color: var(--muted); font-weight: 400; font-size: 12.5px; line-height: 1.7; }
