/* מקדמים סטודיו: the look of the afters calculator (user, 2026-11-03) in the Mekadmim colors: a pale aqua page with soft
   turquoise / sky glows, white borderless cards (28px corners, soft teal shadow), turquoise gradient buttons, deep petrol
   panels for the header and the heroes with the brand mint (#92FFBE) as their accent. Brand gradient: #318EB9 → #92FFBE. */
:root {
  --bg: #e8f5f3; --surface: #ffffff; --surface-2: #eef8f6; --surface-3: #e2f2ef; --ink: #0b2b36; --muted: #5b7a83; --line: #d6ebe8;
  --accent: #0c7f84; --accent-soft: #daf3ef; --mint: #92ffbe; --sky: #318eb9;
  --grad: linear-gradient(135deg, #14a296 0%, #0c7f84 52%, #22679f 100%);
  --grad-brand: linear-gradient(120deg, #318eb9 0%, #3fbfb0 55%, #92ffbe 100%);
  --grad-deep: linear-gradient(150deg, #125068 0%, #0b3242 55%, #061c27 100%);
  --glow-1: #c3f1e3; --glow-2: #cde7fa; --glow-3: #d9f8e8;
  --shadow: 0 1px 2px rgba(8, 60, 70, .05), 0 14px 34px -16px rgba(12, 110, 120, .28);
  --shadow-lift: 0 2px 4px rgba(8, 60, 70, .06), 0 26px 50px -20px rgba(12, 110, 120, .42);
  --good: #12805a; --good-soft: #def4ea; --bad: #b8322a; --bad-soft: #fbe7e5; --warn: #8a5d06; --warn-soft: #fbf0d6;
  --t-podcast: #12a39a; --t-lecture: #2f86d0; --t-hub: #21a874;
  --r-admin: #0b3242; --r-partner: #0c7f84; --r-employee: #2f78bd; --r-client: #6c8790;
  --body: 'Rubik', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  --r: 28px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #061a22; --surface: #0c2833; --surface-2: #113543; --surface-3: #16404f; --ink: #e5faf5; --muted: #8fb5bb; --line: #1b4452;
  --accent: #5fe0c8; --accent-soft: #123f44; --glow-1: #0b3b3d; --glow-2: #0a2c45; --glow-3: #0c3a33;
  --shadow: 0 14px 34px -18px rgba(0, 0, 0, .6); --shadow-lift: 0 26px 50px -20px rgba(0, 0, 0, .75);
  --good: #4fd39b; --good-soft: #12382a; --bad: #ff8a80; --bad-soft: #3a1714; --warn: #f2c25a; --warn-soft: #3a2c10;
  --r-admin: #92ffbe; --r-client: #9db4ba; --r-employee: #6fb4f0; --r-partner: #5fe0c8;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #061a22; --surface: #0c2833; --surface-2: #113543; --surface-3: #16404f; --ink: #e5faf5; --muted: #8fb5bb; --line: #1b4452;
  --accent: #5fe0c8; --accent-soft: #123f44; --glow-1: #0b3b3d; --glow-2: #0a2c45; --glow-3: #0c3a33;
  --shadow: 0 14px 34px -18px rgba(0, 0, 0, .6); --shadow-lift: 0 26px 50px -20px rgba(0, 0, 0, .75);
  --good: #4fd39b; --good-soft: #12382a; --bad: #ff8a80; --bad-soft: #3a1714; --warn: #f2c25a; --warn-soft: #3a2c10;
  --r-admin: #92ffbe; --r-client: #9db4ba; --r-employee: #6fb4f0; --r-partner: #5fe0c8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; direction: rtl;
  background:
    radial-gradient(900px 520px at 100% -8%, var(--glow-1) 0%, transparent 62%),
    radial-gradient(760px 480px at -6% 38%, var(--glow-2) 0%, transparent 60%),
    radial-gradient(700px 420px at 60% 110%, var(--glow-3) 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-orb { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0%, var(--mint) 30%, #3fbfb0 60%, rgba(49, 142, 185, 0) 72%);
  animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.82); opacity: .6; } }

/* ---------------------------------------------------------------- shell */
.wrap { max-width: 1240px; margin: 0 auto; padding-block: 18px 60px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 18px; }

/* the deep petrol panels re-scope the tokens so everything inside reads light-on-dark */
.deep {
  --ink: #ffffff; --muted: #b5d6da; --surface: #134a5c; --surface-2: rgba(255, 255, 255, .1); --line: rgba(255, 255, 255, .14);
  --accent: var(--mint); --accent-soft: rgba(146, 255, 190, .16); --good: var(--mint); --bad: #ff9fb0;
  color: var(--ink); position: relative; isolation: isolate; overflow: hidden; border-radius: var(--r);
  background:
    radial-gradient(circle at 12% -20%, rgba(63, 191, 176, .75) 0%, transparent 46%),
    radial-gradient(circle at 96% 120%, rgba(146, 255, 190, .22) 0%, transparent 40%), var(--grad-deep);
  box-shadow: 0 24px 48px -24px rgba(6, 60, 80, .7);
}
.deep::after { content: ""; position: absolute; z-index: -1; width: 190px; height: 190px; border-radius: 50%; left: 20%; top: -82px;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #b8f5e6 16%, #3fbfb0 46%, rgba(49, 142, 185, 0) 72%); opacity: .5; pointer-events: none; }
.deep::before { content: ""; position: absolute; z-index: -1; width: 58px; height: 58px; border-radius: 50%; left: -14px; bottom: -20px;
  background: radial-gradient(circle at 35% 30%, #f1fff6 0%, var(--mint) 45%, rgba(146, 255, 190, 0) 72%); opacity: .85; pointer-events: none; }

header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 18px 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.brand-mark svg { width: 20px; height: 20px; margin-inline-start: 3px; }
.brand-text { display: grid; line-height: 1.1; }
.brand-text b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { font-size: 12.5px; color: var(--muted); }
.brand-logo { height: 15px; width: auto; display: block; margin-bottom: 4px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 0; background: rgba(255, 255, 255, .1); color: #d3ecec; padding: 8px 17px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  text-decoration: none; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.tab svg { width: 16px; height: 16px; opacity: .85; }
.tab:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.tab[aria-current="page"] { background: var(--mint); color: #062a33; }
.tab[aria-current="page"] svg { opacity: 1; }

.me-box { display: flex; align-items: center; gap: 10px; position: relative; }
.me-btn { display: flex; align-items: center; gap: 10px; border: 0; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 5px 5px 5px 14px;
  cursor: pointer; color: inherit; text-align: right; }
.me-btn:hover { background: rgba(255, 255, 255, .16); }
.me-btn .who { display: grid; line-height: 1.15; }
.me-btn .who b { font-size: 14px; }
.me-btn .who small { font-size: 12px; color: var(--muted); }
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; min-width: 220px; padding: 8px; border-radius: 20px; background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-lift); display: grid; gap: 2px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  text-align: right; color: var(--ink); text-decoration: none; font-size: 14.5px; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu svg { width: 17px; height: 17px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* ---------------------------------------------------------------- cards & controls */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card h2, .sec-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 18px; padding: 4px 6px 0; }
.page-head h1 { margin: 0; font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background .15s, transform .15s, filter .15s, box-shadow .15s;
  white-space: nowrap; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgba(12, 127, 132, .9); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.mint { background: var(--mint); color: #062a33; }
.btn.mint:hover { background: #b2ffd2; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 6px 14px; font-size: 13.5px; }
.btn.big { padding: 13px 26px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 12px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-weight: 400; font-size: 12.5px; }
input[type=text], input[type=password], input[type=search], input[type=email], select, textarea {
  width: 100%; border: 1.5px solid transparent; border-radius: 14px; padding: 11px 14px; background: var(--surface-2); color: var(--ink); font-size: 15px;
  transition: border-color .15s, background .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[aria-invalid="true"] { border-color: var(--bad); }
input.ltr { direction: ltr; text-align: right; }
.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.note { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.note b { color: var(--ink); }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.role-chip { --rc: var(--r-client); background: color-mix(in srgb, var(--rc) 13%, transparent); color: var(--rc); }
.role-chip.r-admin { --rc: var(--r-admin); } .role-chip.r-partner { --rc: var(--r-partner); } .role-chip.r-employee { --rc: var(--r-employee); }
.deep .role-chip { background: rgba(146, 255, 190, .16); color: var(--mint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.avatar { --ac: var(--r-client); flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 70%, #fff), var(--ac)); }
.avatar.r-admin { --ac: #0b3242; } .avatar.r-partner { --ac: #0c7f84; } .avatar.r-employee { --ac: #2f78bd; }
.avatar.sm { width: 32px; height: 32px; border-radius: 11px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 21px; }
.me-btn .avatar { background: var(--grad-brand); color: #062a33; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 4px 12px -6px rgba(8, 60, 70, .35); }
.seg .n { font-size: 12px; background: var(--surface-3); border-radius: 999px; padding: 0 7px; color: var(--muted); }

.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; background: var(--surface-3); cursor: pointer; flex: none;
  transition: background .18s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--grad); }
.switch[aria-checked="true"]::after { transform: translateX(-18px); }
.switch[disabled] { cursor: not-allowed; opacity: .55; }
.switch.busy { opacity: .6; }

/* ---------------------------------------------------------------- home */
.hero { padding: 28px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: end; }
.hero h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; }
.hero h1 .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out 1; }
@keyframes wave { 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } 50% { transform: none; } }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero .chips .chip { background: rgba(255, 255, 255, .1); color: #d7f0ee; }
.hero .stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mini { background: rgba(255, 255, 255, .09); border-radius: 18px; padding: 12px 16px; min-width: 112px; }
.mini b { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; color: #fff; }
.mini b.mint { color: var(--mint); }
.mini span { font-size: 12.5px; color: var(--muted); }

.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.app-card { --tone: var(--t-podcast); position: relative; isolation: isolate; overflow: hidden; display: grid; gap: 14px; align-content: start;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 14%, var(--surface)) 0, var(--surface) 170px);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; transition: transform .2s, box-shadow .2s; }
.app-card.t-sky { --tone: var(--t-lecture); }
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.app-card::after { content: ""; position: absolute; z-index: -1; width: 220px; height: 220px; border-radius: 50%; left: -60px; top: -90px;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone) 28%, transparent) 0%, transparent 70%); pointer-events: none; }
.app-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.app-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 55%, #fff) 0%, var(--tone) 55%, color-mix(in srgb, var(--tone) 70%, #000) 100%);
  box-shadow: 0 14px 26px -12px color-mix(in srgb, var(--tone) 85%, transparent); }
.app-icon svg { width: 30px; height: 30px; }
.app-card h3 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.app-card .desc { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.can { display: flex; flex-wrap: wrap; gap: 6px; }
.can .chip { background: color-mix(in srgb, var(--tone) 11%, var(--surface)); color: color-mix(in srgb, var(--tone) 75%, var(--ink)); }
.can .chip.home { background: var(--surface-2); color: var(--muted); }
.app-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.app-foot .btn.primary { background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 80%, #fff) 0%, color-mix(in srgb, var(--tone) 82%, #000) 100%);
  box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--tone) 90%, transparent); }
.app-foot .btn svg { transform: scaleX(1); }
.status { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.status.on { color: var(--good); }
.app-soon { border: 2px dashed var(--line); background: transparent; box-shadow: none; display: grid; place-items: center; text-align: center; color: var(--muted);
  border-radius: var(--r); padding: 24px; min-height: 220px; }
.app-soon .plus { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--surface-2); }
.app-soon .plus svg { width: 24px; height: 24px; }
.app-soon b { color: var(--ink); display: block; font-size: 16px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { border-radius: 22px; padding: 14px 16px; background: var(--surface-2); }
.kpi b { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi.k1 { background: color-mix(in srgb, var(--r-admin) 9%, var(--surface)); }
.kpi.k2 { background: color-mix(in srgb, var(--r-partner) 12%, var(--surface)); }
.kpi.k3 { background: color-mix(in srgb, var(--r-employee) 12%, var(--surface)); }
.kpi.k4 { background: color-mix(in srgb, var(--t-hub) 12%, var(--surface)); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 6px; border-radius: 14px; }
.feed li:hover { background: var(--surface-2); }
.feed .ev-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.feed .ev-ic svg { width: 16px; height: 16px; }
.feed .ev-ic.bad { background: var(--bad-soft); color: var(--bad); }
.feed .ev-ic.good { background: var(--good-soft); color: var(--good); }
.feed .txt { min-width: 0; font-size: 14px; }
.feed .txt small { display: block; color: var(--muted); font-size: 12.5px; }
.feed time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }

/* ---------------------------------------------------------------- users */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 260px; }
.ulist { display: grid; gap: 4px; }
.urow { display: grid; grid-template-columns: 40px minmax(0, 1.5fr) auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 10px;
  border-radius: 18px; cursor: pointer; border: 0; background: none; text-align: right; width: 100%; color: inherit; }
.urow:hover { background: var(--surface-2); }
.urow .nm { min-width: 0; }
.urow .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .nm small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .apps-ic { display: flex; gap: 5px; }
.app-dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--t-podcast); }
.app-dot.t-sky { background: var(--t-lecture); }
.app-dot svg { width: 15px; height: 15px; }
.app-dot.off { background: var(--surface-3); color: var(--muted); opacity: .6; }
.urow .seen { font-size: 12.5px; color: var(--muted); text-align: left; white-space: nowrap; }

/* ---------------------------------------------------------------- dialogs */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(4, 24, 32, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; overflow-x: hidden; background: var(--surface); border-radius: 30px; box-shadow: var(--shadow-lift);
  padding: 24px 26px; animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 21px; font-weight: 700; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.dialog-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin-top: 18px; }

.role-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.role-opt { border: 0; text-align: right; padding: 12px 14px; border-radius: 18px; background: var(--surface-2); cursor: pointer; display: grid; gap: 2px; color: inherit; }
.role-opt b { font-size: 15px; }
.role-opt span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.role-opt[aria-pressed="true"] { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -12px rgba(12, 127, 132, .9); }
.role-opt[aria-pressed="true"] span { color: rgba(255, 255, 255, .82); }

.link-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 16px; padding: 8px 8px 8px 8px; }
.link-box code { flex: 1; min-width: 0; direction: ltr; text-align: left; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }
.success-ic { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 12px; background: var(--good-soft); color: var(--good); }
.success-ic svg { width: 30px; height: 30px; }
.msg-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 18px; padding: 12px 14px; font-size: 13.5px; color: var(--muted); }
.btn.wa { background: #25d366; color: #063b1c; }
.btn.wa:hover { background: #4ae083; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 4px 0 14px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; }
.actions-list { display: grid; gap: 8px; }

/* ---------------------------------------------------------------- permissions */
.legend { display: flex; flex-wrap: wrap; gap: 10px; }
.role-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.role-card { border-radius: 22px; padding: 16px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 8px; align-content: start; }
.role-card .rc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-card .rc-head b { font-size: 17px; }
.role-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.role-card .apps-ic { display: flex; gap: 6px; flex-wrap: wrap; }
.matrix-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table.matrix { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
.matrix th, .matrix td { padding: 10px 10px; text-align: center; vertical-align: middle; }
.matrix thead th { font-size: 13px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
.matrix thead th .role-chip { font-size: 13px; }
.matrix th.pname, .matrix td.pname { text-align: right; width: 46%; }
.matrix tbody tr:not(.grp) td { border-top: 1px solid var(--line); }
.matrix td.pname b { font-weight: 600; font-size: 14.5px; display: block; }
.matrix td.pname small { color: var(--muted); font-size: 12.5px; display: block; line-height: 1.4; }
.matrix tr.grp td { padding-top: 20px; text-align: right; }
.matrix tr.grp .grp-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.matrix tr.grp .app-dot { width: 32px; height: 32px; border-radius: 11px; }
.matrix tr.grp .app-dot.t-hub { background: var(--t-hub); }
.matrix tr.home-row td { opacity: .78; }
.matrix td.inactive .switch[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 35%, var(--surface-3)); }
.cell { display: inline-grid; place-items: center; gap: 2px; }
.cell .lock { font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.cell .lock svg { width: 11px; height: 11px; }
.fixed-on { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.fixed-on svg { width: 15px; height: 15px; }
.home-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 2px 9px; margin-inline-start: 6px; }
.home-tag svg { width: 12px; height: 12px; }
.idle-sel { width: auto; padding: 7px 10px; font-size: 13px; border-radius: 12px; }
.col-pick { display: none; margin-bottom: 8px; }
@media (max-width: 640px) {
  .col-pick { display: inline-flex; }
  table.matrix { min-width: 0; }
  .matrix th[class^="c-"], .matrix td[class^="c-"] { display: none; }
  .matrix.pick-client .c-client, .matrix.pick-employee .c-employee, .matrix.pick-partner .c-partner, .matrix.pick-admin .c-admin { display: table-cell; }
  .matrix th.pname, .matrix td.pname { width: auto; }
}

/* ---------------------------------------------------------------- activity */
.day-head { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 6px 4px; }
.app-tag { font-size: 11.5px; border-radius: 999px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); margin-inline-start: 6px; }
.app-tag.podcast { background: color-mix(in srgb, var(--t-podcast) 14%, var(--surface)); color: color-mix(in srgb, var(--t-podcast) 80%, var(--ink)); }
.app-tag.lecture { background: color-mix(in srgb, var(--t-lecture) 14%, var(--surface)); color: color-mix(in srgb, var(--t-lecture) 80%, var(--ink)); }

/* ---------------------------------------------------------------- account */
.acct { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile b { font-size: 20px; display: block; }

/* ---------------------------------------------------------------- sign-in screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; padding: 18px;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.auth-side { padding: 40px 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; min-height: 0; }
.auth-side::after { width: 340px; height: 340px; left: -90px; top: -120px; }
.auth-side::before { width: 96px; height: 96px; left: -22px; bottom: -26px; }
.auth-side .brand-logo { height: 22px; }
.auth-side h1 { margin: 0; font-size: clamp(30px, 4.2vw, 48px); line-height: 1.08; font-weight: 700; letter-spacing: -.02em; max-width: 12ch; }
.auth-side h1 em { font-style: normal; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-side p { color: var(--muted); font-size: 16px; max-width: 34ch; margin: 14px 0 0; }
.floaters { display: flex; gap: 12px; flex-wrap: wrap; }
.floater { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 18px; background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); font-weight: 600; font-size: 14px; animation: float 6s ease-in-out infinite; }
.floater:nth-child(2) { animation-delay: -2s; } .floater:nth-child(3) { animation-delay: -4s; }
.floater .app-dot { width: 32px; height: 32px; border-radius: 11px; }
@keyframes float { 50% { transform: translateY(-6px); } }
.auth-main { display: grid; place-items: center; padding: 20px 8px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { margin: 0 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); }
.pw { position: relative; }
.pw input { padding-left: 46px; }
.pw .icon-btn { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); }
.back-to { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.back-to .app-dot { width: 30px; height: 30px; }
.auth-foot { margin-top: 22px; font-size: 13.5px; color: var(--muted); text-align: center; }
.strength { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.strength i { display: block; height: 100%; border-radius: 99px; background: var(--grad-brand); transition: width .2s; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: max(18px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px;
  width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { background: #0b3242; color: #fff; border-radius: 18px; padding: 12px 16px; box-shadow: 0 18px 36px -14px rgba(0, 0, 0, .5); display: flex; gap: 10px;
  align-items: center; font-size: 14.5px; animation: rise .2s ease-out; }
.toast svg { width: 18px; height: 18px; color: var(--mint); flex: none; }
.toast.bad svg { color: #ff9fb0; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .grid-2, .acct { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 6px; }
  .auth-side { padding: 26px 24px; gap: 18px; }
  .auth-side h1 { font-size: 30px; }
  .auth-side .floaters { display: none; }
}
@media (max-width: 640px) {
  header.top { padding: 14px 16px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 7px 13px; font-size: 14px; flex: none; }
  .me-btn .who { display: none; }
  .me-btn { padding: 4px; }
  .hero { padding: 22px 20px; }
  .card { padding: 18px 16px; }
  .apps { grid-template-columns: minmax(0, 1fr); }
  .urow { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .urow .apps-ic, .urow .seen { display: none; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .toolbar input[type=search] { max-width: none; }
  .dialog { padding: 20px 18px; border-radius: 26px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
