/*
 * Microsoft Places — Tag Manager
 */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --ink:     #0A1D5F;
  --blue:    #0972CE;
  --teal:    #37C1CE;
  --vi:      #0972CE;   /* alias of --blue, matches Control Center's token name */
  --vi2:     #37C1CE;   /* alias of --teal, matches Control Center's token name */
  --snow:    #f7f8fb;
  --cloud:   #eef0f6;
  --mist:    #e2e4ef;
  --silver:  #abafc4;
  --surface: #ffffff;
  --text:    #1a1a2e;
  --muted:   #5a6278;
  --danger:  #d13438;
  --success: #107c10;
  --top-h:   56px;
  --filt-h:  52px;
  --rad:     8px;

  --c-building:   #0A1D5F;
  --c-floor:      #0972CE;
  --c-section:    #5a6278;
  --c-room:       #107c10;
  --c-workspace:  #8764b8;
  --c-desk:       #0e7d80;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--snow);
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

#main-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

[hidden] { display: none !important; }

/* ── Sign-in screen ─────────────────────────────────────────────────────────── */
#signin-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  z-index: 100;
}

#signin-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,193,206,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,193,206,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.signin-logo {
  position: absolute; top: 24px; left: 28px;
  height: 28px; width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}

.signin-card {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 44px;
  text-align: center;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.32);
}

.signin-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--teal); margin-bottom: 12px;
}

.signin-card h1 { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.signin-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }

.btn-ms {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 8px;
  padding: 14px 24px; font-family: inherit;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-ms:hover { background: #0d2470; }

/* ── Loading screen ─────────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: var(--ink); z-index: 90;
}

.loading-logo { height: 32px; width: auto; filter: brightness(0) invert(1); opacity: .85; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(55,193,206,.25);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-msg { font-size: 14px; color: rgba(255,255,255,.7); }

/* ── Error / Consent / Maintenance screens ──────────────────────────────────── */
#error-screen,
#consent-screen,
#maintenance-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--snow); z-index: 80;
}

.error-card {
  background: var(--surface); border-radius: 12px;
  padding: 40px; text-align: center; width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  border: 1px solid var(--mist);
}

.error-icon { margin-bottom: 16px; }
.error-card h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.error-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 20px; }

.btn-retry {
  display: inline-block; padding: 10px 24px;
  background: var(--ink); color: #fff; border: none; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-retry:hover { background: #0d2470; }

#avispl-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  z-index: 100;
  overflow: hidden;
}
#avispl-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,193,206,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,193,206,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
#avispl-screen::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0972CE 0%, #37C1CE 100%);
}
.avispl-prompt-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.btn-avispl-continue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-avispl-continue:hover {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.06);
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 20px;
  background: var(--ink); flex-shrink: 0;
}

.tb-logo { height: 22px; width: auto; filter: brightness(0) invert(1); opacity: .9; }
.tb-divider { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 0 4px; }

.tb-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tb-breadcrumb-parent {
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6);
  text-decoration: none; transition: color .15s;
}
.tb-breadcrumb-parent:hover { color: rgba(255,255,255,.9); }
.tb-breadcrumb-sep { font-size: 13px; color: rgba(255,255,255,.35); }
.tb-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }

.btn-back, .btn-signout, .btn-help {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8);
  background: transparent; text-decoration: none; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-back:hover, .btn-signout:hover, .btn-help:hover {
  background: rgba(255,255,255,.1); color: #fff;
}

/* ── Expiry badge + modal ─────────────────────────────────────────────────────── */
.user-expiry-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #d97706;
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  pointer-events: none;
  z-index: 1;
}

.expiry-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,29,95,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.expiry-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(10,29,95,.18);
  padding: 28px;
  max-width: 400px;
  width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.expiry-modal-icon {
  width: 40px;
  height: 40px;
  background: #fffbeb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.expiry-modal h2 { font-size: 17px; font-weight: 700; color: #0A1D5F; margin: 0; }
.expiry-modal p  { font-size: 14px; color: #5a6278; line-height: 1.55; margin: 0; }
.expiry-modal a  { color: #0972CE; font-weight: 600; }
.expiry-modal .btn-expiry-ok {
  align-self: flex-end;
  background: #0972CE;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  transition: background .15s;
  margin-top: 4px;
}
.expiry-modal .btn-expiry-ok:hover { background: #0762b0; }

/* ── User info chip + popover ────────────────────────────────────────────────── */
.user-info-wrap { position: relative; flex-shrink: 0; }

.btn-user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px 4px 8px;
  transition: background .15s;
  white-space: nowrap;
}
.btn-user-info:hover { background: rgba(255,255,255,.18); }
.btn-user-info .user-chevron { opacity: .55; transition: transform .2s; }
.btn-user-info[aria-expanded="true"] .user-chevron { transform: rotate(180deg); }

.user-info-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e4ef;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(10,29,95,.12), 0 1px 4px rgba(0,0,0,.06);
  min-width: 260px;
  z-index: 200;
}
.uip-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0f0f6;
}
.uip-row:last-child { border-bottom: none; }
.uip-label {
  font-size: 10px;
  font-weight: 700;
  color: #5a6278;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.uip-value { font-size: 13px; color: #1a1a2e; word-break: break-all; }
.uip-mono  { font-family: monospace; font-size: 11px; }
.uip-expiry-ok   { color: #107c10; }
.uip-expiry-warn { color: #d97706; }
.uip-expiry-none { color: #5a6278; }

/* ── Maintenance banner ─────────────────────────────────────────────────────── */
.maintenance-banner {
  background: #fffbeb;
  border-bottom: 2px solid #fbbf24;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}
.maintenance-banner svg { flex-shrink: 0; }
.maintenance-banner-msg { flex: 1; }
.maintenance-banner-dismiss {
  background: transparent;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  color: #92400e;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.maintenance-banner-dismiss:hover { background: #fef3c7; }

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tm-tabs {
  display: flex; gap: 4px; background: var(--cloud); border-radius: 8px; padding: 3px;
  margin: 14px 24px 0;
  width: fit-content;
  flex-shrink: 0;
}
.tm-tab {
  border: none; background: transparent; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 7px 16px; border-radius: 6px; cursor: pointer;
  transition: background .15s, color .15s;
}
.tm-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Filter bar — ported to match Control Center's #filterbar ───────────────── */
#filterbar {
  height: var(--filt-h);
  background: var(--surface);
  border-bottom: 1px solid var(--mist);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 10px;
}
#filterbar::-webkit-scrollbar { display: none; }

.filter-srch {
  display: flex; align-items: center; gap: 6px;
  background: var(--snow); border: 1px solid var(--mist); border-radius: 6px;
  padding: 0 10px; min-width: 220px; flex-shrink: 0; transition: border-color .15s;
}
.filter-srch:focus-within { border-color: var(--vi); }
.filter-srch svg { color: var(--silver); flex-shrink: 0; }
.filter-srch input {
  border: none; background: transparent; font-family: inherit; font-size: 13px;
  color: var(--text); outline: none; padding: 8px 0; width: 100%;
}
.filter-srch input::placeholder { color: var(--silver); }

.filter-sel {
  background: var(--snow); border: 1px solid var(--mist); border-radius: 6px;
  padding: 7px 30px 7px 10px; font-family: inherit; font-size: 13px; color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23abafc4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; min-width: 130px; flex-shrink: 0; transition: border-color .15s;
}
.filter-sel:focus { outline: 2px solid var(--vi); outline-offset: -1px; border-color: transparent; }
.filter-sel:hover { border-color: var(--vi); }

.btn-clear {
  background: transparent; border: 1px solid var(--mist); border-radius: 6px;
  padding: 7px 14px; font-family: inherit; font-size: 13px; color: var(--muted);
  cursor: pointer; flex-shrink: 0; transition: background .15s, color .15s; white-space: nowrap;
}
.btn-clear:hover { background: var(--cloud); color: var(--text); }

.filter-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.btn-tree-ctrl {
  background: transparent; border: none; padding: 6px 10px;
  font-family: inherit; font-size: 12px; font-weight: 500; color: var(--vi);
  cursor: pointer; border-radius: 5px; white-space: nowrap; transition: background .15s;
}
.btn-tree-ctrl:hover { background: var(--cloud); }

.btn-tm-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--mist); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-tm-secondary:hover { background: var(--cloud); border-color: var(--silver); }

/* ── Selection bar ─────────────────────────────────────────────────────────── */
#tm-selection-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px;
  background: #eef7fd;
  border-bottom: 1px solid #cfe6f7;
  flex-shrink: 0;
}
#tm-selection-count { font-size: 13px; font-weight: 700; color: var(--ink); flex-shrink: 0; }
#tm-bulk-tag-input {
  flex: 1; max-width: 320px;
  border: 1px solid var(--mist); border-radius: 6px;
  padding: 7px 12px; font-family: inherit; font-size: 13px; outline: none;
}
#tm-bulk-tag-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,114,206,.1); }

.btn-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border: none; border-radius: 7px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-action.primary { background: var(--ink); color: #fff; }
.btn-action.primary:hover:not(:disabled) { background: #0d2470; }
.btn-action.danger { background: var(--danger); color: #fff; }
.btn-action.danger:hover:not(:disabled) { background: #b02a2e; }
.btn-action:disabled { opacity: .5; cursor: not-allowed; }

/* ── Main body ──────────────────────────────────────────────────────────────── */
#app-body { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }

.tm-panel { max-width: 1400px; margin: 0 auto; }

.tm-empty { text-align: center; color: var(--muted); padding: 32px 14px; }

.tm-type-badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 8px; border-radius: 4px; color: #fff;
}
.tm-type-building   { background: var(--c-building); }
.tm-type-floor       { background: var(--c-floor); }
.tm-type-section     { background: var(--c-section); }
.tm-type-room        { background: var(--c-room); }
.tm-type-workspace   { background: var(--c-workspace); }
.tm-type-desk        { background: var(--c-desk); }

/* ── Building groups (collapsible) ───────────────────────────────────────────── */
.tm-group {
  background: var(--surface);
  border: 1px solid var(--mist);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.tm-group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--ink); color: #fff;
  cursor: pointer; user-select: none;
  transition: background .15s;
}
.tm-group-header:hover { background: #112574; }
.tm-group-header:focus-visible { outline: 2px solid var(--vi2); outline-offset: -2px; }
.tm-group-chevron { flex-shrink: 0; color: rgba(255,255,255,.7); transition: transform .2s cubic-bezier(.4,0,.2,1); }
.tm-group-header.collapsed .tm-group-chevron { transform: rotate(-90deg); }
.tm-group-check { flex-shrink: 0; width: 15px; height: 15px; cursor: pointer; accent-color: var(--vi2); }
.tm-group-name { font-size: 14px; font-weight: 600; flex: 1; }
.tm-group-count { font-size: 12px; opacity: .65; font-weight: 400; }
.tm-group-body.hidden { display: none; }

.tm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 14px;
}

.tm-resource-card {
  aspect-ratio: 1 / 1;
  background: var(--snow);
  border: 1px solid var(--mist);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.tm-resource-card:hover { border-color: var(--vi); box-shadow: 0 2px 8px rgba(9,114,206,.08); }

.tm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.tm-card-head .tm-row-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--vi); }

/* Large resource-type icon — the card's visual anchor, same pattern as
   Device Manager's sensor-type icon */
.tm-card-icon {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin: 0 auto;
  border-radius: 50%;
  background: var(--cloud); color: #fff;
}
.tm-card-icon-building   { background: rgba(10,29,95,.12);   color: var(--c-building); }
.tm-card-icon-floor      { background: rgba(9,114,206,.12);  color: var(--c-floor); }
.tm-card-icon-section    { background: rgba(90,98,120,.12);  color: var(--c-section); }
.tm-card-icon-room       { background: rgba(16,124,16,.12);  color: var(--c-room); }
.tm-card-icon-workspace  { background: rgba(135,100,184,.15); color: var(--c-workspace); }
.tm-card-icon-desk       { background: rgba(14,125,128,.15); color: var(--c-desk); }

.tm-card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; text-align: center; }

.tm-card-name {
  font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tm-card-breadcrumb { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Report tab table (kept tabular — suits dense numeric data) ─────────────── */
.tm-list-wrap {
  background: var(--surface);
  border: 1px solid var(--mist);
  border-radius: 10px;
  overflow: hidden;
}
.tm-list { width: 100%; border-collapse: collapse; }
.tm-list thead th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  padding: 10px 14px; background: var(--cloud); border-bottom: 1px solid var(--mist);
}
.tm-list tbody td { padding: 10px 14px; border-bottom: 1px solid var(--mist); vertical-align: middle; }
.tm-list tbody tr:last-child td { border-bottom: none; }
.tm-list tbody tr:hover { background: var(--snow); }

/* ── Tag chips ──────────────────────────────────────────────────────────────── */
.tm-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tm-resource-card .tm-chip-row { justify-content: center; overflow: hidden; max-height: 48px; flex-shrink: 0; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--cloud); color: var(--text);
  font-size: 12px; font-weight: 500;
  padding: 3px 6px 3px 10px; border-radius: 999px;
}
.tag-chip-remove {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 4px;
  border-radius: 50%; transition: background .15s, color .15s;
}
.tag-chip-remove:hover { background: rgba(209,52,56,.12); color: var(--danger); }
.tag-chip-remove:disabled { opacity: .4; cursor: not-allowed; }

.tag-chip-add {
  border: 1px dashed var(--silver); background: transparent; color: var(--muted);
  font-family: inherit; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.tag-chip-add:hover { border-color: var(--blue); color: var(--blue); }

.tag-chip-input {
  border: 1px solid var(--blue); border-radius: 999px;
  padding: 3px 10px; font-family: inherit; font-size: 12px;
  width: 150px; outline: none;
}

/* ── Report tab ─────────────────────────────────────────────────────────────── */
.tm-report-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.tm-report-lead { font-size: 13px; color: var(--muted); max-width: 720px; line-height: 1.6; }

.tm-tag-link {
  border: none; background: transparent; color: var(--blue);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline;
  padding: 0;
}

/* ── Bulk tag modal ─────────────────────────────────────────────────────────── */
.bulk-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,29,95,.4);
  z-index: 300;
}
.bulk-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 560px; max-width: 92vw; max-height: 82vh;
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  z-index: 310; display: flex; flex-direction: column; overflow: hidden;
}
.bulk-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.bulk-modal-header .help-close { color: rgba(255,255,255,.7); }
.bulk-modal-header .help-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.bulk-modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.bulk-modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--mist); flex-shrink: 0;
}

.bulk-progress-track { height: 8px; background: var(--cloud); border-radius: 999px; overflow: hidden; }
.bulk-progress-bar { height: 100%; background: var(--teal); width: 0%; transition: width .2s; }
.bulk-progress-text { font-size: 12px; color: var(--muted); text-align: right; }
.bulk-progress-summary { font-size: 13px; font-weight: 600; color: var(--ink); }

.tagbulk-rows { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.tagbulk-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 10px; border-radius: 6px; background: var(--snow);
  font-size: 12px;
}
.tagbulk-row-name { font-weight: 600; color: var(--text); }
.tagbulk-row-status { color: var(--muted); }
.tagbulk-row-status.ok { color: var(--success); font-weight: 600; }
.tagbulk-row-status.fail { color: var(--danger); font-weight: 600; }

/* ── Help drawer ────────────────────────────────────────────────────────────── */
.help-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,29,95,.35);
  backdrop-filter: blur(2px); z-index: 200;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.help-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 95vw;
  background: var(--surface); z-index: 210;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.18);
  animation: slideIn .25s cubic-bezier(.4,0,.2,1);
}

.help-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 3px solid var(--teal);
  background: var(--ink);
  flex-shrink: 0;
}

.help-title { font-size: 15px; font-weight: 700; color: #fff; }

.help-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  border-radius: 6px; cursor: pointer; color: rgba(255,255,255,.6);
  transition: background .15s, color .15s;
}
.help-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.help-body {
  flex: 1; overflow-y: auto; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 24px;
}

.help-section { display: flex; flex-direction: column; gap: 10px; }
.help-section-title { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }

.help-section p { font-size: 13px; color: var(--muted); line-height: 1.75; }
.help-section p + p { margin-top: 6px; }

.help-list { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.help-list li { font-size: 13px; color: var(--muted); line-height: 1.65; }
.help-list strong { color: var(--text); }

.help-section code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px; background: var(--cloud); padding: 1px 5px; border-radius: 3px;
}

@media (max-width: 900px) {
  #tm-toolbar { flex-direction: column; align-items: stretch; }
  .tm-filters { justify-content: flex-start; }
}
