/* ═══════════════════════════════════════════════════════════════════════════
   EFT WebRadar — Modern Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #000;
  --panel: rgba(11, 18, 32, .92);
  --panel-solid: #0b1220;
  --panel2: #111827;
  --surface: rgba(255, 255, 255, .04);
  --surface-hover: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-faint: rgba(229, 231, 235, .45);
  --ok: #4ade80;
  --ok-dim: rgba(74, 222, 128, .15);
  --warn: #facc15;
  --warn-dim: rgba(250, 204, 21, .15);
  --bad: #f87171;
  --bad-dim: rgba(248, 113, 113, .15);
  /* Single accent — matches the desktop client's cyan focus / "on" state. */
  --accent: #34d4d4;
  --accent-dim: rgba(52, 212, 212, .18);
  --accent-soft: rgba(52, 212, 212, .35);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --sidebar-w: 360px;
  --tabbar-h: 64px;
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, "Microsoft YaHei UI", "Microsoft YaHei", "微软雅黑", sans-serif;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); }

/* ═══════════════════════════════════════════════════════════════════════════
   CANVAS
   ═══════════════════════════════════════════════════════════════════════════ */

#root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

#radar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg);
  touch-action: none;
}

.roster-toggle,
.quest-assistant-toggle {
  position: fixed;
  left: 14px;
  top: 76px;
  z-index: 21;
  min-width: 84px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(11, 18, 32, .78);
  box-shadow: 0 12px 34px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.quest-assistant-toggle {
  left: 108px;
}

.roster-toggle[aria-expanded="true"],
.quest-assistant-toggle[aria-expanded="true"] {
  color: #001314;
  background: var(--accent);
  border-color: transparent;
}

.roster-count,
.quest-assistant-count {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,.12);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.roster-toggle[aria-expanded="true"] .roster-count,
.quest-assistant-toggle[aria-expanded="true"] .quest-assistant-count {
  color: #001314;
  background: rgba(0,19,20,.14);
}

#sourceRoster {
  position: fixed;
  left: 14px;
  top: 128px;
  width: min(280px, calc(100vw - 28px));
  max-height: min(58vh, 520px);
  z-index: 20;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(11,18,32,.88), rgba(11,18,32,.68));
  box-shadow: 0 18px 48px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

#sourceRoster[hidden] {
  display: none;
}

.roster-title-row {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.roster-title {
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--accent);
  text-transform: uppercase;
}

.roster-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.roster-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(min(58vh, 520px) - 44px);
  padding-right: 2px;
}

.roster-empty {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text-dim);
}

.roster-source {
  display: none;
}

.roster-row {
  min-height: 44px;
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.roster-row.active {
  border-color: var(--accent-soft);
  background: var(--accent-dim);
}

@media (hover: hover) and (pointer: fine) {
  .roster-toggle:hover,
  .quest-assistant-toggle:hover,
  .roster-close:hover,
  .roster-row:hover,
  .qa-icon-btn:hover {
    border-color: var(--accent-soft);
    background: var(--accent-dim);
  }
}

.roster-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
}

.roster-dot.stale {
  background: var(--warn);
  box-shadow: 0 0 12px var(--warn);
}

.roster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.roster-meta {
  color: var(--text-dim);
  font-size: 11px;
}

#tacticalToolbar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  max-width: min(760px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(11, 18, 32, .82);
  box-shadow: 0 18px 48px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

#tacticalToolbar button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

#tacticalToolbar button.active {
  color: #001314;
  border-color: transparent;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(52,212,212,.36);
}

#tacticalUndo,
#tacticalFinish,
#tacticalCancel {
  display: none;
}

#tacticalToolbar.route-draft #tacticalUndo,
#tacticalToolbar.route-draft #tacticalFinish,
#tacticalToolbar.route-draft #tacticalCancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 820px) {
  .roster-toggle {
    top: 68px;
    left: 10px;
  }

  .quest-assistant-toggle {
    top: 68px;
    left: 104px;
  }

  #sourceRoster {
    left: 10px;
    top: 120px;
    width: min(280px, calc(100vw - 20px));
    max-height: 42vh;
  }

  #tacticalToolbar {
    border-radius: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS BADGE
   ═══════════════════════════════════════════════════════════════════════════ */

#status {
  position: fixed;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10001;
  transition: color var(--transition), background var(--transition);
}

#status .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}

#status.ok .dot  { background: var(--ok);   box-shadow: 0 0 8px var(--ok); }
#status.warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
#status.bad .dot  { background: var(--bad);  box-shadow: 0 0 8px var(--bad); }

#status.ok   { color: var(--ok); }
#status.warn { color: var(--warn); }
#status.bad  { color: var(--bad); }

.settings-toast {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 20001;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-soft);
  background: rgba(11, 18, 32, .96);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12px;
}
.settings-toast[hidden] { display: none; }
.settings-toast button {
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  padding: 5px 9px;
  font-weight: 700;
  cursor: pointer;
}
.settings-toast button:hover { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   RELAY KEY GATE
   ═══════════════════════════════════════════════════════════════════════════ */

.key-gate {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(52, 212, 212, .16), transparent 34%),
    rgba(0, 0, 0, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.key-gate[hidden] { display: none; }
.key-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(11, 18, 32, .94);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.key-eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.key-card h1 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.2;
}
.key-label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 12px;
}
.key-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  outline: none;
}
.key-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.key-error {
  min-height: 20px;
  margin-top: 8px;
  color: var(--bad);
  font-size: 12px;
}
.key-submit {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #061015;
  font-weight: 800;
  cursor: pointer;
}
.key-submit:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════════════════════════════════════════
   HAMBURGER MENU BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

#followLockBtn,
#fullscreenBtn,
#menuBtn {
  position: fixed;
  top: 10px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(17, 24, 39, .78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  cursor: pointer;
  z-index: 10004;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform .15s ease;
}
#menuBtn { right: 10px; }
#fullscreenBtn { right: 62px; color: rgba(229, 231, 235, .9); }
#followLockBtn {
  right: 114px;
  color: rgba(229, 231, 235, .92);
  font-size: 19px;
  line-height: 1;
}
#followLockBtn.unlocked {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-soft);
}
#followLockBtn .follow-lock-icon {
  display: block;
  transform: translateY(-1px);
}
#followLockBtn:hover,
#fullscreenBtn:hover,
#menuBtn:hover { background: rgba(17, 24, 39, .95); }
#followLockBtn:active,
#fullscreenBtn:active,
#menuBtn:active { transform: scale(.94); }
#followLockBtn:focus-visible,
#fullscreenBtn:focus-visible,
#menuBtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#fullscreenBtn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#fullscreenBtn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-soft);
}

#menuBtn .lines {
  width: 18px;
  height: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#menuBtn .lines span {
  height: 2px;
  border-radius: 999px;
  background: rgba(229, 231, 235, .9);
  display: block;
  transition: transform .2s ease, opacity .2s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EDGE ZONE (hover-open trigger)
   ═══════════════════════════════════════════════════════════════════════════ */

#edgeZone {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 14px;
  z-index: 10003;
  background: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  min-height: 0;

  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .3);

  display: flex;
  flex-direction: column;

  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
  transform: translateX(0);
  z-index: 10002;
}
#sidebar.collapsed { transform: translateX(100%); }

/* ── Sidebar Header ── */
#sidebar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(17, 24, 39, .5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#titlewrap { display: flex; flex-direction: column; gap: 2px; }
#title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
  background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#subline { font-size: 11px; color: var(--text-dim); }

#toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
#toggle:hover { background: var(--surface-hover); color: var(--text); }

/* ── Settings Search ── */
.settings-search {
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, .32);
  flex-shrink: 0;
}
.settings-search input {
  width: 100%;
  max-width: none;
  margin-left: 0;
  display: block;
  height: 38px;
}
.settings-search-results {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(100% - 6px);
  z-index: 10005;
  max-height: min(320px, 52vh);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(11, 18, 32, .98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .48);
}
.settings-search-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.settings-search-item:hover,
.settings-search-item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.settings-search-title {
  font-size: 12px;
  font-weight: 700;
}
.settings-search-path {
  color: var(--text-dim);
  font-size: 11px;
}
.settings-search-empty {
  padding: 10px;
  color: var(--text-dim);
  font-size: 12px;
}
.setting-hit {
  animation: setting-hit-pulse 1.2s ease;
}
@keyframes setting-hit-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 212, 212, .0); }
  20% { box-shadow: 0 0 0 3px rgba(52, 212, 212, .36); background: rgba(52, 212, 212, .12); }
  100% { box-shadow: 0 0 0 0 rgba(52, 212, 212, .0); }
}

/* ── Tabs ── */
.tabbar {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(17, 24, 39, .25);
}

.tab {
  flex: 1 0 33.333%;
  text-align: center;
  padding: 9px 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  user-select: none;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .02); }
.tab.active {
  color: var(--ok);
  border-color: var(--ok);
}

/* ── Tab Content ── */
.tab-content {
  display: none;
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.tab-content.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.section {
  margin-bottom: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.section + .section { margin-top: 4px; }

.section h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Labels */
.section label,
.ctrl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 7px 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  gap: 10px;
}

/* ── Color Inputs ── */
.section input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  padding: 2px;
  transition: border-color var(--transition);
}
.section input[type="color"]:hover { border-color: rgba(255, 255, 255, .25); }
.section input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.section input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .1);
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.toggle-switch .slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-dim);
  border-radius: 999px;
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked + .slider {
  background: var(--ok-dim);
  border-color: rgba(74, 222, 128, .3);
}
.toggle-switch input:checked + .slider::before {
  transform: translateY(-50%) translateX(18px);
  background: var(--ok);
}

/* ── Range Slider ── */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.range-wrap .range-val {
  min-width: 32px;
  text-align: right;
  font-size: 11px;
  color: var(--text-dim);
  font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
  white-space: nowrap;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--text);
  border: 2px solid var(--ok);
  box-shadow: 0 0 6px rgba(74, 222, 128, .25);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(74, 222, 128, .4);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--text);
  border: 2px solid var(--ok);
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  height: 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS & BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}

button.small {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  min-height: 38px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
button.small:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, .2);
}
button.small:active { transform: scale(.97); }

.badge {
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-dim);
  white-space: nowrap;
}

.kv {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin: 6px 0;
  color: var(--text-dim);
}

.hint {
  font-size: 11px;
  color: var(--text-faint);
  margin: 4px 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLTIP
   ═══════════════════════════════════════════════════════════════════════════ */

.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 20000;
  max-width: 300px;

  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: rgba(17, 24, 39, .94);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .5);

  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.tooltip.hidden { display: none; }

.tooltip .t-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tooltip .t-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .2);
  flex-shrink: 0;
}
.tooltip .t-name {
  font-weight: 700;
  font-size: 13px;
}
.tooltip .t-type {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.tooltip .t-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.tooltip .t-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-size: 11px;
}
.tooltip .t-grid .k { color: var(--text-dim); }
.tooltip .t-grid .v { text-align: right; font-family: "Cascadia Code", "Fira Code", monospace; }

/* Equipment breakdown */
.tooltip .t-eq-h {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.tooltip .t-grid.t-eq .v {
  text-align: left;
  font-family: inherit;
}
.tooltip .t-price { color: var(--ok); }

/* ═══════════════════════════════════════════════════════════════════════════
   PLAYER COUNT CHIPS (status area)
   ═══════════════════════════════════════════════════════════════════════════ */

#playerCounts {
  position: fixed;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 10001;
}
#playerCounts:empty { display: none; }

.pcount-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}
.pcount-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTAINER SELECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.container-select {
  margin-top: 6px;
}
.container-select summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  padding: 4px 0;
  user-select: none;
}
.container-select summary:hover {
  color: var(--text);
}
.container-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.container-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.container-item:hover {
  background: var(--surface-hover);
}
.container-item.disabled {
  cursor: default;
  opacity: .62;
}
.container-item.disabled:hover {
  background: transparent;
}
.container-item .cname {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.container-item.quest-item {
  align-items: flex-start;
}
.container-item.quest-item .cname {
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: normal;
  min-width: 0;
}
.quest-title-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest-req-preview {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}
.quest-req-chip,
.quest-req-more {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 5px;
  border: 1px solid rgba(52, 212, 212, .42);
  border-radius: 999px;
  background: rgba(8, 72, 84, .52);
  color: #d9ffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}
.quest-req-chip.key {
  border-color: rgba(251, 191, 36, .45);
  background: rgba(120, 53, 15, .45);
  color: #fde68a;
}
.quest-req-more {
  color: #cbd5e1;
  border-color: var(--border);
  background: var(--surface);
}
.container-type-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 18px;
  border-radius: 4px;
  background: rgba(8, 72, 84, .55);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.category-grid label {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 72, 84, .28);
}
.container-type-glyph {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 5px;
  background: rgba(8, 72, 84, .55);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, .55), 0 0 8px rgba(96, 165, 250, .24);
}
.container-type-glyph::before,
.container-type-glyph::after {
  content: "";
  position: absolute;
  border: 1.5px solid #93c5fd;
  border-radius: 2px;
}
.container-type-glyph::before {
  left: 4px;
  right: 4px;
  top: 4px;
  height: 4px;
  border-bottom: 0;
}
.container-type-glyph::after {
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 9px;
  box-shadow: inset 0 3px 0 rgba(147, 197, 253, .45);
}
.quest-kappa {
  color: #fbbf24;
  margin-right: 4px;
  font-weight: 600;
}
.quest-trader {
  color: var(--muted);
  font-size: 11px;
  margin-left: 6px;
}
button.small.wl-rm {
  width: 34px;
  min-height: 34px;
  padding: 4px 0;
  line-height: 1;
  flex-shrink: 0;
}
.container-list {
  max-height: 320px;
}

/* Map-style shortcut stays available beside the radar. */
.map-style-launcher { position: fixed; top: 76px; right: 14px; z-index: 19; display: flex; flex-direction: column; gap: 8px; }
.map-style-launcher button {
  color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; min-height: 44px; font: inherit; cursor: pointer; touch-action: manipulation;
}
.map-style-launcher button:hover { border-color: var(--accent-soft); background: var(--accent-dim); }
.map-style-launcher button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-style-quick { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border-strong); }
.map-style-quick[hidden] { display: none; }
.map-style-quick button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
#mapStyle, #mapStylePreference, #syncMapCatalog { min-height: 44px; }
#mapStyle:disabled, #syncMapCatalog:disabled { opacity: .6; cursor: default; }
.loot-live-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.loot-live-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 0;
}
.loot-live-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 12px;
  width: 100%;
  min-height: 66px;
  text-align: left;
  padding: 10px 11px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(8, 72, 84, .22);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.loot-live-row:hover {
  background: rgba(8, 72, 84, .34);
}
.loot-live-row:focus-visible {
  outline: 2px solid rgba(124, 255, 107, .72);
  outline-offset: 2px;
}
.loot-live-row.selected {
  border-color: rgba(124, 255, 107, .52);
  box-shadow: 0 0 0 1px rgba(124, 255, 107, .22), 0 0 16px rgba(124, 255, 107, .14);
  background: rgba(45, 120, 38, .24);
}
.loot-live-main,
.loot-live-meta {
  min-width: 0;
}
.loot-live-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.loot-live-meta {
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding-top: 1px;
}
.loot-live-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}
.loot-live-titleline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.loot-live-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .35);
  color: #7CFF6B;
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16);
}
.loot-live-row.selected .loot-live-pick {
  border-color: rgba(124, 255, 107, .82);
  background: rgba(124, 255, 107, .18);
}
.loot-live-count {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.loot-live-full {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.25;
  padding-left: 24px;
}
.loot-live-price {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.loot-live-distance {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}
.loot-live-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-left: 24px;
  margin-top: 1px;
}
.loot-live-tag {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .16);
  border: 1px solid rgba(148, 163, 184, .20);
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
}
.loot-live-empty {
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .28);
}
.toggle-switch.small {
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch.small .slider::before {
  width: 16px;
  height: 16px;
}
.toggle-switch.small input:checked + .slider::before {
  transform: translateY(-50%) translateX(14px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEXT INPUT / SELECT (loot search, mode)
   ═══════════════════════════════════════════════════════════════════════════ */

.text-input {
  flex: 1;
  min-width: 0;
  max-width: 60%;
  margin-left: auto;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.text-input:hover { background: var(--surface-hover); }
.text-input:focus {
  border-color: var(--accent);
  background: var(--surface-hover);
}
select.text-input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
}
select.text-input option {
  background: var(--panel-solid);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AIMVIEW WIDGET
   ═══════════════════════════════════════════════════════════════════════════ */

.aimview {
  position: fixed;
  bottom: 12px;
  left: 12px;
  border-radius: var(--radius-lg);
  background: rgba(11, 18, 32, .88);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  z-index: 10000;
  overflow: hidden;
  touch-action: none;
  display: flex;
  flex-direction: column;
}
.aimview.dragging { cursor: grabbing; }
.aimview.hidden { display: none; }

.aimview-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim, #9aa6bd);
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid var(--border-strong);
  cursor: grab;
  user-select: none;
}
.aimview.dragging .aimview-header { cursor: grabbing; }
.aimview-grip { opacity: .55; letter-spacing: -1px; }

.aimview canvas {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Resize handles */
.aimview-resize {
  position: absolute;
  z-index: 2;
}
.aimview-resize-n  { top: 0;    left: 6px;  right: 6px; height: 4px; cursor: ns-resize; }
.aimview-resize-s  { bottom: 0; left: 6px;  right: 6px; height: 4px; cursor: ns-resize; }
.aimview-resize-e  { top: 6px;  bottom: 6px; right: 0;  width: 4px;  cursor: ew-resize; }
.aimview-resize-w  { top: 6px;  bottom: 6px; left: 0;   width: 4px;  cursor: ew-resize; }
.aimview-resize-ne { top: 0;    right: 0;  width: 10px; height: 10px; cursor: nesw-resize; }
.aimview-resize-nw { top: 0;    left: 0;   width: 10px; height: 10px; cursor: nwse-resize; }
.aimview-resize-se { bottom: 0; right: 0;  width: 12px; height: 12px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,.25) 50%); }
.aimview-resize-sw { bottom: 0; left: 0;   width: 10px; height: 10px; cursor: nesw-resize; }

/* ═══════════════════════════════════════════════════════════════════════════
   QUEST ASSISTANT WIDGET
   Button-opened panel; visually aligned with the teammate roster glass panel.
   ═══════════════════════════════════════════════════════════════════════════ */

.quest-assistant {
  position: fixed;
  right: 14px;
  top: 128px;
  width: 320px;
  height: 360px;
  min-width: 220px;
  min-height: 160px;
  max-width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(11,18,32,.88), rgba(11,18,32,.68));
  box-shadow: 0 18px 48px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
  touch-action: none;
}

#questAssistant[hidden] {
  display: none;
}

.qa-header {
  flex: 0 0 auto;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: grab;
  user-select: none;
}
.quest-assistant.dragging .qa-header { cursor: grabbing; }
.qa-title {
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--accent);
  text-transform: uppercase;
}
.qa-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.qa-icon-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
}
.qa-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 0 2px 0 0;
  background: transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.qa-empty {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}
.qa-quest {
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.qa-quest-head {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
}
.qa-trader-icon,
.qa-trader-fallback {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
}
.qa-trader-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}
.qa-name {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}
.qa-trader {
  color: #cbd5e1;
  font-size: 11px;
}
.qa-source {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.qa-objectives {
  margin: 0;
  padding: 0 0 0 14px;
}
.qa-objective {
  margin: 3px 0;
  padding-left: 1px;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
}
.qa-objective.done {
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.qa-objective::marker { color: #f8fafc; }
.qa-obj-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.qa-item-icon,
.loot-icon-marker {
  width: 18px;
  height: 18px;
  object-fit: contain;
  image-rendering: auto;
}
.qa-item-icon {
  flex: 0 0 auto;
  background: #000;
}
.qa-obj-text {
  overflow-wrap: anywhere;
}
.qa-count {
  color: var(--accent);
  font-weight: 800;
  margin-left: 2px;
}
.qa-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(52,212,212,.65) 50%);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  :root { --sidebar-w: 100vw; }
  #fullscreenBtn,
  #menuBtn { width: 44px; height: 44px; }
  #fullscreenBtn { right: 62px; }
  .section { padding: 10px; }
  .aimview { bottom: 12px; left: 8px; }
}

@media (min-width: 481px) and (max-width: 768px) {
  :root { --sidebar-w: 280px; }
}
.web-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.web-category-heading,
.web-category-member-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.web-category-heading h3 { margin: 0; }
.web-category-list {
  display: grid;
  gap: 4px;
  max-height: 224px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 2px 10px 0;
  scrollbar-width: thin;
}
.web-category-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text-dim);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.web-category-glyph {
  display: inline-grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
}
.web-category-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-category-select:hover { color: var(--text); border-color: var(--border-strong); }
.web-category-select.active {
  color: var(--text);
  background: rgba(52, 212, 212, .16);
  border-color: var(--accent);
}
.web-category-select.active .web-category-glyph { background: rgba(52, 212, 212, .12); }
.web-category-select:focus-visible,
.web-category-suggestion:focus-visible,
.web-category-member button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.web-category-count {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.web-category-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.web-category-settings { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.web-category-field { display: grid !important; gap: 5px !important; min-height: 0 !important; padding: 0 !important; }
.web-category-field:first-child { grid-column: 1 / -1; }
.web-category-field:nth-child(3) { grid-column: 1 / -1; }
.web-category-field .text-input,
.web-category-member-title .text-input,
.web-category-add .text-input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
}
.web-category-label { color: var(--text-dim); font-size: 11px; font-weight: 600; }
.web-category-enabled {
  justify-content: flex-start !important;
  gap: 8px !important;
  min-height: 36px !important;
  padding: 0 !important;
}
.web-category-delete { grid-column: 2; grid-row: 2; justify-self: end; }
.web-category-style {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}
.web-category-style .web-category-field:first-child,
.web-category-style .web-category-field:nth-child(3) { grid-column: auto; }
.web-category-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  min-height: 30px;
}
.web-category-style input[type="color"] { width: 100%; min-height: 30px; border: 0; background: transparent; }
.web-category-owner { color: var(--accent); font-size: 11px; }
.web-category-member-title { flex-wrap: wrap; }
.web-category-member-title strong { font-size: 12px; }
.web-category-member-title .text-input { flex: 1 1 150px; }
.web-category-members {
  max-height: 260px;
  min-height: 50px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .12);
}
.web-category-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.web-category-member:last-child { border-bottom: 0; }
.web-category-member-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.web-category-member-copy { display: grid; gap: 2px; min-width: 0; }
.web-category-member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-category-member-meta { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.web-category-member-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-dim);
}
.web-category-member-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.web-category-member .small { flex: 0 0 auto; }
.web-category-members .hint { padding: 10px; margin: 0; }
.web-category-excluded {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.web-category-excluded summary {
  padding: 8px 10px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.web-category-excluded summary:hover { color: var(--text); }
.web-category-add { display: grid; gap: 6px; }
.web-category-suggestions { display: grid; gap: 2px; max-height: 230px; overflow-y: auto; }
.web-category-suggestion {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.web-category-suggestion:hover { border-color: var(--accent); }
.category-grid[hidden] { display: none !important; }
[hidden] { display: none !important; }
