/* Phone-first layer over style.css: messenger theme, bottom navigation, my work, sheets, lists.
   Loaded after style.css; desktop keeps its layout and only gains the new screens in the top switcher. */

/* ---------- light theme (follows the messenger / device) ---------- */
:root[data-theme="light"] {
  --bg-color: #f3f5f8;
  --surface-color: #ffffff;
  --surface-hover: #eef2f6;
  --border-color: #dfe5ec;
  --text-main: #111827;
  --text-muted: #5f6b7a;
  --primary-color: #0a84d6;
  --primary-hover: #086fb5;
  --primary-text: #ffffff;
  --col-todo-bg: rgba(10, 132, 214, 0.05);
  --col-doing-bg: rgba(217, 119, 6, 0.06);
  --col-done-bg: rgba(5, 150, 105, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.12);
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root {
  --m-late: #ef4444;
  --m-today: #f59e0b;
  --m-review: #3b82f6;
  --m-ok: #10b981;
  --nav-h: 62px;
}
:root[data-theme="light"] .toast { background: #111827; color: #fff; }
:root[data-theme="light"] .toast.toast-error { background: #b91c1c; }
:root[data-theme="light"] .toast.toast-success { background: #047857; }
:root[data-theme="light"] .modal-overlay { background: rgba(15, 23, 42, 0.45); }
:root[data-theme="light"] .app-header, :root[data-theme="light"] .view-switcher-bar { background: var(--surface-color); }

/* ---------- shared bits ---------- */
.m-list-root, .home-root { display: flex; flex-direction: column; gap: 10px; padding: 4px 14px 24px; max-width: 760px; margin: 0 auto; width: 100%; }
.m-skeleton { height: 64px; border-radius: 14px; background: linear-gradient(90deg, var(--surface-color), var(--surface-hover), var(--surface-color)); background-size: 200% 100%; animation: mShimmer 1.2s infinite linear; }
@keyframes mShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .m-skeleton { animation: none; } }
.m-empty { text-align: center; color: var(--text-muted); padding: 28px 12px; line-height: 2; }
.m-empty.big { font-size: 1.1rem; padding: 48px 12px; }
.m-tip { color: var(--text-muted); font-size: 0.78rem; text-align: center; padding: 6px 0 2px; }
.m-btn { border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.m-btn.wide { width: 100%; min-height: 46px; }
.m-btn:active, .m-card:active, .m-task:active, .m-member:active, .m-tile:active, .m-feed:active { transform: scale(0.985); }
.m-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.74rem; color: var(--primary-color); direction: ltr; unicode-bidi: isolate; }
.m-count { font-size: 0.75rem; background: var(--surface-hover); color: var(--text-muted); border-radius: 999px; padding: 1px 8px; margin-inline-start: 4px; }
.m-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-hover); color: var(--text-muted); white-space: nowrap; }
.m-chip.prio { color: var(--m-late); }
.m-chip.st-doing { color: var(--m-today); }
.m-chip.st-review { color: var(--m-review); }
.m-chip.st-blocked { color: var(--m-late); }
.m-chip.st-done { color: var(--m-ok); }
.m-section { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 12px; }
.m-section-title { font-weight: 800; font-size: 0.95rem; padding: 8px 2px 0; display: flex; align-items: center; }
.m-day { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; padding: 10px 2px 0; }

/* ---------- my work ---------- */
.home-hello { padding: 6px 2px 0; }
.home-hi { font-size: 1.25rem; font-weight: 800; }
.home-sub { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; }
.m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.m-stats.small { margin: 10px 0; }
.m-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--surface-color); border: 1px solid var(--border-color); color: var(--text-main); cursor: pointer; font: inherit; }
.m-stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.m-stat span { font-size: 0.7rem; color: var(--text-muted); }
.m-stat.late b { color: var(--m-late); }
.m-stat.today b { color: var(--m-today); }
.m-stat.review b { color: var(--m-review); }
.m-stat.zero b { color: var(--text-muted); opacity: 0.6; }
.m-banner { text-align: start; border: 1px dashed var(--m-today); background: color-mix(in srgb, var(--m-today) 10%, transparent); color: var(--text-main); border-radius: 14px; padding: 12px 14px; font-size: 0.88rem; cursor: pointer; font-family: inherit; }

.m-task { position: relative; display: flex; align-items: center; gap: 10px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px; min-height: 60px; cursor: pointer; transition: transform 0.15s ease, background 0.15s; touch-action: pan-y; overflow: hidden; }
.m-task.swipe-next { background: color-mix(in srgb, var(--m-ok) 14%, var(--surface-color)); transition: background 0.15s; }
.m-task.swipe-prev { background: color-mix(in srgb, var(--m-today) 14%, var(--surface-color)); transition: background 0.15s; }
.m-swipe-hint { position: absolute; inset-inline-end: 12px; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); pointer-events: none; }
.m-task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.m-task-title { font-weight: 600; font-size: 0.93rem; line-height: 1.5; overflow-wrap: anywhere; }
.m-task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 0.75rem; color: var(--text-muted); }
.m-due { font-size: 0.74rem; }
.m-due.late { color: var(--m-late); font-weight: 700; }
.m-check { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--text-muted); background: transparent; cursor: pointer; position: relative; }
.m-check::after { content: ""; position: absolute; inset: -9px; }   /* 46px tap target */
.m-check.checked { background: var(--m-ok); border-color: var(--m-ok); }
.m-check.checked::before { content: "✓"; color: #fff; font-size: 16px; position: absolute; inset: 0; display: grid; place-items: center; }
.m-check-gap { flex: 0 0 4px; }

/* ---------- meetings, activity, team ---------- */
.m-card { text-align: start; display: flex; flex-direction: column; gap: 6px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px 14px; color: var(--text-main); cursor: pointer; font-family: inherit; }
.m-card-top { display: flex; justify-content: space-between; gap: 8px; }
.m-date { font-size: 0.75rem; color: var(--text-muted); }
.m-card-title { font-weight: 700; font-size: 0.95rem; }
.m-card-text { font-size: 0.82rem; color: var(--text-muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.m-card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-feed { display: flex; gap: 10px; text-align: start; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px; padding: 10px 12px; color: var(--text-main); cursor: pointer; font-family: inherit; }
.m-feed.alert { border-color: color-mix(in srgb, var(--m-late) 50%, var(--border-color)); }
.m-feed-icon { font-size: 1.1rem; line-height: 1.6; }
.m-feed-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m-feed-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.m-feed-text { font-size: 0.86rem; line-height: 1.75; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.m-feed.expanded .m-feed-text { -webkit-line-clamp: unset; display: block; }
.m-group { display: flex; flex-direction: column; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; }
.m-member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: none; border: none; border-bottom: 1px solid var(--border-color); color: var(--text-main); text-align: start; cursor: pointer; font-family: inherit; min-height: 58px; }
.m-member:last-child { border-bottom: none; }
.m-member-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-member-body small { color: var(--text-muted); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-chev { color: var(--text-muted); font-size: 1.3rem; }
.m-avatar { position: relative; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: color-mix(in srgb, var(--primary-color) 22%, var(--surface-hover)); color: var(--text-main); }
.m-avatar i { position: absolute; bottom: -2px; inset-inline-start: -2px; font-style: normal; font-size: 0.65rem; }
.m-avatar.big { flex-basis: 56px; width: 56px; height: 56px; font-size: 1.3rem; }
.m-profile { display: flex; align-items: center; gap: 12px; }
.m-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.m-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 14px; background: var(--surface-color); border: 1px solid var(--border-color); color: var(--text-main); font-size: 1.3rem; cursor: pointer; font-family: inherit; }
.m-tile span { font-size: 0.74rem; color: var(--text-muted); }
.m-switch-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border-color); min-height: 52px; }
.m-switch { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--surface-hover); border: 1px solid var(--border-color); position: relative; cursor: pointer; transition: background 0.15s; }
.m-switch::after { content: ""; position: absolute; top: 2px; inset-inline-end: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-end 0.15s; }
.m-switch:checked { background: var(--m-ok); }
.m-switch:checked::after { inset-inline-end: 20px; }
.m-row-title { padding: 12px 14px 6px; font-weight: 600; font-size: 0.9rem; display: flex; flex-direction: column; gap: 2px; }
.m-row-title small { color: var(--text-muted); font-weight: 400; font-size: 0.74rem; }
.m-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px 12px; }
.m-seg button { border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 10px; padding: 9px 2px; font-size: 0.78rem; cursor: pointer; font-family: inherit; }
.m-seg button.active { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); font-weight: 700; }
.m-decisions { list-style: persian; margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; line-height: 1.8; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 140; }
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 150; max-height: 88vh; display: flex; flex-direction: column; background: var(--surface-color); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(100%); transition: transform 0.2s ease-out; padding-bottom: env(safe-area-inset-bottom, 0px); max-width: 640px; margin: 0 auto; }
.sheet.open { transform: translateY(0); }
.sheet-grip { flex: 0 0 auto; height: 22px; display: grid; place-items: center; touch-action: none; }
.sheet-grip::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--border-color); }
.sheet-body { overflow-y: auto; padding: 0 16px 18px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.sheet-title { font-weight: 800; font-size: 1.02rem; line-height: 1.6; }
.sheet-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; color: var(--primary-color); }
.sheet-hint { font-size: 0.8rem; color: var(--text-muted); line-height: 1.7; }
.sheet-text { font-size: 0.88rem; line-height: 1.9; background: var(--bg-color); border-radius: 12px; padding: 10px 12px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-action { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); font-size: 0.93rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.sheet-action small { font-weight: 400; font-size: 0.75rem; color: var(--text-muted); }
.sheet-action.primary { border-color: var(--primary-color); }
.sheet-action.danger { color: var(--m-late); }
body.sheet-open { overflow: hidden; }

/* ---------- card menu button on the board ---------- */
.btn-card-menu { width: 40px; height: 34px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--surface-hover); color: var(--text-main); font-size: 1.2rem; line-height: 1; cursor: pointer; }

/* ---------- phone chrome (hidden on wide screens) ---------- */
.bottom-nav, .fab, .board-pills, .ptr-indicator { display: none; }

@media (max-width: 768px) {
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }

  /* compact header: identity + project; the team lives under «بیشتر» */
  .app-header { padding: 8px 12px 6px; }
  .header-top { margin-bottom: 6px; }
  .brand-sub, .presence-bar-container, .view-switcher-bar { display: none !important; }
  .brand-icon { font-size: 20px; }
  .brand-title { font-size: 0.95rem; }
  .controls-bar { gap: 6px; }
  .btn-add-task { display: none; }
  body:not([data-view="kanban"]) .search-wrapper { display: none; }
  body:not([data-view="kanban"]) .project-selector-wrapper { flex: 1 1 100%; }
  body[data-view="home"] .project-selector-wrapper { display: none; }

  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 120; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface-color); border-top: 1px solid var(--border-color); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12); }
  .nav-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: none; color: var(--text-muted); font-family: inherit; cursor: pointer; }
  .nav-btn .nb-icon { font-size: 1.25rem; line-height: 1; filter: grayscale(0.6); opacity: 0.8; }
  .nav-btn .nb-label { font-size: 0.68rem; font-weight: 600; }
  .nav-btn.active { color: var(--primary-color); }
  .nav-btn.active .nb-icon { filter: none; opacity: 1; transform: translateY(-1px); }
  .nb-badge { position: absolute; top: 6px; inset-inline-end: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--m-late); color: #fff; font-size: 0.66rem; font-weight: 800; display: grid; place-items: center; }

  .fab { display: grid; place-items: center; position: fixed; z-index: 110; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px)); inset-inline-start: auto; left: 16px; width: 56px; height: 56px; border-radius: 18px; border: none; background: var(--primary-color); color: var(--primary-text); font-size: 1.7rem; box-shadow: var(--shadow-lg); cursor: pointer; }
  body:not([data-view="home"]):not([data-view="kanban"]) .fab { display: none; }
  .toast { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); text-align: center; }

  /* board: column tabs + one column per screen, snapping */
  .board-pills { display: flex; gap: 6px; overflow-x: auto; padding: 2px 12px 8px; scrollbar-width: none; position: sticky; top: 0; z-index: 5; background: var(--bg-color); }
  .board-pills::-webkit-scrollbar { display: none; }
  .pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 999px; padding: 7px 12px; font-size: 0.8rem; font-family: inherit; cursor: pointer; }
  .pill b { font-size: 0.72rem; color: var(--text-muted); }
  .pill.active { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }
  .pill.active b { color: inherit; }
  .kanban-board { scroll-snap-type: x mandatory; scroll-padding-inline: 12px; }
  .kanban-column { flex: 0 0 86vw !important; max-width: 86vw; scroll-snap-align: start; }
  .board-top-actions .btn { display: none !important; }

  /* task detail: full screen, reachable controls */
  #modal-task-detail { padding: 0; align-items: stretch; }
  #modal-task-detail .modal-card { max-width: none; max-height: none; height: 100%; border-radius: 0; border: none; }

  .ptr-indicator { display: grid; place-items: center; position: fixed; top: 0; left: 50%; z-index: 160; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-color); color: var(--primary-color); box-shadow: var(--shadow-md); font-size: 1.3rem; transform: translate(-50%, -60px); opacity: 0; transition: opacity 0.15s; pointer-events: none; }
  .ptr-indicator.show { opacity: 1; }
  .ptr-indicator.spin { animation: mSpin 0.8s linear infinite; }
  @keyframes mSpin { from { transform: translate(-50%, 30px) rotate(0); } to { transform: translate(-50%, 30px) rotate(360deg); } }
}

:root[data-theme="light"] .presence-bar-container { background: var(--surface-hover); }

/* desktop: the new screens get a comfortable width; the top switcher holds all nine views */
@media (min-width: 769px) {
  .m-list-root, .home-root { padding-top: 12px; }
  .view-switcher { max-width: 1000px; }
  .view-btn { white-space: nowrap; }
}

/* ---------- project control (control.js): dashboard, team calendar, templates, import ---------- */
.m-btn.primary { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }
.m-btn.danger { color: var(--m-late); border-color: color-mix(in srgb, var(--m-late) 40%, transparent); }
.m-stat.ok b { color: var(--m-ok); }
.c-hero { display: flex; align-items: center; gap: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 16px; padding: 12px 14px; }
.c-hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.c-ring { flex: 0 0 auto; }
.c-ring-track { fill: none; stroke: var(--surface-hover); stroke-width: 10; }
.c-ring-val { fill: none; stroke: var(--primary-color); stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.c-ring-text { fill: var(--text-main); font-size: 22px; font-weight: 800; font-family: inherit; }
.c-time { font-size: 0.78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.c-up { color: var(--m-ok); } .c-down { color: var(--m-late); }
.m-chip.late { background: color-mix(in srgb, var(--m-late) 14%, transparent); color: var(--m-late); }
.c-chart { padding: 8px 6px 4px; cursor: default; }
.c-line { width: 100%; height: auto; display: block; direction: ltr; }
.c-grid { stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 3 3; }
.c-axis { fill: var(--text-muted); font-size: 10px; font-family: inherit; }
.c-stroke { fill: none; stroke: var(--primary-color); stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.c-area { fill: color-mix(in srgb, var(--primary-color) 16%, transparent); }
.c-dot { fill: var(--primary-color); }
.c-line.late .c-stroke { stroke: var(--m-late); } .c-line.late .c-area { fill: color-mix(in srgb, var(--m-late) 14%, transparent); }
.c-line.late .c-dot { fill: var(--m-late); }
.c-bar { flex: 1; min-width: 60px; height: 8px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; display: inline-block; }
.c-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary-color); }
.c-bar.time i { background: var(--m-today); }
.c-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border-color); background: transparent; color: var(--text-main); font: inherit; text-align: start; width: 100%; }
.c-row:last-child { border-bottom: 0; }
button.c-row { cursor: pointer; }
.c-row-label { flex: 0 0 34%; min-width: 0; font-size: 0.86rem; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.c-row-label small { color: var(--text-muted); font-size: 0.72rem; }
.c-row-val { font-size: 0.8rem; white-space: nowrap; color: var(--text-muted); }
.c-proj .c-row-label, .c-tpl .c-row-label { flex: 1; }
.c-stack { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-hover); display: flex; overflow: hidden; }
.c-stack i.open { background: var(--primary-color); } .c-stack i.late { background: var(--m-late); }
.c-work .c-row-val { flex: 0 0 auto; }
.c-spark polyline { fill: none; stroke: var(--primary-color); stroke-width: 1.8; }
.c-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.c-report { display: block; cursor: default; font-size: 0.86rem; line-height: 1.9; }
.c-cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.86rem; }
.c-cal-nav .m-btn { min-width: 46px; font-size: 1.1rem; }
.c-layers { display: flex; flex-wrap: wrap; gap: 6px; }
.c-layer { flex: 0 0 auto; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-muted); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.c-layer.active { background: var(--primary-color); border-color: var(--primary-color); color: var(--primary-text); font-weight: 700; }
.c-day { background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.c-day.off { background: color-mix(in srgb, var(--m-late) 5%, var(--surface-color)); }
.c-day.today { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color) inset; }
.c-day-head { font-size: 0.8rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.c-day-head b { color: var(--text-main); }
.c-item { display: flex; gap: 8px; align-items: flex-start; border: 0; border-inline-start: 3px solid var(--primary-color); background: var(--bg-color); border-radius: 8px; padding: 8px 10px; color: var(--text-main); font: inherit; text-align: start; cursor: pointer; }
.c-item.meeting { border-inline-start-color: var(--m-review); }
.c-item.leave { border-inline-start-color: var(--m-ok); }
.c-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.c-item-body b { font-size: 0.84rem; font-weight: 600; overflow-wrap: anywhere; }
.c-item-body small { color: var(--text-muted); font-size: 0.72rem; }
.c-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--text-muted); margin: 8px 0; }
.c-field input, .c-field select, .c-field textarea, .c-textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 10px; padding: 10px; font: inherit; font-size: 16px; }
.c-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#lv-kind { grid-template-columns: repeat(3, 1fr); padding: 0; margin: 8px 0; }
.c-file { display: flex; align-items: center; justify-content: center; margin-top: 8px; }
.c-file input { display: none; }
.c-imp { padding: 9px 12px; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 2px; font-size: 0.84rem; }
.c-imp small { color: var(--text-muted); font-size: 0.72rem; line-height: 1.7; }
.c-imp.err { background: color-mix(in srgb, var(--m-late) 7%, transparent); }
.c-imp.draft { background: color-mix(in srgb, var(--m-today) 7%, transparent); }
.task-extra { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.task-extra:empty { display: none; }
.task-desc { background: var(--bg-color); border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; line-height: 1.9; white-space: normal; }
.task-extra-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-extra-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.c-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.c-stepper button { width: 38px; height: 34px; border: 0; background: var(--surface-hover); color: var(--text-main); font-size: 1.1rem; cursor: pointer; }
.c-stepper b { min-width: 34px; text-align: center; }

/* ---------- secretariat & organisational meetings (secretariat.js) ---------- */
.s-tabs { padding: 0; }
.s-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.s-actions .m-btn:only-child { grid-column: 1 / -1; }
.s-search { width: 100%; box-sizing: border-box; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 16px; }
.s-letter { cursor: pointer; }
.s-icon { font-size: 1.15rem; }
.s-letter .c-row-label { flex: 1; }
.s-done { padding: 6px 10px; font-size: 0.78rem; white-space: nowrap; }
.s-meta { font-size: 0.86rem; line-height: 1.9; margin: 2px 0; }
.s-body { max-height: 40vh; overflow-y: auto; }
.s-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.s-buttons .m-btn { flex: 1 1 calc(50% - 8px); }
.s-buttons .m-btn.wide { flex-basis: 100%; }
.m-chip.ok { background: color-mix(in srgb, var(--m-ok) 16%, transparent); color: var(--m-ok); }
button.m-chip { border: 0; cursor: pointer; font-family: inherit; }
.s-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.s-person { border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 99px; padding: 7px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.4; }
.s-person small { font-size: 0.66rem; color: var(--text-muted); }
.s-person.active { background: var(--primary-color); border-color: var(--primary-color); color: var(--primary-text); font-weight: 700; }
.s-person.active small { color: inherit; opacity: 0.8; }
.s-dir { grid-template-columns: repeat(2, 1fr); padding: 0; margin-bottom: 8px; }
.hidden.s-out, .hidden.s-in { display: none; }
.s-plans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.s-plan { cursor: pointer; }
.s-rsvp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.s-inv:disabled { cursor: default; opacity: 1; }
.s-inv.present { background: color-mix(in srgb, var(--m-ok) 8%, transparent); }
.s-inv.absent { background: color-mix(in srgb, var(--m-late) 7%, transparent); }
.s-att { font-size: 0.78rem; white-space: nowrap; }
.s-approval { margin-top: 14px; border-top: 1px solid var(--border-color); padding-top: 6px; }
.s-upload { cursor: pointer; }
.s-upload .c-row-label { flex: 1; }

/* ---------- sales & finance (crm.js) ---------- */
.c-tabs2 { grid-template-columns: 1fr 1fr; padding: 0; }
.m-stats.c-three { grid-template-columns: repeat(3, 1fr); }
.m-stats.c-three .m-stat b { font-size: 0.86rem; }
.c-opp { cursor: pointer; }
.c-amount { font-size: 0.86rem; color: var(--m-ok); white-space: nowrap; }
.c-call { display: flex; align-items: center; justify-content: center; text-decoration: none; margin: 6px 0; }
.c-int .c-row-label { flex: 1; }
.c-int .c-row-label b { font-weight: 500; font-size: 0.84rem; }
.m-seg.c-five { grid-template-columns: repeat(5, 1fr); padding: 0; margin-bottom: 8px; }
.m-seg.c-five button { font-size: 0.7rem; padding: 8px 0; }
.m-seg.c-two-seg { grid-template-columns: 1fr 1fr; padding: 0; margin-bottom: 8px; }
#nc-kind { grid-template-columns: repeat(3, 1fr); padding: 0; margin: 8px 0; }
.c-budget { cursor: pointer; gap: 8px; }
.c-warn { color: var(--m-today); }
.c-bar.warn i { background: var(--m-today); }
.c-bar.over i { background: var(--m-late); }
.c-bar i.in { background: var(--m-ok); }
.c-bar i.out { background: var(--m-late); }
.c-bar-in { fill: var(--m-ok); background: var(--m-ok); }
.c-bar-out { fill: var(--m-late); background: var(--m-late); }
.c-legend { display: flex; gap: 14px; justify-content: center; font-size: 0.74rem; color: var(--text-muted); padding: 2px 0 4px; }
.c-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-inline-end: 4px; }
.c-tx .c-row-label { flex: 1; }
.c-receipt { width: 100%; border-radius: 12px; }
.c-cust { font-size: 0.78rem; color: var(--primary-color); font-weight: 600; }

/* ---------- phase 4: forms, time, collaborators, guest (phase4.js) ---------- */
.f-tabs { grid-template-columns: repeat(3, 1fr); padding: 0; }
.f-tabs button { font-size: 0.74rem; }
.f-grid { grid-template-columns: repeat(2, 1fr); }
.f-items { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.f-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.3fr; gap: 4px; }
.f-cell { width: 100%; box-sizing: border-box; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 8px; padding: 8px 6px; font: inherit; font-size: 15px; min-width: 0; }
.f-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0; }
.f-step { font-size: 0.74rem; border-radius: 99px; padding: 4px 10px; background: var(--surface-hover); color: var(--text-muted); }
.f-step.done { background: color-mix(in srgb, var(--m-ok) 16%, transparent); color: var(--m-ok); }
.f-step.now { background: color-mix(in srgb, var(--m-today) 18%, transparent); color: var(--m-today); font-weight: 700; }
.f-step.rejected { background: color-mix(in srgb, var(--m-late) 16%, transparent); color: var(--m-late); }
.f-arrow { color: var(--text-muted); font-size: 0.7rem; }
.timer-chip { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); white-space: nowrap; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); border: 0; border-radius: 99px; padding: 9px 14px; background: var(--m-late); color: #fff; font: inherit; font-size: 0.8rem; font-weight: 700; box-shadow: 0 6px 16px rgba(0,0,0,0.25); cursor: pointer; }
.timer-chip.hidden { display: none; }
.p4-extra { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--border-color); padding-top: 8px; }
.chip-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 2px; font-size: 0.8rem; }
.t-running { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; cursor: default; }
.t-days { flex-direction: row; justify-content: space-between; align-items: flex-end; height: 120px; padding: 10px 12px; cursor: default; }
.t-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.t-bar { flex: 1; width: 60%; max-width: 26px; display: flex; align-items: flex-end; background: var(--surface-hover); border-radius: 6px; overflow: hidden; }
.t-bar i { display: block; width: 100%; background: var(--primary-color); border-radius: 6px; }
.t-day small { font-size: 0.7rem; color: var(--text-muted); }
body.guest-mode .bottom-nav, body.guest-mode #fab-new-task, body.guest-mode .view-switcher-bar, body.guest-mode #project-select,
body.guest-mode .project-selector, body.guest-mode #btn-my-presence { display: none !important; }
.g-ring { --p: 0; flex: 0 0 96px; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--primary-color) calc(var(--p) * 1%), var(--surface-hover) 0); }
.g-ring b { width: 74px; height: 74px; border-radius: 50%; background: var(--surface-color); display: grid; place-items: center; font-size: 1.15rem; }
.g-tasks .c-row-label { flex: 1; }

/* ---------- phase 5: notes, discussion, reactions (phase5.js) ---------- */
.rx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; position: relative; }
.rx { border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 99px; padding: 2px 8px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.rx.mine { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 14%, transparent); }
.rx.add { color: var(--text-muted); }
.rx-pick { display: inline-flex; gap: 2px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 99px; padding: 2px 6px; box-shadow: var(--shadow-md); }
.rx-pick button { border: 0; background: transparent; font-size: 1.15rem; cursor: pointer; padding: 2px; }
.n-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.n-card { --nc: #ffffff; text-align: start; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border-color); border-radius: 14px; padding: 10px; background: color-mix(in srgb, var(--nc) 70%, var(--surface-color)); color: var(--text-main); font: inherit; cursor: pointer; min-height: 90px; }
:root[data-theme="dark"] .n-card { background: color-mix(in srgb, var(--nc) 16%, var(--surface-color)); }
.n-card b { font-size: 0.88rem; overflow-wrap: anywhere; }
.n-card p { margin: 0; font-size: 0.76rem; color: var(--text-muted); line-height: 1.7; overflow-wrap: anywhere; }
.n-card small { font-size: 0.72rem; color: var(--text-muted); }
.n-prog { height: 4px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.n-prog i { display: block; height: 100%; background: var(--m-ok); }
.n-labels { display: flex; flex-wrap: wrap; gap: 3px; }
.n-labels i { font-style: normal; font-size: 0.66rem; background: var(--surface-hover); color: var(--text-muted); border-radius: 99px; padding: 1px 7px; }
.n-item { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border-color); font-size: 0.88rem; }
.n-item span { flex: 1; overflow-wrap: anywhere; }
.n-item.done span { text-decoration: line-through; color: var(--text-muted); }
.n-item button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.n-item input { width: 20px; height: 20px; }
.n-add { display: flex; gap: 6px; margin: 6px 0; }
.n-add input { flex: 1; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 10px; padding: 9px; font: inherit; font-size: 16px; }
.n-colors { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.n-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-color); cursor: pointer; }
.n-color.active { border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color); }
.dz-root { height: calc(100dvh - 210px - var(--nav-h)); min-height: 360px; padding-bottom: 0; }
.dz-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.dz-msg { align-self: flex-start; max-width: 84%; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 14px 14px 14px 4px; padding: 8px 10px; }
.dz-msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--primary-color) 14%, var(--surface-color)); border-radius: 14px 14px 4px 14px; }
.dz-author { font-size: 0.76rem; color: var(--primary-color); }
.dz-body { font-size: 0.9rem; line-height: 1.8; overflow-wrap: anywhere; }
.dz-meta { display: flex; gap: 8px; align-items: center; font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }
.dz-meta button { border: 0; background: transparent; color: var(--text-muted); font: inherit; cursor: pointer; padding: 0; }
.dz-quote { font-size: 0.74rem; color: var(--text-muted); border-inline-start: 3px solid var(--primary-color); padding: 2px 8px; margin-bottom: 4px; background: var(--bg-color); border-radius: 6px; }
.dz-quote.hidden { display: none; }
.dz-compose { position: sticky; bottom: 0; background: var(--bg-color); padding: 6px 0 4px; border-top: 1px solid var(--border-color); }
.dz-row { display: flex; gap: 6px; align-items: flex-end; }
.dz-row textarea { flex: 1; resize: none; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 12px; padding: 10px; font: inherit; font-size: 16px; max-height: 120px; }
.dz-groups { display: block; font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- Jalali date picker (jdate.js) ---------- */
.jdate-input { cursor: pointer; background-image: none; }
.jdp-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.jdp-overlay.hidden { display: none; }
.jdp { width: 100%; max-width: 420px; background: var(--surface-color); color: var(--text-main); border-radius: 18px 18px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(0,0,0,0.2); direction: rtl; }
@media (min-width: 600px) { .jdp-overlay { align-items: center; } .jdp { border-radius: 18px; } }
.jdp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.jdp-nav { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); font-size: 1.3rem; cursor: pointer; }
.jdp-title { display: flex; gap: 6px; }
.jdp-title select { border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 10px; padding: 8px; font: inherit; font-size: 15px; font-weight: 700; }
.jdp-week, .jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.jdp-week span { font-size: 0.78rem; color: var(--text-muted); padding: 4px 0; font-weight: 700; }
.jdp-week span.off { color: var(--m-late); }
.jdp-day { aspect-ratio: 1 / 1; min-height: 40px; border: 0; border-radius: 12px; background: var(--bg-color); color: var(--text-main); font: inherit; font-size: 0.95rem; cursor: pointer; position: relative; }
.jdp-day.off { color: var(--m-late); }
.jdp-day.holiday::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--m-late); }
.jdp-day.today { box-shadow: 0 0 0 2px var(--primary-color) inset; font-weight: 800; }
.jdp-day.sel { background: var(--primary-color); color: var(--primary-text); font-weight: 800; }
.jdp-day.disabled { opacity: 0.3; cursor: default; }
.jdp-pad { min-height: 40px; }
.jdp-note { display: flex; flex-direction: column; gap: 2px; font-size: 0.72rem; color: var(--m-late); margin: 8px 2px 0; min-height: 4px; }
.jdp-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.jdp-foot button { border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 12px; padding: 11px 4px; font: inherit; font-weight: 700; cursor: pointer; }
.jdp-foot [data-act=today] { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }

/* ---------- time picker wheels (jdate.js) ---------- */
.jtp-title { text-align: center; font-weight: 800; margin-bottom: 8px; }
.jtp-wheels { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 220px; }
.jtp-col { width: 84px; height: 220px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; position: relative; z-index: 1; mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.jtp-col::-webkit-scrollbar { display: none; }
.jtp-pad { height: 88px; }
.jtp-item { height: 44px; line-height: 44px; text-align: center; font-size: 1.25rem; color: var(--text-muted); scroll-snap-align: center; cursor: pointer; }
.jtp-item.on { color: var(--text-main); font-weight: 800; font-size: 1.5rem; }
.jtp-colon { font-size: 1.6rem; z-index: 1; }
.jtp-band { position: absolute; left: 50%; top: 88px; width: 210px; height: 44px; margin-left: -105px; border-radius: 12px; background: color-mix(in srgb, var(--primary-color) 14%, transparent); border: 1px solid color-mix(in srgb, var(--primary-color) 40%, transparent); }
.jtp-labels { display: flex; justify-content: center; gap: 110px; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.jtp .jdp-foot [data-act=ok] { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }
.jtp .jdp-foot [data-act=now] { background: var(--bg-color); color: var(--text-main); border-color: var(--border-color); }

/* ---------- attendance (attendance.js) ---------- */
.at-today { cursor: default; gap: 10px; }
.at-times { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.9rem; }
.at-live { color: var(--m-ok); font-weight: 700; }
.at-big { min-height: 54px; font-size: 1.05rem; }
.m-seg.at-kinds { grid-template-columns: repeat(4, 1fr); padding: 0; margin: 4px 0; }
.m-seg.at-kinds button { font-size: 0.72rem; padding: 9px 0; }
.at-day:disabled { opacity: 1; cursor: default; }
.at-day.off .c-row-label b { color: var(--m-late); }

/* ---------- forms: auto fields, conditional fields, approval chain editor ---------- */
.f-wrap.hidden { display: none; }
.f-autos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.f-autos .f-wrap[data-wrap="leave_balance"] { grid-column: 1 / -1; }
.f-auto { display: flex; flex-direction: column; gap: 2px; background: var(--bg-color); border-radius: 10px; padding: 8px 10px; }
.f-auto small { font-size: 0.7rem; color: var(--text-muted); }
.f-auto b { font-size: 0.86rem; overflow-wrap: anywhere; }
.m-seg.f-choice { padding: 0; }
.f-calc { background: color-mix(in srgb, var(--primary-color) 10%, transparent); border-radius: 10px; padding: 9px 12px; font-size: 0.82rem; margin: 6px 0; line-height: 1.9; }
.f-calc.hidden { display: none; }
.f-admin { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.f-admin .m-btn { margin: 0 12px; font-size: 0.8rem; }
.f-step-edit { background: var(--bg-color); border-radius: 12px; padding: 8px; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.f-step-top { display: flex; align-items: center; gap: 4px; }
.f-step-top input { flex: 1; min-width: 0; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 8px; padding: 8px; font: inherit; font-size: 15px; }
.f-step-top button { width: 30px; height: 34px; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 8px; cursor: pointer; }
.f-step-edit select { width: 100%; border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-main); border-radius: 8px; padding: 8px; font: inherit; font-size: 15px; }
.f-opt { font-size: 0.74rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.f-person { border-bottom: 1px solid var(--border-color); padding: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.f-person small { font-size: 0.72rem; color: var(--text-muted); }
