/* ── Admin and unit-manager screens ── */
.adm-hero { border-radius: 30px; padding: 22px 20px 18px; margin-bottom: 14px; box-shadow: var(--shadow-lg); border: 1px solid rgba(233, 196, 106, .22); }
.adm-hero h1 { font-family: var(--serif); font-size: 2rem; line-height: 1.1; margin: 12px 0 4px; font-weight: 700; }
.adm-hero p { margin: 0; color: rgba(245, 239, 230, .78); font-size: .92rem; }
.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.kpi { border-radius: 16px; padding: 10px 4px 8px; text-align: center; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 240, 210, .14); min-width: 0; }
.kpi b { display: block; font-family: var(--serif); font-size: 1.6rem; line-height: 1.05; color: #f6dfa4; }
.kpi span { display: block; font-size: .66rem; color: rgba(245, 239, 230, .75); line-height: 1.25; }
.kpi.warn b { color: #ff9fbc; }

.tabs { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 5px; margin-bottom: 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.tabs-blob { position: absolute; top: 5px; bottom: 5px; right: 5px; width: calc((100% - 10px) / var(--n)); border-radius: 17px; background: var(--gala); box-shadow: 0 8px 18px rgba(34, 18, 63, .3); transform: translateX(calc(var(--i) * -100%)); transition: transform .45s cubic-bezier(.3, 1.25, .5, 1); }
.tabs button { position: relative; z-index: 1; min-width: 0; border: 0; background: none; padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .76rem; font-weight: 500; color: var(--ink-2); transition: color .3s; }
.tabs button .duo { width: 21px; height: 21px; }
.tabs button.on { color: #f6dfa4; }

.adm-loading { display: flex; justify-content: center; gap: 8px; padding: 40px 0; }
.adm-loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: bob 1s ease-in-out infinite; }
.adm-loading span:nth-child(2) { animation-delay: .15s; }
.adm-loading span:nth-child(3) { animation-delay: .3s; }

.adm-tools .search { margin-bottom: 10px; }
.adm-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 12px; }
.adm-actions .btn { padding: 10px 12px; font-size: .9rem; min-width: 0; }
.adm-actions .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-body .chips { flex-wrap: wrap; margin: 0 0 12px; }
.adm-body .chips::-webkit-scrollbar { display: none; }
.adm-body .chip { white-space: nowrap; flex: none; }
.chip em { font-style: normal; font-size: .72rem; opacity: .75; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 999px; padding: 0 7px; }

.adm-row.off { opacity: .6; }
.adm-row.off .av { filter: grayscale(1); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tags:empty { display: none; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: .66rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.gold { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold-deep); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.tag.plum { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.tag.soft { background: var(--surface-2); color: var(--ink-2); border: 1px dashed color-mix(in srgb, var(--ink-3) 50%, transparent); }
.tag.mute { background: var(--surface-2); color: var(--ink-3); }
.adm-date { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 48px; padding: 5px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.adm-date b { font-family: var(--serif); font-size: 1.25rem; line-height: 1.05; color: var(--gold-deep); }
.adm-date small { font-size: .62rem; color: var(--ink-2); }
.nodate { display: flex; flex-direction: column; align-items: center; color: var(--rose); }
.nodate svg { width: 18px; height: 18px; }
.nodate small { color: var(--rose); font-size: .62rem; }
:root[data-theme="dark"] .tag.gold, :root[data-theme="dark"] .adm-date b, :root[data-theme="dark"] .var { color: #e9c46a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.gold, :root:not([data-theme="light"]) .adm-date b, :root:not([data-theme="light"]) .var { color: #e9c46a; } }

/* sheets */
.sheet-icon { width: 54px; height: 54px; margin: 10px auto 0; border-radius: 18px; display: grid; place-items: center; background: var(--gala); color: #f6dfa4; box-shadow: 0 12px 26px rgba(34, 18, 63, .35); }
.sheet-icon svg { width: 28px; height: 28px; }
.sheet-lead { text-align: center; color: var(--ink-2); font-size: .88rem; margin: -6px 8px 16px; line-height: 1.55; }
.emp-head { display: flex; align-items: center; gap: 14px; margin: 10px 0 16px; }
.emp-head > div { min-width: 0; }
.emp-head h3 { margin: 0; font-family: var(--serif); font-size: 1.45rem; line-height: 1.15; overflow-wrap: anywhere; }
.emp-head small { color: var(--ink-2); font-size: .78rem; }
.sheet-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.sheet-sec h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: .95rem; }
.sheet-sec h4 svg { width: 19px; height: 19px; color: var(--gold); }
.danger-zone .btn-danger.armed { background: #c22d55; color: #fff; }
.role-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px; padding-inline-start: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; font-weight: 500; max-width: 100%; }
.role-chip .av { margin-inline-start: -8px; }
.role-chip button { width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--rose) 12%, transparent); color: var(--rose); flex: none; }
.role-chip button svg { width: 14px; height: 14px; }
.role-add { display: flex; flex-wrap: wrap; gap: 8px; }
.role-add .input { flex: 1 1 150px; min-width: 0; }
.role-add .btn { flex: none; min-height: 50px; }
.hint { display: block; font-size: .76rem; color: var(--ink-2); line-height: 1.5; margin: 8px 4px 0; }
.small { font-size: .84rem; }

/* import */
.steps { margin: 0 0 6px; padding-inline-start: 22px; font-size: .9rem; line-height: 1.6; }
.steps li::marker { color: var(--gold); font-weight: 700; }
.imp-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0 10px; }
.imp-actions .link-btn { display: inline-flex; align-items: center; gap: 4px; }
.imp-actions .link-btn svg { width: 16px; height: 16px; }
.imp-text { min-height: 120px; resize: vertical; font-size: .9rem; line-height: 1.5; }
.imp-sum { display: flex; gap: 14px; margin: 12px 4px 8px; font-size: .86rem; font-weight: 600; }
.imp-sum span { display: inline-flex; align-items: center; gap: 4px; }
.imp-sum svg { width: 16px; height: 16px; }
.imp-sum .ok { color: #1f8a55; }
.imp-sum .bad { color: var(--rose); }
.imp-list { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; }
.imp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .84rem; }
.imp-row:first-child { border-top: 0; }
.imp-row.bad { background: color-mix(in srgb, var(--rose) 7%, transparent); }
.imp-n { min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.imp-n small { color: var(--ink-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; }
.imp-s { flex: none; font-size: .78rem; color: var(--ink-2); text-align: end; max-width: 45%; }
.imp-row.bad .imp-s { color: var(--rose); font-weight: 600; }

/* units */
.unit-tree { padding: 6px; overflow: hidden; }
.unit-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: start; padding: 10px; padding-inline-start: calc(10px + var(--d) * 22px); border-radius: 16px; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 50ms); transition: background .2s; }
.unit-row:hover { background: var(--surface-2); }
.unit-row + .unit-row { border-top: 1px solid var(--line); }
.unit-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--accent); border: 1px solid var(--line); }
.unit-ic svg { width: 21px; height: 21px; }
.unit-row .faces { display: flex; flex: none; }
.unit-row .faces .av { margin-inline-start: -8px; box-shadow: 0 0 0 2px var(--surface); border-radius: 50%; }
.unit-row .faces .av:first-child { margin-inline-start: 0; }
.unit-row .row-sub { white-space: normal; }
.admin-list { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); border-radius: 999px; padding: 3px; padding-inline-end: 14px; font-weight: 500; font-size: .9rem; max-width: 100%; }
.admin-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rules */
.mail-status { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 4px; flex-wrap: wrap; }
.mail-status .row-main { flex: 1 1 180px; }
.mail-status b { display: block; font-size: .96rem; }
.mail-status small { display: block; color: var(--ink-2); font-size: .8rem; line-height: 1.45; }
.mail-status small.bad { color: var(--rose); font-weight: 500; }
.ms-ic { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.ms-ic svg { width: 21px; height: 21px; }
.mail-status.ok .ms-ic { background: color-mix(in srgb, #1f8a55 14%, transparent); color: #1f8a55; }
.mail-status.warn { background: color-mix(in srgb, var(--gold) 9%, var(--surface)); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.mail-status.warn .ms-ic { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-deep); }
.btn.sm { min-height: 38px; padding: 7px 14px; font-size: .84rem; }
.rtrack { padding: 36px 30px 14px; }
.rt-line { position: relative; height: 4px; border-radius: 999px; background: linear-gradient(to left, color-mix(in srgb, var(--accent) 18%, transparent), var(--gold)); }
.rt-cake { position: absolute; left: -17px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gala); color: #f6dfa4; box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 25%, transparent), 0 8px 18px rgba(34, 18, 63, .3); z-index: 2; }
.rt-cake .duo { width: 19px; height: 19px; }
.rt-dot { position: absolute; top: 50%; left: var(--x); transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 1; }
.rt-dot i { width: 14px; height: 14px; border-radius: 50%; background: var(--gold-grad); background-size: 200% 100%; box-shadow: 0 0 0 3px var(--surface), 0 0 14px rgba(233, 196, 106, .8); animation: pulse-dot 2.4s ease-in-out infinite; }
.rt-dot small { position: absolute; bottom: 18px; font-size: .7rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.rt-legend { display: flex; justify-content: space-between; margin: 16px -14px 0; font-size: .7rem; color: var(--ink-3); }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 3px var(--surface), 0 0 22px rgba(233, 196, 106, 1); transform: scale(1.12); } }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { padding: 14px 16px; cursor: pointer; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); transition: transform .2s, opacity .3s; position: relative; overflow: hidden; }
.rule::before { content: ''; position: absolute; inset-block: 0; right: 0; width: 4px; background: var(--gold-grad); }
.rule:hover { transform: translateY(-2px); }
.rule.off { opacity: .6; }
.rule.off::before { background: var(--ink-3); }
.rule-top { display: flex; align-items: center; gap: 12px; }
.rule-when { flex: none; width: 58px; height: 58px; border-radius: 18px; background: var(--gala); color: #f6dfa4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rule-when b { font-family: var(--serif); font-size: 1.5rem; line-height: 1; }
.rule-when b .duo { width: 22px; height: 22px; display: block; }
.rule-when small { font-size: .56rem; color: rgba(245, 239, 230, .8); white-space: nowrap; }
.rule-to { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.rule-subj { margin-top: 8px; font-size: .86rem; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 8px 12px; overflow-wrap: anywhere; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { position: relative; cursor: pointer; }
.pchip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pchip span { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: .86rem; font-weight: 500; transition: .2s; }
.pchip span svg { width: 0; height: 15px; transition: width .2s; }
.pchip input:checked + span { background: var(--gala); color: #f6dfa4; border-color: rgba(233, 196, 106, .4); }
.pchip input:checked + span svg { width: 15px; }
.pchip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.pchip.soon { opacity: .55; cursor: default; }
.pchip em { font-style: normal; font-size: .66rem; background: var(--gold-grad); color: #2a1a05; padding: 0 6px; border-radius: 999px; }
textarea.input { resize: vertical; line-height: 1.55; }
.vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 2px 14px; }
.vars small { color: var(--ink-2); font-size: .76rem; }
.var { border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); background: color-mix(in srgb, var(--gold) 8%, transparent); color: var(--gold-deep); border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 600; }
.mail-prev { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.mp-bar { display: flex; align-items: center; gap: 5px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mp-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); opacity: .4; }
.mp-bar span { margin-inline-start: auto; font-size: .7rem; color: var(--ink-3); }
.mp-head { padding: 14px 16px; }
.mp-head small { display: block; font-size: .68rem; letter-spacing: .1em; color: #f6dfa4; }
.mp-head b { display: block; font-family: var(--serif); font-size: 1.15rem; margin-top: 2px; overflow-wrap: anywhere; }
.mp-body { padding: 14px 16px 16px; font-size: .92rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* logs */
.log { padding: 4px 6px; }
.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 10px; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
.log-row + .log-row { border-top: 1px solid var(--line); }
.log-dot { width: 10px; height: 10px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.log-dot.ok { background: #1f8a55; box-shadow: 0 0 0 4px color-mix(in srgb, #1f8a55 14%, transparent); }
.log-dot.bad { background: var(--rose); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rose) 14%, transparent); }
.log-text { display: block; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.log-text b { font-weight: 600; }
.log-row small { display: block; font-size: .74rem; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }

@media (max-width: 360px) {
  .adm-hero { padding: 18px 14px 14px; }
  .adm-hero h1 { font-size: 1.7rem; }
  .adm-kpis { gap: 5px; }
  .kpi b { font-size: 1.3rem; }
  .kpi span { font-size: .58rem; }
  .nav a { font-size: .62rem; }
  .tabs button { font-size: .7rem; }
}
.section-head .more { display: inline-flex; align-items: center; gap: 4px; }
.section-head .more svg { width: 16px; height: 16px; flex: none; }
.imp-text { white-space: pre; overflow-x: auto; tab-size: 14; }

/* join requests */
.req-card { padding: 14px 14px 6px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: color-mix(in srgb, var(--gold) 7%, var(--surface)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 10%, transparent), var(--shadow); }
.req-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.req-head b { display: block; font-family: var(--serif); font-size: 1.15rem; }
.req-head small { display: block; color: var(--ink-2); font-size: .78rem; line-height: 1.45; }
.req-ic { position: relative; flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--gala); color: #f6dfa4; animation: wiggle 3s ease-in-out infinite; }
.req-ic .duo { width: 24px; height: 24px; }
.req-ic i { position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--rose); color: #fff; font-style: normal; font-size: .7rem; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.req-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.req-row .row-main { flex: 1 1 150px; }
.req-av { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; background: var(--soft); color: var(--accent); border: 1px solid var(--line); }
.req-btns { display: flex; gap: 6px; flex: none; margin-inline-start: auto; }
.req-btns .btn-ghost { border: 1px solid var(--line); }
.req-btns .btn-ghost.armed { background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose); }
.row-name .job { font-weight: 400; color: var(--ink-2); font-size: .8rem; }
/* Emails sit on their own line, right-aligned like the Hebrew around them, and end in "…" when too long */
.row-sub.email { text-align: right; unicode-bidi: plaintext; }
.demo-box { margin-bottom: 14px; }

/* Unit page: quick actions, its people and sub-units */
.unit-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 4px 0 2px; }
.unit-actions .btn { min-height: 46px; }
.unit-members { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 18px; padding: 4px; background: var(--surface); }
.um-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; border: 0; background: none; text-align: start; padding: 8px 10px; border-radius: 14px; color: inherit; font: inherit; cursor: pointer; }
.um-row:hover { background: var(--surface-2); }
.um-row + .um-row { border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.um-row .row-main { flex: 1; min-width: 0; display: grid; }
.um-row .row-name { font-weight: 600; overflow-wrap: anywhere; }
.um-row .row-sub { font-size: .8rem; color: var(--ink-2); }
.um-row .tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex: 0 1 auto; }
.um-row .unit-ic { flex: none; }
.role-chip .role-kind { font-style: normal; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-deep, #8a6420); }
:root[data-theme="dark"] .role-chip .role-kind { color: #f6dfa4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .role-chip .role-kind { color: #f6dfa4; } }
.adm-tools .unit-filter { display: block; width: 100%; margin-bottom: 10px; }
.adm-row .row-name { white-space: normal; overflow-wrap: anywhere; }
