/* Mizkar AIno. Flat AIno colours: indigo accent, navy headings and top bar. */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --navy: #1E1B4B; --indigo: #4338CA; --indigo-2: #6366F1; --soft: #EEF2FF; --sky: #38BDF8; --violet: #7C3AED; --cyan: #22D3EE;
  --text: #1E1B4B; --muted: #64748B; --line: #E2E8F0; --bg: #F4F5FA; --card: #FFFFFF;
  --red: #DC2626; --red-soft: #FEE2E2; --amber: #B45309; --amber-soft: #FEF3C7;
  --radius: 10px; --shadow: 0 1px 2px rgba(30, 27, 75, .06), 0 4px 14px rgba(30, 27, 75, .05);
  --top: 56px; --nav: 224px;
  --hover: #F8FAFC; --line2: #F1F5F9; --chip: #E2E8F0; --edge: #CBD5E1; --text2: #475569; --col: #E9ECF5; --mine: #E0E7FF;
  --topbar: #1E1B4B; --toast: #1E1B4B; --accent-soft: #EEF2FF;
}
/* Brand rule: the top bar is navy in every section and the accent is the one AIno indigo. */

:root[data-theme=dark] {
  --navy: #E0E7FF; --text: #E2E8F0; --muted: #94A3B8; --line: #334155; --bg: #0F172A; --card: #1E293B;
  --soft: #312E81; --hover: #263449; --line2: #2A3A52; --chip: #334155; --edge: #475569; --text2: #CBD5E1; --col: #162033; --mine: #3730A3;
  --red-soft: #4C1D1D; --amber-soft: #453209; --amber: #FBBF24; --red: #F87171;
  --topbar: #0F172A; --toast: #4338CA; --indigo: #818CF8; --indigo-2: #6366F1;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: "Vazirmatn", Tahoma, sans-serif; font-size: 14px; line-height: 1.75; color: var(--text); background: var(--bg); }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 21px; font-weight: 800; color: var(--navy); }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }
h3 small, h4 small { font-weight: 400; color: var(--muted); }
a { color: var(--indigo); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 14px 16px; }
.center { text-align: center; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }

/* ---------- inputs ---------- */
input[type=text], input[type=search], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--card); outline: none; min-height: 38px;
}
textarea { resize: vertical; line-height: 1.8; display: block; }
input:focus, select:focus, textarea:focus, .picker-box:focus-within { border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--indigo); flex: none; }
input:disabled, select:disabled { background: var(--line2); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field .label { font-size: 12.5px; font-weight: 600; color: var(--navy); }
.field .hint, .hint { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline.between { display: flex; justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--navy);
  border-radius: 8px; padding: 6px 14px; font-weight: 600; font-size: 13.5px; min-height: 36px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.primary:hover { background: #3730A3; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger.ghost { background: var(--card); color: var(--red); border-color: var(--red-soft); }
.btn.small { padding: 3px 10px; min-height: 30px; font-size: 12.5px; }
.btn.block { width: 100%; min-height: 42px; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--indigo); }
.link-btn { border: 0; background: none; color: var(--indigo); padding: 0; font-size: 12.5px; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.actions.start { margin: 10px 0 14px; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 0 9px; font-size: 11.5px; font-weight: 600; background: var(--indigo); color: #fff; line-height: 1.9; white-space: nowrap; }
.pill.soft { background: var(--soft); color: var(--indigo); }
.pill.gray { background: var(--chip); color: var(--muted); }
.pill.urgent.u1 { background: var(--amber-soft); color: var(--amber); }
.pill.urgent.u2 { background: var(--red-soft); color: var(--red); }
.pill.status-open { background: var(--soft); color: var(--indigo); }
.pill.status-pending { background: var(--amber-soft); color: var(--amber); }
.pill.status-done { background: #E0F2FE; color: #0369A1; }
.pill.prio-pill.p0 { background: var(--line2); color: var(--muted); }
.pill.prio-pill.p2 { background: var(--amber-soft); color: var(--amber); }
.pill.prio-pill.p3 { background: var(--red-soft); color: var(--red); }
.pill.kind-paraph { background: #F3E8FF; color: var(--violet); }
.pill.kind-reply { background: var(--soft); color: var(--indigo); }
.pill.kind-forward { background: #E0F2FE; color: #0369A1; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; }
.tag { display: inline-flex; align-items: center; border-radius: 6px; padding: 0 8px; font-size: 11.5px; font-weight: 600; line-height: 1.9; border: 0; white-space: nowrap; }
.tag.plain { background: rgba(30, 27, 75, .07); color: var(--navy); }
.tag.plain.on { background: var(--indigo); color: #fff; }
.tag.add { background: var(--card); border: 1px dashed var(--edge); color: var(--muted); }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--red); font-weight: 600; }
.due.today { color: var(--amber); font-weight: 600; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; user-select: none; }
.avatars { display: inline-flex; flex-direction: row-reverse; }
.avatars .avatar { margin-inline-start: -7px; border: 2px solid var(--card); box-sizing: content-box; }
.avatar.more { width: 24px; height: 24px; background: var(--edge); color: var(--navy); font-size: 10px; }
.bar { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: var(--indigo-2); border-radius: 99px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); text-align: center; grid-column: 1 / -1; }
.empty .icon { color: #C7D2FE; }
.loading { padding: 32px; text-align: center; color: var(--muted); }
.rich { white-space: normal; overflow-wrap: anywhere; }
.notice { background: var(--amber-soft); color: var(--amber); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.modal.wide { max-width: 760px; }
.modal > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid rgba(30, 27, 75, .08); }
.modal-body { padding: 18px; }
.confirm-text { font-size: 14.5px; }
.menu { position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 170px; max-height: 60vh; overflow-y: auto; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 7px; text-align: start; font-size: 13.5px; }
.menu button:hover { background: var(--soft); }
.menu button.danger { color: var(--red); }
.menu button:disabled { opacity: .6; cursor: default; background: none; }
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--toast); color: #fff; padding: 9px 16px; border-radius: 9px; box-shadow: var(--shadow); max-width: 360px; font-size: 13.5px; }
.toast.error { background: var(--red); }

.picker { position: relative; }
.picker-box { display: flex; flex-wrap: wrap; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--card); min-height: 38px; align-items: center; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--soft); color: var(--navy); border-radius: 99px; padding: 1px 4px 1px 8px; font-size: 12.5px; }
.chip button, .file-chip button, .date-clear { border: 0; background: none; color: var(--muted); padding: 0 3px; font-size: 15px; line-height: 1; }
.chip-input { flex: 1; min-width: 110px; border: 0 !important; box-shadow: none !important; padding: 2px 4px !important; min-height: 28px !important; }
.pick-list { position: absolute; inset-inline: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; z-index: 5; padding: 4px; }
.pick-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 5px 8px; border-radius: 7px; text-align: start; }
button.pick-row:hover { background: var(--soft); }
.pick-row small { color: var(--muted); margin-inline-start: auto; }
.empty-row { padding: 10px; color: var(--muted); text-align: center; font-size: 13px; }
.date-input { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--card); min-height: 38px; cursor: pointer; color: var(--muted); min-width: 150px; }
.date-text { border: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 0 !important; cursor: pointer; color: var(--text); background: transparent !important; flex: 1; width: 90px; }
.cal-pop { position: fixed; z-index: 80; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px; width: 262px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 8px; }
.cal-head { text-align: center; font-size: 11.5px; color: var(--muted); }
.cal-day { border: 0; background: none; border-radius: 7px; height: 32px; font-size: 13px; }
.cal-day:hover { background: var(--soft); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--indigo-2); }
.cal-day.selected { background: var(--indigo); color: #fff; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--line2); border-radius: 7px; padding: 2px 8px; font-size: 12.5px; max-width: 240px; overflow: hidden; }
.file-chip.pending { opacity: .6; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.file-image img { max-width: 240px; max-height: 200px; border-radius: 8px; display: block; border: 1px solid var(--line); }
.file-link { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: var(--card); color: var(--navy); font-size: 13px; max-width: 100%; }
.file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-link small { color: var(--muted); white-space: nowrap; }
.swatches { display: inline-flex; gap: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--indigo); }

/* ---------- sign-in ---------- */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.auth-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 30px 28px; width: 100%; max-width: 400px; }
.auth-logo { height: 54px; display: block; margin: 0 auto 14px; }
.auth-card h1 { text-align: center; }
.auth-sub { text-align: center; color: var(--muted); margin: 4px 0 18px; font-size: 13px; }
.auth-error { background: var(--red-soft); color: var(--red); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ---------- shell ---------- */
.app { height: 100%; display: grid; grid-template-columns: var(--nav) 1fr; grid-template-rows: var(--top) 1fr; }
#topbar { grid-column: 1 / -1; background: var(--topbar); transition: background .2s; color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; }
.brand-logo { height: 34px; display: block; }
.brand-name { font-weight: 800; font-size: 17px; border-inline-start: 1px solid rgba(255, 255, 255, .25); padding-inline-start: 10px; }
.org-name { color: #C7D2FE; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { position: relative; flex: 1; max-width: 460px; margin-inline: auto; }
.search input { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.search input::placeholder { color: #C7D2FE; }
.search input:focus { background: var(--card); color: var(--text); }
.search-results { position: absolute; top: 100%; inset-inline: 0; margin-top: 6px; background: var(--card); color: var(--text); border-radius: 12px; box-shadow: 0 12px 40px rgba(15, 23, 42, .25); padding: 6px; max-height: 70vh; overflow-y: auto; }
.search-results h4 { font-size: 11.5px; color: var(--muted); padding: 6px 8px 2px; margin: 0; }
.search-results button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 7px; text-align: start; }
.search-results button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results button:hover { background: var(--soft); }
.top-btn { position: relative; width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.top-btn:hover, .me-btn:hover { background: rgba(255, 255, 255, .12); }
.top-btn .badge { position: absolute; top: 1px; inset-inline-start: 0; }
.me-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; border-radius: 9px; padding: 3px 8px; }
.notif-pop { position: fixed; top: calc(var(--top) + 4px); left: 12px; width: 340px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; background: var(--card); border-radius: 12px; box-shadow: 0 12px 40px rgba(15, 23, 42, .25); z-index: 60; }
.notif-pop header { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.notif { display: flex; flex-direction: column; width: 100%; border: 0; border-bottom: 1px solid var(--line2); background: none; padding: 9px 14px; text-align: start; }
.notif:hover { background: var(--hover); }
.notif.unread { background: var(--soft); }
.notif small { color: var(--muted); }

#nav { background: var(--card); border-inline-end: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text2); font-weight: 600; }
#nav a:hover { background: var(--hover); }
#nav a.active { background: var(--soft); color: var(--indigo); }
#nav > a { flex: none; }
#nav a span { flex: 1; }
.main { overflow-y: auto; min-width: 0; min-height: 0; }
.page { padding: 20px 24px 40px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-actions input[type=search] { width: 220px; }
.head-actions select { width: auto; max-width: 170px; }
.crumb { font-size: 12.5px; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-inline-end: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.card.pad { padding: 14px 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.card-head a { font-size: 12.5px; }
.scroll-x { overflow-x: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--indigo); color: #fff; }
.tabs button:not(.active):hover { background: var(--chip); }

.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line2); color: inherit; cursor: pointer; min-width: 0; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row.col { flex-direction: column; align-items: stretch; gap: 2px; cursor: default; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.row-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.row-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12.5px; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--line2); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--hover); }
.table .num { font-weight: 700; text-align: end; }

/* ---------- home ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--navy); }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--soft); color: var(--indigo); display: flex; align-items: center; justify-content: center; }
.stat.warn .stat-icon { background: var(--red-soft); color: var(--red); }
.stat-text { display: flex; flex-direction: column; line-height: 1.4; }
.stat-text strong { font-size: 22px; font-weight: 800; }
.stat-text small { color: var(--muted); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }

/* ---------- people ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person.inactive { opacity: .6; }
.person-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.avatar-wrap { position: relative; display: inline-flex; }
.online { position: absolute; bottom: 1px; inset-inline-start: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--cyan); border: 2px solid var(--card); }
.person-tags { display: flex; gap: 5px; flex-wrap: wrap; min-height: 22px; margin: 4px 0; }
.contact { font-size: 12.5px; color: var(--muted); text-align: end; overflow: hidden; text-overflow: ellipsis; }

/* ---------- chat ---------- */
.page.view-chat { padding: 0; max-width: none; height: 100%; }
.chat { display: grid; grid-template-columns: 300px 1fr; height: 100%; background: var(--card); }
.chat-side { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 0; gap: 8px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.conv-list { overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px 10px; }
.conv { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: inherit; }
.conv:hover { background: var(--hover); }
.conv.active { background: var(--soft); }
.conv-icon { background: var(--soft); color: var(--indigo); }
.conv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.conv-text strong, .conv-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-text small { color: var(--muted); }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--muted); font-size: 11.5px; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.chat-title small { color: var(--muted); }
.back-btn { display: none; }
.stream { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { text-align: center; margin: 8px 0; }
.day-sep span, .msg.system > span { background: var(--chip); color: var(--text2); border-radius: 99px; padding: 1px 12px; font-size: 12px; }
.msg { display: flex; align-items: flex-end; gap: 7px; max-width: 78%; align-self: flex-start; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.system { align-self: center; max-width: 90%; margin: 4px 0; }
.bubble { background: var(--card); border-radius: 14px 14px 14px 4px; padding: 7px 12px 4px; box-shadow: 0 1px 1px rgba(30, 27, 75, .06); min-width: 70px; display: flex; flex-direction: column; }
[dir=rtl] .bubble { border-radius: 14px 14px 4px 14px; }
.msg.mine .bubble { background: var(--mine); border-radius: 14px 14px 14px 4px; }
.bubble.deleted { color: var(--muted); }
.bubble .sender { font-size: 12.5px; }
.bubble .meta { font-size: 11px; color: var(--muted); align-self: flex-end; display: inline-flex; gap: 4px; }
.ticks.seen { color: var(--indigo); }
.quote { border-inline-start: 3px solid var(--indigo-2); background: rgba(99, 102, 241, .08); border-radius: 6px; padding: 2px 8px; margin-bottom: 4px; font-size: 12.5px; display: flex; flex-direction: column; }
.quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.task-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 4px; }
.msg-more { opacity: 0; width: 26px; height: 26px; }
.msg:hover .msg-more { opacity: 1; }
.more-btn { align-self: center; }
.composer { background: var(--card); border-top: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.composer.note { color: var(--muted); text-align: center; font-size: 13px; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { resize: none; border-radius: 18px; max-height: 140px; }
.composer .send { border-radius: 50%; width: 40px; height: 40px; padding: 0; flex: none; }
.composer .send .icon { transform: scaleX(-1); }
.reply-bar { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 8px; padding: 2px 10px; font-size: 12.5px; }
.reply-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tasks ---------- */
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--edge); background: var(--card); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; color: #fff; }
.tick:not(:disabled):hover { border-color: var(--indigo); }
.tick.half { background: #C7D2FE; border-color: #C7D2FE; color: var(--indigo); }
.tick.pending { background: var(--amber-soft); border-color: #FCD34D; color: var(--amber); }
.tick.done { background: var(--indigo); border-color: var(--indigo); }
.tick:disabled { cursor: default; }
.is-done .row-title, .is-done .kcard-title { color: var(--muted); text-decoration: line-through; }
.prio { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.prio.p2 { background: #F59E0B; }
.prio.p3 { background: var(--red); }
.proj { font-weight: 600; }
.task-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.task-title { font-size: 19px; font-weight: 800; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; background: var(--hover); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.info small { color: var(--muted); font-size: 12px; display: block; }
.person-inline { display: inline-flex; align-items: center; gap: 6px; }
.people-inline { display: flex; flex-direction: column; gap: 4px; }
.done-mark { display: inline-flex; color: var(--indigo); }
.block { margin-top: 16px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.check-item span { flex: 1; }
.check-item.done span, .check-item.done input.bare { color: var(--muted); text-decoration: line-through; }
.check-item .icon-btn { width: 26px; height: 26px; opacity: .5; }
.bare { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 2px 0 !important; min-height: 28px !important; }
.activity { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.act { display: flex; gap: 10px; align-items: flex-start; }
.act.system { justify-content: space-between; font-size: 12.5px; color: var(--muted); border-inline-start: 2px solid var(--line); padding-inline-start: 10px; gap: 8px; }
.act.system small { white-space: nowrap; }
.act-body { flex: 1; min-width: 0; background: var(--hover); border-radius: 10px; padding: 8px 12px; }
.act-body header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.act-body header small { color: var(--muted); margin-inline-start: auto; }
.comment-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.comment-box textarea { border: 0; box-shadow: none !important; padding: 2px 4px; }
.cal-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-bar strong { min-width: 110px; text-align: center; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-head { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.month-day { position: relative; min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month-day.blank { border: 0; }
.month-day.today { border-color: var(--indigo-2); background: var(--hover); }
.month-day b { font-size: 12px; color: var(--muted); }
.cal-task { border: 0; background: var(--soft); color: var(--indigo); border-radius: 5px; font-size: 11.5px; padding: 0 5px; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task.late { background: var(--red-soft); color: var(--red); }
.cal-task.pending { background: var(--amber-soft); color: var(--amber); }
.cal-task.done { background: var(--line2); color: var(--muted); text-decoration: line-through; }
.cal-add { position: absolute; top: 2px; inset-inline-end: 2px; border: 0; background: none; color: var(--muted); opacity: 0; width: 22px; height: 22px; border-radius: 6px; }
.month-day:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--soft); color: var(--indigo); }

/* ---------- projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.project-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--indigo); border-radius: var(--radius); padding: 14px 16px; color: inherit; display: flex; flex-direction: column; }
.project-card:hover { box-shadow: var(--shadow); }
.project-card strong { font-size: 15px; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 1.75em; font-size: 13px; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kcol { background: var(--col); border-radius: 12px; padding: 8px; width: 280px; flex: none; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; }
.kcol.over { border-color: var(--indigo-2); }
.kcol > header { display: flex; align-items: center; gap: 8px; padding: 2px 6px; }
.kcol > header small { color: var(--muted); flex: 1; }
.kcol > header .icon-btn { width: 26px; height: 26px; }
.kcol-list { display: flex; flex-direction: column; gap: 8px; min-height: 24px; }
.kcol.add-col { background: transparent; border: 2px dashed var(--edge); color: var(--muted); flex-direction: row; align-items: center; justify-content: center; min-height: 52px; font-weight: 600; }
.kcard { background: var(--card); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(30, 27, 75, .08); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.kcard:hover { box-shadow: var(--shadow); }
.kcard.dragging { opacity: .4; }
.kcard-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.kcard-title { font-weight: 600; overflow-wrap: anywhere; }
.kcard-title .prio { margin-inline-end: 6px; }
.quick-add { border: 0 !important; background: transparent !important; min-height: 32px !important; }
.quick-add:focus { background: var(--card) !important; }

/* ---------- letters ---------- */
.letters { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: start; }
.box-list { display: flex; flex-direction: column; gap: 3px; }
.box-list button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 12px; border-radius: 9px; text-align: start; font-weight: 600; color: var(--text2); }
.box-list button span { flex: 1; }
.box-list button:hover { background: var(--chip); }
.box-list button.active { background: var(--indigo); color: #fff; }
.box-list button.quiet { margin-top: 10px; font-weight: 400; font-size: 13px; }
.letters-main { min-width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1; min-width: 200px; width: auto; }
.filters select { width: auto; }
.letter-row.unread .row-title { font-weight: 800; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--indigo); flex: none; }
.letter-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.paper { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; min-width: 0; }
.letterhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.lh-brand { display: flex; align-items: center; gap: 12px; }
.lh-brand img { height: 46px; }
.lh-brand strong { font-size: 16px; }
.lh-meta { display: flex; flex-direction: column; font-size: 13px; }
.paper-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.addr { margin-bottom: 2px; }
.paper-body { margin: 16px 0 22px; font-size: 14.5px; line-height: 2.1; }
.sign { display: flex; flex-direction: column; align-items: center; width: fit-content; margin-inline-start: auto; text-align: center; padding: 0 20px; }
.sign small { color: var(--muted); }
.thread-item { display: flex; flex-direction: column; gap: 8px; }
.recipient { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; }
.recipient div { display: flex; flex-direction: column; line-height: 1.5; min-width: 0; }
.seen { color: #0369A1; font-size: 12px; }
.recipient small.muted { font-size: 12px; }
.linked-task { display: flex; align-items: center; gap: 6px; padding: 4px 0; color: inherit; }
.linked-task span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- notes ---------- */
.notes-grid { columns: 4 240px; column-gap: 12px; margin-top: 12px; }
.note-card { position: relative; break-inside: avoid; border: 1px solid rgba(30, 27, 75, .1); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.note-card:hover { box-shadow: var(--shadow); }
.note-card p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.note-card footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.note-card footer small { margin-inline-start: auto; font-size: 11.5px; }
.note-pin { position: absolute; top: 8px; inset-inline-end: 10px; color: var(--indigo); }
.note-check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.note-check i { width: 14px; height: 14px; border: 1.5px solid #94A3B8; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.note-check.done { color: var(--muted); text-decoration: line-through; }
.note-modal .modal-body > div > input, .note-modal .modal-body > div > textarea { background: rgba(255, 255, 255, .6); margin-bottom: 8px; }
.note-title-input { font-weight: 700; font-size: 15px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .home-grid, .letter-layout { grid-template-columns: 1fr; }
  .letters { grid-template-columns: 1fr; }
  .box-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .box-list button { white-space: nowrap; }
  .box-list button.quiet { margin-top: 0; }
}
@media (max-width: 720px) {
  :root { --top: 52px; }
  .app { grid-template-columns: 1fr; grid-template-rows: var(--top) 1fr 58px; }
  #nav { grid-row: 3; flex-direction: row; padding: 4px; border: 0; border-top: 1px solid var(--line); gap: 0; overflow-x: auto; }
  #nav a { flex: 1 1 0; flex-direction: column; gap: 0; padding: 4px 1px; font-size: 10px; position: relative; min-width: 0; text-align: center; white-space: nowrap; }
  #nav a .badge { position: absolute; top: 0; inset-inline-start: 50%; }
  .org-name, .me-name, .brand-name { display: none; }
  .brand-logo { height: 28px; }
  #topbar { gap: 8px; padding: 0 10px; }
  .page { padding: 14px 12px 30px; }
  .grid2 { grid-template-columns: 1fr; }
  .head-actions input[type=search] { width: 100%; }
  .chat { grid-template-columns: 1fr; }
  .chat.has-current .chat-side, .chat:not(.has-current) .chat-pane { display: none; }
  .back-btn { display: inline-flex; }
  .msg { max-width: 92%; }
  .msg-more { opacity: 1; }
  .paper { padding: 16px; }
  .month-day { min-height: 64px; }
  .month-head { font-size: 10px; overflow: hidden; }
  .overlay { padding: 0; }
  .modal, .modal.wide { max-width: none; min-height: 100%; border-radius: 0; }
  .row { padding: 10px 12px; gap: 9px; }
  .task-row .avatars { display: none; }
}

/* ---------- version 1.1 ---------- */
.btn.primary:hover { background: var(--indigo); filter: brightness(.9); }
.print-only { display: none; }
.sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* colleagues under the menu */
.mates { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 1px; min-height: 0; }
.mates h4 { font-size: 12px; color: var(--muted); padding: 0 12px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.mate { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 5px 10px; border-radius: 9px; text-align: start; width: 100%; }
.mate:hover { background: var(--hover); }
.mate-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.mate-text b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mate-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mates .online { width: 10px; height: 10px; }
#nav a .icon { color: var(--muted); }
#nav a.active .icon { color: var(--indigo); }

/* chat */
.mini-tabs { margin-bottom: 0; }
.mini-tabs button { padding: 2px 12px; font-size: 12.5px; }
.msg.system { flex-direction: column; align-items: center; gap: 6px; }
.task-card { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-inline-start: 3px solid var(--indigo); border-radius: 10px; padding: 7px 12px; text-align: start; min-width: 240px; max-width: 420px; margin-top: 4px; color: var(--text); }
.task-card:hover { box-shadow: var(--shadow); }
.task-card.done { border-inline-start-color: var(--muted); }
.task-card.done b { text-decoration: line-through; color: var(--muted); }
.task-card.pending { border-inline-start-color: #F59E0B; }
.task-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.task-card-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.task-card-text small { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.task-card .tick { width: 20px; height: 20px; }
.add-task { border-radius: 99px; align-self: center; }
.sys-link { border: 0; background: var(--chip); color: var(--text2); border-radius: 99px; padding: 1px 12px; font-size: 12px; }
.sys-link:hover { color: var(--indigo); }

/* tasks */
.quick-task { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--indigo); flex-wrap: wrap; overflow: visible; }
.quick-task input[type=text]:not(.date-text) { flex: 1; min-width: 180px; border: 0; box-shadow: none !important; }

/* project */
.project-layout { display: block; }
.project-layout.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; align-items: start; }
.project-layout:not(.with-side) .project-side { display: none; }
.project-side h4 small { font-weight: 400; color: var(--muted); }
.pstats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.pstat { background: var(--hover); border-radius: 9px; padding: 6px 10px; display: flex; flex-direction: column; line-height: 1.5; }
.pstat strong { font-size: 18px; font-weight: 800; }
.pstat small { color: var(--muted); font-size: 12px; }
.pstat.late strong { color: var(--red); }
.chat-pane.embedded { height: calc(100vh - var(--top) - 190px); min-height: 380px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* letters */
.marked { color: var(--indigo); display: inline-flex; }
.rich-editor { border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.rich-editor:focus-within { border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.rich-tools { display: flex; align-items: center; gap: 2px; padding: 3px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rich-tools .icon-btn { width: 30px; height: 30px; color: var(--text2); font-size: 14px; }
.rich-area { min-height: 220px; max-height: 50vh; overflow-y: auto; padding: 10px 12px; outline: none; line-height: 2; }
.rich-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.formatted p, .formatted div { margin: 0; }
.formatted ul, .formatted ol, .rich-area ul, .rich-area ol { margin: 4px 0; padding-inline-start: 26px; }

/* notes */
.quick-note { padding: 8px 14px; display: flex; flex-direction: column; gap: 4px; max-width: 620px; margin-inline: auto; box-shadow: var(--shadow); }
.quick-note textarea { resize: none; }
.note-card.in-trash { cursor: default; opacity: .92; }
.notes-grid.tag-list { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tag-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--indigo); text-align: start; }
.tag-tile:hover { box-shadow: var(--shadow); }
.tag-tile b { color: var(--text); }
.tag-tile small { color: var(--muted); }

/* work list */
.page.view-worklist { max-width: 900px; }
.wl-compose { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow: visible; box-shadow: var(--shadow); }
.wl-title { font-weight: 700; font-size: 15px; }
.wl-compose textarea { resize: none; }
.wl-send { display: flex; align-items: center; gap: 8px; }
.wl-to { flex: 1; min-width: 0; }
.wl-list .card { overflow: visible; }
.wl-item { border-bottom: 1px solid var(--line2); cursor: pointer; }
.wl-item:last-child { border-bottom: 0; }
.wl-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.wl-item:hover > .wl-row { background: var(--hover); }
.wl-item.open { background: var(--hover); }
.wl-item.unseen .row-title { font-weight: 800; }
.wl-detail { cursor: default; padding: 4px 16px 14px; margin-inline-start: 46px; display: flex; flex-direction: column; gap: 10px; }
.wl-history { display: flex; flex-direction: column; gap: 8px; border-inline-start: 2px solid var(--line); padding-inline-start: 12px; }
.wl-step { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.wl-step small { color: var(--muted); }
.wl-step p { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; margin-top: 3px; white-space: pre-wrap; }
.wl-step.return p { border-color: var(--red-soft); }
.wl-actions { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.wl-note { display: flex; gap: 6px; align-items: center; }
.wl-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wl-next { display: flex; gap: 6px; flex: 1; min-width: 260px; }
.wl-next .picker { flex: 1; min-width: 0; }
.btn.done-btn { background: #0369A1; border-color: #0369A1; color: #fff; }

/* dark display: paper-like surfaces keep their light look */
:root[data-theme=dark] .paper, :root[data-theme=dark] .note-card, :root[data-theme=dark] .note-modal, :root[data-theme=dark] .auth-card {
  --navy: #1E1B4B; --text: #1E1B4B; --muted: #64748B; --line: #E2E8F0; --card: #FFFFFF; --soft: #EEF2FF; --hover: #F8FAFC; --line2: #F1F5F9;
  --chip: #E2E8F0; --edge: #CBD5E1; --text2: #475569; --indigo: #4338CA; --red: #DC2626; --red-soft: #FEE2E2; --amber: #B45309; --amber-soft: #FEF3C7;
  color: #1E1B4B; color-scheme: light;
}
:root[data-theme=dark] .btn.primary, :root[data-theme=dark] .tabs button.active, :root[data-theme=dark] .box-list button.active,
:root[data-theme=dark] .cal-day.selected, :root[data-theme=dark] .tag.plain.on, :root[data-theme=dark] .pill:not([class*="-"]):not(.soft):not(.gray) { color: #0F172A; }
:root[data-theme=dark] .paper .btn.primary, :root[data-theme=dark] .note-modal .btn.primary, :root[data-theme=dark] .auth-card .btn.primary { color: #fff; }
:root[data-theme=dark] .tag.plain { background: rgba(148, 163, 184, .2); }
:root[data-theme=dark] .note-card .tag.plain, :root[data-theme=dark] .note-modal .tag.plain { background: rgba(30, 27, 75, .08); }
:root[data-theme=dark] .pill.status-done, :root[data-theme=dark] .pill.kind-forward { background: #0C3B57; color: #7DD3FC; }
:root[data-theme=dark] .pill.kind-paraph { background: #3B2A66; color: #C4B5FD; }
:root[data-theme=dark] .paper .pill.kind-paraph { background: #F3E8FF; color: #7C3AED; }
:root[data-theme=dark] .paper .pill.kind-forward, :root[data-theme=dark] .paper .pill.status-done { background: #E0F2FE; color: #0369A1; }
:root[data-theme=dark] .msg.mine .bubble { color: #E0E7FF; }
:root[data-theme=dark] .day-sep span, :root[data-theme=dark] .msg.system > span { color: var(--text2); }
:root[data-theme=dark] .tick { background: transparent; }
:root[data-theme=dark] .tick.done { background: var(--indigo); color: #0F172A; }
:root[data-theme=dark] .empty .icon { color: #475569; }
:root[data-theme=dark] .search input:focus { background: #1E293B; color: #E2E8F0; }
:root[data-theme=dark] .file-image img { border-color: var(--line); }

@media (max-width: 900px) {
  .project-layout.with-side { grid-template-columns: 1fr; }
  .mates { display: none; }
}
@media (max-width: 720px) {
  .chat-pane.embedded { height: calc(100vh - var(--top) - 250px); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs button { white-space: nowrap; flex: none; }
  .quick-task .btn.small:last-child { display: none; }
  .wl-detail { margin-inline-start: 0; padding-inline: 12px; }
  .wl-next { min-width: 100%; flex-wrap: wrap; }
  .wl-next .btn, .wl-buttons > .btn { flex: 1; }
  .view-worklist .page-head p { display: none; }
}
@media print {
  .print-only { display: block; margin-bottom: 10px; }
  .card { border-color: #CBD5E1; break-inside: avoid; }
  .task-row .tick { border-color: #64748B; }
  .project-side { display: none; }
}

/* ---------- print: only the letter, with its letterhead ---------- */
@page { margin: 18mm 16mm; }
@media print {
  #topbar, #nav, #toasts, .no-print, .menu { display: none !important; }
  body, .app, .main { background: var(--card); height: auto; display: block; overflow: visible; }
  .page { padding: 0; max-width: none; }
  .letter-layout { display: block; }
  .paper { border: 0; padding: 0; }
  .act-body { background: var(--card); border: 1px solid var(--edge); }
}

/* ---------- v1.3: org chart, convert buttons ---------- */
.person-boss { font-size: 12px; }
.org-chart ul { list-style: none; margin: 0; padding: 0; }
.org-chart li { position: relative; padding-top: 8px; }
.org-chart ul ul { margin-inline-start: 26px; padding-inline-start: 20px; border-inline-start: 2px solid var(--line); }
.org-chart ul ul > li::before { content: ""; position: absolute; top: 37px; inset-inline-start: -20px; width: 20px; border-top: 2px solid var(--line); }
.org-node { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; max-width: 520px; }
.org-node.me { border-color: var(--indigo); }
.org-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.org-text .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-convert { display: inline-flex; gap: 6px; flex: none; }
.wl-convert .btn.small { padding: 4px 9px; font-size: 12px; gap: 4px; white-space: nowrap; }
.wl-convert .btn.linked { color: var(--indigo); border-color: var(--indigo); text-decoration: none; }
@media (max-width: 720px) {
  .org-chart ul ul { margin-inline-start: 12px; padding-inline-start: 12px; }
  .org-chart ul ul > li::before { inset-inline-start: -12px; width: 12px; }
  .wl-row { flex-wrap: wrap; }
  .wl-row .row-main { flex: 1 1 0; min-width: 0; }
  .wl-convert { order: 5; flex: 1 1 100%; margin-inline-start: 46px; }
}

/* ---------- v1.3.1: chart and access setup ---------- */
.setup-card { padding: 4px 0; overflow-x: auto; }
.setup-table { width: 100%; border-collapse: collapse; }
.setup-table th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.setup-table td { padding: 8px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.setup-table tr:last-child td { border-bottom: 0; }
.setup-table select, .setup-table input { width: 100%; min-width: 150px; }
.setup-name { display: flex; flex-direction: column; line-height: 1.5; white-space: nowrap; }
.setup-h { margin: 22px 0 4px; font-size: 15px; }
@media (max-width: 720px) {
  .setup-table thead { display: none; }
  .setup-table tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .setup-table td { display: flex; align-items: center; gap: 10px; padding: 4px 0; border: 0; }
  .setup-table td[data-label]::before { content: attr(data-label); flex: 0 0 86px; font-size: 12px; color: var(--muted); }
}

/* ---------- v1.4: user access page ---------- */
.acc-layout { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.acc-side { padding: 10px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px; max-height: calc(100vh - 150px); }
.acc-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.acc-user { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; border-radius: 9px; text-align: start; width: 100%; color: var(--text); }
.acc-user:hover { background: var(--hover); }
.acc-user.active { background: var(--soft); }
.acc-user-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.5; }
.acc-user-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.acc-head { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.acc-who { display: flex; align-items: center; gap: 12px; }
.acc-who h2 { font-size: 17px; margin: 0; }
.acc-bulk { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.acc-group { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.acc-group header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acc-group h3 { font-size: 14.5px; margin: 0; }
.acc-check { font-size: 13.5px; }
.acc-check input:disabled { opacity: .6; }
@media (max-width: 720px) {
  .acc-layout { grid-template-columns: 1fr; }
  .acc-side { position: static; max-height: 240px; }
}

/* ---------- v1.5: voice and video calls ---------- */
.call-start { display: inline-flex; align-items: center; gap: 2px; }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, .25); } }
.overlay.call { background: #0F172A; padding: 0; flex-direction: column; align-items: stretch; justify-content: flex-start; color: #E2E8F0; z-index: 80; overflow: hidden; }
.call-top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.call-top strong { font-size: 15px; }
.call-clock { color: #C7D2FE; font-variant-numeric: tabular-nums; flex: 1; }
.call-min { border: 0; background: #1E293B; color: #E2E8F0; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 10px; padding: 0 14px; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.call-grid[data-count="1"] { grid-template-columns: 1fr; }
.call-grid[data-count="5"], .call-grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.call-grid[data-count="many"] { grid-template-columns: repeat(3, 1fr); }
.call-tile { position: relative; background: #1E293B; border-radius: 14px; overflow: hidden; min-height: 0; display: flex; align-items: center; justify-content: center; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: #0F172A; }
.call-tile.is-screen video { object-fit: contain; }
.call-tile[data-user] video { transform: none; }
.call-face { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #1E293B; }
.call-tile.cam-off .call-face { display: flex; }
.call-tile.failed { outline: 2px solid #F87171; }
.call-name { position: absolute; bottom: 8px; inset-inline-start: 8px; background: rgba(15, 23, 42, .75); color: #fff; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 16px); }
.call-state { color: #C7D2FE; }
.call-muted { color: #F87171; display: inline-flex; }
.call-wait { text-align: center; color: #C7D2FE; padding: 6px; }
.call-bar { display: flex; justify-content: center; gap: 14px; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.call-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #334155; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.call-btn:hover { background: #475569; }
.call-btn.off { background: #E2E8F0; color: #1E1B4B; }
.call-btn.on, .call-btn.answer { background: #4338CA; }
.call-btn.hang { background: #DC2626; }
.call-btn.hang .icon { transform: rotate(135deg); }
.overlay.call.mini { inset: auto; inset-inline-start: 16px; bottom: 16px; width: 280px; height: 210px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); cursor: pointer; }
.overlay.call.mini .call-top { padding: 6px 10px; }
.overlay.call.mini .call-top strong, .overlay.call.mini .call-wait { display: none; }
.overlay.call.mini .call-grid { padding: 0 6px; gap: 4px; }
.overlay.call.mini .call-face .avatar { transform: scale(.5); }
.overlay.call.mini .call-name { display: none; }
.overlay.call.mini .call-bar { padding: 6px; gap: 8px; }
.overlay.call.mini .call-btn { width: 34px; height: 34px; }
.overlay.call.mini .call-btn .icon { width: 16px; height: 16px; }
.ring { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 90; background: #1E1B4B; color: #fff; border-radius: 16px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .4); width: min(420px, calc(100vw - 24px)); }
.ring-text { flex: 1; display: flex; flex-direction: column; line-height: 1.6; min-width: 0; }
.ring-text span { color: #C7D2FE; font-size: 12.5px; }
.ring .call-btn { width: 44px; height: 44px; flex: none; }
@media (max-width: 720px) {
  .call-grid { grid-template-columns: 1fr; padding: 0 8px; }
  .call-grid[data-count="3"], .call-grid[data-count="4"], .call-grid[data-count="5"], .call-grid[data-count="6"], .call-grid[data-count="many"] { grid-template-columns: repeat(2, 1fr); }
  .overlay.call.mini { width: 200px; height: 160px; bottom: 72px; }
}

/* ---------- 1.5: correspondence automation ---------- */
.seg { display: inline-flex; background: var(--chip); border-radius: 9px; padding: 3px; gap: 2px; margin-bottom: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; color: var(--text2); font-weight: 600; }
.seg button.active { background: var(--card); color: var(--indigo); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.seg.small { display: flex; margin-bottom: 6px; }
.seg.small button { flex: 1; padding: 5px 4px; font-size: 12px; }
.pill.state-new { background: var(--amber-soft); color: var(--amber); }
.pill.state-doing { background: var(--soft); color: var(--indigo); }
.pill.state-done { background: var(--chip); color: var(--text2); }
.pill.void { text-decoration: line-through; }
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); color: var(--navy); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.banner p { margin: 2px 0 0; font-size: 13px; color: var(--text2); }
.banner.amber { background: var(--amber-soft); }
.banner.red { background: var(--red-soft); }
.banner .icon { flex: none; margin-top: 3px; }
.ref-line { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 8px; padding: 6px 10px; margin-bottom: 12px; font-size: 13px; flex-wrap: wrap; }
.ref-line select { width: auto; min-height: 30px; padding-block: 2px; }
.ref-line span { flex: 1; min-width: 120px; }
.order-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.addr.ref a, .addr.ref span { color: var(--indigo); font-weight: 600; }
.paper.voided { position: relative; }
.paper.voided::after { content: "باطل شد"; position: absolute; top: 90px; inset-inline-end: 30px; border: 3px solid var(--red); color: var(--red); font-weight: 800; font-size: 22px; padding: 2px 18px; border-radius: 8px; transform: rotate(-12deg); opacity: .7; }
.book-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.book-head .head-actions { margin-inline-start: auto; }
.book tr.void td { color: var(--muted); text-decoration: line-through; }
.more-row { display: flex; justify-content: center; margin-top: 12px; }
.page-head .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.recipient small { display: block; }
:root[data-theme=dark] .paper .banner, :root[data-theme=dark] .seg button.active { color: var(--indigo); }
@media print {
  body.print-book .letters { display: block; }
  body.print-book .box-list, body.print-book .filters, body.print-book .tabs { display: none !important; }
  body.print-book .book { border: 0; }
  body.print-book .scroll-x { overflow: visible; }
  body.print-book .table { font-size: 11px; }
  body.print-book .table th, body.print-book .table td { border: 1px solid #94A3B8; padding: 4px 6px; }
}

/* ---------- 1.5: design pass from the review ---------- */
:focus-visible { outline: 2px solid var(--indigo-2); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .rich-area:focus-visible { outline-offset: 0; }
.tabs button.active, .box-list button.active { background: var(--soft); color: var(--indigo); }
.box-list button.active .badge { background: var(--indigo); color: #fff; }
:root[data-theme=dark] .tabs button.active, :root[data-theme=dark] .box-list button.active { color: #C7D2FE; }
.toast { max-width: min(420px, calc(100vw - 32px)); }
:root[data-theme=dark] .toast.error, :root[data-theme=dark] .badge { color: #0F172A; }
:root[data-theme=dark] ::placeholder { color: #94A3B8; opacity: 1; }
.num, .badge, .stat strong, .table td { font-variant-numeric: tabular-nums; }
.notif-pop header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-pop { left: auto; inset-inline-end: 12px; }
.empty .icon { background: var(--soft); color: var(--indigo); border-radius: 50%; padding: 14px; width: 68px; height: 68px; }
.empty p { max-width: 420px; margin-inline: auto; }
#nav-more { display: none; }
.badge.dot { min-width: 9px; width: 9px; height: 9px; padding: 0; }
.overlay.sheet { align-items: flex-end; padding: 0; }
.sheet-box { background: var(--card); width: 100%; border-radius: 16px 16px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 2px; }
.sheet-box a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 15px; }
.sheet-box a span { flex: 1; }
.sheet-box a.active { background: var(--soft); color: var(--indigo); }
@supports (height: 100dvh) { html, body, .app { height: 100dvh; } }
@media (max-width: 720px) {
  .app { grid-template-rows: var(--top) 1fr calc(60px + env(safe-area-inset-bottom)); }
  #nav { overflow: visible; padding: 2px 4px env(safe-area-inset-bottom); }
  #nav a.extra, #nav .mates { display: none; }
  #nav a, #nav-more { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px; font-size: 11px; font-weight: 600; position: relative; border: 0; background: none; color: var(--text2); border-radius: 9px; padding: 4px 1px; }
  #nav a.hidden { display: none; }
  #nav a .badge, #nav-more .badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); }
  #nav-more .icon { color: var(--muted); }
  .btn, .icon-btn, .tabs button, .box-list button, .seg button, select, input[type=text], input[type=search], input[type=password], input[type=number] { min-height: 44px; }
  .btn.small { min-height: 38px; }
  .icon-btn { min-width: 44px; }
  .modal header { position: sticky; top: 0; background: var(--card); z-index: 2; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; justify-content: center; }
  .letter-row .row-end { flex-direction: row; align-items: center; gap: 8px; }
  #toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ---------- profile photo ---------- */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatars .avatar, .avatar-wrap .avatar { overflow: hidden; }
.photo-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.photo-edit .hint { margin-top: 6px; }

/* ================= 1.6 design pass: depth, motion, tables, home ================= */
:root {
  --bg: #EEF0F8;
  --t-fast: 110ms; --t-mid: 160ms; --t-slow: 240ms; --ease: cubic-bezier(.2, 0, .38, .9); --ease-in: cubic-bezier(0, 0, .38, .9);
  --lift: 0 1px 2px rgba(30, 27, 75, .07), 0 1px 1px rgba(30, 27, 75, .03);
}
:root[data-theme=dark] { --bg: #0F172A; --lift: none; }

/* Surfaces lift off the page with a soft shadow instead of a grey outline (dark theme keeps the outline). */
.card, .stat, .person, .project-card { border-color: transparent; box-shadow: var(--lift); }
:root[data-theme=dark] .card, :root[data-theme=dark] .stat, :root[data-theme=dark] .person { border-color: var(--line); }
.project-card { border-top-color: var(--indigo); border-top-width: 5px; }
.card-head { background: var(--hover); padding: 11px 16px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h3::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--indigo-2); flex: none; }
.card-head h3 small { background: var(--chip); color: var(--text2); border-radius: 99px; padding: 0 8px; font-size: 11.5px; font-weight: 700; line-height: 1.8; }
h1 { font-size: 23px; }
.row-sub, .row-preview { font-size: 13px; }

/* Feedback on hover and press. */
.btn, .icon-btn, .row, .stat, .kcard, .person, .project-card, .note-card, #nav a, .conv, .tabs button, .box-list button, .tick, .mate {
  transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-mid) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:not(:disabled):active { transform: scale(.97); }
.stat:hover, .kcard:hover, .person:hover, .project-card:hover, .note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.rows .row { border-inline-start: 3px solid transparent; }
.rows .row:hover { border-inline-start-color: var(--indigo-2); }
.letter-row.unread, .wl-item.unseen { border-inline-start-color: var(--indigo) !important; background: var(--accent-soft); }
:root[data-theme=dark] .letter-row.unread, :root[data-theme=dark] .wl-item.unseen { background: #232B52; }
#nav a.active { box-shadow: inset -3px 0 0 var(--indigo); }
.conv.active { box-shadow: inset -3px 0 0 var(--indigo); }
.conv-icon { background: var(--violet); color: #fff; }

/* Page and dialog entry. */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.page > * { animation: rise var(--t-slow) var(--ease-in) both; }
.page > *:nth-child(2) { animation-delay: 30ms; } .page > *:nth-child(3) { animation-delay: 60ms; }
.page > *:nth-child(4) { animation-delay: 90ms; } .page > *:nth-child(n+5) { animation-delay: 120ms; }
.overlay { animation: fade var(--t-mid) var(--ease-in); }
.modal { animation: pop-in 200ms var(--ease-in); }
.toast { animation: rise var(--t-slow) var(--ease-in); }
.tick.pop { animation: tick-pop 280ms var(--ease-in); }
@keyframes tick-pop { 50% { transform: scale(1.25); } }
.task-row.is-done { transition: opacity var(--t-slow) var(--ease); opacity: .55; }

/* Loading placeholders: flat pulse, no shimmer. */
.loading.card { padding: 6px 16px; text-align: start; }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line2); }
.skel-row:last-child { border-bottom: 0; }
.skel { display: block; height: 12px; border-radius: 6px; background: var(--chip); animation: skel 1.1s ease-in-out infinite alternate; }
.skel.dot { width: 30px; height: 30px; border-radius: 50%; flex: none; }
@keyframes skel { to { opacity: .45; } }

/* Empty pages: centred, with room for one action. */
.empty { padding: 56px 16px; gap: 12px; }
.empty p { font-size: 14px; color: var(--text2); }
.chat-pane > .empty { flex: 1; justify-content: center; }

/* ---------- home ---------- */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: #1E1B4B; color: #fff; border-radius: 14px; padding: 22px 26px; margin-bottom: 14px; }
:root[data-theme=dark] .hero { background: #1E1B4B; border: 1px solid #312E81; }
.hero h1 { color: #fff; font-size: 24px; }
.hero-text, .hero-ring { position: relative; z-index: 1; }
.hero-date { color: #C7D2FE; font-size: 13px; }
.hero-line { margin-top: 8px; font-size: 15px; font-weight: 600; color: #E0E7FF; max-width: 560px; }
.hero-shape { position: absolute; border-radius: 50%; z-index: 0; }
.hero-shape.a { width: 220px; height: 220px; background: #312E81; inset-inline-end: -60px; top: -90px; }
.hero-shape.b { width: 120px; height: 120px; background: #4338CA; inset-inline-end: 110px; bottom: -80px; }
.hero-ring { display: flex; align-items: center; gap: 14px; }
.ring-box { position: relative; width: 76px; height: 76px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ring-box b { position: relative; font-size: 15px; font-weight: 800; direction: ltr; display: inline-flex; }
.day-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.day-ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: rgba(255, 255, 255, .16); }
.ring-arc { stroke: #22D3EE; stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease); }
.day-text { display: flex; flex-direction: column; line-height: 1.6; }
.day-text small { color: #C7D2FE; }
.hero-ring.full .ring-box b { color: #22D3EE; }
.home-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { border-inline-start: 4px solid var(--indigo-2); }
.stat-text strong { font-size: 26px; }
.stat.tone-violet { border-inline-start-color: var(--violet); } .stat.tone-violet .stat-icon { background: #EDE9FE; color: #7C3AED; }
.stat.tone-sky { border-inline-start-color: var(--sky); } .stat.tone-sky .stat-icon { background: #E0F2FE; color: #1E1B4B; }
.stat.tone-cyan { border-inline-start-color: var(--cyan); } .stat.tone-cyan .stat-icon { background: #CFFAFE; color: #1E1B4B; }
.stat.tone-red { border-inline-start-color: var(--red); } .stat.tone-red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat.tone-red:not(.zero) strong { color: var(--red); }
:root[data-theme=dark] .stat.tone-violet .stat-icon { background: #3B2A6B; color: #C4B5FD; }
:root[data-theme=dark] .stat.tone-sky .stat-icon { background: #123B55; color: #7DD3FC; }
:root[data-theme=dark] .stat.tone-cyan .stat-icon { background: #134550; color: #67E8F9; }
.stat.zero { border-inline-start-color: var(--chip); }
.stat.zero strong { color: var(--muted); font-weight: 600; }
.stat.zero .stat-icon { background: var(--line2); color: var(--muted); }

.week .bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 14px 18px 12px; height: 132px; }
.wbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.wbar small { font-size: 11.5px; font-weight: 700; color: var(--text2); min-height: 18px; }
.wbar i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: #C7D2FE; transition: height 400ms var(--ease); }
.wbar i.none { background: var(--chip); }
.wbar.today i:not(.none) { background: var(--indigo); }
:root[data-theme=dark] .wbar i { background: #4338CA; } :root[data-theme=dark] .wbar i.none { background: var(--chip); }
.wbar span { font-size: 12px; color: var(--muted); }
.wbar.today span { color: var(--indigo); font-weight: 800; }

.clear-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.clear-icon { width: 52px; height: 52px; border-radius: 50%; background: #CFFAFE; color: #1E1B4B; display: flex; align-items: center; justify-content: center; flex: none; }
:root[data-theme=dark] .clear-icon { background: #134550; color: #67E8F9; }
.clear-card ul { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 2px 18px; color: var(--muted); font-size: 13px; }
.clear-card li::before { content: "✓ "; color: var(--indigo); font-weight: 700; }

/* ---------- tables ---------- */
.card.book { overflow: clip; }
.table td { height: 46px; padding: 6px 14px; vertical-align: middle; font-variant-numeric: normal; }
.table thead th { background: var(--hover); color: var(--text2); font-size: 12.5px; font-weight: 700; height: 42px; padding: 0 14px; position: sticky; top: 0; z-index: 1; }
.book .table td { white-space: nowrap; }
.table td.id, .table td.date { unicode-bidi: isolate; }
.table td.id { font-weight: 700; color: var(--indigo); }
.table td.subject { font-weight: 600; min-width: 180px; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.table tbody tr:hover td.id { text-decoration: underline; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: "↕"; margin-inline-start: 6px; opacity: 0; font-weight: 400; }
.table th[data-sort]:hover::after, .table th[data-sort]:focus-visible::after { opacity: .55; }
.table th[aria-sort=ascending]::after { content: "↑"; opacity: 1; color: var(--indigo); }
.table th[aria-sort=descending]::after { content: "↓"; opacity: 1; color: var(--indigo); }
.setup-table thead th { background: var(--hover); }

/* One strong pill per row: the state keeps its colour and gets a dot, the rest calm down. */
.pill[class*="state-"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Other screens. */
.note-card { box-shadow: var(--lift); }
.person-tags:empty { display: none; }
.pstat { border-inline-start: 3px solid var(--indigo-2); }
.pstat.late { border-inline-start-color: var(--red); }
.acc-group header { border-bottom: 1px solid var(--line2); padding-bottom: 8px; }
.box-list { background: var(--card); border-radius: var(--radius); padding: 8px; box-shadow: var(--lift); align-self: start; }
.filters-more { display: contents; }
.filter-toggle { display: none; }
:root[data-theme=dark] .stat.zero .stat-icon { background: var(--line2); color: var(--muted); }
.quick-task { border-style: dashed; }

@media (max-width: 720px) {
  .hero { padding: 18px; }
  .hero h1 { font-size: 21px; }
  .hero-shape.b { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #nav a.active { box-shadow: none; }
  .hero-ring { width: 100%; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; }
  .home-actions .btn { flex: 1 1 auto; }
  .filter-toggle { display: inline-flex; }
  .filters.foldable input[type=search] { min-width: 0; }
  .filters.foldable .filters-more { display: none; }
  .filters.foldable.open .filters-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
  .filters.foldable.open .filters-more > select, .filters.foldable.open .filters-more > .date-input { flex: 1 1 140px; min-width: 0; }
  /* A wide table becomes a stack of small cards. */
  .book .scroll-x { overflow: visible; }
  .book .table thead { display: none; }
  .book .table, .book .table tbody { display: block; }
  .book .table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .book .table td { height: auto; padding: 0; border: 0; max-width: none; min-width: 0; white-space: normal; font-size: 13px; }
  .book .table td:empty { display: none; }
  .book .table td::before { content: attr(data-label) "  "; color: var(--muted); font-size: 11.5px; font-weight: 400; }
  .book .table td.subject { grid-column: 1 / -1; order: -1; font-size: 14.5px; }
  .book .table td.subject::before { content: none; }
}
@media print { .page > *, .modal, .overlay { animation: none; } .card { box-shadow: none; border-color: #CBD5E1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================= 1.6.1 brighter colours, icon tiles, livelier buttons ================= */
:root { --bg: #F1F3FF; --soft: #E8EBFF; --accent-soft: #E8EBFF; --line: #DDE2F5; --line2: #ECEFFB; --hover: #F6F7FF; --chip: #E0E5F8;
  --glow: 0 6px 16px rgba(67, 56, 202, .28); }
:root[data-theme=dark] { --bg: #0F172A; --soft: #312E81; --accent-soft: #312E81; --line: #334155; --line2: #2A3A52; --hover: #263449; --chip: #334155;
  --glow: 0 6px 16px rgba(0, 0, 0, .4); }

/* Buttons: rounder, tinted, and the main one glows a little. */
.btn { border-radius: 11px; font-weight: 700; border-color: #C7D2FE; color: var(--indigo); background: var(--card); padding: 6px 16px; }
.btn:hover { background: var(--soft); border-color: var(--indigo-2); }
.btn .icon { stroke-width: 2.1; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; box-shadow: var(--glow); }
.btn.primary:hover { background: #4F46E5; border-color: #4F46E5; transform: translateY(-1px); }
.btn.primary .icon:first-child { background: rgba(255, 255, 255, .22); border-radius: 50%; padding: 2px; width: 20px; height: 20px; }
.btn.danger { box-shadow: 0 6px 16px rgba(220, 38, 38, .22); border-color: var(--red); color: #fff; }
.btn.danger.ghost { box-shadow: none; color: var(--red); border-color: #FCA5A5; }
.btn.danger.ghost:hover { background: var(--red-soft); }
.btn.small { border-radius: 9px; }
.btn:disabled { box-shadow: none; }
:root[data-theme=dark] .btn { border-color: #4338CA; color: #C7D2FE; }
:root[data-theme=dark] .btn.primary { background: #6366F1; border-color: #6366F1; color: #fff; }
:root[data-theme=dark] .btn.danger { color: #0F172A; }
:root[data-theme=dark] .btn.danger.ghost { color: var(--red); border-color: #7F1D1D; }
.icon-btn { color: var(--indigo-2); border-radius: 10px; }
.icon-btn:hover { background: var(--soft); color: var(--indigo); transform: scale(1.08); }
.modal > header .icon-btn, .top-btn { color: inherit; }
.tabs button { border-radius: 10px; font-weight: 700; }
.tabs button.active { background: var(--indigo); color: #fff; box-shadow: var(--glow); }
:root[data-theme=dark] .tabs button.active { background: #6366F1; color: #fff; }
.tabs button.active .badge { background: #fff; color: var(--indigo); }
.pill { font-weight: 700; }
.pill.soft { background: #E0E7FF; }
:root[data-theme=dark] .pill.soft { background: #3730A3; color: #E0E7FF; }
.badge { box-shadow: 0 0 0 2px var(--card); }
input:focus, select:focus, textarea:focus, .picker-box:focus-within { box-shadow: 0 0 0 3px rgba(99, 102, 241, .22); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=time], select, textarea, .date-input { border-radius: 10px; }

/* Menu: every section has its own coloured icon tile (flat brand colours). */
#nav > a { padding: 7px 10px; border-radius: 12px; }
#nav > a > .icon { width: 32px; height: 32px; padding: 7px; border-radius: 10px; background: var(--indigo-2); stroke-width: 2; transition: transform var(--t-mid) var(--ease); }
#nav > a > .icon, #nav > a.active > .icon { color: var(--ic, #fff); }
#nav > a:hover > .icon { transform: scale(1.1) rotate(-4deg); }
#nav > a[data-view=home] > .icon { background: #4338CA; }
#nav > a[data-view=chat] > .icon { background: #22D3EE; --ic: #1E1B4B; }
#nav > a[data-view=worklist] > .icon { background: #7C3AED; }
#nav > a[data-view=tasks] > .icon { background: #6366F1; }
#nav > a[data-view=projects] > .icon { background: #38BDF8; --ic: #1E1B4B; }
#nav > a[data-view=letters] > .icon { background: #A78BFA; --ic: #1E1B4B; }
#nav > a[data-view=notes] > .icon { background: #FCD34D; --ic: #1E1B4B; }
#nav > a[data-view=people] > .icon { background: #818CF8; }
#nav > a[data-view=access] > .icon { background: #1E1B4B; --ic: #22D3EE; }
:root[data-theme=dark] #nav > a[data-view=access] > .icon { background: #312E81; }
#nav > a.active { background: var(--soft); color: var(--indigo); box-shadow: none; font-weight: 800; }
#nav > a.active > .icon { box-shadow: 0 4px 10px rgba(67, 56, 202, .3); }
:root[data-theme=dark] #nav > a.active { color: #E0E7FF; }

/* The page title carries the section colour. */
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head h1::before { content: ""; width: 8px; height: 26px; border-radius: 4px; background: var(--indigo-2); flex: none; }
body[data-section=chat] .page-head h1::before { background: #22D3EE; }
body[data-section=worklist] .page-head h1::before { background: #7C3AED; }
body[data-section=projects] .page-head h1::before { background: #38BDF8; }
body[data-section=letters] .page-head h1::before { background: #A78BFA; }
body[data-section=notes] .page-head h1::before { background: #FCD34D; }
body[data-section=people] .page-head h1::before { background: #818CF8; }

/* Home: brighter greeting band and solid icon tiles. */
.hero { background: #4338CA; box-shadow: 0 10px 26px rgba(67, 56, 202, .28); }
:root[data-theme=dark] .hero { background: #3730A3; border-color: #4338CA; box-shadow: none; }
.hero-shape.a { background: #7C3AED; }
.hero-shape.b { background: #22D3EE; width: 96px; height: 96px; bottom: -56px; }
.hero-date { color: #E0E7FF; }
.ring-track { stroke: rgba(255, 255, 255, .25); }
.stat { border-inline-start-width: 0; border-radius: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; background: #6366F1; color: #fff; }
.stat-icon .icon { stroke-width: 2; }
.stat.tone-indigo .stat-icon { background: #6366F1; color: #fff; }
.stat.tone-violet .stat-icon { background: #7C3AED; color: #fff; }
.stat.tone-sky .stat-icon { background: #38BDF8; color: #1E1B4B; }
.stat.tone-cyan .stat-icon { background: #22D3EE; color: #1E1B4B; }
.stat.tone-red .stat-icon { background: var(--red); color: #fff; }
:root[data-theme=dark] .stat.tone-violet .stat-icon { background: #7C3AED; color: #fff; }
:root[data-theme=dark] .stat.tone-sky .stat-icon { background: #38BDF8; color: #1E1B4B; }
:root[data-theme=dark] .stat.tone-cyan .stat-icon { background: #22D3EE; color: #1E1B4B; }
:root[data-theme=dark] .stat.tone-red .stat-icon { color: #0F172A; }
.stat.zero .stat-icon, :root[data-theme=dark] .stat.zero .stat-icon { opacity: .45; }
.stat.zero.tone-red .stat-icon { background: var(--edge); }
.stat:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-icon { transition: transform var(--t-mid) var(--ease); }
.wbar i { background: #A5B4FC; }
.wbar:nth-child(3n+1) i:not(.none) { background: #38BDF8; } .wbar:nth-child(3n+2) i:not(.none) { background: #A78BFA; }
.wbar.today i:not(.none) { background: var(--indigo); }
.clear-icon, :root[data-theme=dark] .clear-icon { background: #22D3EE; color: #1E1B4B; }
.card-head h3::before { background: var(--violet); }
.home-grid > .card:nth-child(3n+1) .card-head h3::before { background: #38BDF8; }
.home-grid > .card:nth-child(3n+2) .card-head h3::before { background: var(--indigo-2); }

/* Coloured icons in side lists and empty pages. */
.box-list button .icon { color: var(--indigo-2); }
.box-list button:nth-child(3n+2) .icon { color: var(--violet); }
.box-list button:nth-child(3n) .icon { color: #0EA5E9; }
.box-list button.active .icon { color: var(--indigo); }
.empty .icon { background: #6366F1; color: #fff; box-shadow: 0 0 0 10px var(--soft); margin-bottom: 8px; }
:root[data-theme=dark] .empty .icon { background: #6366F1; color: #fff; }
.project-card { border-top-width: 6px; border-radius: 14px; }
.card, .person, .box-list { border-radius: 14px; }
.modal { border-radius: 18px; }
.modal > header { background: var(--soft); border-radius: 18px 18px 0 0; }
.modal > header h2, .modal > header h3 { color: var(--indigo); }
:root[data-theme=dark] .modal > header h2, :root[data-theme=dark] .modal > header h3 { color: #E0E7FF; }
.tick { border-color: #A5B4FC; }
.tick:not(:disabled):hover { background: var(--soft); transform: scale(1.12); }
.online { background: #22D3EE; box-shadow: 0 0 0 2px var(--card); border: 0; }

@media (max-width: 720px) {
  #nav > a { padding: 0; border-radius: 12px; }
  #nav > a > .icon { width: 30px; height: 30px; padding: 6px; opacity: .7; }
  #nav > a.active > .icon { opacity: 1; }
  #nav > a.active { background: none; }
  .sheet-box a .icon { color: var(--indigo-2); }
  .page-head h1::before { height: 22px; }
}

/* ---------- phones (1.7.0) ---------- */
/* the app download strip sits above the app; the app takes the rest of the screen */
html.aino-has-strip .app { height: calc(100% - var(--aino-strip, 0px)); }
@supports (height: 100dvh) { html.aino-has-strip .app { height: calc(100dvh - var(--aino-strip, 0px)); } }
html.aino-has-strip .auth { min-height: calc(100% - var(--aino-strip, 0px)); }
@media (max-width: 720px) {
  /* 16px stops phones from zooming in on every field and is easier to read */
  input[type=text], input[type=search], input[type=password], input[type=number], input[type=time], input[type=email],
  input[type=tel], input[type=url], select, textarea, .rich-area, .date-input { font-size: 16px; }
  .tick { width: 28px; height: 28px; }
  .chip button, .file-chip button, .date-clear { min-width: 28px; min-height: 28px; font-size: 18px; }
  .menu button { min-height: 44px; }
  .notif { min-height: 48px; }
  .auth { padding: 14px; align-items: flex-start; padding-top: 8vh; }
  .auth-card { padding: 24px 18px; }
  .auth-card .btn { min-height: 46px; }
}
.ext-accounts:not(:empty) { margin-top: 12px; display: grid; gap: 6px; font-size: 13px; }
.view-sync .card > h2 { padding: 14px 16px 8px; margin: 0; font-size: 15px; }

/* ================= 1.8.1 project board: cheerful colours, dark look by default ================= */
.board-wrap { position: relative; border-radius: 18px; padding: 14px 14px 4px; overflow: hidden; isolation: isolate; }
.board-wrap::before, .board-wrap::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; pointer-events: none; }
.board-wrap::before { width: 340px; height: 340px; inset-inline-end: -120px; top: -160px; }
.board-wrap::after { width: 220px; height: 220px; inset-inline-start: 18%; bottom: -150px; }
.board-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.board-sum { font-weight: 700; font-size: 13px; }
.board { padding-bottom: 14px; }
.board .kcol { --cc: #38BDF8; width: 286px; border-radius: 16px; padding: 10px; border: 0; border-top: 4px solid var(--cc); }
.board .kcol[data-tone="1"] { --cc: #A78BFA; }
.board .kcol[data-tone="2"] { --cc: #22D3EE; }
.board .kcol[data-tone="3"] { --cc: #FBBF24; }
.board .kcol[data-tone="4"] { --cc: #818CF8; }
.board .kcol > header { padding: 4px 6px 6px; }
.board .kcol > header strong { flex: 1; font-size: 14.5px; }
.kcol-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc, var(--indigo-2)); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc, #6366F1) 25%, transparent); }
.board .kcol > header small.kcol-count { flex: none; min-width: 26px; text-align: center; border-radius: 99px; padding: 0 8px; font-weight: 800; font-size: 12px;
  background: var(--cc); color: #1E1B4B; }
.board .kcard { border-radius: 12px; padding: 11px 12px; border-inline-start: 4px solid var(--cc); }
.board .kcard:hover { transform: translateY(-3px) rotate(-.4deg); }
.board .kcard .kcard-title { font-size: 14px; line-height: 1.7; }
.board .kcol.over { box-shadow: 0 0 0 2px var(--cc) inset; }
.board .kcol.add-col { border-top: 0; border-radius: 16px; width: 200px; }
.board .quick-add { border-radius: 10px !important; }

/* Dark look */
.board-wrap.look-dark { background: #14123A; color: #E0E7FF; }
.board-wrap.look-dark::before { background: #2A2470; }
.board-wrap.look-dark::after { background: #12395A; }
.board-wrap.look-dark .board-sum { color: #C7D2FE; }
.board-wrap.look-dark .board-look { background: rgba(255, 255, 255, .08); border-color: rgba(199, 210, 254, .3); color: #E0E7FF; box-shadow: none; }
.board-wrap.look-dark .board-look:hover { background: rgba(255, 255, 255, .16); }
.board.look-dark .kcol { background: rgba(30, 27, 75, .72); backdrop-filter: blur(2px); }
.board.look-dark .kcol > header strong { color: #F1F5FF; }
.board.look-dark .kcard { background: #24205A; color: #E9ECFF; box-shadow: 0 6px 16px rgba(0, 0, 0, .28); }
.board.look-dark .kcard:hover { background: #2C2770; box-shadow: 0 10px 22px rgba(0, 0, 0, .35); }
.board.look-dark .kcard .row-sub, .board.look-dark .kcard .mini { color: #A5B4FC; }
.board.look-dark .kcard .pill.soft { background: rgba(165, 180, 252, .18); color: #C7D2FE; }
.board.look-dark .kcard .avatar { box-shadow: 0 0 0 2px #24205A; }
.board.look-dark .kcard.is-done .kcard-title { color: #8C93C9; }
.board.look-dark .quick-add { color: #E0E7FF; }
.board.look-dark .quick-add::placeholder { color: #A5B4FC; }
.board.look-dark .quick-add:focus { background: rgba(255, 255, 255, .08) !important; }
.board.look-dark .kcol.add-col { background: transparent; border: 2px dashed rgba(199, 210, 254, .35); color: #C7D2FE; }
.board.look-dark .kcol.add-col:hover { background: rgba(255, 255, 255, .06); }
.board.look-dark .icon-btn { color: #C7D2FE; }
.board.look-dark .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.board.look-dark .due:not(.late) { color: #C7D2FE; }
.board.look-dark .due.late { color: #FCA5A5; }

/* Light look: soft lilac board, white cards */
.board-wrap.look-light { background: #EEF0FF; }
.board-wrap.look-light::before { background: #E0E7FF; }
.board-wrap.look-light::after { background: #DDF4FE; }
.board-wrap.look-light .board-sum { color: var(--indigo); }
.board.look-light .kcol { background: rgba(255, 255, 255, .6); }
.board.look-light .kcard { background: #fff; box-shadow: 0 2px 8px rgba(67, 56, 202, .1); }
:root[data-theme=dark] .board-wrap.look-light { background: #1E293B; }
:root[data-theme=dark] .board-wrap.look-light::before { background: #263449; }
:root[data-theme=dark] .board-wrap.look-light::after { background: #1F3A4D; }
:root[data-theme=dark] .board.look-light .kcol { background: rgba(15, 23, 42, .55); }
:root[data-theme=dark] .board.look-light .kcard { background: #263449; }

@media (max-width: 720px) {
  .board-wrap { margin-inline: -4px; padding: 10px 10px 2px; border-radius: 14px; }
  .board .kcol { width: 82vw; max-width: 300px; scroll-snap-align: start; }
  .board { scroll-snap-type: x mandatory; }
}
@media print { .board-wrap { background: none !important; color: inherit !important; } .board-wrap::before, .board-wrap::after, .board-look { display: none; } }

/* ================= 1.8.1 the user's own background (AIno background kit) ================= */
/* The picture shows behind the pages; cards, the top bar and the menu keep their own colours. */
html.aino-bg .main .tabs:not(.mini-tabs) { background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 14px; padding: 4px; width: fit-content; max-width: 100%; box-shadow: 0 2px 10px rgba(15, 23, 42, .08); }
html.aino-bg[data-theme=dark] .main .tabs:not(.mini-tabs) { background: rgba(30, 41, 59, .86); }
html.aino-bg .main label.check { background: rgba(255, 255, 255, .86); border-radius: 10px; padding: 2px 10px; }
html.aino-bg[data-theme=dark] .main label.check { background: rgba(30, 41, 59, .86); }
html.aino-bg-dark .main .page-head h1, html.aino-bg-dark .main .page-head .crumb, html.aino-bg-dark .main .page-head .crumb a,
html.aino-bg-dark .main .page-head .muted, html.aino-bg-dark .main .page-head .sub { color: #F8FAFC; text-shadow: 0 1px 3px rgba(15, 23, 42, .45); }
html.aino-bg-dark .main > .empty, html.aino-bg-dark .main .empty-page { color: #E2E8F0; }
@media print { html.aino-bg .main .tabs, html.aino-bg .main label.check { background: none; box-shadow: none; } }
.act-body header .act-del { width: 28px; height: 28px; opacity: .55; } .act-body header .act-del:hover { opacity: 1; color: var(--red); }
.wl-remove { display: flex; justify-content: flex-end; margin-top: 10px; }
.link-btn.danger { color: var(--red); } .notif-pop header { gap: 10px; }

/* ================= 1.9 several organisations, deletes ================= */
.org-name { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 8px; padding: 4px 8px; }
.org-name:hover { background: rgba(199, 210, 254, .14); color: #fff; }
.org-name.many { background: rgba(199, 210, 254, .12); color: #E0E7FF; font-weight: 600; }
.pill.wait { background: #FEF3C7; color: #92400E; }
:root[data-theme=dark] .pill.wait { background: #78350F; color: #FDE68A; }
.orgs-dialog h4 { margin: 18px 0 6px; }
.org-list { display: grid; gap: 8px; margin-top: 8px; }
.org-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.org-row.current { border-color: var(--indigo-2); background: var(--soft); }
.org-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.org-ic { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: #E0E7FF; color: #4338CA; flex: none; }
:root[data-theme=dark] .org-ic { background: #312E81; color: #C7D2FE; }
.org-reqs { margin-top: 8px; display: grid; gap: 6px; }
.join-code { font: 700 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 3px; direction: ltr; padding: 10px 16px; border-radius: 12px; background: var(--soft); color: var(--indigo); display: inline-block; }
.req-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line2, var(--line)); }
.req-row:last-child { border-bottom: 0; }
.req-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ================= 1.9 a happier page: each section has its own light tint and a few flat colour shapes ================= */
/* Flat colours only (no gradients), AIno palette plus the notes yellow. A background the user picked wins over all of it. */
body { --pg-a: #C7D2FE; --pg-b: #BAE6FD; --pg-c: #FDE68A; }
html:not(.aino-bg) body { background: var(--bg); }
html:not(.aino-bg):not([data-theme=dark]) body { --bg: #ECEFFF; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=chat] { --bg: #E6F8FC; --pg-a: #A5F3FC; --pg-b: #C7D2FE; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=worklist] { --bg: #F1ECFF; --pg-a: #DDD6FE; --pg-b: #BAE6FD; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=tasks] { --bg: #ECEEFF; --pg-a: #C7D2FE; --pg-b: #A5F3FC; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=projects] { --bg: #E8F4FF; --pg-a: #BAE6FD; --pg-b: #DDD6FE; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=letters] { --bg: #F2EEFF; --pg-a: #DDD6FE; --pg-b: #FDE68A; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=notes] { --bg: #FFF8E1; --pg-a: #FDE68A; --pg-b: #A5F3FC; --pg-c: #DDD6FE; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=people] { --bg: #EDF0FF; --pg-a: #C7D2FE; --pg-b: #FDE68A; }
html:not(.aino-bg)[data-theme=dark] body { --bg: #13113A; --pg-a: #312E81; --pg-b: #0C4A6E; --pg-c: #4C1D95; }

/* the shapes sit behind the work area, never behind the top bar or the menu */
.app { position: relative; }
.main { position: relative; isolation: isolate; }
html:not(.aino-bg) .main::before, html:not(.aino-bg) .main::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; transition: background .4s; }
html:not(.aino-bg) .main::before { width: 460px; height: 460px; top: calc(var(--top) - 170px); inset-inline-end: -150px; background: var(--pg-a); opacity: .7; }
html:not(.aino-bg) .main::after { width: 340px; height: 340px; bottom: -140px; inset-inline-start: calc(var(--nav) + 30%); background: var(--pg-b); opacity: .6;
  box-shadow: -520px -260px 0 -110px var(--pg-c); }
html:not(.aino-bg)[data-theme=dark] .main::before, html:not(.aino-bg)[data-theme=dark] .main::after { opacity: .45; }
/* the side menu gets a soft tint of the same family instead of plain white */
html:not(.aino-bg):not([data-theme=dark]) #nav { background: #FAFAFF; }
/* page titles carry the section colour as a little flat tile behind the bar */
html:not(.aino-bg) .page-head h1 { letter-spacing: -.2px; }
@media (max-width: 760px) {
  html:not(.aino-bg) .main::before { width: 300px; height: 300px; top: calc(var(--top) - 120px); inset-inline-end: -120px; }
  html:not(.aino-bg) .main::after { width: 220px; height: 220px; inset-inline-start: 40%; bottom: -100px; box-shadow: none; }
}
@media print { .main::before, .main::after { display: none !important; } body { background: #fff !important; } }

/* 1.10.1: an open people list (or any pop-up inside a page section) must sit above the sections after it.
   Each .page > * has an entrance animation, which gives it its own stacking layer, so later sections
   (e.g. the work-list tabs «در دست من») were painted over the «برای چه کسی؟» list. */
.page > *:focus-within { position: relative; z-index: 15; }
.wl-compose { position: relative; z-index: 6; }

/* ================= 1.11 minutes (صورتجلسه), emoji, organisation logo ================= */
.grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 14px; }
.mn-form .hint .icon { vertical-align: -2px; }
.mn-body-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.mn-body-head label { font-weight: 600; font-size: 13.5px; }
.mn-body-head .grow { flex: 1; }
.btn.live { background: #FEE2E2; color: #B91C1C; border-color: #FCA5A5; }
.mn-sub { margin: 16px 0 2px; }
.mn-items { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mn-item { display: grid; grid-template-columns: 28px 1fr 170px 150px 32px; gap: 8px; align-items: center; width: 100%; }
.mn-num { width: 26px; height: 26px; border-radius: 50%; background: var(--soft); color: var(--indigo); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; }
.mn-list { padding: 4px 0; }
.mn-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.mn-row:last-child { border-bottom: 0; }
.mn-row:hover { background: var(--hover); }
.mn-badge { flex: none; min-width: 74px; text-align: center; padding: 4px 8px; border-radius: 8px; background: #EEF2FF; color: #4338CA; font-weight: 700; font-size: 13px; }
.mn-badge.draft { background: #FEF3C7; color: #92400E; font-weight: 600; }
.mn-counts { display: flex; align-items: center; gap: 10px; flex: none; }
.mn-files { padding: 12px 16px; }
.mn-files h3 { margin: 0 0 8px; font-size: 15px; }
/* the sheet looks like the printed page */
.mn-sheet { background: #fff; color: #1E1B4B; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; max-width: 900px; margin: 0 auto 16px; box-shadow: var(--shadow); }
.mn-head { display: grid; grid-template-columns: 120px 1fr 190px; gap: 16px; align-items: center; border-bottom: 3px solid #4338CA; padding-bottom: 14px; }
.mn-logo { width: 110px; height: 80px; display: grid; place-items: center; }
.mn-logo img { max-width: 110px; max-height: 80px; object-fit: contain; }
.mn-logo-text { width: 64px; height: 64px; border-radius: 16px; background: #4338CA; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.mn-head-mid { text-align: center; }
.mn-org { font-weight: 700; font-size: 15px; color: #475569; }
.mn-head-mid h2 { margin: 6px 0 0; font-size: 26px; font-weight: 800; color: #1E1B4B; letter-spacing: 0; }
.mn-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 13.5px; }
.mn-meta dt { color: #64748B; }
.mn-meta dd { margin: 0; font-weight: 700; }
.mn-info, .mn-dec { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.mn-info th, .mn-info td, .mn-dec th, .mn-dec td { border: 1px solid #CBD5E1; padding: 8px 10px; text-align: start; vertical-align: top; }
.mn-info th { background: #EEF2FF; color: #3730A3; width: 110px; font-weight: 700; white-space: nowrap; }
.mn-dec thead th { background: #4338CA; color: #fff; font-weight: 700; }
.mn-dec td:first-child { width: 44px; text-align: center; }
.mn-dec td:nth-child(3) { width: 150px; } .mn-dec td:nth-child(4) { width: 110px; white-space: nowrap; }
.mn-dec tbody tr:nth-child(even) td { background: #F8FAFF; }
.mn-task { margin-inline-start: 6px; color: #4338CA; vertical-align: -2px; }
.mn-sec { margin-top: 18px; }
.mn-sec h3, .mn-sign h3 { font-size: 15px; margin: 0 0 6px; color: #3730A3; display: flex; align-items: center; gap: 8px; }
.mn-sec h3::before, .mn-sign h3::before { content: ""; width: 6px; height: 16px; border-radius: 3px; background: #22D3EE; }
.mn-sec .rich { line-height: 1.95; }
.mn-sign { margin-top: 22px; }
.mn-sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mn-sign-box { border: 1px dashed #94A3B8; border-radius: 10px; padding: 8px 10px 34px; display: flex; flex-direction: column; font-size: 13px; }
.mn-sign-box small { color: #64748B; }
.mn-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #E2E8F0; color: #64748B; font-size: 12px; }
:root[data-theme=dark] .mn-sheet { box-shadow: none; }
@media (max-width: 720px) {
  .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > :first-child { grid-column: 1 / -1; }
  .mn-item { grid-template-columns: 26px 1fr; } .mn-item > select, .mn-item > .date-input { grid-column: 2; } .mn-item > button { grid-column: 2; justify-self: start; }
  .mn-sheet { padding: 16px; }
  .mn-head { grid-template-columns: 70px 1fr; } .mn-logo { width: 64px; height: 56px; } .mn-logo img { max-width: 64px; max-height: 56px; }
  .mn-meta { grid-column: 1 / -1; grid-template-columns: auto 1fr auto 1fr auto 1fr; }
  .mn-counts .pill { display: none; }
}
@media print {
  body.print-minutes .page > *:not(.mn-sheet) { display: none !important; }
  body.print-minutes .mn-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  body.print-minutes .mn-dec thead th { background: #4338CA !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-minutes .mn-info th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-minutes .mn-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* emoji palette */
.emoji-pop { position: fixed; z-index: 85; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.emoji-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.emoji-tabs button { border: 0; background: none; color: var(--text2); font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.emoji-tabs button.on { background: var(--soft); color: var(--indigo); font-weight: 700; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); max-height: 210px; overflow-y: auto; }
.emoji-grid button { border: 0; background: none; font-size: 22px; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-grid button:hover { background: var(--hover); }
.wl-note .emoji-btn, .composer-row .emoji-btn { flex: none; }
/* organisation logo */
.logo-preview { min-height: 110px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; padding: 14px; margin: 10px 0; background: #fff; }
.logo-preview img { max-width: 220px; max-height: 110px; object-fit: contain; }
body[data-section=minutes] .page-head h1::before { background: #22D3EE; }
html:not(.aino-bg):not([data-theme=dark]) body[data-section=minutes] { --bg: #E9F7FB; --pg-a: #A5F3FC; --pg-b: #DDD6FE; }

/* ---------- 1.12 forms ---------- */
.fb-fields { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.fb-field { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--card); }
.fb-row { display: flex; gap: 8px; align-items: center; }
.fb-row .fb-label { flex: 1; min-width: 0; }
.fb-row select { width: 150px; }
.fb-opts { display: flex; flex-direction: column; gap: 6px; margin: 8px 34px 0 0; }
.fb-opt { display: flex; align-items: center; gap: 8px; }
.fb-opt input { flex: 1; }
.fb-opt i { width: 14px; height: 14px; border: 2px solid var(--edge); flex: none; }
.fb-opt i.dot { border-radius: 50%; } .fb-opt i.box { border-radius: 3px; }
.fb-tools { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.fb-tools .grow, .grow { flex: 1; }
.fb-fill .field { margin-bottom: 14px; }
.fb-fill .req { color: var(--red); margin-inline-start: 3px; }
.fb-choices { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 4px 0; }
.fb-stars { display: inline-flex; gap: 2px; }
.fb-stars button { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--chip); padding: 0 2px; cursor: pointer; }
.fb-stars button.on { color: #F59E0B; }
.fb-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--soft); color: var(--indigo); display: flex; align-items: center; justify-content: center; flex: none; }
.fb-ic.off { background: var(--chip); color: var(--muted); }
.fb-desc, .fb-mine { padding: 14px 16px; margin-bottom: 12px; }
.fb-mine p { margin: 0; display: flex; align-items: center; gap: 6px; }
.fb-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 8px; }
.fb-q { padding: 14px 16px; }
.fb-q header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.fb-q h3 { margin: 0; font-size: 14.5px; }
.fb-bars { display: flex; flex-direction: column; gap: 7px; }
.fb-bar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto 40px; gap: 8px; align-items: center; font-size: 13px; }
.fb-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-bar-track { height: 10px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.fb-bar-track i { display: block; height: 100%; background: var(--indigo-2); border-radius: 99px; }
.fb-big { font-size: 20px; font-weight: 800; color: var(--indigo); margin: 8px 0 0; }
.fb-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fb-nums span { display: flex; flex-direction: column; background: var(--soft); border-radius: 8px; padding: 6px 8px; }
.fb-nums small { color: var(--muted); font-size: 11.5px; } .fb-nums b { font-size: 16px; color: var(--navy); }
.fb-texts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.fb-texts li { background: var(--line2); border-radius: 8px; padding: 6px 10px; }
.fb-table td, .fb-table th { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.fb-table tbody tr { cursor: default; }

/* ---------- 1.12 work report ---------- */
.rp-filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.rp-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.rp-chip { border: 1px solid var(--line); background: var(--card); color: var(--text2); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rp-chip.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.rp-dates { display: inline-flex; gap: 6px; }
.rp-dates .date-input { width: 140px; }
.rp-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.rp-table th, .rp-table td { white-space: nowrap; }
.rp-table th { font-size: 12px; }
.rp-table th.sortable { cursor: pointer; user-select: none; }
.rp-table th.sorted { color: var(--indigo); }
.rp-table td.num { text-align: center; }
.rp-table td.zero { color: var(--edge); font-weight: 400; }
.rp-table td.bad { color: var(--red); }
.rp-name { display: flex; align-items: center; gap: 8px; }
.rp-name > span { display: flex; flex-direction: column; line-height: 1.35; }
.rp-name small { font-size: 11.5px; }
.rp-bar { display: inline-flex; align-items: center; gap: 6px; min-width: 90px; }
.rp-bar i { display: block; height: 8px; background: var(--indigo-2); border-radius: 99px; min-width: 2px; flex: none; max-width: 60px; }
.rp-bar { justify-content: flex-start; }
.rp-rate { display: inline-block; border-radius: 99px; padding: 0 9px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--indigo); }
.rp-rate.good { background: #E0F2FE; color: #0369A1; }
.rp-rate.mid { background: var(--amber-soft); color: var(--amber); }
.rp-rate.low { background: var(--red-soft); color: var(--red); }
.rp-who { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rp-who > div { display: flex; flex-direction: column; }
.rp-range { margin-inline-start: auto; font-size: 12.5px; }
.rp-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.rp-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.rp-group h4 { margin: 0 0 6px; font-size: 13px; color: var(--indigo); }
.rp-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 2px 0; }
.rp-kv b { color: var(--navy); }
.rp-items { list-style: none; margin: 0; padding: 0; }
.rp-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line2); }
.rp-item:last-child { border-bottom: 0; }
.rp-item .row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rp-item a { color: var(--navy); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-item a:hover { color: var(--indigo); }
.rp-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--indigo); flex: none; }
.rp-item.k-task_overdue .rp-ic { background: var(--red-soft); color: var(--red); }
.rp-self { padding: 16px; }
@media (max-width: 720px) {
  .rp-dates { width: 100%; } .rp-dates .date-input { flex: 1; width: auto; }
  .fb-bar { grid-template-columns: 30% 1fr auto; } .fb-bar small { display: none; }
  .fb-nums { grid-template-columns: 1fr 1fr; }
}

/* ---------- 1.13 «آینو» channel ---------- */
.conv-icon.aino { background: #fff; border: 1px solid var(--line); overflow: hidden; }
.conv-icon.aino img { width: 72%; height: 72%; object-fit: contain; }

/* ---------- 1.13 guide ---------- */
.gd-cover { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; margin-bottom: 14px; text-align: center; border-top: 5px solid var(--indigo); }
.gd-logo { height: 56px; margin-bottom: 10px; }
:root[data-theme=dark] .gd-logo { content: url("../img/aino-logo-dark.svg"); }
.gd-cover h1 { margin: 6px 0; font-size: 26px; color: var(--navy); }
.gd-cover p { margin: 0 0 14px; color: var(--muted); }
.gd-actions { display: flex; gap: 8px; justify-content: center; }
.gd-toc-card { padding: 16px 18px; margin-bottom: 14px; }
.gd-toc-card h2 { margin: 0 0 10px; font-size: 16px; }
.gd-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.gd-toc a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; color: var(--navy); text-decoration: none; font-size: 14px; }
.gd-toc a:hover { background: var(--soft); }
.gd-n { width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--indigo); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.gd-sec { padding: 18px 20px; margin-bottom: 12px; scroll-margin-top: 70px; }
.gd-sec header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gd-sec h2 { margin: 0; font-size: 18px; color: var(--navy); }
.gd-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.gd-intro { margin: 0 0 8px; line-height: 2; color: var(--text2); }
.gd-steps { margin: 0; padding-inline-start: 26px; line-height: 2; list-style-type: persian; }
.gd-steps li { padding-inline-start: 4px; }
.gd-steps li::marker { color: var(--indigo); font-weight: 700; }
.gd-tips { margin-top: 10px; background: var(--amber-soft); border-radius: 8px; padding: 8px 12px; }
.gd-tips p { margin: 2px 0; display: flex; gap: 8px; align-items: baseline; line-height: 1.9; color: var(--text); }
.gd-tips svg { color: var(--amber); flex: none; }
@media print {
  .gd-cover { border: 0; padding: 20mm 0 6mm; }
  .gd-sec, .gd-toc-card { break-inside: auto; border: 0; padding: 4mm 0; }
  .gd-sec header { break-after: avoid; }
  .gd-steps li { break-inside: avoid; }
  .gd-ic, .gd-tips, .gd-n { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .gd-toc-card { break-after: page; }
}

/* ---------- 1.14 progress ring, bigger task cards in chat ---------- */
.prog-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.prog-ring svg { position: absolute; inset: 0; }
.prog-track { stroke: var(--line); }
.prog-bar { stroke: var(--indigo-2); transition: stroke-dasharray .3s; }
.prog-bar.full { stroke: #0EA5E9; }
.prog-ring b { position: relative; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -.3px; }
.chat-head .prog-slot { margin-inline-start: 4px; }
.task-card { gap: 14px; padding: 12px 16px; min-width: 300px; max-width: min(560px, 100%); border-inline-start-width: 4px; border-radius: 12px; }
.task-card-text b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 15px; font-weight: 700; line-height: 1.6; }
.task-card-text small { font-size: 12.5px; margin-top: 2px; }
@media (max-width: 720px) { .task-card { min-width: 0; width: 100%; } }

/* ---------- 1.14 activity descriptions ---------- */
.rp-modes { margin-bottom: 10px; }
.rp-acts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; color: var(--navy); }
.rp-acts { padding: 14px 16px; margin-bottom: 12px; }
.rp-acts header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rp-acts header > div { display: flex; flex-direction: column; flex: 1; }
.rp-acts-table td { vertical-align: top; font-size: 13px; }
.rp-acts-table .rp-t { font-weight: 600; min-width: 160px; }
.rp-acts-table .rp-d { color: var(--text2); min-width: 240px; line-height: 1.8; }
@media print {
  .rp-filters, .rp-modes, .page-head .muted { display: none !important; }
  .rp-acts { break-inside: auto; border: 0; padding: 0 0 6mm; }
  .rp-acts-table tr { break-inside: avoid; }
}
@media (max-width: 720px) { .chat-head .prog-slot { display: none; } }

/* ---------- 1.15 messenger ---------- */
button.chat-title { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.chat-title small.typing { color: var(--indigo); font-weight: 600; }
.muted-mark { font-style: normal; font-size: 12px; margin-inline-start: 6px; }
.ticks { letter-spacing: -3px; font-weight: 700; }
.ticks.got { color: var(--muted); }
.views { display: inline-flex; align-items: center; gap: 2px; }
.bubble-wrap { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .bubble-wrap { align-items: flex-end; }
.fwd-label { font-size: 11.5px; color: var(--muted); font-style: italic; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 2px; }
button.quote { border-top: 0; border-bottom: 0; border-inline-end: 0; text-align: start; cursor: pointer; font: inherit; font-size: 12.5px; color: inherit; }
.bubble .star { font-style: normal; font-size: 10px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -6px; padding: 0 8px; position: relative; }
.react-chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; font-size: 14px; line-height: 22px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; box-shadow: 0 1px 2px rgba(30, 27, 75, .08); }
.react-chip small { font-size: 11px; color: var(--text2); }
.react-chip.on { border-color: var(--indigo); background: var(--soft); }
.react-row { display: flex; gap: 2px; padding: 4px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .react-row button { font-size: 19px; padding: 3px 4px; border-radius: 8px; justify-content: center; min-width: 0; width: auto; }
.menu .react-row button.on { background: var(--soft); }
.pin-bar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--card); border-bottom: 1px solid var(--line); color: var(--indigo); }
.pin-bar.hidden { display: none; }
.pin-text { flex: 1; min-width: 0; background: none; border: 0; text-align: start; cursor: pointer; display: flex; flex-direction: column; font: inherit; color: var(--text); line-height: 1.4; }
.pin-text b { font-size: 12px; color: var(--indigo); }
.pin-text span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.flash .bubble { outline: 2px solid var(--indigo); outline-offset: 2px; }
.voice-note { display: flex; align-items: center; gap: 6px; color: var(--indigo); margin: 4px 0; }
.voice-note audio { height: 36px; max-width: 260px; }
.voice-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.voice-bar.hidden { display: none; }
.voice-bar > span { flex: 1; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #DC2626; animation: recblink 1s infinite; }
@keyframes recblink { 50% { opacity: .25; } }
.mic-btn.live { color: #DC2626; }
.fwd-preview { display: flex; gap: 6px; align-items: center; background: var(--soft); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; font-size: 13px; color: var(--text2); }
.fwd-list { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.fwd-list .pick-row, .member-list label.pick-row { cursor: pointer; }
.msg-info .info-msg { background: var(--soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.info-sec h4 { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; font-size: 14px; }
.info-sec h4 small { color: var(--muted); font-weight: 400; }
.ticks.none { color: var(--muted); }
.info-row .grow { flex: 1; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.gallery a { aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--soft); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.starred-row { background: none; border: 0; text-align: start; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.conv-flags { display: inline-flex; align-items: center; gap: 4px; }
.conv-flags i { font-style: normal; font-size: 11px; }
.pin-mark { color: var(--muted); display: inline-flex; }
.badge.quiet { background: var(--muted); }
.mini-tabs .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--indigo); margin-inline-start: 4px; vertical-align: middle; }
.conv-desc { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: 8px 10px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.invite-box { display: flex; flex-direction: column; gap: 6px; }
.invite-box .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.invite-card { max-width: 420px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; }

/* ---------- 1.15 signatures ---------- */
.sign-edit { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sign-edit .label { font-weight: 600; font-size: 13.5px; }
.sign-preview { background: #fff; border: 1px dashed #94A3B8; border-radius: 10px; min-height: 70px; display: grid; place-items: center; padding: 8px; }
.sign-preview img { max-width: 260px; max-height: 110px; object-fit: contain; }
.sign-preview.small img { max-width: 180px; max-height: 70px; }
.fb-sign { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fb-sign-img { max-width: 110px; max-height: 46px; object-fit: contain; background: #fff; border-radius: 4px; }
.mn-sign-box.signed { padding-bottom: 8px; border-style: solid; border-color: #C7D2FE; }
.mn-sign-img { max-width: 100%; height: 64px; object-fit: contain; margin: 6px 0 2px; align-self: center; }
.mn-sign-date { font-size: 11.5px; }
.fb-sheet { margin: 0; box-shadow: none; }
@media print {
  body.print-sheet > *:not(.sheet-overlay) { display: none !important; }
  body.print-sheet .sheet-overlay { position: static; background: none; padding: 0; display: block; }
  body.print-sheet .sheet-overlay .modal { box-shadow: none; max-width: none; width: auto; max-height: none; border: 0; overflow: visible; }
  body.print-sheet .sheet-overlay .modal > header, body.print-sheet .no-print { display: none !important; }
  body.print-sheet .mn-sheet { border: 0; padding: 0; }
  body.print-sheet .mn-info th, body.print-sheet .mn-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* 1.15.1 signature pad */
.sign-pad-box { display: flex; flex-direction: column; gap: 6px; position: relative; }
.sign-pad { width: 100%; height: 200px; background: #fff; border: 1px dashed #94A3B8; border-radius: 12px; touch-action: none; cursor: crosshair; }
.sign-pad-line { height: 0; border-top: 1px solid #CBD5E1; margin: -46px 24px 40px; pointer-events: none; }
.sign-preview { background-image: linear-gradient(45deg, #F1F5F9 25%, transparent 25%, transparent 75%, #F1F5F9 75%), linear-gradient(45deg, #F1F5F9 25%, transparent 25%, transparent 75%, #F1F5F9 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }

/* ---------- 1.16 phone bottom bar: every section, scrolled sideways ---------- */
@media (max-width: 720px) {
  #nav { position: relative; z-index: 6; background: var(--card); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; justify-content: flex-start; }
  html:not(.aino-bg):not([data-theme=dark]) #nav { background: #FAFAFF; }
  #nav::-webkit-scrollbar { display: none; }
  #nav a.extra { display: flex; }
  #nav a.extra.hidden, #nav a.hidden, #nav-more { display: none !important; }
  #nav > a { flex: 0 0 auto; min-width: 72px; max-width: 96px; scroll-snap-align: center; padding: 4px 6px; }
  #nav > a span { flex: none; overflow: hidden; text-overflow: ellipsis; max-width: 88px; }
  #nav > a > .icon { width: 30px; height: 30px; padding: 6px; }
  #nav > a.active { background: var(--soft); }
  /* the soft background shapes stay above the bar, not behind its icons */
  html:not(.aino-bg) .main::after { bottom: -60px; }
}
/* 1.16: a people list is never narrower than a readable name */
.pick-list { min-width: min(280px, calc(100vw - 32px)); }
@media (max-width: 720px) {
  .wl-send { flex-wrap: wrap; }
  .wl-send .wl-to { flex: 1 1 100%; order: -1; }
  .wl-send .btn.primary { flex: 1; }
  .wl-to .pick-list { inset-inline: 0; min-width: 100%; max-height: 50vh; }
}
/* 1.16 paper minutes */
.mn-mode { margin-bottom: 6px; }
.mn-mode button { display: inline-flex; align-items: center; gap: 6px; }
.mn-paper-box.hidden { display: none; }
.mn-paper { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.mn-paper img { width: 100%; max-width: 820px; border: 1px solid #E2E8F0; border-radius: 6px; background: #fff; }
@media print { .mn-paper img { border: 0; max-height: 23cm; object-fit: contain; } }

/* ---------- 1.16 cheerful welcome card (flat, warm, by time of day) ---------- */
:root:not([data-theme=dark]) .hero { color: #1E1B4B; box-shadow: 0 10px 24px rgba(30, 27, 75, .10); border: 0; }
:root:not([data-theme=dark]) .hero h1 { color: #1E1B4B; display: flex; align-items: center; gap: 10px; }
:root:not([data-theme=dark]) .hero-date, :root:not([data-theme=dark]) .day-text small { color: #5B4A2E; }
:root:not([data-theme=dark]) .hero-line { color: #2E2A4F; }
:root:not([data-theme=dark]) .ring-track { stroke: rgba(30, 27, 75, .12); }
:root:not([data-theme=dark]) .ring-arc { stroke: #F97316; }
:root:not([data-theme=dark]) .hero-ring.full .ring-box b { color: #EA580C; }
:root:not([data-theme=dark]) .hero.mood-morning { background: #FFF0CF; }
:root:not([data-theme=dark]) .hero.mood-morning .hero-shape.a { background: #FFC857; }
:root:not([data-theme=dark]) .hero.mood-morning .hero-shape.b { background: #FF8C69; }
:root:not([data-theme=dark]) .hero.mood-morning .hero-shape.c { background: #FFE08A; }
:root:not([data-theme=dark]) .hero.mood-noon { background: #DDF1FF; }
:root:not([data-theme=dark]) .hero.mood-noon .hero-shape.a { background: #7DD3FC; }
:root:not([data-theme=dark]) .hero.mood-noon .hero-shape.b { background: #FDBA74; }
:root:not([data-theme=dark]) .hero.mood-noon .hero-shape.c { background: #FDE68A; }
:root:not([data-theme=dark]) .hero.mood-evening { background: #FFE4D6; }
:root:not([data-theme=dark]) .hero.mood-evening .hero-shape.a { background: #FB923C; }
:root:not([data-theme=dark]) .hero.mood-evening .hero-shape.b { background: #F472B6; }
:root:not([data-theme=dark]) .hero.mood-evening .hero-shape.c { background: #FCD34D; }
:root:not([data-theme=dark]) .hero.mood-night { background: #ECE6FF; }
:root:not([data-theme=dark]) .hero.mood-night .hero-shape.a { background: #C4B5FD; }
:root:not([data-theme=dark]) .hero.mood-night .hero-shape.b { background: #FBCFE8; }
:root:not([data-theme=dark]) .hero.mood-night .hero-shape.c { background: #FDE68A; }
.hero-shape.c { width: 64px; height: 64px; inset-inline-start: 38%; top: -26px; opacity: .9; }
.hero-sun { font-size: 30px; line-height: 1; display: inline-block; animation: sunbob 3s ease-in-out infinite; }
@keyframes sunbob { 50% { transform: translateY(-3px) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .hero-sun { animation: none; } }
.hero-cheer { margin-top: 4px; font-size: 14px; font-weight: 600; color: #C2410C; }
:root[data-theme=dark] .hero-cheer { color: #FDBA74; }
:root[data-theme=dark] .hero-shape.c { background: #F59E0B; opacity: .5; }
.stat:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-icon { transition: transform var(--t-mid, .2s) var(--ease, ease); }
@media (max-width: 720px) { .hero-shape.c { display: none; } }

/* 1.16: seeing several organisations together */
.org-ticks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 14px; background: var(--card, #fff); border: 1px solid var(--line, #E2E8F0); }
.org-ticks-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); font-size: 13px; }
.org-tick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--chip); cursor: pointer; font-size: 13px; }
.org-tick input { accent-color: #4338CA; margin: 0; }
.org-tick:has(input:checked) { background: #E0E7FF; color: #3730A3; font-weight: 600; }
:root[data-theme=dark] .org-tick:has(input:checked) { background: #312E81; color: #E0E7FF; }
.org-tick.current { cursor: default; }
.pill.org-pill { background: #FFEDD5; color: #9A3412; }
:root[data-theme=dark] .pill.org-pill { background: #7C2D12; color: #FED7AA; }
.combined-head h2 { margin: 0 0 4px; font-size: 18px; color: var(--navy, #1E1B4B); }
.combined-head p { margin: 0; }
.org-sum .row-title { display: inline-flex; gap: 8px; align-items: center; }
.notif .notif-app { align-self: flex-start; margin-bottom: 3px; }
