/* ============================================================
   Server manager - layout & components
   ============================================================ */

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-backdrop { display: none; } /* shown only on mobile while the menu is open */
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-press));
  box-shadow: 0 4px 14px var(--accent-line);
  color: var(--on-accent);
}
.brand .logo svg { width: 20px; height: 20px; }
.brand .title { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; line-height: 1.1; }
.brand .subtitle { font-size: 11px; color: var(--text-faint); letter-spacing: 0.4px; text-transform: uppercase; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; font-weight: 500;
  border: 1px solid transparent; transition: background 0.12s, color 0.12s;
  user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--panel-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-line); }
.nav-item.active svg { opacity: 1; }
.nav-badge { margin-left: auto; font-size: 11px; background: var(--bg-3); color: var(--text-dim); padding: 1px 7px; border-radius: 20px; }

.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--bg-3); color: var(--accent-hover); border: 1px solid var(--border-strong);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
button.avatar { padding: 0; cursor: pointer; font-family: inherit; }
button.avatar:hover, button.avatar:focus-visible { border-color: var(--accent); outline: none; }
.user-chip .meta { line-height: 1.2; min-width: 0; }
.user-chip .name { font-weight: 600; font-size: 13px; }
.user-chip .role { font-size: 11px; color: var(--text-faint); text-transform: capitalize; }

/* ---------- Main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--topbar-bg, rgba(12, 15, 20, 0.82)); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 17px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }

/* Notification bell (topbar) */
.bell-wrap { position: relative; display: inline-flex; }
.bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  pointer-events: none;
}
.bell-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border); }
.bell-item .grow { min-width: 0; }
.bell-item .grow > div { overflow-wrap: anywhere; } /* Windows paths in alert details must break, not pan the list */
.bell-item:last-child { border-bottom: none; }
.bell-item.unread { background: var(--accent-soft); border-radius: 6px; }
.bell-emoji { font-size: 16px; line-height: 1.4; flex: none; }
.view { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------- Server status pill (topbar) ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 20px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border-strong); background: var(--bg-2);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: none; }
.status-dot.running { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); animation: pulse 2s infinite; }
.status-dot.stopped { background: var(--text-faint); }
.status-dot.starting, .status-dot.stopping { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-soft); animation: pulse 1.1s infinite; }
.status-dot.crashed { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- Cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--gap); }
/* That stacked-card spacing must not leak into grid/flex layouts: it shoved
   every card after the first down by one gap (ragged tops on the Servers grid
   and Node health cards). Grids and rows space with their own gap. */
.grid > .card + .card, .row > .card + .card { margin-top: 0; }
/* wrap: card action buttons must drop below the title on narrow screens, not
   overflow the card (every view passes toolbars here). */
.card-head { display: flex; align-items: center; gap: 12px; row-gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head > div:first-child { min-width: 0; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .sub { font-size: 12.5px; color: var(--text-faint); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.stat .label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 7px; }
.stat .label svg { width: 15px; height: 15px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.stat .value small { font-size: 14px; color: var(--text-faint); font-weight: 500; }
.stat .meter { height: 6px; border-radius: 6px; background: var(--bg-3); overflow: hidden; margin-top: 2px; }
.stat .meter > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width 0.4s ease; }
.stat .meter.green > span { background: linear-gradient(90deg, #2f9e4d, var(--green)); }
.stat .meter.blue > span { background: linear-gradient(90deg, #2f78c4, var(--blue)); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text);
  cursor: pointer; transition: all 0.12s; white-space: nowrap; line-height: 1; font-family: inherit;
}
.btn svg { width: 16px; height: 16px; }
.btn .ico { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; margin: 0; flex: none; }
.btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.lg { padding: 12px 20px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-press)); border-color: var(--accent-press); color: var(--on-accent); }
.btn.primary:hover { background: linear-gradient(180deg, var(--accent-hover), var(--accent)); }
.btn.success { background: linear-gradient(180deg, #3fb85b, #2f9e4d); border-color: #2f9e4d; color: #06210e; }
.btn.success:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red-soft); border-color: rgba(240, 98, 90, 0.5); color: var(--red); }
.btn.danger:hover { background: rgba(240, 98, 90, 0.22); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--panel-hover); color: var(--text); }
/* Active/attention state (e.g. the Maintenance button while maintenance is ON). */
.btn.warning { background: var(--yellow-soft); border-color: rgba(224, 177, 60, 0.55); color: var(--yellow); }
.btn.warning:hover { background: rgba(224, 177, 60, 0.24); }
.btn.icon { padding: 8px; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-dim);
}
.badge svg { width: 14px; height: 14px; flex: none; }
.badge.green { color: var(--green); background: var(--green-soft); border-color: transparent; }
.badge.red { color: var(--red); background: var(--red-soft); border-color: transparent; }
.badge.yellow { color: var(--yellow); background: var(--yellow-soft); border-color: transparent; }
.badge.blue { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.badge.accent { color: var(--accent-hover); background: var(--accent-soft); border-color: transparent; }
.dot-sep { color: var(--text-faint); margin: 0 2px; }

/* ---------- Forms ---------- */
/* min-width:0 so a field in a grid/flex row can shrink to its track - without it
   a long <select> option (game/template names) forces the column wider than the
   modal and every control overflows/clips on mobile. */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.help { font-size: 12px; color: var(--text-faint); }
/* "Show help text" off (Settings): hide inline tips/help across the panel. */
body.hide-tips .help { display: none; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.field.inline > label { margin: 0; }

input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], textarea, select {
  width: 100%; padding: 9px 12px; font-size: 13.5px; font-family: inherit;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }

/* Search input with an inset magnifier icon (ui.searchBox). */
.search-box { position: relative; display: inline-flex; align-items: center; max-width: 100%; min-width: 0; }
.search-box input[type=search] { min-width: 120px; }
.search-box .ico { position: absolute; left: 10px; display: inline-flex; width: 15px; height: 15px; color: var(--text-faint); pointer-events: none; }
.search-box .ico svg { width: 15px; height: 15px; }
.search-box input[type=search] { padding-left: 32px; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0c0' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
/* The chevron color is baked into the data URI; give light theme its own (--text-dim #46586a). */
:root[data-theme="light"] select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2346586a' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); }
.input-affix { display: flex; align-items: stretch; }
/* flex inputs refuse to shrink below intrinsic width without min-width: 0 —
   without this, path input + Browse + Auto-install overflows narrow cards. */
.input-affix input { flex: 1 1 auto; min-width: 0; width: auto; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-affix .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--bg-3); border: 1px solid var(--border-strong); border-radius: 20px; transition: 0.18s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--text-dim); transition: 0.18s; }
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent-line); }
.switch input:checked + .track .thumb { transform: translateX(18px); background: var(--accent); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; padding: 11px 14px; background: var(--bg-1); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.1s; }
table.data tbody tr:hover { background: var(--panel-hover); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 8px; background: var(--bg-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width 0.3s; }

/* ---------- Console / log ---------- */
.console {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  background: #080a0e; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  /* viewport-relative so the command input stays on-screen in phone landscape;
     dvh accounts for mobile browser chrome (vh line = fallback). */
  height: 460px;
  height: min(460px, calc(100dvh - 240px));
  min-height: 240px;
  color: #d7e0ea; /* fixed: the console stays dark in the light theme too */
}
.console .line { padding: 1px 0; }
.console .line .ts { color: var(--text-faint); margin-right: 8px; }
.console .line.err { color: #ff9a93; }
.console .line.warn { color: var(--yellow); }
.console .line.cmd { color: var(--accent-hover); }
.console .line.sys { color: var(--blue); }
.console-input { display: flex; gap: 8px; margin-top: 12px; }
.console-input input { font-family: var(--mono); }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 44px)); }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  animation: toast-in 0.22s ease; border-left: 3px solid var(--text-faint);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--yellow); }
.toast.info { border-left-color: var(--blue); }
.toast .ico { flex: none; margin-top: 1px; }
.toast .msg { font-size: 13.5px; }
.toast .msg .t { font-weight: 650; }
.toast.closing { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(5, 7, 10, 0.66);
  /* minmax(0,1fr): a definite track so the modal's width:100%/max-width resolve
     against the viewport. Without it the auto track shrink-to-fits to the modal's
     content (a long <select> option) and the modal overflows the screen on mobile. */
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center;
  padding: 20px; animation: fade 0.15s ease; backdrop-filter: blur(2px);
}
.modal {
  background: var(--bg-1); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); width: 100%; max-width: 520px; display: flex; flex-direction: column;
  max-height: 88vh;
  max-height: min(88vh, calc(100dvh - 24px)); /* keep footer buttons visible above mobile browser chrome */
  animation: modal-in 0.18s ease;
}
.modal.wide { max-width: 820px; }
.modal.xl { max-width: 980px; }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; overflow-x: hidden; } /* wide children scroll inside their own .table-wrap, never push the modal off-screen */
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* ---------- Statistics: scope row + server picker ---------- */
.stat-count { font-size: 11.5px; font-weight: 600; color: var(--text-dim); background: var(--bg-3); border-radius: 20px; padding: 1px 9px; }
.stat-scope { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.stat-scope .spacer, .stat-pick-pop .spacer { flex: 1; }
/* Compact selection dropdown anchored to the Edit-selection button. */
.stat-pick-anchor { position: relative; display: inline-flex; }
.stat-pick-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  width: min(560px, 92vw); max-height: min(60vh, 520px); overflow: auto;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 12px 14px;
}
/* On phones the button sits at the left of a wrapped row, so a right-anchored
   absolute popover runs off-screen. Pin it to the viewport instead. */
@media (max-width: 640px) {
  .stat-pick-pop { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar-h, 56px) + 8px); width: auto; max-height: calc(100dvh - var(--topbar-h, 56px) - 24px); }
}
/* clickable game header: click a game to select/clear all of its servers */
.stat-pick-head { align-items: center; margin: 8px 0 2px; padding: 5px 6px; border-radius: var(--radius-xs); cursor: pointer; user-select: none; }
.stat-pick-head:hover { background: var(--panel-hover); }
.stat-pick-all { font-size: 12px; color: var(--accent-hover); font-weight: 600; flex: none; }
/* min(230px, 100%) so a narrow column can never be forced wider than itself
   (a hard 230px min column overflows the page horizontally on small screens) */
.stat-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 2px 14px; margin-bottom: 8px; }
.stat-pick {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 6px 8px; border-radius: var(--radius-xs); cursor: pointer;
}
.stat-pick:hover { background: var(--panel-hover); }
.stat-pick input[type=checkbox] { flex: none; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.stat-pick .name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-pick .sub { font-size: 11.5px; color: var(--text-faint); flex: none; }

/* Statistics highlight cards */
.stat-highlight { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--border); }
.stat-highlight .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); }
.stat-highlight .v { font-weight: 700; font-size: 15.5px; margin: 5px 0 3px; overflow-wrap: anywhere; }
.stat-highlight .s { font-size: 12.5px; color: var(--text-dim); }

/* Statistics: metric segmented control + per-server comparison bars */
.stat-seg { display: inline-flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.stat-seg button { border: none; background: transparent; color: var(--text-dim); font-size: 12.5px; font-weight: 600; padding: 5px 14px; border-radius: 999px; cursor: pointer; transition: background 0.12s, color 0.12s; }
.stat-seg button:hover { color: var(--text); }
.stat-seg button.on { background: var(--accent-soft); color: var(--accent-hover); }
.stat-bars { display: flex; flex-direction: column; gap: 8px; }
.stat-bar { display: grid; grid-template-columns: minmax(110px, 200px) 1fr 70px; align-items: center; gap: 12px; }
.stat-bar-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-name small { color: var(--text-faint); font-weight: 400; margin-left: 6px; }
.stat-bar-track { height: 22px; background: var(--bg-2); border-radius: 6px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width 0.3s ease; }
.stat-bar-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 620px) {
  .stat-bar { grid-template-columns: 1fr auto; }
  .stat-bar-track { grid-column: 1 / -1; order: 3; }
  .stat-seg button { padding: 5px 10px; }
  .stat-pick-pop { padding: 10px 10px 6px; }
}

/* ---------- Empty state / banners ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--text-dim); }
.chat-window .empty { font-family: var(--font); font-size: 14px; line-height: 1.5; }
/* direct child only — a button's own 16px icon inside the empty state must NOT inherit this */
.empty > .ico { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--text-faint); opacity: 0.7; display: block; }
.empty h3 { color: var(--text); }
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-2); margin-bottom: 18px; }
.banner svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.banner.warn { background: var(--yellow-soft); border-color: rgba(224, 177, 60, 0.4); }
.banner.warn svg { color: var(--yellow); }
.banner.info { background: var(--blue-soft); border-color: rgba(81, 168, 255, 0.35); }
.banner.info svg { color: var(--blue); }
.banner.danger { background: var(--red-soft); border-color: rgba(240, 98, 90, 0.4); }
.banner.danger svg { color: var(--red); }

/* ---------- Login / setup ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); overflow: hidden; }
.auth-head { padding: 28px 28px 8px; text-align: center; }
.auth-head .logo { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px; display: grid; place-items: center; background: linear-gradient(145deg, var(--accent), var(--accent-press)); box-shadow: 0 8px 24px var(--accent-line); color: var(--on-accent); }
.auth-head .logo svg { width: 30px; height: 30px; }
.auth-head h1 { font-size: 1.3rem; }
.auth-body { padding: 12px 28px 28px; }

/* ---------- Mod list ---------- */
.mod-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); margin-bottom: 10px; transition: border-color 0.12s; }
.mod-item:hover { border-color: var(--border-strong); }
.mod-item.disabled { opacity: 0.55; }
.mod-item .drag { cursor: grab; color: var(--text-faint); display: flex; }
.mod-item .order { width: 26px; height: 26px; border-radius: 6px; background: var(--bg-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-dim); flex: none; }
.mod-item .mod-main { min-width: 0; flex: 1; }
.mod-item .mod-name { font-weight: 600; }
.mod-item .mod-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mod-item.dragging { opacity: 0.4; }
.mod-item.drag-over { border-color: var(--accent-line); box-shadow: var(--ring); }

/* ---------- Key/value definition rows ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); gap: 10px 16px; }
.kv dt { color: var(--text-faint); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }

/* ---------- Spinner ---------- */
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner.lg { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: grid; place-items: center; padding: 50px; }

/* ---------- Responsive ---------- */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  /* dvh: with 100vh the user chip (account/logout) hides behind the browser toolbar */
  .sidebar { position: fixed; z-index: 60; width: 264px; transform: translateX(-100%); transition: transform 0.2s; height: 100vh; height: 100dvh; }
  .sidebar.open { transform: none; }
  /* Tappable overlay behind the open menu - tap anywhere off the menu to close it. */
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 55; }
  .menu-toggle { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; }
}
/* iOS Safari auto-zooms (and stays zoomed) on focus of any <16px form control —
   must ship together with the pinch-zoom-enabled viewport meta. */
@media (max-width: 860px), (pointer: coarse) {
  input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], textarea, select { font-size: 16px; }
}
@media (max-width: 680px) {
  .view { padding: 12px; }
  /* Page-header action rows (Servers etc.): full-width, evenly stretched
     buttons instead of a crushed cluster; the search gets its own line. */
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; min-height: 42px; }
  .page-actions .search-box { flex: 1 1 100% !important; }
  .card-body { padding: 14px; }
  .card-head { padding: 12px 14px; }
  /* Modals get the whole screen minus a sliver: phone/tablet forms need the room. */
  .modal-backdrop { padding: 8px; }
  .modal, .modal.wide, .modal.xl { max-width: none; max-height: calc(100dvh - 16px); }
  .modal-head { padding: 13px 14px; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; }
}
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 12px; }
  #toast-root { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .search-box { width: 100%; }
  .search-box input[type=search] { width: 100% !important; } /* beats the helper's inline width */
  .input-affix { flex-wrap: wrap; }
  .input-affix input, .input-affix .btn { border-radius: var(--radius-sm); }
  .chat-tag { max-width: 90px; }
}
/* Touch devices: 40px-class targets without changing desktop density. */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { padding: 10px 14px; }
  .btn.icon { padding: 12px; min-width: 40px; min-height: 40px; }
  .tab { padding: 12px 14px; }
  .switch { width: 48px; height: 28px; }
  .switch .thumb { width: 20px; height: 20px; }
  .switch input:checked + .track .thumb { transform: translateX(20px); }
  .btn-group, .row.gap-s { gap: 10px; }
  input[type=checkbox] { width: 18px; height: 18px; }
}

/* small helpers used across views */
/* ---------- Mod rows ---------- */
.mod-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); margin-bottom: 8px; cursor: grab; }
.mod-row:hover { border-color: var(--border-strong); }
.mod-row.dragging { opacity: 0.5; }
.mod-row .mod-ord { width: 38px; height: 26px; flex: none; padding: 0; text-align: center; border: 1px solid transparent; border-radius: 6px; background: var(--bg-3); color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: text; }
.mod-row .mod-ord:hover { border-color: var(--border-strong); }
.mod-row .mod-ord:focus { border-color: var(--accent); color: var(--text); outline: none; }
.mod-row .mod-name { font-weight: 600; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); margin: 22px 0 10px; font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-input { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.code-block { background: #080a0e; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; color: #9fb0c0; overflow-x: auto; white-space: pre; }

/* ---------- Folder/file browser ---------- */
.fb { display: flex; flex-direction: column; gap: 12px; }
.fb-path { display: flex; gap: 8px; align-items: stretch; }
.fb-path .input-affix { flex: 1; }
.fb-list { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); max-height: 360px; overflow-y: auto; }
.fb-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.fb-item:last-child { border-bottom: none; }
.fb-item:hover { background: var(--panel-hover); }
.fb-item svg { width: 17px; height: 17px; flex: none; color: var(--accent-hover); }
.fb-item.file svg { color: var(--text-faint); }
.fb-item.up svg { color: var(--text-dim); }
.fb-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.fb-empty { padding: 16px; color: var(--text-faint); text-align: center; }
/* free/total space chip (drive rows + current-folder line) */
.fb-space { display: flex; align-items: center; gap: 8px; flex: none; }
.fb-item .fb-space { margin-left: auto; padding-left: 10px; }
.fb-space .fb-bar { width: 62px; height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; flex: none; }
.fb-space .fb-bar-fill { height: 100%; border-radius: 3px; }
.fb-bar-fill.text-green { background: var(--green); }
.fb-bar-fill.text-yellow { background: var(--yellow); }
.fb-bar-fill.text-red { background: var(--red); }


/* ---- Chat view (combined in-game chat window) ---- */
.chat-window { background: var(--bg-0, #0b0f14); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 240px; overflow-y: auto; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.65; }
/* wrap + ellipsis: long player names must not crush the message into a sliver
   or pan the whole window sideways on phones. */
.chat-line { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; flex-wrap: wrap; }
.chat-line .chat-time { color: var(--text-faint); font-size: 11.5px; flex: none; }
.chat-tag { flex: none; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 9px; border: 1px solid var(--border-strong); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-player { flex: none; font-weight: 600; color: var(--accent, #29aae1); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-player::after { content: ':'; color: var(--text-dim); }
.chat-msg { overflow-wrap: anywhere; flex: 1 1 60px; min-width: 0; }
.chat-jl .chat-msg { color: var(--text-faint); font-style: italic; }
.chat-tag.tag-a { color: #4fc3f7; } .chat-tag.tag-b { color: #aed581; } .chat-tag.tag-c { color: #ffb74d; }
.chat-tag.tag-d { color: #ba98f5; } .chat-tag.tag-e { color: #f48fb1; } .chat-tag.tag-f { color: #80cbc4; }
:root[data-theme="light"] .chat-window { background: var(--bg-1, #f4f7fa); }
:root[data-theme="light"] .chat-tag.tag-a { color: #0277bd; } :root[data-theme="light"] .chat-tag.tag-b { color: #558b2f; }
:root[data-theme="light"] .chat-tag.tag-c { color: #ef6c00; } :root[data-theme="light"] .chat-tag.tag-d { color: #6a3ab2; }
:root[data-theme="light"] .chat-tag.tag-e { color: #c2185b; } :root[data-theme="light"] .chat-tag.tag-f { color: #00695c; }

/* ---- Roles: capability tooltips + expandable guide ---- */
.cap-word { border-bottom: 1px dotted var(--text-faint); cursor: help; }
.cap-guide { margin-top: 10px; font-size: 12.5px; }
.cap-guide summary { color: var(--text-faint); cursor: pointer; user-select: none; }
.cap-guide summary:hover { color: var(--text-dim); }
.cap-guide-list { margin-top: 8px; display: grid; gap: 4px; }
.cap-guide-item strong { font-weight: 600; }

/* Toast close affordance (errors persist until dismissed) */
.toast { cursor: pointer; }
.toast .toast-close { width: 14px; height: 14px; display: inline-flex; flex: none; color: var(--text-faint); margin-left: 4px; align-self: flex-start; }
.toast .toast-close svg { width: 14px; height: 14px; }
.toast .toast-close:hover { color: var(--text); }

/* ---------- Rich text (notes + announcements markdown-lite) ---------- */
.rich-text p { margin: 6px 0; }
.rich-text h2 { font-size: 19px; margin: 12px 0 6px; }
.rich-text h3 { font-size: 16.5px; margin: 10px 0 5px; }
.rich-text h4 { font-size: 14.5px; margin: 8px 0 4px; }
.rich-text ul, .rich-text ol { margin: 6px 0; padding-left: 22px; }
.rich-text li { margin: 2px 0; }
.rich-text code { background: rgba(128,128,128,0.14); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-family: var(--mono); font-size: 12.5px; }
.rich-text pre.code-block { background: rgba(128,128,128,0.1); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.rich-text hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.rich-text a { word-break: break-all; }

/* ---------- Calendar (fleet tasks, 2026-09-13) ---------- */
.cal-view { --cal-gutter: 56px; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-toolbar .spacer { flex: 1; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav .btn { min-width: 34px; justify-content: center; }
.cal-title { margin: 0; font-size: 20px; font-weight: 700; min-width: 220px; }
.cal-server { max-width: 260px; }
.cal-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.cal-seg-btn { background: transparent; border: 0; color: var(--text-dim); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cal-seg-btn + .cal-seg-btn { border-left: 1px solid var(--border-strong); }
.cal-seg-btn:hover { color: var(--text); background: var(--panel-hover); }
.cal-seg-btn.active { background: var(--accent-soft); color: var(--accent-hover); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
.cal-lg { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px 2px 7px; color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; }
.cal-lg:hover { color: var(--text); border-color: var(--border-strong); }
.cal-lg.static { cursor: default; border-color: transparent; padding-left: 4px; }
.cal-lg.off { opacity: 0.45; text-decoration: line-through; }
.cal-lg-sep { width: 1px; height: 16px; background: var(--border-strong); margin: 0 4px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cal-c, var(--accent)); flex: none; }
.cal-dot.ran { background: var(--green); } .cal-dot.failed { background: var(--red); }
.cal-dot.clash { background: transparent; box-shadow: inset 0 0 0 1.5px var(--red); }
.cal-note { font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; display: flex; flex-direction: column; gap: 3px; }

/* one variable per task type; every calendar surface reads it */
.t-restart { --cal-c: var(--yellow); }
.t-update { --cal-c: var(--blue); }
.t-backup { --cal-c: var(--green); }
.t-wipe, .t-stop { --cal-c: var(--red); }
.t-configOverride { --cal-c: var(--purple); }
.t-start { --cal-c: #2ec4b6; }
.t-broadcast, .t-announce, .t-task { --cal-c: var(--text-faint); }
.t-multi { --cal-c: var(--text-dim); }
/* several tasks in one half-hour slot, folded into one block */
.cal-ev.cal-cluster { background: color-mix(in srgb, var(--cal-c) 34%, var(--panel)); box-shadow: 2px 2px 0 -1px var(--panel), 3px 3px 0 0 var(--cal-c); }
.cal-ev.cal-cluster .cal-name { font-weight: 700; }

/* month grid */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal-dow { padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--bg-1); }
.cal-cell { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:nth-last-child(-n + 7) { border-bottom: 0; }
.cal-cell.other { background: var(--bg); }
.cal-cell.other .cal-daybtn { color: var(--text-faint); }
.cal-cell.past .cal-chips { opacity: 0.8; }
.cal-cell.drop, .cal-col.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cal-daynum { display: flex; justify-content: flex-end; }
.cal-daybtn { background: transparent; border: 0; color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 7px; border-radius: 12px; line-height: 1.3; }
.cal-daybtn:hover { background: var(--panel-hover); color: var(--text); }
.cal-cell.today .cal-daybtn, .cal-tl-dayhead.today .cal-daybtn { background: var(--accent); color: var(--on-accent); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 4px; font-size: 12px; line-height: 1.35; background: var(--bg-3); background: color-mix(in srgb, var(--cal-c) 16%, transparent); border-left: 3px solid var(--cal-c); cursor: pointer; min-width: 0; white-space: nowrap; overflow: hidden; }
.cal-chip:hover { filter: brightness(1.15); }
.cal-chip .cal-time { color: var(--text-dim); font-variant-numeric: tabular-nums; flex: none; }
.cal-chip .cal-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.cal-chip .cal-srv { color: var(--text-faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; margin-left: auto; flex: 0 1 auto; }
.cal-chip .cal-rep { color: var(--text-faint); font-size: 11px; flex: none; }
.cal-chip.cont { opacity: 0.75; border-left-style: dashed; }
.cal-chip.s-ran, .cal-chip.s-failed, .cal-chip.s-skipped { background: transparent; border-left-color: transparent; padding-left: 3px; }
.cal-chip.s-ran .cal-dot { background: var(--green); }
.cal-chip.s-failed .cal-dot { background: var(--red); }
.cal-chip.s-failed .cal-name { color: var(--red); }
.cal-chip.s-skipped .cal-dot { background: var(--text-faint); }
.cal-chip.s-skipped .cal-name { color: var(--text-faint); text-decoration: line-through; }
.cal-chip.s-active { box-shadow: inset 0 0 0 1px var(--cal-c); }
.cal-chip.clash, .cal-ev.clash, .cal-agenda-item.clash { box-shadow: inset 0 0 0 1px var(--red); }
.cal-chip.draggable, .cal-ev.draggable { cursor: grab; }
.cal-chip.dragging, .cal-ev.dragging { opacity: 0.4; }
.cal-more { background: transparent; border: 0; color: var(--accent-hover); font: inherit; font-size: 12px; text-align: left; padding: 1px 6px; cursor: pointer; }
.cal-more:hover { text-decoration: underline; }

/* week / day timeline */
.cal-tl { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.cal-tl-head, .cal-tl-band, .cal-tl-body { display: grid; }
.cal-tl-head { border-bottom: 1px solid var(--border); background: var(--bg-1); }
.cal-tl-dayhead { padding: 8px 6px 6px; text-align: center; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.cal-tl-dayhead .dow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); }
.cal-tl-dayhead .cal-daybtn { font-size: 15px; padding: 2px 8px; }
.cal-tl-band { border-bottom: 1px solid var(--border); padding: 4px 0; row-gap: 3px; }
.cal-tl-band .cal-tl-gutter { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 6px; }
.cal-bar { margin: 0 4px; padding: 3px 8px; border-radius: 4px; font-size: 12px; background: var(--bg-3); background: color-mix(in srgb, var(--cal-c) 22%, transparent); border-left: 3px solid var(--cal-c); cursor: pointer; display: flex; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.cal-bar .cal-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-bar .cal-srv { color: var(--text-faint); margin-left: auto; flex: none; }
.cal-bar.s-active { box-shadow: inset 0 0 0 1px var(--cal-c); }
.cal-tl-scroll { max-height: calc(100vh - 320px); min-height: 380px; overflow-y: auto; position: relative; }
.cal-tl-body { position: relative; }
.cal-tl-gutter { position: relative; min-width: 0; }
.cal-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--border); min-width: 0; }
.cal-col.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-hline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); opacity: 0.6; pointer-events: none; }
.cal-ev { position: absolute; box-sizing: border-box; padding: 2px 6px; border-radius: 4px; font-size: 11.5px; line-height: 1.3; overflow: hidden; background: var(--bg-3); background: color-mix(in srgb, var(--cal-c) 24%, var(--panel)); border-left: 3px solid var(--cal-c); cursor: pointer; display: flex; flex-direction: column; z-index: 1; }
.cal-ev:hover { z-index: 3; filter: brightness(1.12); }
.cal-ev.window { background: color-mix(in srgb, var(--cal-c) 12%, transparent); border: 1px dashed var(--cal-c); border-left: 3px solid var(--cal-c); }
.cal-ev .cal-time { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev .cal-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev .cal-srv { color: var(--text-faint); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-l1 { display: flex; gap: 5px; min-width: 0; overflow: hidden; white-space: nowrap; }
.cal-ev-l1 .cal-name { flex: 0 1 auto; }
/* A point event in the week/day timeline is one half-hour slot tall; when
   that is too short for two lines, everything sits on one line. */
.cal-ev.short { flex-direction: row; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; }
.cal-ev.short .cal-ev-l1 { flex: 0 1 auto; }
.cal-ev.short .cal-srv { flex: 1 1 auto; min-width: 0; }
.cal-ev.s-ran { opacity: 0.7; }
.cal-ev.s-failed { border-left-color: var(--red); }
.cal-ev.s-failed .cal-name { color: var(--red); }
.cal-ev.s-skipped { opacity: 0.55; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 2; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.cal-day-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.cal-agenda { display: flex; flex-direction: column; gap: 8px; }
.cal-agenda-title { margin: 4px 0 2px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.cal-agenda-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--cal-c); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 13px; }
.cal-agenda-item:hover { background: var(--panel-hover); }
.cal-agenda-item .t { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cal-agenda-item .n { font-weight: 600; }
.cal-agenda-item .m { color: var(--text-faint); font-size: 12px; word-break: break-word; }
.cal-agenda-item.s-failed .n { color: var(--red); }
.cal-details .cal-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.cal-details .cal-row:last-child { border-bottom: 0; }
.cal-details .cal-row .k { color: var(--text-faint); }
.cal-details .cal-row .v { word-break: break-word; }
@media (max-width: 900px) {
  .cal-day-layout { grid-template-columns: 1fr; }
  .cal-cell { min-height: 84px; padding: 4px; }
  .cal-chip .cal-srv, .cal-chip .cal-time { display: none; }
  .cal-title { min-width: 0; font-size: 17px; }
  .cal-view { --cal-gutter: 44px; }
}

/* ---------- Storage breakdown (2026-09-13) ---------- */
.stor-section { margin-top: 18px; }
.stor-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.stor-cards { display: flex; flex-direction: column; gap: var(--gap); margin-top: 8px; }
.stor-bar { display: flex; width: 100%; border-radius: 6px; overflow: hidden; background: var(--bg-3); }
.stor-seg { display: block; height: 100%; min-width: 1px; }
.stor-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-dim); margin: 8px 0 4px; }
.stor-lg { display: inline-flex; align-items: center; gap: 5px; }
.stor-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.stor-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 8px 0 0; font-size: 13px; }
.stor-kv dt { color: var(--text-faint); }
.stor-kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.stor-table td.num, .stor-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stor-table .stor-bar { min-width: 120px; }
.stor-growth.up { color: var(--yellow); }
.stor-growth.down { color: var(--green); }
.stor-sub td { color: var(--text-dim); font-weight: 600; border-top: 1px solid var(--border-strong); }

/* ---------- Chat page: global chat bar (2026-09-14) ---------- */
.gc-bar { display: flex; gap: 12px 16px; align-items: flex-start; flex-wrap: wrap; }
.gc-bar-main { flex: 1 1 320px; min-width: 0; }
.gc-bar-main .help { overflow-wrap: anywhere; }
.gc-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.chat-line .chat-mute-btn { padding: 0 6px; min-height: 0; font-size: 11px; line-height: 1.7; opacity: 0.7; }
.chat-line:hover .chat-mute-btn { opacity: 1; }
/* The server filter keeps its own width so the toggles share its line (the
   global `select { width: 100% }` would give it a line of its own). */
.chat-controls .chat-filter { width: 220px; max-width: 100%; flex: none; }
/* Mute dialog: suggestions under the player field */
.gc-pick { position: relative; }
.gc-suggest { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); margin-top: 4px; max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-2); }
.gc-suggest-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--text); padding: 9px 11px; font: inherit; font-size: 13.5px; cursor: pointer; }
.gc-suggest-item:last-child { border-bottom: 0; }
.gc-suggest-item:hover, .gc-suggest-item:focus { background: var(--panel-hover); outline: none; }
.gc-suggest-item .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-suggest-item .g { color: var(--text-faint); font-size: 12px; flex: none; }
@media (max-width: 680px) {
  .gc-bar-actions { width: 100%; }
  .gc-bar-actions .btn { flex: 1 1 auto; justify-content: center; }
  .chat-controls { gap: 10px 14px !important; justify-content: space-between; }
  .chat-controls .chat-filter { width: 100%; }
  .gc-suggest-item { padding: 12px 12px; font-size: 15px; }
  .chat-window { height: calc(100dvh - 330px); font-size: 12.5px; padding: 8px; }
  .chat-window .empty { font-size: 13.5px; }
  .chat-line { gap: 6px; }
  .chat-player { max-width: 55%; }
  .chat-tag { max-width: 110px; }
}
