/* =====================================================================
   Hawaii Robo Labs — light dashboards (Home, Admin, Teacher, Knowledge Base):
   shell and surfaces. Loaded after style.css; Admin and Teacher add
   dashboard-layout.js for the sidebar behaviour. Every rule is scoped to body.admin-app, so the other
   pages that share .admin-card / .admin-table keep their look.
   Layout: dark sidebar (grouped nav, icon rail when collapsed, drawer on
   phones) + light sticky header + content column.
   ==================================================================== */
.admin-app {
  --bg: #F5F4F1;
  --line: #E7E4DE;
  --line-strong: #D9D5CD;
  --row-line: #F0EDE8;
  --teal-hover: #277C76;
  --teal-bright: #5FD0C6;
  --err-soft: #FBEAE7;
  --shadow-sm: 0 1px 2px rgba(29, 33, 38, .06);
  --shadow-card: 0 1px 2px rgba(29, 33, 38, .04), 0 10px 28px -16px rgba(29, 33, 38, .16);
  --ring: 0 0 0 3px rgba(46, 143, 136, .18);
  --side-w: 256px;
  --side-rail: 72px;
  --hdr-h: 68px;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- sign-in ---------------- */
.admin-app .auth {
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(46, 143, 136, .16), transparent 60%),
    radial-gradient(800px 480px at 105% 110%, rgba(232, 147, 12, .14), transparent 60%),
    var(--bg);
}
.admin-app .auth-card { border-radius: 20px; border-color: transparent; box-shadow: 0 30px 80px -24px rgba(22, 24, 27, .28), 0 0 0 1px rgba(22, 24, 27, .05); }

/* ---------------- shell grid ---------------- */
.admin-app #dash {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh; transition: grid-template-columns .2s ease;
}
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-scrim { display: none; }

/* ---------------- sidebar ---------------- */
.admin-sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 60;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #1A1D21 0%, var(--glass) 100%);
  color: #C9CDD2; border-right: 1px solid #0E0F11;
}
.admin-sidebar-brand {
  display: flex; align-items: center; gap: 11px; flex-shrink: 0;
  height: var(--hdr-h); padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
a.admin-sidebar-brand { color: inherit; text-decoration: none; }
a.admin-sidebar-brand:hover .brand-logo { box-shadow: 0 0 0 2px var(--amber); }
a.admin-sidebar-brand:focus-visible { outline: 2px solid var(--amber); outline-offset: -4px; }
.admin-sidebar-brand .brand-logo {
  width: 34px; height: 34px; padding: 3px; border-radius: 9px;
  background: rgba(255, 255, 255, .94); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
}
.brand-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.1; }
.brand-stack strong { font: 700 .98rem var(--font-display); color: #fff; white-space: nowrap; letter-spacing: .2px; }
.brand-stack span { font: 600 .64rem var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }

.admin-app .admin-tabs {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 12px 12px 16px; background: transparent; border: 0;
  overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #33373C transparent;
}
.admin-app .admin-tabs::before, .admin-app .admin-tabs::after { display: none; }
.nav-group {
  font: 700 .66rem var(--font-display); letter-spacing: .14em; text-transform: uppercase;
  color: #6B737C; padding: 18px 12px 6px; white-space: nowrap;
}
.nav-group:first-child { padding-top: 6px; }

.admin-app .admin-tab, .nav-collapse {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 9px; background: transparent;
  font: 500 .88rem var(--font-body); color: #AEB5BC; text-align: left; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.admin-app .admin-tab:hover:not(.active), .nav-collapse:hover { background: rgba(255, 255, 255, .06); color: #F1EFEA; }
.admin-app .admin-tab.active {
  background: linear-gradient(90deg, rgba(46, 143, 136, .30), rgba(46, 143, 136, .10));
  color: #fff; font-weight: 600;
}
.admin-app .admin-tab.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--amber);
}
.admin-app .admin-tab.active .nav-icon { color: var(--teal-bright); }
.admin-app .admin-tab:focus-visible, .nav-collapse:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.admin-sidebar-foot { flex-shrink: 0; padding: 10px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.nav-collapse { color: #7E868F; font-size: .82rem; }
.nav-collapse .nav-icon { transition: transform .2s ease; }

/* Icon rail (desktop only; the drawer below always shows labels). */
@media (min-width: 901px) {
  .admin-app.nav-collapsed #dash { grid-template-columns: var(--side-rail) minmax(0, 1fr); }
  .nav-collapsed .admin-sidebar-brand { justify-content: center; padding: 0; }
  .nav-collapsed .brand-stack,
  .nav-collapsed .nav-label { display: none; }
  .nav-collapsed .nav-group { height: 1px; padding: 0; margin: 10px 10px; font-size: 0; background: rgba(255, 255, 255, .08); }
  .nav-collapsed .nav-group:first-child { margin-top: 4px; }
  .admin-app.nav-collapsed .admin-tab, .nav-collapsed .nav-collapse { justify-content: center; padding: 10px 0; }
  .nav-collapsed .nav-collapse .nav-icon { transform: scaleX(-1); }
}

/* ---------------- header ---------------- */
.admin-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  min-height: var(--hdr-h); padding: 10px 32px;
  background: rgba(245, 244, 241, .85);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.admin-header-title { flex: 1; min-width: 0; }
.admin-header-title h1 {
  margin: 0; font: 700 1.25rem/1.2 var(--font-display); letter-spacing: -.01em; color: var(--ink);
}
.admin-header-title p {
  margin: 3px 0 0; font-size: .83rem; color: var(--ink2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-header-title p:empty { display: none; }
.admin-header-utility { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  display: none; place-items: center; width: 40px; height: 40px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.icon-btn .nav-icon { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--teal); }

.admin-app .profile-menu .who {
  display: inline-flex; align-items: center; gap: 10px; max-width: 260px;
  padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: 600 .85rem var(--font-body);
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-app .profile-menu .who:hover { border-color: var(--line-strong); color: var(--ink); }
.admin-app .profile-menu .who:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--teal); }
.admin-app .profile-menu .who .chevron { color: var(--ink2); }
.admin-app .profile-menu .dropdown { margin-top: 10px; }

/* Notification bell (notify.js), restyled for the light header. */
.admin-app .bell-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink2);
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, color .15s ease;
}
.admin-app .bell-btn .btn-icon { width: 18px; height: 18px; }
.admin-app .bell-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.admin-app .bell-btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--teal); }
.admin-app .bell-badge { top: -4px; right: -4px; box-shadow: 0 0 0 2px var(--bg); }
.admin-app .bell-panel {
  border-radius: 14px; border-color: var(--line);
  box-shadow: 0 20px 48px -12px rgba(22, 24, 27, .25), 0 0 0 1px rgba(22, 24, 27, .03);
}

/* ---------------- content ---------------- */
.admin-app .admin-content { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }
.admin-app .admin-panel { gap: 24px; animation: admin-panel-in .22s ease both; }
@keyframes admin-panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.admin-app .admin-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 26px; box-shadow: var(--shadow-card);
}
.admin-app .admin-card > h2, .admin-app .admin-card > h3 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px;
  font: 700 1.08rem/1.3 var(--font-display); letter-spacing: -.005em; color: var(--ink);
}
.admin-app .admin-card > h2::before {
  content: ''; flex-shrink: 0; width: 4px; height: 18px; border-radius: 4px;
  background: linear-gradient(180deg, var(--teal), var(--amber));
}
.admin-app .admin-card > h2 + .hint, .admin-app .admin-card > h3 + .hint { margin-top: -8px; }
.admin-app .hint { line-height: 1.55; }
.admin-app .admin-card > .hint { max-width: 90ch; }

/* ---------------- form controls ---------------- */
.admin-app .form-row label, .admin-app .form label, .admin-app .admin-card > label,
.admin-app .invoice-generator label:not(.toggle-switch):not(.segmented-option) {
  font-size: .8rem; font-weight: 600; color: #3F464E;
}
.admin-app :is(.form-row, .form, .table-toolbar, .plan-kit-picker, .admin-card > label, .invoice-generator label)
  :is(:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])), select, textarea) {
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 400 .9rem var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-app :is(.form-row, .form, .table-toolbar, .plan-kit-picker, .admin-card > label, .invoice-generator label)
  :is(:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])), select, textarea):hover { border-color: #C4BFB5; }
.admin-app :is(.form-row, .form, .table-toolbar, .plan-kit-picker, .admin-card > label, .invoice-generator label)
  :is(input, select, textarea):focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.admin-app :is(input, textarea)::placeholder { color: #9AA0A7; }
.admin-app .app-search input:not([type=checkbox]) { padding-left: 36px; }
.admin-app .form-row { gap: 14px; }
.admin-app input[type=checkbox], .admin-app input[type=radio] { accent-color: var(--teal); }

/* ---------------- buttons ---------------- */
.admin-app .primary {
  min-height: 40px; padding: 10px 18px; border-radius: 10px; font-size: .92rem;
  background: var(--teal);
  box-shadow: 0 1px 2px rgba(29, 33, 38, .14), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.admin-app .primary:not(.danger-btn):hover { filter: none; background: var(--teal-hover); }
.admin-app .dialog-actions .primary.danger-btn { background: var(--err); }
.admin-app .primary:active:not(:disabled) { transform: translateY(1px); }
.admin-app .primary:focus-visible { outline: none; box-shadow: var(--ring); }
.admin-app .primary:disabled { opacity: .5; cursor: not-allowed; }
.admin-app .btn-secondary {
  min-height: 40px; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: .9rem;
}
.admin-app .btn-secondary:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.admin-app .btn-whatsapp, .admin-app .btn-whatsapp:hover:not(:disabled) { background: #25D366; border-color: #25D366; color: #fff; }

.admin-app .table-btn {
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  padding: 6px 12px; font-size: .8rem; font-weight: 500;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.admin-app .table-btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.admin-app .table-btn.danger:hover:not(:disabled) { border-color: var(--err); color: var(--err); background: var(--err-soft); }
.admin-app .table-btn.icon-only { padding: 7px; }
.admin-app .table-toolbar { align-items: center; margin: 12px 0; }

.admin-app .dialog-actions button:not(.primary), .admin-app .pagination button {
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, color .15s ease;
}
.admin-app .dialog-actions button:not(.primary):hover:not(:disabled),
.admin-app .pagination button:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }

/* Segmented recipient tabs (School / Individual) */
.admin-app .tabs {
  align-self: flex-start; width: fit-content; gap: 4px; padding: 4px;
  background: #ECE9E4; border-radius: 12px;
}
.admin-app .tab {
  border: 0; border-radius: 9px; padding: 7px 14px;
  font-size: .84rem; color: var(--ink2); background: transparent;
}
.admin-app .tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(29, 33, 38, .14); }
.admin-app .tab:hover:not(.active) { color: var(--ink); }

.admin-app .samples-filter button { border-radius: 999px; }

/* ---------------- tables ---------------- */
.admin-app .table-scroll {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.admin-app .admin-table { margin-top: 0; }
.admin-app .admin-table th {
  padding: 11px 14px; background: var(--surface2); border-bottom: 1px solid var(--line);
  font-size: .7rem; letter-spacing: .08em; color: #6B737C; white-space: nowrap;
}
.admin-app .admin-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--row-line); font-size: .875rem; vertical-align: middle;
}
.admin-app .admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-app .admin-table tbody tr:hover { background: #FAF9F6; }

.admin-app .pagination { justify-content: flex-end; color: var(--ink2); margin-top: 16px; }
.admin-app .pagination button { padding: 7px 14px; font-weight: 500; }

/* ---------------- invoices ---------------- */
.admin-app .invoice-summary { top: calc(var(--hdr-h) + 20px); border-radius: 16px; }
.admin-app .invoice-stat-tile { border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 1180px) {
  .admin-app .invoice-generator { grid-template-columns: 1fr; }
  .admin-app .invoice-summary { position: static; }
}

/* ---------------- dialogs ---------------- */
.admin-app dialog {
  border: 0; border-radius: 18px; padding: 24px 28px;
  box-shadow: 0 28px 70px -16px rgba(22, 24, 27, .38), 0 0 0 1px rgba(22, 24, 27, .06);
}
.admin-app dialog[open] { animation: admin-dialog-in .18s ease-out; }
.admin-app dialog::backdrop {
  background: rgba(20, 22, 25, .5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.admin-app dialog > h2 { font-size: 1.25rem; letter-spacing: -.01em; margin-bottom: 14px; }
.admin-app dialog .dialog-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.admin-app dialog.dialog-fullscreen { border-radius: 0; box-shadow: none; }
@keyframes admin-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

@media (prefers-reduced-motion: reduce) {
  .admin-app .admin-panel, .admin-app dialog[open] { animation: none; }
  .admin-app #dash, .admin-sidebar, .admin-scrim { transition: none; }
}

/* ---------------- Home ("/") ---------------- */
.home-header { padding: 10px 32px; }
.home-brand { flex: 1; display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--ink); text-decoration: none; }
.home-brand .brand-logo {
  width: 36px; height: 36px; padding: 3px; border-radius: 10px; background: #fff;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}
.home-brand .brand-stack strong { color: var(--ink); font-size: 1rem; }
/* The sidebar's amber is too light on the pale header; this is the same hue, darker. */
.home-brand .brand-stack span { color: #B5750A; }

.home-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; }

.home-hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 36px 40px 34px;
  color: #fff; background:
    radial-gradient(520px 260px at 100% 0%, rgba(46, 143, 136, .45), transparent 70%),
    radial-gradient(420px 240px at 0% 120%, rgba(232, 147, 12, .28), transparent 70%),
    linear-gradient(135deg, #1D2126 0%, var(--glass) 100%);
  box-shadow: 0 24px 60px -30px rgba(22, 24, 27, .6);
}
.home-hero::after {
  /* faint circuit grid, so the dark panel does not read as a blank slab */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.home-hero > * { position: relative; z-index: 1; }
.home-eyebrow { margin: 0 0 8px; font: 700 .7rem var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--amber); }
.home-hero h1 { margin: 0; font: 800 clamp(1.6rem, 3.2vw, 2.3rem)/1.15 var(--font-display); letter-spacing: -.02em; }
.home-lead { margin: 10px 0 0; max-width: 60ch; color: #C9CDD2; font-size: 1rem; line-height: 1.55; }
.home-plan {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 20px; padding: 7px 8px 7px 14px;
  border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  font-size: .85rem; color: #E8E6E1;
}
.home-plan-dot { width: 8px; height: 8px; border-radius: 50%; background: #3DD68C; box-shadow: 0 0 0 3px rgba(61, 214, 140, .2); }
.home-plan.is-warn .home-plan-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(232, 147, 12, .25); }
.home-plan a {
  margin-left: 4px; padding: 4px 12px; border-radius: 999px; background: #fff; color: var(--ink);
  font-weight: 600; font-size: .8rem; text-decoration: none;
}
.home-plan a:hover { background: var(--amber-soft); }

.home-section { margin-top: 36px; }
.home-section-title {
  margin: 0 0 14px; font: 700 .72rem var(--font-display); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink2);
}
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* One accent per tile; everything inside reads it. */
.home-tile { --tile: var(--teal); --tile-soft: var(--teal-soft); }
.home-tile[data-tile="ros2"], .home-tile[data-tile="subscription"] { --tile: #4F5FC9; --tile-soft: #E8EAFB; }
.home-tile[data-tile="cv"], .home-tile[data-tile="notifications"] { --tile: #B5750A; --tile-soft: var(--amber-soft); }
.home-tile[data-tile="admin"] { --tile: var(--ink); --tile-soft: #ECEAE6; }
.home-tile[data-tile="kb"] { --tile: #2F8F63; --tile-soft: #E1F3EA; }
.home-tile[data-tile="showcase"] { --tile: #B04A76; --tile-soft: #F8E6EE; }

.home-tile {
  position: relative; display: flex; flex-direction: column; gap: 16px; min-height: 196px;
  padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow-card); color: var(--ink); font: inherit; text-align: left; text-decoration: none;
  cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.home-tile:hover {
  transform: translateY(-2px); border-color: color-mix(in srgb, var(--tile) 35%, var(--line));
  box-shadow: 0 2px 4px rgba(29, 33, 38, .04), 0 18px 36px -18px color-mix(in srgb, var(--tile) 45%, transparent);
}
.home-tile:focus-visible { outline: none; border-color: var(--tile); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile) 25%, transparent); }
.home-tile-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--tile-soft); color: var(--tile);
}
.home-tile-icon svg { width: 25px; height: 25px; }
.home-tile-text { display: flex; flex-direction: column; gap: 6px; }
.home-tile-name { font: 700 1.06rem/1.25 var(--font-display); letter-spacing: -.005em; }
.home-tile-desc { color: var(--ink2); font-size: .88rem; line-height: 1.5; }
.home-tile-foot {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: .85rem; color: var(--tile);
}
.home-tile-foot svg { width: 16px; height: 16px; transition: transform .16s ease; }
.home-tile:hover .home-tile-foot svg { transform: translateX(3px); }

.home-tile.is-locked { background: var(--surface2); box-shadow: none; }
.home-tile.is-locked .home-tile-icon { background: #ECEAE6; color: #8A9098; }
.home-tile.is-locked .home-tile-name { color: #4A5159; }
.home-tile.is-locked .home-tile-foot { color: var(--ink2); }
.home-tile.is-locked:hover { border-color: #D8C29A; box-shadow: 0 14px 30px -20px rgba(181, 117, 10, .5); }
.home-tile.is-locked:hover .home-tile-foot { color: #B5750A; }
.home-tile-lock {
  position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font: 700 .66rem var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2);
}
.home-tile-lock svg { width: 12px; height: 12px; }

@media (prefers-reduced-motion: reduce) {
  .home-tile, .home-tile-foot svg { transition: none; }
  .home-tile:hover { transform: none; }
}

/* ---------------- Knowledge Base ---------------- */
/* The article pane scrolls on its own (kb.js resets #kbMain.scrollTop when
   an article opens), so the main column is exactly one screen tall. */
.kb-app { --side-w: 300px; }
.kb-app .kb-sidebar { width: auto; padding: 0; border-right: 1px solid #0E0F11; background: linear-gradient(180deg, #1A1D21 0%, var(--glass) 100%); }
.kb-sidebar-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 24px;
  scrollbar-width: thin; scrollbar-color: #33373C transparent;
}
.kb-app .admin-main { height: 100vh; height: 100dvh; }
.kb-app .kb-main { flex: 1; min-height: 0; overflow-y: auto; padding: 32px 32px 64px; }
.kb-app .kb-contents-btn { display: none; }

.kb-app .kb-search { margin-bottom: 6px; }
.kb-app .kb-search input {
  width: 100%; min-height: 40px; padding: 9px 12px 9px 36px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .10); background: rgba(255, 255, 255, .06);
  color: #F1EFEA; font: 400 .88rem var(--font-body);
}
.kb-app .kb-search input::placeholder { color: #7E868F; }
.kb-app .kb-search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(46, 143, 136, .3); }
.kb-app .kb-search .kb-search-icon { color: #7E868F; left: 12px; }
.kb-app .kb-sidebar h2 {
  margin: 18px 8px 8px; font: 700 .66rem var(--font-display); letter-spacing: .14em; color: #6B737C;
}
.kb-app .kb-nav-btn {
  padding: 8px 10px; border-radius: 9px; color: #AEB5BC; font: 500 .87rem/1.35 var(--font-body);
  transition: background-color .15s ease, color .15s ease;
}
.kb-app .kb-nav-btn:hover { background: rgba(255, 255, 255, .06); color: #F1EFEA; }
.kb-app .kb-nav-btn.active {
  background: linear-gradient(90deg, rgba(46, 143, 136, .32), rgba(46, 143, 136, .12)); color: #fff;
  box-shadow: inset 3px 0 0 var(--amber);
}
.kb-app .kb-nav-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.kb-app .kb-nav-chevron, .kb-app .kb-nav-btn.active .kb-nav-chevron { color: #6B737C; }
.kb-app .kb-nav-list .kb-nav-list { border-left-color: rgba(255, 255, 255, .08); }
.kb-app .kb-nav-btn .difficulty-tag {
  flex: 0 0 auto; padding: 1px 7px; background: rgba(255, 255, 255, .06); font-size: .58rem;
}
/* The light-page tag colours are too dark on the sidebar; same hues, lifted. */
.kb-app .kb-nav-btn .difficulty-tag.easy { color: var(--teal-bright); }
.kb-app .kb-nav-btn .difficulty-tag.intermediate { color: #F2B24C; }
.kb-app .kb-nav-btn .difficulty-tag.hard { color: #F08A7E; }
.kb-app .kb-nav-btn .difficulty-tag.expert { color: #A3ADF5; }
.kb-app .kb-nav-btn.active .difficulty-tag { background: rgba(255, 255, 255, .14); }

.kb-app .kb-search-results { gap: 6px; margin-top: 12px; }
.kb-app .kb-search-result {
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; background: rgba(255, 255, 255, .04);
  transition: border-color .15s ease, background-color .15s ease;
}
.kb-app .kb-search-result:hover { border-color: var(--teal); background: rgba(46, 143, 136, .12); }
.kb-app .kb-search-result-title { color: #F1EFEA; }
.kb-app .kb-search-result-path { color: #7E868F; }
.kb-app .kb-search-result-snippet, .kb-app .kb-search-empty { color: #9AA2AA; }
.kb-app .kb-search-results mark { background: rgba(232, 147, 12, .32); color: #fff; }

.kb-app .kb-article {
  max-width: 880px; margin: 0 auto; padding: 40px 48px 48px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card);
}
.kb-app .kb-breadcrumb {
  display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; padding: 4px 12px;
  border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); font-size: .78rem;
}
.kb-app .kb-content h1 { font-size: 2rem; letter-spacing: -.02em; line-height: 1.2; }
.kb-app .kb-content h2 { margin-top: 2em; padding-top: 1.2em; border-top: 1px solid var(--line); letter-spacing: -.01em; }
.kb-app .kb-content p, .kb-app .kb-content li { color: #2F353C; }
.kb-app .kb-content pre { border-radius: 12px; }
.kb-app .kb-content img { border-radius: 10px; }
.kb-app .kb-empty {
  max-width: 880px; margin: 0 auto; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 18px;
}

/* ---------------- tablets & phones: sidebar becomes a drawer ---------------- */
@media (max-width: 900px) {
  .admin-app #dash { grid-template-columns: minmax(0, 1fr); }
  .admin-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(284px, 84vw); height: auto; z-index: 90;
    transform: translateX(-100%); transition: transform .22s ease, box-shadow .22s ease;
  }
  .admin-app.nav-open .admin-sidebar { transform: none; box-shadow: 24px 0 60px rgba(0, 0, 0, .35); }
  /* Knowledge Base: kb.js drives its drawer with .is-open and #kbBackdrop. */
  .kb-app .kb-sidebar { top: 0; width: min(320px, 86vw); box-shadow: none; }
  .kb-app .kb-sidebar.is-open { transform: none; box-shadow: 24px 0 60px rgba(0, 0, 0, .35); }
  .kb-app .kb-backdrop { inset: 0; z-index: 89; }
  .kb-app .kb-contents-btn { display: inline-grid; }
  .kb-app .kb-main { padding: 16px 12px 40px; }
  .kb-app .kb-article { padding: 24px 20px 32px; border-radius: 14px; }
  .admin-sidebar-foot { display: none; }
  .admin-scrim {
    display: block; position: fixed; inset: 0; z-index: 89;
    background: rgba(20, 22, 25, .45); opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .admin-app.nav-open .admin-scrim { opacity: 1; pointer-events: auto; }
  .admin-app.nav-open { overflow: hidden; }
  .icon-btn { display: inline-grid; }
  .admin-header { padding: 10px 16px; gap: 12px; }
  .admin-app .admin-content { padding: 20px 16px 40px; }
  .admin-app .admin-card { padding: 18px; border-radius: 14px; }
}
@media (max-width: 560px) {
  .home-header { padding: 10px 16px; }
  .home-main { padding: 18px 16px 48px; }
  .home-hero { padding: 26px 22px; border-radius: 16px; }
  .home-brand .brand-stack { display: none; }
  .admin-header-title h1 { font-size: 1.08rem; }
  .admin-header-title p { display: none; }
  .admin-app .profile-menu .who { padding: 3px; }
  .admin-app .profile-menu .who .who-name,
  .admin-app .profile-menu .who .chevron { display: none; }
  .admin-app dialog { padding: 20px 18px; }
  /* The bell panel would hang off a 40px button; pin it under the header. */
  .admin-app .bell-panel { position: fixed; top: calc(var(--hdr-h) + 6px); left: 10px; right: 10px; width: auto; }
}

/* =====================================================================
   Admin > Robots (admin-src/tabs/robots.js): filter chips, the fleet table,
   the Manage panel that opens under a row, paging. Same tokens as the rest
   of the light dashboards.
   ==================================================================== */
.admin-app .fleet-card { padding: 24px 26px 18px; }
.fleet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.admin-app .fleet-head h2 { margin: 0 0 6px; }
.fleet-head .hint { margin: 0; max-width: 78ch; }
.fleet-head .primary { flex-shrink: 0; }

.fleet-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.fleet-search { flex: 1 1 320px; max-width: 520px; position: relative; display: block; }
.admin-app .fleet-search input {
  width: 100%; min-height: 42px; padding: 9px 12px 9px 38px; border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface); font: 400 .9rem var(--font-body); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-app .fleet-search input:focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.fleet-live { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink2); }
.fleet-live.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 158, 111, .18); }
.fleet-live.is-stale { color: #9A5F05; }

/* ---- filter chips ---- */
.fleet-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line);
}
.fleet-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fleet-filter-label { font: 700 .64rem var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: #8A9098; margin-right: 2px; }
.fleet-chip {
  position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: #3F464E;
  font: 500 .8rem var(--font-body); cursor: pointer; user-select: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.fleet-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fleet-chip b { font: 600 .72rem var(--font-mono); color: #8A9098; }
.fleet-chip .status-dot { width: 8px; height: 8px; box-shadow: none; }
.fleet-chip:hover { border-color: var(--teal); }
.fleet-chip.is-on { background: var(--teal-soft); border-color: var(--teal); color: #1F6F69; }
.fleet-chip.is-on b { color: #1F6F69; }
.fleet-chip.is-on::after {
  content: ""; width: 5px; height: 9px; margin: -2px 1px 0 -1px; border: solid #1F6F69; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.fleet-chip.is-empty:not(.is-on) { color: #9AA0A7; }
.fleet-chip:has(input:focus-visible) { box-shadow: var(--ring); border-color: var(--teal); }
.fleet-clear {
  margin-left: auto; border: 0; background: none; padding: 4px 6px; border-radius: 6px;
  font: 600 .8rem var(--font-body); color: var(--teal); cursor: pointer;
}
.fleet-clear:hover { background: var(--teal-soft); }
.fleet-clear[hidden] { display: none; }

/* ---- the table ---- */
.admin-app .fleet-table th { white-space: nowrap; }
.admin-app .fleet-table td { vertical-align: middle; padding: 14px; }
.fleet-actions-head { width: 1%; }
.fleet-row { transition: background-color .15s ease; }
.admin-app .fleet-table tbody tr.fleet-row.is-open { background: #F4FAF9; }
.admin-app .fleet-table tbody tr.fleet-row.is-open td { border-bottom-color: transparent; }
.fleet-robot { min-width: 210px; }
.admin-app .fleet-table td:nth-child(3) { min-width: 150px; }
.admin-app .fleet-table td:nth-child(4) { min-width: 170px; }
.admin-app .fleet-table td:nth-child(5) { min-width: 170px; }
.fleet-ip { font: 600 .76rem var(--font-mono); color: var(--ink); }
.fleet-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fleet-name strong { font: 700 .95rem var(--font-display); color: var(--ink); }
.fleet-tag {
  padding: 2px 8px; border-radius: 999px; font: 700 .62rem var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  background: #ECEAE6; color: #4A5159;
}
.fleet-tag.is-self { background: #EEF0FC; color: #4F5FC9; }
.fleet-ids { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.fleet-ids:empty { display: none; }
.fleet-id {
  padding: 2px 8px; border-radius: 6px; font: 600 .74rem var(--font-mono); letter-spacing: .02em;
  background: var(--glass); color: #E8E6E1;
}
.fleet-serial { padding: 2px 8px; border-radius: 6px; font: 500 .74rem var(--font-mono); background: var(--surface2); color: var(--ink2); border: 1px solid var(--line); }
.fleet-who { display: block; font-weight: 600; color: var(--ink); font-size: .87rem; }
.fleet-sub { display: block; margin-top: 3px; font-size: .78rem; color: var(--ink2); line-height: 1.4; }
.fleet-sub .rnet { margin: 0; font-size: .76rem; }
.fleet-muted { color: #9AA0A7; font-size: .85rem; }

.fleet-live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px; white-space: nowrap;
  font: 600 .76rem var(--font-body); background: #EFEDE9; color: #5C646D;
}
.fleet-live-pill .status-dot { width: 8px; height: 8px; box-shadow: none; }
.fleet-live-pill.is-online { background: #E4F4EC; color: #1F7A52; }
.fleet-live-pill.is-running { background: var(--amber-soft); color: #9A5F05; }
.fleet-live-pill.is-error { background: #FBEAE7; color: #A8392E; }

.fleet-state {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  font: 600 .74rem var(--font-body); background: #EFEDE9; color: #5C646D;
}
.fleet-state.is-active { background: #E4F4EC; color: #1F7A52; }
.fleet-state.is-in_stock { background: #E8F1FB; color: #2B62A8; }
.fleet-state.is-lapsed { background: #FBEAE7; color: #A8392E; }
.fleet-state.is-maintenance { background: var(--amber-soft); color: #9A5F05; }
.fleet-state.is-retired { background: #ECEAE6; color: #6B737C; text-decoration: line-through; }
.fleet-state.is-self { background: #EEF0FC; color: #4F5FC9; }

.fleet-actions { white-space: nowrap; text-align: right; }
.fleet-actions .table-btn { vertical-align: middle; margin-left: 4px; }
.fleet-manage {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 10px 6px 12px; vertical-align: middle;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink);
  font: 600 .8rem var(--font-body); cursor: pointer; transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.fleet-manage .btn-icon { width: 14px; height: 14px; }
.fleet-manage:hover { border-color: var(--teal); color: var(--teal); }
.fleet-manage[aria-expanded="true"] { background: var(--glass); border-color: var(--glass); color: #fff; }
.fleet-manage:focus-visible { outline: none; box-shadow: var(--ring); }
.fleet-chevron { transition: transform .18s ease; }
.fleet-manage[aria-expanded="true"] .fleet-chevron { transform: rotate(180deg); }

.fleet-empty { padding: 36px 16px; text-align: center; color: var(--ink2); font-size: .9rem; }

/* ---- the Manage panel, under its row ---- */
.admin-app .fleet-table tbody tr.fleet-panel-row:hover { background: transparent; }
.admin-app .fleet-table tr.fleet-panel-row > td { padding: 0 14px 16px; background: #F4FAF9; }
.fleet-panel-row[hidden] { display: none; }
.fleet-panel {
  border: 1px solid #CFE6E3; border-radius: 14px; background: var(--surface);
  box-shadow: 0 10px 26px -18px rgba(22, 24, 27, .35); animation: admin-panel-in .18s ease both;
}
.fleet-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px 0 14px; border-bottom: 1px solid var(--line);
}
.fleet-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.fleet-tabs::-webkit-scrollbar { display: none; }
.fleet-tab {
  flex: none; padding: 10px 12px 11px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none;
  font: 600 .84rem var(--font-body); color: var(--ink2); cursor: pointer;
}
.fleet-tab:hover { color: var(--ink); }
.fleet-tab.is-active { color: var(--ink); border-bottom-color: var(--teal); }
.fleet-tab:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; border-radius: 6px; }
.fleet-panel-close {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink2); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.fleet-panel-close:hover { background: var(--surface2); color: var(--ink); }
.fleet-panel-body { padding: 18px 20px 20px; }
.fleet-panel-body .fleet-form-host .dialog-actions,
.fleet-panel-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-start;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.admin-app .fleet-panel-body .dialog-actions button:not(.primary):not(.fleet-danger-btn),
.fleet-panel-actions .btn-secondary {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: .9rem;
}
.fleet-panel-actions .btn-secondary .btn-icon, .fleet-danger-btn .btn-icon { width: 15px; height: 15px; }
.admin-app .fleet-danger-btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 16px; margin-left: auto;
  border: 1px solid #E5B3AC; border-radius: 10px; background: var(--surface); color: #B3372B; font: 500 .9rem var(--font-body); cursor: pointer;
}
.admin-app .fleet-danger-btn:hover:not(:disabled) { background: var(--err-soft); border-color: var(--err); }
.fleet-danger-btn[hidden] { display: none; }
.fleet-panel-body .msg:empty { display: none; }
/* The shared form, in a panel: buttons at their own width, fields top-aligned
   (the uniqueness notes under Robot ID and serial add height). */
.admin-app .fleet-form-host .form-row { align-items: flex-start; }
.admin-app .fleet-panel-body .dialog-actions .primary { flex: 0 0 auto; min-width: 150px; }
.admin-app .fleet-form-host .dialog-actions .fleet-danger-btn { color: #B3372B; border-color: #E5B3AC; }

/* Robot ID, and the live uniqueness checks. */
.fleet-id-input { display: flex; gap: 6px; }
.fleet-id-input input { flex: 1; min-width: 0; font-family: var(--font-mono) !important; letter-spacing: .03em; }
.admin-app .fleet-id-input .table-btn { flex-shrink: 0; min-height: 40px; padding: 0 12px; border-radius: 10px; }
.fleet-check { display: block; min-height: 1.2em; font-size: .76rem; font-weight: 500; color: var(--ink2); }
.fleet-check.is-ok { color: #1F7A52; }
.fleet-check.is-ok::before { content: "\2713  "; }
.fleet-check.is-bad { color: #A8392E; }
.fleet-check.is-bad::before { content: "\2715  "; }
.fleet-check.is-wait { color: #8A9098; }
.admin-app input.is-invalid { border-color: var(--err) !important; box-shadow: 0 0 0 3px rgba(207, 74, 61, .14) !important; }

/* Assignment pane. */
.fleet-note {
  padding: 11px 14px; margin-bottom: 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--line);
  font-size: .86rem; color: #3F464E; line-height: 1.5;
}
.fleet-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 18px;
  background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.fleet-summary > div { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: #FBFAF8; min-width: 0; }
.fleet-summary > div > span:first-child { font: 700 .62rem var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: #8A9098; }
.fleet-summary strong { font-size: .92rem; color: var(--ink); overflow-wrap: anywhere; }
.fleet-summary small { font-size: .76rem; color: var(--ink2); overflow-wrap: anywhere; }
.fleet-subhead { margin: 0 0 10px; font: 700 .88rem var(--font-display); color: var(--ink); }
.fleet-assign-edit .form-row { align-items: flex-end; }
.admin-app .fleet-assign-edit input:not([type=checkbox]) {
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font: 400 .9rem var(--font-body);
}
[data-a-reassign-host] > .fleet-form-host {
  margin-top: 18px; padding: 16px 18px; border: 1px dashed #BFE0DC; border-radius: 12px; background: #FAFDFC;
}
.fleet-assign-lead { margin: 0 0 12px !important; }
.fleet-assign-lead[hidden] { display: none; }

/* Access pane: switches. */
.fleet-lead { margin: 0 0 14px; font-size: .86rem; color: var(--ink2); max-width: 80ch; line-height: 1.5; }
.fleet-switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.fleet-switch {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s ease;
}
.fleet-switch:hover { border-color: var(--line-strong); }
.fleet-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fleet-switch-track {
  position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 999px; background: #D5D1CA; transition: background-color .15s ease;
}
.fleet-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease;
}
.fleet-switch input:checked + .fleet-switch-track { background: var(--teal); }
.fleet-switch input:checked + .fleet-switch-track::after { transform: translateX(16px); }
.fleet-switch input:focus-visible + .fleet-switch-track { box-shadow: var(--ring); }
.fleet-switch input:disabled + .fleet-switch-track { opacity: .5; }
.fleet-switch strong { display: block; font-size: .87rem; color: var(--ink); }
.fleet-switch small { display: block; margin-top: 2px; font-size: .76rem; color: var(--ink2); line-height: 1.4; }

.fleet-history { margin: 0; }

/* ---- paging ---- */
.admin-app .fleet-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.fleet-page-size { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink2); }
.admin-app .fleet-page-size select {
  min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font: 500 .84rem var(--font-body);
}
.fleet-page-nav { display: inline-flex; align-items: center; gap: 10px; font-size: .84rem; }

/* ---- tablets and phones: each robot becomes a card ---- */
@media (max-width: 1000px) {
  .fleet-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-app .fleet-scroll { border: 0; background: transparent; overflow: visible; }
  .fleet-table thead { display: none; }
  /* Tables in a .table-scroll get min-width 780px (style.css); cards must fit. */
  .admin-app .table-scroll .fleet-table { min-width: 0; }
  .fleet-table, .fleet-table tbody { display: block; }
  .admin-app .fleet-table tr.fleet-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px; margin-bottom: 10px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  }
  .admin-app .fleet-table tr.fleet-row.is-open { margin-bottom: 0; border-radius: 14px 14px 0 0; border-bottom-color: transparent; }
  .admin-app .fleet-table tr.fleet-row td { display: block; padding: 0; border: 0; min-width: 0; }
  .fleet-table td.fleet-robot { grid-column: 1 / -1; min-width: 0; }
  .admin-app .fleet-table td.fleet-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-start; text-align: left; }
  .fleet-actions .fleet-manage { flex: 1; justify-content: center; }
  .admin-app .fleet-table tr.fleet-panel-row { display: block; margin-bottom: 10px; }
  .admin-app .fleet-table tr.fleet-panel-row > td {
    display: block; padding: 0 10px 10px; border: 1px solid #CFE6E3; border-top: 0; border-radius: 0 0 14px 14px;
  }
  .admin-app .fleet-table tr.fleet-panel-row[hidden] { display: none; }
}
@media (max-width: 640px) {
  .fleet-head { flex-direction: column; }
  .fleet-head .primary { width: 100%; justify-content: center; }
  .fleet-filters { gap: 10px; }
  .fleet-filter-group { width: 100%; }
  .fleet-filter-label { width: 100%; }
  .fleet-clear { margin-left: 0; }
  .fleet-panel-body { padding: 14px; }
  .fleet-summary { grid-template-columns: 1fr; }
  .admin-app .fleet-danger-btn { margin-left: 0; }
  .fleet-panel-actions > *, .fleet-panel-body .fleet-form-host .dialog-actions > * { flex: 1 1 100%; justify-content: center; }
  .admin-app .fleet-pagination { flex-direction: column; align-items: stretch; }
  .fleet-page-nav { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .fleet-panel, .fleet-chevron, .fleet-switch-track::after { animation: none; transition: none; }
}

/* =====================================================================
   Notifications & messaging (notifications.js, messaging.js, delivery.js)
   ===================================================================== */
/* Inputs in the panel and its dialogs, same look as every other admin form. */
.admin-app :is(.mx-shell, .nt-dialog, .mx-hist-dialog)
  :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  width: 100%; box-sizing: border-box; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  color: var(--ink); font: 400 .9rem var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-app :is(.mx-shell, .nt-dialog) textarea { line-height: 1.55; resize: vertical; }
.admin-app :is(.mx-shell, .nt-dialog, .mx-hist-dialog) :is(input, select, textarea):focus {
  outline: none; border-color: var(--teal); box-shadow: var(--ring);
}
.admin-app .nt-editor-fields input[type=text], .admin-app .nt-editor-fields textarea { margin-top: 6px; }
.admin-app .mx-shell :is(.app-search, .mx-combo) input:not([type=checkbox]):not([type=radio]) { padding-left: 36px; }
.mx-head { margin-bottom: 14px; }
.mx-grow { flex: 1; }

/* ---- section tabs ---- */
.mx-tabs {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 18px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.mx-tabs::-webkit-scrollbar { display: none; }
.mx-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: 1 0 auto; justify-content: center;
  padding: 9px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2);
  font: 600 .86rem var(--font-body); white-space: nowrap; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.mx-tab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mx-tab:hover { color: var(--ink); }
.mx-tab.is-active { background: var(--surface); color: var(--teal); box-shadow: 0 1px 3px rgba(22, 24, 27, .1); }
.mx-tab:focus-visible { outline: none; box-shadow: var(--ring); }
.mx-pane-intro { margin: 0 0 14px; max-width: 80ch; }

.mx-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mx-toolbar .fleet-search { flex: 1 1 240px; max-width: 360px; }
.mx-inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink2); cursor: pointer; }
.mx-inline-check input { width: 16px; height: 16px; }
.mx-empty { padding: 24px 0; text-align: center; }
.mx-empty-state { padding: 40px 20px; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.mx-empty-state strong { font-family: var(--font-display); font-size: 1.05rem; }
.mx-empty-state .hint { max-width: 52ch; margin: 6px auto 0; }

/* channel chips and badges */
.mx-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.mx-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font: 600 .8rem var(--font-body);
  color: var(--ink2); cursor: pointer;
}
.mx-chip b { font: 600 .72rem var(--font-mono); color: #8A9098; }
.mx-chip.is-on { background: var(--teal-soft); border-color: var(--teal); color: #1F6F69; }
.mx-ch-icon { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- template library ---- */
.mx-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mx-tpl-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s ease, box-shadow .15s ease;
}
.mx-tpl-card:hover { border-color: var(--line-strong); box-shadow: 0 6px 20px -12px rgba(22, 24, 27, .25); }
.mx-tpl-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mx-tpl-card h4 { margin: 0; font: 700 1rem var(--font-display); }
.mx-tpl-chs { display: inline-flex; gap: 3px; flex-shrink: 0; }
.mx-ch-badge {
  display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center;
  border-radius: 7px; color: #C2C5C9; background: var(--surface2);
}
.mx-ch-badge.is-on { color: var(--teal); background: var(--teal-soft); }
.mx-ch-badge .mx-ch-icon { width: 13px; height: 13px; }
.mx-tpl-desc { margin: 0; font-size: .8rem; color: var(--ink2); }
.mx-tpl-subject { margin: 0; font-size: .84rem; font-weight: 600; }
.mx-tpl-subject span { font: 700 .62rem var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: #8A9098; margin-right: 6px; }
.mx-tpl-preview { margin: 0; font-size: .84rem; color: var(--ink2); line-height: 1.5; flex: 1; white-space: pre-line; }
.mx-tpl-card footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--row-line);
}
.mx-tpl-card footer .hint { margin: 0; font-size: .76rem; }
.mx-tpl-actions { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.mx-tpl-actions .table-btn { padding: 5px 10px; font-size: .78rem; }

/* template editor dialog */
.mx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mx-tpl-dialog .mx-row2 label, .mx-compose .mx-row2 label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 12px; }
.mx-tpl-dialog .mx-row2 input, .mx-compose .mx-row2 input { margin-top: 6px; }
.mx-chtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 14px; }
.mx-chtabs button {
  position: relative; padding: 9px 14px; border: 0; background: none; font: 600 .86rem var(--font-body);
  color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.mx-chtabs button i { display: none; position: absolute; top: 7px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.mx-chtabs button.has-content i { display: block; }
.mx-chtabs button.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.mx-count { float: right; font: 500 .72rem var(--font-mono); color: var(--ink2); }

/* phone bubble preview for SMS / WhatsApp */
.mx-phone { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 14px; border-radius: 14px; background: #ECE5DD; min-height: 140px; }
.mx-phone-sms { background: #F2F2F5; }
.mx-bubble {
  max-width: 92%; padding: 9px 12px; border-radius: 12px 12px 12px 3px; background: #fff;
  font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.mx-phone-sms .mx-bubble { background: #E5E5EA; }
.mx-phone-meta { font-size: .74rem; color: var(--ink2); }
.mx-phone-meta code { font-size: .72rem; }

/* ---- send message ---- */
.mx-compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.mx-step { padding: 18px 0 20px; border-bottom: 1px solid var(--row-line); }
.mx-step:first-child { padding-top: 4px; }
.mx-step:last-child { border-bottom: 0; }
.mx-step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.mx-step-head h3 { margin: 0; font: 700 1rem var(--font-display); }
.mx-step-head .hint { margin: 2px 0 0; font-size: .8rem; }
.mx-step-num {
  display: inline-flex; width: 26px; height: 26px; flex-shrink: 0; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--teal); color: #fff; font: 700 .8rem var(--font-display);
}
.mx-seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mx-seg button {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font: 600 .84rem var(--font-body); color: var(--ink2); cursor: pointer;
}
.mx-seg button:hover { border-color: var(--teal); color: var(--ink); }
.mx-seg button.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.mx-aud { display: flex; flex-direction: column; gap: 10px; }
.mx-aud .hint { margin: 0; }
.mx-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-pill-check {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); font-size: .86rem; font-weight: 600; cursor: pointer; background: var(--surface);
}
.mx-pill-check:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); color: #1F6F69; }
.mx-pill-check b { font: 600 .74rem var(--font-mono); color: #8A9098; }
.mx-pill-check input { width: 15px; height: 15px; }
.mx-picklist {
  max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0;
}
.mx-pick {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
  border-bottom: 1px solid var(--row-line); border-right: 1px solid var(--row-line);
}
.mx-pick:hover { background: var(--surface2); }
.mx-pick:has(input:checked) { background: var(--teal-soft); }
.mx-pick input { width: 16px; height: 16px; flex-shrink: 0; }
.mx-pick span { display: flex; flex-direction: column; min-width: 0; }
.mx-pick strong { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-pick small { font-size: .74rem; color: var(--ink2); }
.mx-pick.is-disabled { opacity: .5; cursor: default; }
.mx-pick[hidden] { display: none; }
.mx-combo { position: relative; }
.mx-combo .app-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink2); pointer-events: none; }
.mx-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px -10px rgba(22, 24, 27, .3);
}
.mx-menu li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mx-menu li:hover { background: var(--surface2); }
.mx-menu li.is-picked { opacity: .5; }
.mx-menu li.is-empty { color: var(--ink2); cursor: default; }
.mx-menu strong { font-size: .88rem; }
.mx-menu small { font-size: .76rem; color: var(--ink2); }
.mx-picked { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-person {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; border-radius: 999px;
  background: var(--teal-soft); color: #1F6F69; font-size: .82rem; font-weight: 600;
}
.mx-person small { font-weight: 500; opacity: .75; text-transform: capitalize; }
.mx-person button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; }
.mx-person button:hover { background: rgba(31, 111, 105, .15); }

.mx-aud-summary { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); }
.mx-aud-summary .hint, .mx-aud-summary .msg { margin: 0; }
.mx-aud-count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mx-aud-count strong { font: 800 1.4rem var(--font-display); }
.mx-aud-count span { font-size: .84rem; color: var(--ink2); }
.mx-aud-reach { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.mx-aud-reach span {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font: 600 .76rem var(--font-mono); color: #9AA0A7; background: var(--surface); border: 1px solid var(--line);
}
.mx-aud-reach span.is-on { color: #1F6F69; border-color: var(--teal); }
.mx-aud-reach span.is-short { color: #9A5F05; border-color: #E8B04F; background: var(--amber-soft); }
.mx-aud-sample { margin: 8px 0 0; font-size: .8rem; color: var(--ink2); }

.mx-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mx-channel {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 12px 36px 12px 12px; text-align: left;
  border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.mx-channel:hover:not(:disabled) { border-color: var(--teal); }
.mx-channel-icon { width: 34px; height: 34px; padding: 8px; box-sizing: border-box; border-radius: 9px; background: var(--surface2); color: var(--ink2); flex-shrink: 0; }
.mx-channel-text { display: flex; flex-direction: column; min-width: 0; }
.mx-channel-text strong { font-size: .9rem; color: var(--ink); }
.mx-channel-text small { font-size: .74rem; color: var(--ink2); line-height: 1.35; }
.mx-channel-tick { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); }
.mx-channel.is-on { border-color: var(--teal); background: var(--teal-soft); }
.mx-channel.is-on .mx-channel-icon { background: var(--teal); color: #fff; }
.mx-channel.is-on .mx-channel-tick { background: var(--teal); border-color: var(--teal); }
.mx-channel.is-on .mx-channel-tick::after {
  content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.mx-channel:disabled { cursor: not-allowed; opacity: .55; background: var(--surface2); }
.mx-channel-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: .8rem; }

.mx-tpl-pick { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mx-tpl-pick label { display: block; flex: 0 1 380px; font-size: .85rem; font-weight: 600; }
.mx-tpl-pick select { margin-top: 6px; }
.mx-tpl-pick .hint { margin: 0 0 10px; font-size: .78rem; }
.mx-content { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.mx-block { margin: 0; padding: 12px 14px 4px; border: 1px solid var(--line); border-radius: 12px; }
.mx-block legend { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font: 700 .8rem var(--font-display); color: var(--teal); }
.mx-block label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 10px; }
.mx-block :is(input, textarea) { margin-top: 6px; }
.mx-copy { margin: 0 0 10px; font-size: .8rem; }
.mx-vars { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.mx-vars .hint { margin: 0; }
.mx-vars .nt-var-list { margin: 0; }
.mx-important { padding: 10px 12px; border-radius: 10px; background: var(--surface2); align-items: flex-start; }
.mx-important input { margin-top: 2px; }

.mx-compose-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.mx-preview-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface2); overflow: hidden; }
.mx-preview-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.mx-preview-tabs button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; font: 600 .8rem var(--font-body); color: var(--ink2); cursor: pointer; white-space: nowrap;
}
.mx-preview-tabs button.is-active { background: var(--teal-soft); color: #1F6F69; }
.mx-preview { padding: 12px; min-height: 220px; max-height: 520px; overflow: auto; }
.mx-preview .nt-preview-frame { width: 100%; height: 440px; border: 0; border-radius: 10px; background: #fff; }
.mx-preview .hint { margin: 0; }
.mx-preview-note { margin: 0; padding: 0 12px 10px; font-size: .74rem; }
.mx-send-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.mx-send-bar .msg { flex-basis: 100%; margin: 0 0 4px; }
.mx-send-bar .msg:empty { display: none; }
.mx-send-bar .btn-secondary { flex: 0 0 auto; }
.mx-send-bar .primary { flex: 1; justify-content: center; }
.mx-send-bar .primary:disabled { opacity: .55; cursor: not-allowed; }

/* ---- history ---- */
.mx-hist-table td { vertical-align: top; }
.mx-hist-table small { display: block; margin-top: 2px; font-size: .76rem; }
.mx-hist-row { cursor: pointer; }
.mx-hist-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.mx-when { white-space: nowrap; color: var(--ink2); font-size: .82rem; }
.mx-hist-head { display: block; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-delivery-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.mx-dpill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  font: 600 .74rem var(--font-mono); border: 1px solid var(--line); background: var(--surface2); color: var(--ink2); white-space: nowrap;
}
.mx-dpill .mx-ch-icon { width: 12px; height: 12px; }
.mx-dpill i { font-style: normal; font-weight: 500; margin-left: 2px; }
.mx-dpill.is-ok { color: #1F6F69; border-color: #A9D8D3; background: var(--teal-soft); }
.mx-dpill.is-wait { color: #9A5F05; border-color: #F0CB86; background: var(--amber-soft); }
.mx-dpill.is-bad { color: var(--err); border-color: #EFB2AA; background: #FBE3DF; }
dialog.mx-hist-dialog { width: min(680px, 94vw); }
.mx-hist-block { padding: 12px 0; border-top: 1px solid var(--row-line); }
.mx-hist-block h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 700 .82rem var(--font-display); color: var(--teal); }
.mx-hist-block p { margin: 0 0 6px; font-size: .88rem; line-height: 1.55; }
.mx-pre { white-space: pre-wrap; }
.mx-problems ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.mx-problems li { font-size: .86rem; }
.mx-problems small { display: block; color: var(--ink2); font-size: .76rem; margin-top: 2px; }

/* ---- delivery settings ---- */
.mx-delivery { display: flex; flex-direction: column; gap: 16px; }
.mx-dcard { border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; background: var(--surface); }
.mx-dcard header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.mx-dcard header > div { flex: 1; }
.mx-dcard h3 { margin: 0; font: 700 1.05rem var(--font-display); }
.mx-dcard header .hint { margin: 2px 0 0; font-size: .82rem; }
.mx-dcard-icon { display: inline-flex; width: 38px; height: 38px; padding: 9px; box-sizing: border-box; border-radius: 10px; background: var(--teal-soft); color: var(--teal); flex-shrink: 0; }
.mx-dcard-icon svg { width: 100%; height: 100%; }
.mx-status { flex-shrink: 0; padding: 4px 10px; border-radius: 999px; font: 600 .76rem var(--font-body); white-space: nowrap; }
.mx-status.is-on { background: var(--teal-soft); color: #1F6F69; }
.mx-status.is-off { background: var(--surface2); color: var(--ink2); border: 1px solid var(--line); }
.mx-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.mx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mx-field.is-wide { grid-column: 1 / -1; }
.mx-field label { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: #3F464E; }
.mx-field small { font-size: .76rem; color: var(--ink2); line-height: 1.4; }
.mx-src { font: 600 .66rem var(--font-body); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: var(--surface2); color: #8A9098; }
.mx-src.is-saved { background: var(--teal-soft); color: #1F6F69; }
.mx-src.is-bad { background: #FBE3DF; color: var(--err); }
.mx-secret { display: flex; align-items: center; gap: 10px; }
.mx-secret input { flex: 1; }
.mx-secret .link-btn { font-size: .8rem; white-space: nowrap; }
.mx-danger { color: var(--err) !important; }
.mx-dcard-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--row-line); }
.mx-test { display: inline-flex; gap: 8px; flex: 0 1 420px; }
.mx-test button { white-space: nowrap; flex-shrink: 0; }
.admin-app .mx-test input { min-width: 0; }
.mx-dcard > .msg { margin: 10px 0 0; }
.mx-dcard > .msg:empty { display: none; }
.nt-library { display: block; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: var(--teal-soft); font-size: .84rem; font-weight: 600; }
.nt-library select { margin-top: 6px; }

@media (max-width: 1100px) {
  .mx-compose { grid-template-columns: 1fr; }
  .mx-compose-side { position: static; }
}
@media (max-width: 640px) {
  .mx-tab span { display: none; }
  .mx-tab { padding: 10px; }
  .mx-tab.is-active span { display: inline; }
  .mx-row2, .mx-fields { grid-template-columns: 1fr; }
  .mx-picklist { grid-template-columns: 1fr; }
  .mx-dcard { padding: 16px 14px; }
  .mx-dcard header { flex-wrap: wrap; }
  .mx-test { flex-basis: 100%; }
  .mx-send-bar .btn-secondary, .mx-send-bar .primary { flex: 1 1 100%; }
}

/* ---- Templates connected to events ---- */
.mx-chtabs button[hidden] { display: none; }
.mx-tpl-for { display: grid; gap: 8px; margin: 2px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--teal-soft); }
.mx-tpl-for > label:first-child { font-size: .84rem; font-weight: 600; }
.mx-tpl-for select { margin-top: 6px; }
.mx-tpl-for .hint { margin: 0; font-size: .78rem; }
.mx-tpl-for-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: .78rem; font-weight: 600; color: var(--ink); }
.mx-tpl-for-line > span:last-child { font-weight: 500; color: var(--ink2); }
.mx-tpl-for-line > span.is-on { color: var(--teal); }
.mx-tpl-kind { padding: 1px 7px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: .7rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.mx-tpl-card.is-event { border-left: 3px solid var(--teal); }
#mxTplKind { width: auto; min-width: 150px; }

.nt-link-ic { width: 13px; height: 13px; vertical-align: -2px; color: var(--teal); flex: none; }
.nt-edit.is-linked { border-color: var(--teal); color: var(--teal); }
.nt-tpl-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; font-size: .76rem; color: var(--ink2); }
.nt-tpl-link { padding: 0; border: 0; background: none; color: var(--teal); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.nt-tpl-link:hover { color: var(--teal-hover); }
.nt-library .hint { margin: 6px 0 0; font-size: .76rem; font-weight: 500; }
.nt-library label { display: block; }
.nt-linked-card { display: grid; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.nt-linked-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nt-linked-head strong { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.nt-linked-slot span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink2); }
.nt-linked-slot p { margin: 2px 0 0; font-size: .86rem; white-space: pre-wrap; }
.nt-linked-card .hint { margin: 0; font-size: .76rem; }
.mx-tpl-for-line > span:last-child { flex-basis: 100%; }
/* Stacked on a phone, the editor scrolls as one; a fields column with its
   own scroll box collapsed to a sliver between the header and the preview. */
@media (max-width: 900px) {
  .admin-app .nt-editor-fields { overflow: visible; min-height: auto; padding-right: 0; }
}
.mx-dcard-sub { margin: 18px 0 2px; padding-top: 16px; border-top: 1px solid var(--line); font: 700 .92rem var(--font-display); }
.mx-dcard-subhint { margin: 0 0 12px; font-size: .78rem; }
.mx-field textarea { width: 100%; min-height: 70px; resize: vertical; }
.mx-btnset { margin: 4px 0 14px; padding: 12px 14px 8px; border: 1px solid var(--line); border-radius: 10px; }
.mx-btnset legend { padding: 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink2); }
.mx-btnset .mx-row2 label { margin-bottom: 6px; }
.mx-btnset > .hint { margin: 0 0 10px; font-size: .76rem; }
.mx-xbtns { display: grid; gap: 8px; margin-bottom: 8px; }
.mx-xbtns:empty { display: none; }
.mx-xbtn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.mx-xbtn input { margin: 0 !important; }
#mxTplAddButton { margin-bottom: 6px; font-size: .84rem; }
@media (max-width: 640px) { .mx-xbtn { grid-template-columns: 1fr auto; } .mx-xbtn [data-xb="url"] { grid-column: 1; } }
.mx-aud-optout { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft, #FDEFD6); color: #7A4D05; font-size: .8rem; line-height: 1.45; }
.mx-opt-table td small { display: block; }
#mxOptRole { width: auto; min-width: 130px; }
/* Admin password forms: generate + email option */
.pw-admin-extra { display: flex; flex-direction: column; gap: 8px; flex: 1 1 100%; }
.pw-admin-extra .link-btn { align-self: flex-start; font-size: .84rem; }
.admin-app .form-row label.pw-check, .admin-app .form label.pw-check { flex-direction: row; min-width: 0; flex: none; }
.prof-pw { margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.prof-pw summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.prof-pw[open] summary { margin-bottom: 10px; }
.prof-pw label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.prof-pw .hint { margin: 0; font-size: .78rem; }

/* Organisation: the same fields as every other admin form (they sat
   outside .form/.form-row, so they fell back to browser defaults). */
.admin-app .org-groups :is(input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) {
  width: 100%; box-sizing: border-box; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  color: var(--ink); font: 400 .9rem var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-app .org-groups textarea { line-height: 1.55; resize: vertical; }
.admin-app .org-groups :is(input, select, textarea):hover { border-color: #C4BFB5; }
.admin-app .org-groups :is(input, select, textarea):focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.admin-app .org-groups :is(input, textarea).is-dirty { border-color: var(--amber); background: #FFFBF2; }
.admin-app .org-label { font-size: .82rem; color: #3F464E; margin-bottom: 6px; }

/* =====================================================================
   Kit BOM: overview control bar + collapsible kit cards
   ===================================================================== */
.bom-overview { display: flex; flex-direction: column; gap: 14px; }
.bom-ov-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 24px; }
.bom-ov-head .hint { margin: 4px 0 0; max-width: 70ch; }
.bom-ov-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bom-totals { display: flex; flex-wrap: wrap; gap: 8px; }
.bom-total { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface2); font-size: .8rem; color: var(--ink2); }
.bom-total b { font: 700 .98rem var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.bom-filters { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.bom-search { flex: 1 1 320px; min-width: 220px; }
.admin-app .bom-filters :is(.app-search input, select) {
  box-sizing: border-box; height: 42px; margin: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 400 .9rem var(--font-body);
}
.admin-app .bom-filters select { flex: 0 0 210px; padding: 0 12px; }
.admin-app .bom-filters :is(input, select):focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.bom-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface2); }
.bom-seg button { border: 0; background: none; padding: 0 14px; border-radius: 7px; font: 600 .84rem var(--font-body); color: var(--ink2); cursor: pointer; }
.bom-seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.bom-listbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.bom-listbar .hint { margin: 0; }
.bom-listbar-right { display: inline-flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--ink2); }
.bom-listbar-right .link-btn:disabled { opacity: .45; cursor: not-allowed; }
.bom-size { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; }
.admin-app .bom-size select { height: 32px; min-height: 0; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font: inherit; }

/* One kit */
.bom-kit { padding-top: 14px; padding-bottom: 14px; transition: box-shadow .15s ease; }
.bom-kit .bom-kit-head { align-items: center; margin: 0; }
.bom-toggle {
  display: flex; align-items: flex-start; gap: 12px; flex: 1 1 360px; min-width: 0; padding: 6px 8px; margin: -6px -8px;
  border: 0; border-radius: 10px; background: none; text-align: left; color: inherit; font: inherit; cursor: pointer;
}
.bom-toggle:hover:not(:disabled) { background: var(--surface2); }
.bom-toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.bom-toggle:disabled { cursor: default; }
.bom-chev { flex: none; width: 20px; height: 20px; margin-top: 18px; color: var(--ink2); transition: transform .18s ease; }
.bom-kit.is-open .bom-chev { transform: rotate(90deg); color: var(--teal); }
.bom-kit-title { display: flex; flex-direction: column; min-width: 0; }
.bom-kit-name { font: 700 1.15rem/1.3 var(--font-display); color: var(--ink); }
.bom-kit .bom-sub { margin: 2px 0 0; font-size: .84rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.bom-kit.is-open .bom-sub { -webkit-line-clamp: unset; display: block; }
.bom-kit .bom-stats { align-items: center; gap: 8px; }
.bom-kit .bom-stat { min-width: 0; padding: 6px 12px; display: flex; flex-direction: column; align-items: flex-start; }
.bom-kit .bom-stat b { font-size: 1.05rem; }
.bom-kit .bom-stat span { font-size: .62rem; }
.bom-match { padding: 4px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.bom-kit-body { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.bom-kit-body[hidden] { display: none; }
.bom-table mark { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 1px; }
.bom-kit-title mark { background: #FFE9A8; color: inherit; border-radius: 3px; }
.bom-more { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.bom-more .hint { margin: 0; font-size: .8rem; }
.bom-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 4px 0 24px; }
.bom-pager[hidden] { display: none; }
.sc-page-btn { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 600 .86rem var(--font-body); cursor: pointer; }
.sc-page-btn.is-current { background: var(--teal); border-color: var(--teal); color: #fff; }
.sc-page-btn:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 760px) {
  .admin-app .bom-filters select { flex: 1 1 100%; }
  .bom-seg { flex: 1 1 100%; } .bom-seg button { flex: 1; height: 34px; }
  .bom-kit .bom-stats { width: 100%; padding-left: 32px; }
  .bom-size { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .bom-chev { transition: none; } }

/* Add teacher / Add admin: a 3-up grid, tops aligned, so the strength bar
   and "Passwords match" line grow downwards instead of lifting one box
   above its neighbours. */
.admin-app .form-row.pw-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: start; gap: 14px 14px; }
.admin-app .form-row.pw-form > label { grid-column: span 2; min-width: 0; }
.admin-app .form-row.pw-form > label.half { grid-column: span 3; }
.admin-app .form-row.pw-form > .pw-admin-extra { grid-column: 1 / -1; }
.admin-app .form-row.pw-form > button { grid-column: 1 / -1; justify-self: start; }
.admin-app .pw-match:empty { display: none; }
@media (max-width: 800px) {
  .admin-app .form-row.pw-form { grid-template-columns: minmax(0, 1fr); }
  .admin-app .form-row.pw-form > label, .admin-app .form-row.pw-form > label.half { grid-column: 1 / -1; }
}
/* In a narrow column the tip goes under the bar, not beside it. */
.admin-app .pw-form .pw-meter, .admin-app dialog .pw-meter { grid-template-columns: minmax(0, 1fr) auto; }
.admin-app .pw-form .pw-meter-tip, .admin-app dialog .pw-meter-tip { grid-column: 1 / -1; }
