/* ==========================================================================
   MY-Card — Editorial app system (logged-in user + admin pages)
   Restyles the shared shell markup (_sidebar.html, _admin_sidebar.html,
   _mobile_bottom_nav.html) when the page opts in with <body class="ed">,
   and adds the app components every dashboard page composes from.
   Load after editorial.css.
   ========================================================================== */

/* ---------- Shell ---------- */
.ed .dash-shell { background: var(--paper); grid-template-columns: 272px minmax(0, 1fr); position: relative; z-index: 2; }
.ed .dash-main { min-width: 0; }

.ed .dash-sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  padding: 22px 16px 16px;
  gap: 18px;
  scrollbar-width: thin;
}
.ed .dash-sidebar__logo { display: inline-flex; align-items: center; gap: 0.55rem; padding: 4px 10px 14px; border-bottom: 1px solid var(--rule); font-family: var(--serif); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.ed .dash-sidebar__mark { width: 26px; height: 26px; color: var(--brand); }
.ed .dash-sidebar__logo-sub { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.22em; color: var(--accent); opacity: 1; margin-left: 2px; }
.ed .dash-sidebar__close { border: 1px solid var(--rule); color: var(--ink-2); border-radius: 50%; width: 36px; height: 36px; background: transparent; }
.ed .dash-sidebar__nav { display: grid; gap: 2px; align-content: start; }
.ed .dash-sidebar__label { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); padding: 14px 12px 6px; }
.ed .dash-sidebar__link {
  position: relative; display: flex; align-items: center; gap: 0.75rem;
  padding: 10px 12px; border-radius: 10px;
  font-family: var(--sans); font-size: 0.93rem; font-weight: 450; color: var(--ink-2);
  background: transparent; border: 0;
  transition: background 0.2s, color 0.2s;
}
.ed .dash-sidebar__link i, .ed .dash-sidebar__link svg { width: 18px; height: 18px; color: var(--ink-3); transition: color 0.2s; }
.ed .dash-sidebar__link:hover { background: color-mix(in oklab, var(--ink) 5%, transparent); color: var(--ink); }
.ed .dash-sidebar__link:hover i, .ed .dash-sidebar__link:hover svg { color: var(--ink); }
.ed .dash-sidebar__link.is-active { background: var(--surface); color: var(--ink); font-weight: 560; box-shadow: var(--lift-1); }
.ed .dash-sidebar__link.is-active i, .ed .dash-sidebar__link.is-active svg { color: var(--accent); }
.ed .dash-sidebar__link.is-active::before { content: ''; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: none; }
.ed .dash-sidebar__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-family: var(--mono); font-size: 0.68rem; display: inline-grid; place-items: center; }
.ed .dash-sidebar__foot { margin-top: auto; display: grid; gap: 12px; border-top: 0; padding-top: 0; }
.ed .dash-sidebar__upsell { display: grid; gap: 6px; padding: 16px; border-radius: 14px; background: var(--brand-deep, #0D1729); color: #EDE9E0; border: 0; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
html[data-ed-theme="dark"] .ed .dash-sidebar__upsell { background: #1B2B47; }
.ed .dash-sidebar__upsell:hover { transform: translateY(-2px); box-shadow: var(--lift-2); }
.ed .dash-sidebar__upsell-title { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: #D8B878; }
.ed .dash-sidebar__upsell-body { color: #C4C8D2; font-size: 0.82rem; line-height: 1.45; }
.ed .dash-sidebar__upsell-cta { color: #D8B878; font-weight: 560; font-size: 0.85rem; }
.ed .dash-sidebar__profile { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); }
.ed .dash-sidebar__avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-family: var(--serif); font-size: 1rem; border: 0; flex-shrink: 0; }
.ed .dash-sidebar__name { color: var(--ink); font-weight: 560; font-size: 0.9rem; }
.ed .dash-sidebar__plan { color: var(--accent); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; }
.ed .dash-sidebar__profile-actions { display: flex; gap: 2px; }
.ed .dash-sidebar__profile-actions .mc-icon-btn, .ed .dash-sidebar__profile-actions button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); border: 0; background: transparent; }
.ed .dash-sidebar__profile-actions button:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 6%, transparent); }
.ed .dash-sidebar__profile-actions svg, .ed .dash-sidebar__profile-actions i { width: 16px; height: 16px; }

.ed .dash-topbar { background: color-mix(in oklab, var(--paper) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); padding: 10px 16px; }
.ed .dash-topbar__logo { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--serif); font-size: 1.15rem; font-weight: 500; color: var(--ink); }
.ed .dash-topbar__logo svg { width: 22px; height: 22px; color: var(--brand); }
.ed .dash-menu-toggle { border: 1px solid var(--rule); color: var(--ink); border-radius: 50%; background: transparent; }
.ed .dash-scrim { background: rgba(10, 14, 22, 0.35); }

/* ---------- Admin palette: "Graphite & Garnet" ----------
   The whole operator console (shell + page) re-maps the editorial tokens so it
   is unmistakably different from the customer app: cool stone paper, graphite
   brand, garnet accent, graphite sidebar, and an "ADMIN" strip on top.
   Components keep using tokens, so they re-colour automatically. */
.ed .dash-shell--admin {
  --paper:    #ECEEF1;
  --paper-2:  #E1E4E9;
  --surface:  #F8F9FA;
  --ink:      #12151B;
  --ink-2:    #444A55;
  --ink-3:    #737A86;
  --rule:     rgba(18, 21, 27, 0.13);
  --rule-2:   rgba(18, 21, 27, 0.06);
  --brand:      #232A36;
  --brand-deep: #161B24;
  --on-brand:   #F8F9FA;
  --tint:       #F1E3E5;
  --accent:     #9E2B3A;
  --mc-accent:  #9E2B3A;
  background: var(--paper);
  color: var(--ink);
}
html[data-ed-theme="dark"] .ed .dash-shell--admin {
  --paper:    #0E1116;
  --paper-2:  #141821;
  --surface:  #181D27;
  --ink:      #E8EAEE;
  --ink-2:    #AEB4BF;
  --ink-3:    #7D8492;
  --rule:     rgba(232, 234, 238, 0.12);
  --rule-2:   rgba(232, 234, 238, 0.06);
  --brand:      #E36B7A;
  --brand-deep: #0A0D12;
  --on-brand:   #0E1116;
  --tint:       rgba(227, 107, 122, 0.12);
  --accent:     #E36B7A;
  --mc-accent:  #E36B7A;
}
.ed .dash-shell--admin .dash-sidebar {
  background: #161B24; border-right-color: rgba(232, 234, 238, 0.08);
  --ink: #EDEFF3; --ink-2: #B3B9C4; --ink-3: #858C99; --rule: rgba(232, 234, 238, 0.1);
  --surface: #232A36; --brand: #E36B7A; --on-brand: #161B24; --accent: #E36B7A; --lift-1: none;
}
html[data-ed-theme="dark"] .ed .dash-shell--admin .dash-sidebar { background: #0A0D12; }
.ed .dash-shell--admin .dash-sidebar__avatar { background: #9E2B3A; color: #fff; }
.ed .dash-shell--admin .dash-sidebar__mark { color: #E36B7A; }
.ed .dash-shell--admin .dash-sidebar__logo::after {
  content: 'ADMIN'; margin-left: auto; padding: 2px 7px; border-radius: 4px;
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.18em; color: #fff; background: #9E2B3A;
}
.ed .dash-shell--admin .dash-main { position: relative; }
.ed .dash-shell--admin .dash-main::before {
  /* thin garnet strip + label pinned to the top of every admin page */
  content: 'OPERATOR CONSOLE'; display: block; position: sticky; top: 0; z-index: 16;
  height: 26px; line-height: 26px; padding: 0 clamp(18px, 4vw, 48px);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em; color: #fff;
  background: linear-gradient(90deg, #9E2B3A, #7A1F2C);
}
.ed .dash-shell--admin .dash-topbar { top: 26px; }
.ed .dash-shell--admin .ed-panel--deep, .ed .dash-shell--admin .ed-panel--deep * { --accent: #E36B7A; --brand: #E36B7A; }
.ed .dash-shell--admin .ed-panel--deep { background: #161B24; border-color: #161B24; }

/* Mobile bottom nav */
.ed .mnav { background: color-mix(in oklab, var(--surface) 94%, transparent); border-top: 1px solid var(--rule); box-shadow: 0 -10px 30px -18px rgba(16, 19, 26, 0.35); }
.ed .mnav__tab { color: var(--ink-3); font-family: var(--sans); font-weight: 500; }
.ed .mnav__tab.is-active { color: var(--ink); }
.ed .mnav__tab.is-active::before { background: var(--accent); }
.ed .mnav__tab:active { background: color-mix(in oklab, var(--ink) 6%, transparent); }
.ed .mnav__fab { background: var(--brand); color: var(--on-brand); box-shadow: var(--lift-2); }
.ed .mnav__badge { background: var(--accent); color: #fff; }

/* ---------- Sidebar: primary "New card" + group labels ---------- */
.ed .dash-sidebar__new {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 44px; border-radius: 12px; background: var(--brand); color: var(--on-brand);
  font-weight: 560; font-size: 0.92rem; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.ed .dash-sidebar__new:hover { transform: translateY(-1px); box-shadow: var(--lift-2); }
.ed .dash-sidebar__new svg, .ed .dash-sidebar__new i { width: 17px; height: 17px; }
.ed .dash-sidebar__nav .dash-sidebar__label:first-child { padding-top: 4px; }

/* ---------- Desktop app bar ---------- */
.ed-appbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 clamp(18px, 4vw, 48px);
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(12px); -webkit-backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.ed .dash-shell--admin .ed-appbar { top: 26px; }
.ed-appbar__search {
  display: inline-flex; align-items: center; gap: 0.6rem; width: min(420px, 45vw); height: 40px; padding: 0 8px 0 14px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink-3); font-size: 0.9rem; text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ed-appbar__search:hover { border-color: color-mix(in oklab, var(--ink) 30%, transparent); box-shadow: var(--lift-1); }
.ed-appbar__search svg, .ed-appbar__search i { width: 16px; height: 16px; }
.ed-appbar__search span { flex: 1; }
.ed-appbar__kbd { font-family: var(--mono); font-size: 0.7rem; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink-3); }
.ed-appbar__right { display: flex; align-items: center; gap: 8px; }
.ed-appbar__bell { position: relative; }
.ed-appbar__dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 0.64rem; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper); }
.dash-topbar__actions { display: flex; align-items: center; gap: 6px; }
.dash-topbar__actions .ed-iconbtn { width: 38px; height: 38px; }
@media (max-width: 960px) { .ed-appbar { display: none; } }
/* Height of whatever is pinned to the top of the app column (app bar, plus
   the operator strip on admin). Page-level sticky elements offset by this. */
.ed .dash-main { --appbar-h: 64px; }
.ed .dash-shell--admin .dash-main { --appbar-h: 90px; }
@media (max-width: 960px) { .ed .dash-main, .ed .dash-shell--admin .dash-main { --appbar-h: 0px; } }

/* ---------- Command palette ---------- */
.ed-cmdk { position: fixed; inset: 0; z-index: 3500; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.ed-cmdk[hidden] { display: none; }
.ed-cmdk__scrim { position: absolute; inset: 0; background: rgba(10, 14, 22, 0.38); backdrop-filter: blur(4px); animation: edFade 0.2s ease-out both; }
.ed-cmdk__box { position: relative; width: min(600px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--lift-3); overflow: hidden; animation: edPop 0.25s var(--ease) both; }
.ed-cmdk__input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.ed-cmdk__input svg, .ed-cmdk__input i { width: 18px; height: 18px; }
.ed-cmdk__input input { flex: 1; border: 0; outline: 0; background: transparent; font-family: var(--sans); font-size: 1.02rem; color: var(--ink); }
.ed-cmdk__list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.ed-cmdk__list li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 0.94rem; color: var(--ink-2); }
.ed-cmdk__list li svg, .ed-cmdk__list li i { width: 17px; height: 17px; color: var(--ink-3); }
.ed-cmdk__list li[hidden] { display: none; }
.ed-cmdk__list li.is-active { background: var(--tint); color: var(--ink); }
.ed-cmdk__list li.is-active svg, .ed-cmdk__list li.is-active i { color: var(--accent); }
.ed-cmdk__empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .ed-cmdk__scrim, .ed-cmdk__box { animation: none; } }

/* ---------- Page scaffold ---------- */
.ed-app { padding: clamp(24px, 4vw, 48px) clamp(18px, 4vw, 48px) 96px; max-width: 1280px; width: 100%; margin: 0 auto; display: grid; gap: 28px; align-content: start; }
.ed-app__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.ed-app__head > div:not(.ed-app__actions) { display: grid; gap: 10px; }
.ed-app__title { font-family: var(--serif); font-weight: 380; font-variation-settings: 'opsz' 96; font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.ed-app__title em { font-style: italic; color: var(--accent); font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1; }
.ed-app__lede { color: var(--ink-2); max-width: 52ch; }
.ed-app__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ed:lang(bn) .ed-app__title { letter-spacing: 0; line-height: 1.25; font-weight: 500; }
.ed:lang(bn) .ed-app__title em { font-style: normal; }

.ed-grid { display: grid; gap: 16px; }
.ed-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ed-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }

/* Panel */
.ed-panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; padding: 22px; display: grid; gap: 16px; align-content: start; min-width: 0; }
.ed-panel--flush { padding: 0; overflow: hidden; }
.ed-panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ed-panel__title { font-family: var(--serif); font-weight: 450; font-size: 1.25rem; letter-spacing: -0.012em; color: var(--ink); }
.ed-panel__sub { font-size: 0.86rem; color: var(--ink-3); }
.ed-panel--deep { background: #0D1729; border-color: #0D1729; color: #EDE9E0;
  --ink: #F2EEE5; --ink-2: #BCC0CB; --ink-3: #8C93A3; --rule: rgba(242,238,229,0.12); --brand: #D8B878; --on-brand: #0D1729; --accent: #D8B878; --surface: #16243D; --tint: rgba(216,184,120,0.12); }
html[data-ed-theme="dark"] .ed-panel--deep { background: #16243D; }

/* Stat tiles */
.ed-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 18px; background: var(--surface); overflow: hidden; }
.ed-tile { padding: 20px 22px; display: grid; gap: 6px; align-content: start; border-left: 1px solid var(--rule); min-width: 0; }
.ed-tile:first-child { border-left: 0; }
.ed-tile__label { display: flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.ed-tile__label svg, .ed-tile__label i { width: 14px; height: 14px; }
.ed-tile__value { font-family: var(--serif); font-weight: 380; font-size: clamp(1.9rem, 3vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.05; color: var(--ink); font-variation-settings: 'opsz' 144; }
.ed-tile__value small { font-size: 0.5em; color: var(--ink-3); letter-spacing: 0; }
.ed-tile__foot { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--ink-3); }
.ed-tile__foot svg, .ed-tile__foot i { width: 14px; height: 14px; }
.ed-delta { display: inline-flex; align-items: center; gap: 0.2rem; padding: 1px 7px; border-radius: 999px; font-family: var(--mono); font-size: 0.72rem; }
.ed-delta--up { background: color-mix(in oklab, #2F7A4F 14%, transparent); color: #2F7A4F; }
.ed-delta--down { background: color-mix(in oklab, #B3402A 14%, transparent); color: #B3402A; }
.ed-delta--flat { background: var(--paper-2); color: var(--ink-3); }
html[data-ed-theme="dark"] .ed-delta--up { color: #7FC79C; }
html[data-ed-theme="dark"] .ed-delta--down { color: #E48D78; }

/* Sparkline (inline SVG bars, drawn server-side) */
.ed-spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin-top: 6px; }
.ed-spark span { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: color-mix(in oklab, var(--accent) 35%, transparent); transform-origin: bottom; }
.ed-spark span:nth-last-child(-n+7) { background: var(--accent); }
.js .ed-spark span { animation: edBar 0.9s var(--ease) both; animation-delay: calc(var(--i) * 40ms + 200ms); }
@keyframes edBar { from { transform: scaleY(0); } }

/* Badges */
.ed-badge { display: inline-flex; align-items: center; gap: 0.35rem; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 520; border: 1px solid var(--rule); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.ed-badge svg, .ed-badge i { width: 12px; height: 12px; }
.ed-badge--live { color: #2F7A4F; border-color: color-mix(in oklab, #2F7A4F 30%, transparent); background: color-mix(in oklab, #2F7A4F 8%, transparent); }
.ed-badge--live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: edPulse 2s ease-in-out infinite; }
.ed-badge--off { color: #B3402A; border-color: color-mix(in oklab, #B3402A 30%, transparent); background: color-mix(in oklab, #B3402A 8%, transparent); }
.ed-badge--brass { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 35%, transparent); background: var(--tint); }
.ed-badge--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
html[data-ed-theme="dark"] .ed-badge--live { color: #7FC79C; }
html[data-ed-theme="dark"] .ed-badge--off { color: #E48D78; }
@keyframes edPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Callout / banner */
.ed-callout { display: flex; align-items: center; gap: 16px 20px; flex-wrap: wrap; padding: 18px 20px; border-radius: 16px; border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent); background: var(--tint); }
.ed-callout__ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); flex-shrink: 0; }
.ed-callout__body { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.ed-callout__body strong { font-family: var(--serif); font-weight: 450; font-size: 1.12rem; color: var(--ink); }
.ed-callout__body p { font-size: 0.9rem; color: var(--ink-2); }

/* Meter */
.ed-meter { display: grid; gap: 6px; }
.ed-meter__top { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-3); }
.ed-meter__top b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.ed-meter__bar { height: 4px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.ed-meter__bar span { display: block; height: 100%; width: var(--v); border-radius: inherit; background: var(--accent); transform-origin: left; }
.js .ed-meter__bar span { animation: edGrow 1.2s var(--ease) both 0.3s; }
@keyframes edGrow { from { transform: scaleX(0); } }

/* List / feed */
.ed-feed { display: grid; }
.ed-feed__item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.ed-feed__item:first-child { border-top: 0; }
.ed-feed__ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--accent); }
.ed-feed__ico svg, .ed-feed__ico i { width: 16px; height: 16px; }
.ed-feed__body { display: grid; gap: 1px; min-width: 0; }
.ed-feed__body strong { font-weight: 520; font-size: 0.92rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-feed__body span { font-size: 0.8rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-feed__time { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; }

/* Table */
.ed-table-app { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ed-table-app th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--ink); background: var(--surface); position: sticky; top: 0; }
.ed-table-app td { padding: 13px 16px; border-bottom: 1px solid var(--rule); color: var(--ink-2); vertical-align: middle; }
.ed-table-app tr:hover td { background: color-mix(in oklab, var(--ink) 2.5%, transparent); }
.ed-table-app td strong { color: var(--ink); font-weight: 560; }
.ed-scroll-x { overflow-x: auto; }

/* Forms */
.ed-input, .ed select, .ed .ed-form input[type="text"], .ed .ed-form input[type="email"], .ed .ed-form input[type="password"], .ed .ed-form input[type="number"], .ed .ed-form input[type="url"], .ed .ed-form input[type="tel"], .ed .ed-form input[type="date"], .ed .ed-form textarea, .ed .ed-form select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ed .ed-form textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.55; }
.ed-input:focus, .ed .ed-form :is(input, textarea, select):focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 12%, transparent); }
.ed .ed-form label, .ed-label { display: grid; gap: 6px; font-size: 0.84rem; font-weight: 520; color: var(--ink-2); }
.ed-help { font-size: 0.8rem; color: var(--ink-3); }
.ed-error { font-size: 0.82rem; color: #B3402A; }

/* Empty state */
.ed-empty { display: grid; justify-items: center; text-align: center; gap: 12px; padding: clamp(40px, 7vw, 80px) 24px; border: 1px dashed var(--rule); border-radius: 22px; background: var(--surface); }
.ed-empty__art { width: 180px; margin-bottom: 8px; }
.ed-empty h2 { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; letter-spacing: -0.02em; color: var(--ink); }
.ed-empty p { color: var(--ink-2); max-width: 44ch; }

/* Small helpers */
.ed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-muted { color: var(--ink-3); }
.ed-iconlink { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 520; color: var(--ink); }
.ed-iconlink svg, .ed-iconlink i { width: 16px; height: 16px; }
.ed-btn--danger { --b-fg: #B3402A; --b-bd: color-mix(in oklab, #B3402A 35%, transparent); }
.ed-btn--danger:hover { --b-bg: #B3402A; --b-fg: #fff; --b-bd: #B3402A; }
.ed-btn svg, .ed-btn i { width: 16px; height: 16px; }
.ed-btn--icon { width: 40px; padding: 0; }

/* Staggered entrance for app pages */
.js .ed-rise { animation: edRise 0.8s var(--ease) both; animation-delay: calc(var(--d, 0) * 80ms); }
@keyframes edRise { from { opacity: 0; transform: translateY(14px); } }

@media (max-width: 1100px) {
  .ed-grid--main { grid-template-columns: 1fr; }
  .ed-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-tile:nth-child(3) { border-left: 0; }
  .ed-tile:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 960px) {
  .ed .dash-shell { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ed-grid--2, .ed-grid--3 { grid-template-columns: 1fr; }
  .ed-app__actions { width: 100%; }
  .ed-app__actions .ed-btn { flex: 1; }
  .ed-panel:not(.ed-panel--flush) { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .ed-rise, .js .ed-spark span, .js .ed-meter__bar span, .ed-badge--live::before { animation: none; }
}

/* ---------- Mobile comfort (app shell) ---------- */
.ed .mnav__tab { font-size: 0.75rem; }
@media (pointer: coarse) {
  .ed .dash-sidebar__link { min-height: 48px; }
  .ed .dsh-card__actions .ed-btn, .ed .ed-app__actions .ed-btn { min-height: 44px; }
  .ed .ad-act, .ed .ad-rowact button, .ed .ad-rowact a { min-width: 44px; min-height: 44px; }
  .ed select { min-height: 44px; }
  .ed input[type="checkbox"], .ed input[type="radio"] { width: 22px; height: 22px; }
}
@media (max-width: 640px) {
  .ed .ed-tile__label, .ed .ed-meter__top, .ed .ed-help, .ed .ed-feed__time, .ed .ed-badge { font-size: 0.75rem; }
  .ed .ed-app { padding-bottom: 120px; }
}
@media (max-width: 640px) {
  /* page-level micro-labels (analytics, billing, scanner) */
  .ed .an-strip__k, .ed .an-sub, .ed .an-heat__day, .ed .bl-label,
  .ed .us-stage__rec, .ed .us-stage__meta, .ed .us-vf__sub { font-size: 0.75rem; }
}
@media (pointer: coarse) {
  .ed .dsh-log summary, .ed .ed-iconlink { min-height: 44px; }
}

/* ---------- Sidebar: never let the profile box overlap the nav ----------
   The sidebar is a 100vh flex column; without this the nav could be squeezed
   below its content height on short screens and the links slid under the
   footer. Children keep their size and the sidebar itself scrolls. */
.ed .dash-sidebar > * { flex-shrink: 0; }
.ed .dash-sidebar__nav { overflow: visible; flex: 0 0 auto; }
.ed .dash-sidebar__foot { margin-top: auto; padding-top: 12px; }
@media (max-height: 820px) {
  .ed .dash-sidebar { gap: 12px; padding-top: 16px; }
  .ed .dash-sidebar__link { padding-top: 8px; padding-bottom: 8px; }
  .ed .dash-sidebar__label { padding-top: 10px; }
}
.ed a.dash-sidebar__avatar, .ed a.dash-sidebar__name { text-decoration: none; }
.ed a.dash-sidebar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed a.dash-sidebar__name:hover { color: var(--accent); }

/* ---------- Workspace switcher (personal ↔ team) ---------- */
.ed .dash-ws { position: relative; flex-shrink: 0; }
.ed .dash-ws > summary { list-style: none; display: grid; grid-template-columns: 34px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.ed .dash-ws > summary::-webkit-details-marker { display: none; }
.ed .dash-ws > summary:hover, .ed .dash-ws[open] > summary { border-color: color-mix(in oklab, var(--ink) 25%, transparent); box-shadow: var(--lift-1); }
.ed .dash-ws__mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; background: var(--ws, var(--brand)); color: #fff; font-family: var(--serif); font-size: 0.86rem; }
.ed .dash-ws__mark img { width: 100%; height: 100%; object-fit: cover; }
.ed .dash-ws__mark--me { border-radius: 50%; background: var(--tint); color: var(--accent); }
.ed .dash-ws__text { display: grid; min-width: 0; line-height: 1.2; }
.ed .dash-ws__text strong { font-size: 0.88rem; font-weight: 580; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed .dash-ws__text small { font-size: 0.72rem; color: var(--ink-3); }
.ed .dash-ws__chev { width: 15px; height: 15px; color: var(--ink-3); }
.ed .dash-ws__menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 2px; padding: 6px; border-radius: 16px; border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--lift-3); }
.ed .dash-ws__label { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px 4px; }
.ed .dash-ws__item { display: grid; grid-template-columns: 34px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.ed .dash-ws__item:hover { background: var(--paper-2); }
.ed .dash-ws__item.is-on { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.ed .dash-ws__item > svg { width: 15px; height: 15px; color: var(--accent); }

/* Phones: the bottom tab bar stays, but the full sidebar (workspace switcher,
   team pages, billing, devices…) opens as a drawer from the menu button. */
@media (max-width: 720px) {
  .ed .dash-menu-toggle { display: grid !important; place-items: center; width: 40px; height: 40px; }
  .ed .dash-sidebar { display: flex !important; position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(300px, 86vw); height: 100dvh; transform: translateX(-105%); transition: transform 0.35s var(--ease); overflow-y: auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .ed .dash-shell.is-menu-open .dash-sidebar { transform: translateX(0); }
  .ed .dash-shell.is-menu-open .dash-scrim { display: block !important; opacity: 1; z-index: 65; }
  .ed .dash-sidebar__close { display: grid !important; place-items: center; }
}
