@font-face {
  font-family: "Inter";
  src: url("vendor/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #0e1014;
  --surface: #15181e;
  --surface-2: #1b1f27;
  --surface-3: #232833;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eceef2;
  --text-2: #a9b0bc;
  --text-3: #6f7785;
  --accent: #e7b24a;
  --accent-ink: #1a1408;
  --accent-soft: rgba(231, 178, 74, 0.14);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.14);
  --red: #f0616d;
  --red-soft: rgba(240, 97, 109, 0.14);
  --amber: #f5a524;
  --blue: #5aa9ff;
  --slot: #1f242d;
  --slot-border: rgba(255, 255, 255, 0.05);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 56px;
  --roster-w: 300px;
  --detail-w: 420px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --surface-3: #eceef2;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.16);
    --text: #121620;
    --text-2: #4a5263;
    --text-3: #7d8696;
    --accent: #b9831c;
    --accent-ink: #ffffff;
    --accent-soft: rgba(185, 131, 28, 0.12);
    --green: #12a36a;
    --green-soft: rgba(18, 163, 106, 0.12);
    --red: #d93d4a;
    --red-soft: rgba(217, 61, 74, 0.1);
    --slot: #3a3226;
    --slot-border: rgba(0, 0, 0, 0.2);
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.08);
    color-scheme: light;
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }

/* ------------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--red); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 14px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: grid; gap: 6px; margin: 14px 0; }
.field span { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
input[type="text"], input[type="password"], input[type="search"] {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; width: 100%;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--red); margin: 0 0 12px; font-size: 13px; }

/* ------------------------------------------------------------------ brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none; position: relative;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px; background: var(--accent-ink);
  -webkit-mask: url("pin-mask.svg") center / contain no-repeat; mask: url("pin-mask.svg") center / contain no-repeat;
}
.brand-lg { font-size: 20px; }
.brand-lg .brand-mark { width: 34px; height: 34px; }

/* ------------------------------------------------------------------ login */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(90, 169, 255, .08), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.login-sub { color: var(--text-2); margin: 14px 0 4px; }

/* ------------------------------------------------------------------ app layout */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--roster-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "top top" "roster map";
  position: relative;
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 20px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20;
}
.topbar-stats { display: flex; gap: 18px; color: var(--text-2); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; }
.topbar-stats b { color: var(--text); font-weight: 650; }
.stat-pill { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 0 10px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 165, 36, .18); }
.conn.live .conn-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2.4s infinite; }
.conn.down .conn-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

/* ------------------------------------------------------------------ roster */
.roster {
  grid-area: roster; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--border);
}
.roster-head { padding: 14px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; fill: var(--text-3); }
.search input { padding-left: 34px; height: 38px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg { border: 0; background: transparent; border-radius: 6px; height: 28px; cursor: pointer; color: var(--text-2); font-weight: 550; font-size: 13px; }
.seg.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }

.roster-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.player {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.player:hover { background: var(--surface-2); }
.player.selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.player.offline .avatar { filter: grayscale(1); opacity: .55; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; position: relative;
  font-weight: 700; font-size: 14px; color: #fff; letter-spacing: .02em;
}
.avatar .dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-3); border: 2.5px solid var(--surface);
}
.player.online .avatar .dot { background: var(--green); }
.player-main { min-width: 0; }
.player-name { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.player-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-sub { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-value { text-align: right; font-weight: 650; font-size: 13px; }
.player-value small { display: block; color: var(--text-3); font-weight: 500; font-size: 11.5px; }
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-2); flex: none;
}
.badge-gim { background: rgba(90, 169, 255, .15); color: var(--blue); }
.badge-iron { background: rgba(169, 176, 188, .16); color: var(--text-2); }
.roster-empty { padding: 32px 22px; text-align: center; color: var(--text-2); }
.roster-empty h3 { color: var(--text); margin: 14px 0 6px; font-size: 15px; }
.empty-illustration {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: var(--accent-soft); position: relative;
}
.empty-illustration::after {
  content: ""; position: absolute; inset: 14px; background: var(--accent);
  -webkit-mask: url("pin-mask.svg") center / contain no-repeat; mask: url("pin-mask.svg") center / contain no-repeat;
}

/* ------------------------------------------------------------------ map */
.map-wrap { grid-area: map; position: relative; min-height: 0; }
.map { position: absolute; inset: 0; background: #000; }
.leaflet-container { font-family: var(--font); background: #000; }
.leaflet-control-attribution { background: rgba(14, 16, 20, .7) !important; color: #9aa3ae !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: #c9cfd8 !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-bar { border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow) !important; border-radius: 10px !important; overflow: hidden; }
.map-controls { position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; gap: 8px; }
.plane-switch {
  display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 3px; box-shadow: var(--shadow);
}
.plane-label { font-size: 11.5px; color: var(--text-3); padding: 0 6px 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.plane-switch button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--text-2); font-weight: 650; }
.plane-switch button.active { background: var(--accent); color: var(--accent-ink); }
.map-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.map-btn svg { width: 18px; height: 18px; fill: var(--text-2); }
.map-coords {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; font: 12px var(--mono);
  background: rgba(14, 16, 20, .78); color: #d6dbe2; padding: 5px 9px; border-radius: 7px; pointer-events: none;
  backdrop-filter: blur(6px);
}
.map-coords:empty { display: none; }

.pin { position: relative; }
.pin-bubble {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px;
  background: rgba(14, 16, 20, .88); color: #fff; white-space: nowrap; font-weight: 650; font-size: 12px;
  border: 1.5px solid var(--pin); box-shadow: 0 4px 14px rgba(0,0,0,.45);
  transition: transform .15s;
}
.pin-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--pin); border-bottom: 0;
}
.pin-avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--pin); font-size: 10px; color: #fff; }
.pin.selected .pin-bubble { transform: translate(-50%, -2px) scale(1.08); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pin) 35%, transparent), 0 6px 18px rgba(0,0,0,.5); }
.pin.offline .pin-bubble { opacity: .55; filter: grayscale(.9); }
.pin.other-plane .pin-bubble { opacity: .45; border-style: dashed; }
.pin-anchor { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--pin); border: 2px solid #fff; box-shadow: 0 0 0 0 var(--pin); }
.pin.online .pin-anchor { animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pin) 70%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

/* ------------------------------------------------------------------ detail panel */
.detail {
  position: absolute; top: calc(var(--topbar-h) + 12px); right: 12px; bottom: 12px; width: var(--detail-w);
  z-index: 1100; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  animation: slide-in .2s ease-out;
}
@keyframes slide-in { from { transform: translateX(16px); opacity: 0; } }
.detail-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.detail-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.detail-title { display: flex; align-items: center; gap: 12px; }
.detail-title .avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 16px; }
.detail-title h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.detail-meta { color: var(--text-2); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-chip.online { color: var(--green); }
.status-chip.online::before { background: var(--green); }
.detail-close { margin-left: auto; align-self: flex-start; }
.loc-line {
  margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.loc-line svg { width: 16px; height: 16px; fill: var(--accent); flex: none; }
.loc-line .coords { margin-left: auto; font: 12px var(--mono); color: var(--text-2); }
.loc-line button { margin-left: 6px; }

.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.vital { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.vital-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.vital-top b { color: var(--text); }
.bar { height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; transition: width .4s ease; }
.bar.hp > i { background: linear-gradient(90deg, #e5484d, #ff7a7f); }
.bar.pray > i { background: linear-gradient(90deg, #3e9bff, #7cc0ff); }
.bar.run > i { background: linear-gradient(90deg, #e7b24a, #ffd27a); }

.detail-body { overflow-y: auto; flex: 1; padding: 14px 18px 22px; }
.values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.value-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px;
  display: grid; gap: 2px;
}
.value-card.total { grid-column: 1 / -1; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2); }
.value-card .k { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.value-card .v { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.value-card.total .v { font-size: 24px; color: var(--accent); }
.value-card .t { font-size: 11.5px; color: var(--text-3); }
.value-card .t.stale { color: var(--amber); }

.tabs { display: flex; gap: 2px; margin: 18px 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  border: 0; background: transparent; padding: 9px 10px; cursor: pointer; color: var(--text-2);
  font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { color: var(--text-3); font-weight: 600; margin-left: 4px; font-size: 12px; }

.panel-note { font-size: 12.5px; color: var(--text-2); margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.panel-note.stale { color: var(--amber); }
.empty-note {
  padding: 22px 16px; text-align: center; color: var(--text-2); background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: 12px; font-size: 13px;
}

/* item slots */
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 290px; margin: 0 auto; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.slot {
  aspect-ratio: 1 / 1; border-radius: 9px; position: relative; display: grid; place-items: center;
  background: var(--slot); border: 1px solid var(--slot-border);
}
.slot.filled { cursor: default; }
.slot.filled:hover { border-color: var(--accent); background: color-mix(in srgb, var(--slot) 85%, var(--accent)); }
.slot img { width: 36px; height: 32px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.6)); }
.slot .qty {
  position: absolute; left: 4px; top: 2px; font: 700 11px/1 var(--font); color: #ffff00;
  text-shadow: 1px 1px 0 #000;
}
.slot .qty.k { color: #fff; }
.slot .qty.m { color: #00ff80; }
.slot .ph { font-size: 10px; color: rgba(255,255,255,.35); text-align: center; padding: 2px; font-weight: 600; }
.slot .fallback { font-size: 10px; color: #d6dbe2; text-align: center; line-height: 1.1; padding: 3px; overflow: hidden; }

.equip-grid {
  display: grid; grid-template-columns: repeat(3, 64px); grid-auto-rows: 64px; gap: 10px;
  justify-content: center; padding: 14px; background: var(--surface-2); border-radius: 14px; border: 1px solid var(--border);
}
.equip-grid .slot { aspect-ratio: auto; }
.equip-grid .slot.empty::after { content: attr(data-label); position: absolute; bottom: 4px; font-size: 9.5px; color: rgba(255,255,255,.4); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.bank-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.bank-tools input { height: 34px; }
.bank-tools select {
  height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); padding: 0 8px; font: inherit; font-size: 13px;
}
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 5px; }

.ge-list { display: grid; gap: 8px; }
.ge-offer {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.ge-offer .slot { width: 44px; height: 44px; aspect-ratio: auto; }
.ge-offer .slot img { width: 32px; height: 28px; }
.ge-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ge-sub { font-size: 12px; color: var(--text-2); }
.ge-kind { font-size: 10.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.ge-kind.buy { color: var(--green); }
.ge-kind.sell { color: var(--amber); }
.ge-kind.done { color: var(--blue); }
.ge-kind.cancel { color: var(--red); }
.ge-progress { height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.ge-progress i { display: block; height: 100%; background: var(--green); }
.ge-progress.sell i { background: var(--amber); }
.ge-progress.cancel i { background: var(--red); }
.ge-value { text-align: right; font-weight: 700; }
.ge-value small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 2000; pointer-events: none; background: #0b0d10; color: #eef0f3;
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 9px 11px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 260px;
}
.tooltip h4 { font-size: 13px; margin-bottom: 4px; color: #ffb84d; }
.tooltip dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; }
.tooltip dt { color: #9aa3ae; }
.tooltip dd { margin: 0; text-align: right; font-weight: 600; }

/* ------------------------------------------------------------------ dialogs */
.dialog {
  width: min(900px, calc(100% - 32px)); border: 1px solid var(--border-strong); border-radius: 16px;
  background: var(--surface); color: var(--text); padding: 22px; box-shadow: var(--shadow);
}
.dialog-sm { width: min(400px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(5, 6, 8, .6); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dialog-sub { color: var(--text-2); margin: 6px 0 16px; }
.add-member { display: flex; gap: 8px; }
.new-key {
  margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
}
.new-key p { margin: 0 0 8px; font-size: 13px; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row code {
  flex: 1; font: 13px var(--mono); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; overflow-x: auto; white-space: nowrap;
}
.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.members-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.members-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: 10px 12px; background: var(--surface-2); }
.members-table td { padding: 10px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
.members-table td:last-child { text-align: right; }
.members-table .actions { display: inline-flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.members-table td:last-child { white-space: normal; min-width: 170px; }
.muted { color: var(--text-3); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  :root { --roster-w: 260px; --detail-w: 380px; }
  .topbar-stats .hide-md { display: none; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 52px; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 42vh 1fr;
    grid-template-areas: "top" "map" "roster";
  }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-stats { display: none; }
  .brand-name { font-size: 15px; }
  .conn-label { display: none; }
  .roster { border-right: 0; border-top: 1px solid var(--border); }
  .detail {
    position: fixed; inset: auto 0 0 0; top: 18vh; width: auto; border-radius: 18px 18px 0 0;
    animation: sheet-up .22s ease-out;
  }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
  .detail-head { padding: 16px; }
  .detail-body { padding: 12px 16px calc(22px + env(safe-area-inset-bottom)); }
  .map-controls { top: 10px; right: 10px; }
  .members-table th:nth-child(3), .members-table td:nth-child(3) { display: none; }
  .add-member { flex-direction: column; }
}
.value-card.wide { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ section switcher */
.views { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex: none; }
.views button {
  border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer;
  color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.views button:hover { color: var(--text); }
.views button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }

.app.paged .roster, .app.paged .map-wrap { display: none; }
.page { grid-row: 2; grid-column: 1 / -1; overflow-y: auto; min-height: 0; background: var(--bg); }
.page-inner { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 16px; align-content: start; }
.page-split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.page-split > div { display: grid; gap: 16px; min-width: 0; }
.page-split aside { position: sticky; top: 16px; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--text-2); margin: 4px 0 0; }
.page-note { color: var(--text-3); font-size: 12.5px; margin: 0; }
.page-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-filters .search { width: min(320px, 100%); }
.page-filters select, .card select {
  height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); padding: 0 10px; font: inherit; font-size: 13px;
}
.seg-auto { display: inline-flex; }
.seg-auto .seg { padding: 0 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.card h2 { font-size: 14px; margin-bottom: 12px; color: var(--text); }
.card .table-wrap { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.tile .k { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .v.small { font-size: 18px; line-height: 1.6; }
.tile .v small { font-size: 14px; color: var(--text-3); font-weight: 600; }
.tile .t { font-size: 12px; color: var(--text-3); }
.neg { color: var(--red); }
.pos { color: var(--green); }
.center { text-align: center; }

.who {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0; cursor: pointer;
  font-weight: 650; color: var(--text); max-width: 100%;
}
.who:hover { text-decoration: underline; }
.who-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: 9px 12px; background: var(--surface-2); white-space: nowrap; }
.data-table td { padding: 8px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

.matrix-wrap { max-height: 70vh; overflow: auto; }
.matrix thead th { position: sticky; top: 0; z-index: 1; }
.matrix td:first-child, .matrix th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix thead th:first-child { background: var(--surface-2); z-index: 2; }
.matrix .pcol { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pcol-sub { font-size: 11px; color: var(--text-3); font-weight: 550; margin-top: 2px; }
.matrix td:not(:first-child) { text-align: center; }
.c-done { color: var(--green); font-weight: 700; }
.c-part { color: var(--amber); font-weight: 700; }
.c-none { color: var(--text-3); }
.c-unknown { color: var(--text-3); opacity: .6; }
.matrix td.best { color: var(--accent); font-weight: 700; }
.matrix td.maxed { color: var(--green); font-weight: 700; }
.matrix-legend span { margin-left: 8px; }
.matrix-legend span:first-child { margin-left: 0; }
.item-cell { display: flex; align-items: center; gap: 8px; }

.clog-page { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.clog-page summary { padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.clog-page summary span { font-size: 12.5px; }
.clog-page .table-wrap { margin: 0 12px 12px; }

/* activity */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 12.5px;
}
.chip.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.feed-day { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; margin: 10px 0 2px; }
.feed-day:first-child { margin-top: 0; }
.feed-item {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.feed-item.big { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: linear-gradient(90deg, var(--accent-soft), transparent 60%), var(--surface); }
.feed-icon { font-size: 18px; line-height: 22px; text-align: center; }
.feed-main { min-width: 0; line-height: 22px; }
.feed-item time { color: var(--text-3); font-size: 12px; line-height: 22px; white-space: nowrap; }
.feed-items { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.t-login, .t-logout { padding-top: 6px; padding-bottom: 6px; opacity: .8; }
.feed-more { display: flex; justify-content: center; }
.mini-slot {
  width: 36px; height: 32px; border-radius: 7px; background: var(--slot); border: 1px solid var(--slot-border);
  display: inline-grid; place-items: center; position: relative; flex: none;
}
.mini-slot img { width: 28px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.mini-slot i { position: absolute; left: 3px; top: 1px; font: 700 10px/1 var(--font); color: #ffff00; text-shadow: 1px 1px 0 #000; font-style: normal; }
.best-drops { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.best-drops li { display: grid; grid-template-columns: 18px 36px 1fr auto; gap: 10px; align-items: center; }
.best-drops li.empty-note { display: block; }
.best-drops .rank { color: var(--text-3); font-weight: 700; font-size: 12px; text-align: center; }
.bd-main { min-width: 0; }
.bd-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-sub .who { font-size: 12px; font-weight: 600; color: var(--text-2); }
.bd-value { color: var(--accent); }

/* items */
.big-search input { height: 46px; font-size: 16px; padding-left: 40px; }
.big-search svg { top: 15px; left: 14px; }
.results { display: grid; gap: 8px; }
.result { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.result-icon { width: 52px; height: 52px; aspect-ratio: auto; }
.result-name { font-weight: 700; font-size: 15px; }
.result-sub { color: var(--text-2); font-size: 13px; }
.holders { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.holder { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }

/* charts */
.chart { display: grid; gap: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-plot { position: relative; width: 100%; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-grid text, .chart-end { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart-end { fill: var(--text-2); font-weight: 600; }
.chart-cross { stroke: var(--border-strong); stroke-width: 1; pointer-events: none; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12.5px; min-width: 150px; z-index: 5;
}
.chart-tip-time { color: var(--text-3); font-size: 11.5px; margin-bottom: 4px; }
.chart-tip-row { display: grid; grid-template-columns: 12px auto 1fr; gap: 8px; align-items: center; }
.chart-tip-row i { width: 12px; height: 2px; border-radius: 2px; }
.chart-tip-row b { color: var(--text); }
.chart-tip-row span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* player panel: skills and bosses */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.skill {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 6px; padding: 7px 9px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; min-width: 0;
}
.skill-name { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-lvl { font-weight: 750; font-size: 15px; }
.skill.maxed .skill-lvl { color: var(--green); }
.skill-gain { grid-column: 1 / -1; font-size: 11px; color: var(--green); font-weight: 600; }
.sub-head { font-size: 13px; margin: 18px 0 8px; color: var(--text-2); }
.kc-list { display: grid; gap: 4px; }
.kc { display: grid; grid-template-columns: 1fr auto; padding: 8px 10px; background: var(--surface-2); border-radius: 9px; border: 1px solid var(--border); }
.kc small { grid-column: 1 / -1; color: var(--green); font-size: 11.5px; }
.kc small:empty { display: none; }
.discord-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

@media (max-width: 1100px) {
  .views button { padding: 0 9px; }
  .topbar-stats { display: none; }
  .page-split { grid-template-columns: 1fr; }
  .page-split aside { position: static; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 96px; }
  .topbar { flex-wrap: wrap; align-content: center; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .topbar .brand { flex: 1; }
  .views { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .views button { flex: 1; padding: 0 8px; }
  .app.paged { grid-template-rows: var(--topbar-h) 1fr; }
  .page { grid-row: 2; }
  .page-inner { padding: 16px 16px 40px; }
  .feed-item { grid-template-columns: 24px 1fr; }
  .feed-item time { grid-column: 2; line-height: 1.2; }
  .tile .v { font-size: 20px; }
}

/* alerts dialog */
.alerts-table td { vertical-align: middle; white-space: normal; }
.alerts-table input[type="number"] {
  width: 110px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px;
}
.alerts-table select {
  height: 30px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); padding: 0 6px; font: inherit; font-size: 13px;
}
.alerts-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.alerts-when { color: var(--text-2); line-height: 2.2; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.dialog-actions span { margin-right: auto; }
.field small { font-weight: 450; }
.feed-shot { display: block; margin-top: 8px; max-width: 360px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.feed-shot img { display: block; width: 100%; height: auto; }
@media (max-width: 600px) {
  .alerts-table thead { display: none; }
  .alerts-table tr { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; column-gap: 6px; padding: 8px 4px; }
  .alerts-table td { padding: 0; border: 0; }
  .alerts-table td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; line-height: 2; font-size: 13px; }
  .alerts-table td:nth-child(4):has(input)::before { content: "📷 "; font-size: 12px; }
  .alerts-table tr + tr { border-top: 1px solid var(--border); }
  .alerts-table input[type="number"] { width: 100px; }
}
