/* ============================================================
   MC Panel — "Ember Console" family, runtime accent (--accent)
   Warm dark instrument surfaces · Archivo · IBM Plex Mono data
   Mobile-first (iPhone 375–430) → iPad → desktop
   ============================================================ */

/* ===== Tokens ===== */
:root {
  --accent: #72c46d;                 /* set at runtime from panel.accent */
  --accent-ink: #11140f;             /* text on accent (runtime contrast) */
  --accent-text: var(--accent);      /* accent used as text on dark (runtime-lightened if too dark) */
  --accent-2: color-mix(in srgb, var(--accent) 58%, #ffffff);
  --accent-dim: color-mix(in srgb, var(--accent) 13%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 40%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 32%, transparent);

  --bg: #0e0b09;
  --bg2: #161210;
  --card: #1c1713;
  --card2: #241e19;
  --card3: #2e2721;
  --text: #f2ecdf;
  --text2: #a89d8e;
  --text3: #7e7467;
  --green: #7ed88f;
  --green-dim: rgba(126, 216, 143, .14);
  --green-line: rgba(126, 216, 143, .32);
  --red: #ff8a75;
  --red-dim: rgba(255, 138, 117, .14);
  --red-line: rgba(255, 138, 117, .34);
  --yellow: #ffd166;
  --yellow-dim: rgba(255, 209, 102, .13);
  --yellow-line: rgba(255, 209, 102, .32);
  --blue: #7cc4ff;
  --blue-dim: rgba(124, 196, 255, .13);
  --purple: #c3a1ff;
  --purple-dim: rgba(195, 161, 255, .13);
  --border: color-mix(in srgb, var(--accent) 7%, rgb(255 228 196 / 8%));
  --border-strong: color-mix(in srgb, var(--accent) 15%, rgb(255 228 196 / 13%));

  --font-sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r: 14px;
  --r-sm: 10px;
  --r-xs: 7px;
  --gutter: 16px;
  --topbar-h: 54px;
  --tabbar-h: 58px;
  --side-w: 250px;
  --main-top: 14px;
  --main-bottom: 28px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --shadow: 0 18px 48px rgba(0, 0, 0, .48);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  font-optical-sizing: auto;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 85% 45% at 50% -10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 68%),
    radial-gradient(ellipse 45% 35% at 100% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 62%);
}
html.has-sheet, html.has-sheet body { overflow: hidden; }

h1, h2, h3, h4 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--accent-text); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
.mono { font-variant-numeric: tabular-nums; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }

.muted { color: var(--text2); }
.dim { color: var(--text3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-green { color: var(--green); }
.t-red { color: var(--red); }
.t-yellow { color: var(--yellow); }
.t-accent { color: var(--accent-text); }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Icons, spinner, motion ===== */
.i {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -80% 0; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes flash { 0% { background: var(--accent-dim); } 100% { background: transparent; } }

/* ===== Boot splash ===== */
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--accent-text);
}
.boot img { width: 64px; height: 64px; image-rendering: pixelated; animation: float 3s ease-in-out infinite; }

/* ===== Shell ===== */
.topbar {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--topbar-h) + var(--sat));
  padding: var(--sat) calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal));
  display: flex;
  align-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(16px);
  backdrop-filter: saturate(1.3) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text);
  min-height: 44px;
}
.brand img { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.brand-name {
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: .3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.main {
  padding:
    calc(var(--topbar-h) + var(--sat) + var(--main-top))
    calc(var(--gutter) + var(--sar))
    calc(var(--tabbar-h) + var(--sab) + var(--main-bottom))
    calc(var(--gutter) + var(--sal));
}
/* fill-mode backwards: no transform may persist on .page, or it would trap position:fixed children (savebar) */
.page { max-width: 1240px; margin: 0 auto; animation: pageIn .26s cubic-bezier(.2, .7, .3, 1) backwards; }
.tabbar {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + var(--sab));
  padding: 0 var(--sar) var(--sab) var(--sal);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(16px);
  backdrop-filter: saturate(1.3) blur(16px);
  border-top: 1px solid var(--border);
}
.tab-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 0 2px;
  background: none;
  border: 0;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
  touch-action: manipulation;
}
.tab-item .i { width: 23px; height: 23px; }
.tab-item.active { color: var(--accent-text); }
.tab-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 28%;
  right: 28%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.tab-item:active { transform: scale(.94); }
.sidebar { display: none; }

@media (max-width: 899px) and (pointer: coarse) {
  html.kb .tabbar { display: none; }
}

.busy-banner {
  position: sticky;
  top: calc(var(--topbar-h) + var(--sat) + 8px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1240px;
  margin: 0 auto 14px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--yellow) 12%, var(--card));
  border: 1px solid var(--yellow-line);
  color: var(--text);
  font-size: 14.5px;
  box-shadow: var(--shadow);
}
.busy-banner .spinner { color: var(--yellow); }

/* live indicator */
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font: 500 11px var(--font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); }
.live.on { color: var(--green); }
.live.on i { background: var(--green); box-shadow: 0 0 8px rgba(126, 216, 143, .8); animation: pulse 2.4s ease-in-out infinite; }
.live.off { color: var(--red); }
.live.off i { background: var(--red); animation: blink 1.2s steps(2) infinite; }

@media (min-width: 900px) {
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(var(--side-w) + var(--sal));
    padding: calc(18px + var(--sat)) 12px calc(14px + var(--sab)) calc(12px + var(--sal));
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow: hidden;
  }
  .side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; margin: 0 -6px; padding: 0 6px 8px; }
  .sidebar .brand { padding: 0 8px; flex: none; }
  .sidebar .brand img { width: 30px; height: 30px; }
  .main {
    margin-left: calc(var(--side-w) + var(--sal));
    padding: calc(28px + var(--sat)) calc(32px + var(--sar)) calc(48px + var(--sab)) 32px;
  }
  .busy-banner { top: calc(12px + var(--sat)); }
}
.side-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 2px 6px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.side-nav { display: flex; flex-direction: column; }
.nav-group { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 0 12px 6px;
  font: 500 10.5px var(--font-mono);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--text2);
  font-weight: 600;
  font-size: 14.5px;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item .i { width: 19px; height: 19px; }
.nav-item.active { color: var(--accent-text); background: var(--accent-dim); border-color: var(--accent-line); }
.side-user {
  margin-top: auto;
  padding: 14px 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
}
.su-text { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--text); line-height: 1.25; }
.su-text small { color: var(--text3); font-size: 12px; }
@media (hover: hover) {
  .nav-item:hover { color: var(--text); background: var(--card2); }
  .nav-item.active:hover { color: var(--accent-text); background: var(--accent-dim); }
}

/* ===== Page head ===== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 16px;
}
.ph-text { min-width: 0; flex: 1 1 200px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: .2px; }
.page-head .sub { color: var(--text2); font-size: 14.5px; margin-top: 3px; }
.ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (min-width: 900px) { .page-head h1 { font-size: 30px; } .page-head { margin-bottom: 20px; } }

.sec-title {
  font: 600 11.5px var(--font-mono);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text2);
  margin: 18px 0 8px;
}

/* ===== Cards ===== */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 28px;
}
.card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 12px var(--font-mono);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent-2);
}
.card-title .i { width: 17px; height: 17px; color: var(--accent-text); }
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 44px;
  margin: 10px -4px -8px;
  padding: 0 4px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 14.5px;
}
.card-link .i { width: 18px; height: 18px; }
.count { font-size: 13px; color: var(--text2); }
@media (min-width: 900px) { .card { padding: 18px 20px; } }

.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .span-all { grid-column: 1 / -1; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--card2);
  color: var(--text);
  font: 600 15px/1.1 var(--font-sans);
  letter-spacing: .2px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s, filter .15s;
}
.btn .i { width: 19px; height: 19px; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .42; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-danger { background: var(--red-dim); border-color: var(--red-line); color: var(--red); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #2a0d07; font-weight: 700; }
.btn-success { background: var(--green-dim); border-color: var(--green-line); color: var(--green); }
.btn-warn { background: var(--yellow-dim); border-color: var(--yellow-line); color: var(--yellow); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; gap: 6px; }
.btn-sm .i { width: 17px; height: 17px; }
.btn-lg { min-height: 52px; font-size: 16.5px; border-radius: 12px; }
.btn-icon { width: 44px; padding: 0; flex: none; }
.btn-icon.btn-sm { width: 36px; }
.btn-block { width: 100%; }
/* Touch devices: every control gets a >=44px target */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .btn-icon.btn-sm { width: 44px; }
  .tab, .tabs.seg .tab { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .crumbs a { min-height: 44px; }
  .jump-btn { min-height: 44px; }
}
.btn.loading { pointer-events: none; }
.btn.loading > .i { display: none; }
.btn.loading::after {
  content: '';
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@media (hover: hover) {
  .btn:hover:not(:disabled) { border-color: var(--accent-line); background: var(--card3); }
  .btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
  .btn-ghost:hover:not(:disabled) { background: var(--card2); color: var(--text); border-color: transparent; }
  .btn-danger:hover:not(:disabled) { background: rgba(255, 138, 117, .22); border-color: var(--red-line); }
  .btn-danger-solid:hover:not(:disabled) { background: var(--red); filter: brightness(1.08); }
  .btn-success:hover:not(:disabled) { background: rgba(126, 216, 143, .22); border-color: var(--green-line); }
  .btn-warn:hover:not(:disabled) { background: rgba(255, 209, 102, .2); border-color: var(--yellow-line); }
}

/* ===== Pills & badges ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 11px var(--font-mono);
  letter-spacing: .9px;
  text-transform: uppercase;
  white-space: nowrap;
  flex: none;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.lg { height: 32px; padding: 0 13px; font-size: 12.5px; }
.pill.lg i { width: 8px; height: 8px; }
.st-running { color: var(--green); background: var(--green-dim); border-color: var(--green-line); }
.st-running i { box-shadow: 0 0 8px currentColor; animation: pulse 2.4s ease-in-out infinite; }
.st-starting, .st-stopping { color: var(--yellow); background: var(--yellow-dim); border-color: var(--yellow-line); }
.st-starting i, .st-stopping i { animation: blink 1s steps(2) infinite; }
.st-stopped { color: var(--text2); background: rgba(168, 157, 142, .1); border-color: rgba(168, 157, 142, .22); }
.st-stopped i { background: var(--red); }
.st-unknown { color: var(--text3); background: rgba(168, 157, 142, .08); }
.st-unknown i { animation: pulse 1.2s infinite; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  font: 600 10.5px var(--font-mono);
  letter-spacing: .6px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text2);
  background: rgba(168, 157, 142, .12);
  vertical-align: middle;
  flex: none;
}
.badge .i { width: 12px; height: 12px; }
.b-accent { color: var(--accent-text); background: var(--accent-dim); }
.b-green { color: var(--green); background: var(--green-dim); }
.b-red { color: var(--red); background: var(--red-dim); }
.b-yellow { color: var(--yellow); background: var(--yellow-dim); }
.b-blue { color: var(--blue); background: var(--blue-dim); }
.b-purple { color: var(--purple); background: var(--purple-dim); }
.b-muted { color: var(--text3); background: rgba(168, 157, 142, .08); }

.dim-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font: 600 10.5px var(--font-mono); letter-spacing: .5px; white-space: nowrap; }
.dim-overworld { color: var(--green); background: var(--green-dim); }
.dim-nether { color: var(--red); background: var(--red-dim); }
.dim-the_end { color: var(--purple); background: var(--purple-dim); }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13.5px; font-weight: 600; color: var(--text2); }
.help { font-size: 12.5px; color: var(--text3); line-height: 1.45; }
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font: 400 16px/1.35 var(--font-sans);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.input.mono { font-family: var(--font-mono); font-size: 16px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input::placeholder { color: var(--text3); opacity: 1; }
.input:disabled { opacity: .55; cursor: not-allowed; }
select.input {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a89d8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
textarea.input { min-height: 92px; resize: vertical; line-height: 1.5; }
.input[type='number'] { -moz-appearance: textfield; }
.input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }
.input.num { width: 96px; flex: none; text-align: center; }
.input[type='time'] { min-width: 120px; }
.input[type='color'] { padding: 4px; width: 56px; flex: none; cursor: pointer; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 46px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--text2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form > .input:not(.num) { flex: 1 1 160px; min-width: 0; }
.form-error { color: var(--red); font-size: 14px; min-height: 20px; }
.form-error:empty { min-height: 0; }

/* switch */
.switch { position: relative; display: inline-flex; flex: none; width: 50px; height: 30px; }
.switch input {
  position: absolute;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.switch-ui {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: var(--card3);
  border: 1px solid var(--border-strong);
  transition: background .2s, border-color .2s;
}
.switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #d9d1c4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  transition: transform .22s cubic-bezier(.3, .7, .3, 1.2), background .2s;
}
.switch input:checked + .switch-ui { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-ui { opacity: .45; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 10px 0;
  cursor: pointer;
}
.toggle-row + .toggle-row { border-top: 1px solid var(--border); }
.tr-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr-label { font-weight: 600; font-size: 15px; }

/* check rows (permissions / notify) */
.check-list { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 640px) { .check-list { grid-template-columns: 1fr 1fr; } }
.check-list.compact { grid-template-columns: 1fr 1fr; }
.check-list.compact .check { padding: 10px; gap: 9px; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 48px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background .15s, border-color .15s;
}
.check-box .i { width: 15px; height: 15px; stroke-width: 2.6; }
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px var(--accent-soft); }
.check input:disabled ~ * { opacity: .5; }
.check-text { display: flex; flex-direction: column; min-width: 0; font-size: 14.5px; line-height: 1.35; }
.check-text small { color: var(--text3); font: 11.5px var(--font-mono); margin-top: 2px; }

/* tabs & segmented */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text2);
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background .15s, color .15s;
}
.tab .i { width: 18px; height: 18px; }
.tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}
@media (max-width: 419px) { .tabs .tab .i { display: none; } .tab { padding: 0 10px; } }
@media (hover: hover) { .tab:not(.active):hover { color: var(--text); background: var(--card2); } }
.tabs.seg { display: inline-flex; margin: 0; padding: 3px; border-radius: 11px; background: var(--bg2); }
.tabs.seg .tab { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }

.seg-group { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text2);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  flex: 1 1 auto;
  touch-action: manipulation;
}
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-text); }
.seg-btn:has(input:checked) { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-text); }
.seg-btn:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
.seg-btn:disabled { opacity: .4; cursor: not-allowed; }

.chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  flex: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text2);
  font: 500 13.5px var(--font-mono);
  white-space: nowrap;
  touch-action: manipulation;
}
.chip .i { width: 16px; height: 16px; }
.chip:active { background: var(--accent-dim); color: var(--accent-text); }
@media (min-width: 900px) { .chips-row { margin: 0; padding: 0; flex-wrap: wrap; } .chip { min-height: 34px; } }

.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text2);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.day-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 560px) { .choice-grid { grid-template-columns: repeat(3, 1fr); } }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg2);
}
.choice > span .i { color: var(--text2); margin-bottom: 2px; }
.choice b { font-size: 14.5px; }
.choice small { color: var(--text3); font-size: 12px; line-height: 1.35; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-dim); }
.choice input:checked + span .i { color: var(--accent-text); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* search */
.search { position: relative; flex: 1 1 200px; min-width: 0; }
.search .input { padding-left: 40px; }
.search-i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; display: flex; }
.search-i .i { width: 18px; height: 18px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* dropzone + progress */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 18px;
  border-radius: var(--r);
  border: 1.5px dashed var(--border-strong);
  background: var(--bg2);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-dim); color: var(--accent-text); margin-bottom: 4px; }
.dz-title { font-weight: 700; word-break: break-all; }
.dz-sub { color: var(--text3); font-size: 13px; }
.dropzone.has-file { border-style: solid; border-color: var(--accent-line); }
.progress-bar { height: 8px; border-radius: 8px; background: var(--card3); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s; }
.progress-text { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text2); margin-top: 6px; }

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; }
.li {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
}
.li:last-child { border-bottom: 0; }
button.li, a.li { cursor: pointer; }
a.li { color: inherit; }
.li-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--accent-text);
}
.li-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; font-size: 15.5px; line-height: 1.3; min-width: 0; }
.li-sub { color: var(--text2); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.li-note { color: var(--text); font-size: 14px; margin-top: 2px; }
.li-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.li-end { color: var(--text3); width: 18px; height: 18px; }
.li-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 13px; color: var(--text2); }
.meta { display: inline-flex; align-items: center; gap: 5px; }
.meta .i { width: 15px; height: 15px; color: var(--text3); }
@media (hover: hover) { button.li:hover, a.li:hover { background: color-mix(in srgb, var(--card2) 50%, transparent); } }
@media (max-width: 599px) {
  .li.stack-m { flex-wrap: wrap; }
  .li.stack-m .li-main { flex: 1 1 0; }
  .li.stack-m .li-actions { width: 100%; padding-left: 52px; flex-wrap: wrap; }
}

.kv { display: grid; grid-template-columns: 1fr; gap: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text2); font-size: 14px; flex: none; }
.kv dd { text-align: right; font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.kv.kv-2 { grid-template-columns: 1fr 1fr; gap: 0 16px; }
.kv.kv-2 > div { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; border-bottom: 0; padding: 4px 0; }
.kv.kv-2 dd { text-align: left; }

/* avatar */
.avatar {
  --h: 120;
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: hsl(var(--h) 36% 25%);
  color: hsl(var(--h) 85% 86%);
  border: 1px solid hsl(var(--h) 45% 42% / .55);
  font: 800 17px var(--font-sans);
  line-height: 1;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.avatar.xs { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
.avatar.lg { width: 58px; height: 58px; border-radius: 15px; font-size: 25px; }
.av-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text3);
  border: 2.5px solid var(--card);
}
.av-dot.on { background: var(--green); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px 0 6px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

/* empty / loading / error */
.empty { text-align: center; padding: 28px 12px; color: var(--text2); display: flex; flex-direction: column; align-items: center; }
.empty > .i { width: 38px; height: 38px; color: var(--accent-text); opacity: .85; margin-bottom: 10px; stroke-width: 1.5; }
.empty.err > .i { color: var(--red); }
.empty-title { color: var(--text); font-weight: 700; font-size: 16.5px; }
.empty-text { max-width: 44ch; margin-top: 4px; font-size: 14.5px; }
.empty .btn { margin-top: 14px; }
.loading-block { display: flex; flex-direction: column; gap: 10px; }
.skel {
  height: 64px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--card) 40%, var(--card2) 50%, var(--card) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  animation-delay: var(--d, 0ms);
}
.card .skel { height: 52px; }

/* banners */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  font-size: 14.5px;
  line-height: 1.45;
}
.banner > .i { margin-top: 1px; }
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.banner-text span { color: var(--text2); }
.banner .btn { flex: none; align-self: center; }
a.banner { color: var(--text); }
.banner.warn { background: color-mix(in srgb, var(--yellow) 9%, var(--card)); border-color: var(--yellow-line); }
.banner.warn > .i { color: var(--yellow); }
.banner.error { background: color-mix(in srgb, var(--red) 9%, var(--card)); border-color: var(--red-line); }
.banner.error > .i { color: var(--red); }
.banner.info > .i { color: var(--accent-text); }
.banner.ok { background: color-mix(in srgb, var(--green) 8%, var(--card)); border-color: var(--green-line); }
.banner.ok > .i { color: var(--green); }
.banner.accent { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-color: var(--accent-line); }
.banner.accent > .i { color: var(--accent-text); }
.issues { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; color: var(--text2); font-size: 13.5px; }
.issues li { padding-left: 14px; position: relative; overflow-wrap: anywhere; }
.issues li::before { content: ''; position: absolute; left: 2px; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); }
.hint { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text2); font-size: 13.5px; }
.hint .i { width: 18px; height: 18px; color: var(--accent-text); margin-top: 1px; }

/* ===== Sheets ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 3, .62);
  opacity: 0;
  transition: opacity .26s;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - var(--sat) - 12px);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .5);
  padding-bottom: var(--sab);
  transform: translateY(104%);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  outline: none;
}
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 10px 8px 18px;
  touch-action: none;
  flex: none;
}
.sheet-grip { position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 5px; background: var(--card3); }
.sheet-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 800; overflow-wrap: anywhere; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 18px 18px;
}
.sheet-foot {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.sheet-foot .btn { flex: 1 1 0; }
.sheet-foot .grow { flex: 1 1 auto; }
.sheet-msg { color: var(--text2); font-size: 15px; margin-bottom: 14px; line-height: 1.5; }
.sheet-msg b { color: var(--text); }
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab)); }
  .sheet {
    max-width: 520px;
    max-height: calc(100dvh - 48px - var(--sat) - var(--sab));
    border-bottom: 1px solid var(--border-strong);
    border-radius: 18px;
    padding-bottom: 0;
    opacity: 0;
    transform: translateY(14px) scale(.98);
    transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s;
    box-shadow: var(--shadow);
  }
  .sheet.wide { max-width: 780px; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 14px; touch-action: auto; }
  .sheet-foot .btn { flex: 0 0 auto; min-width: 110px; }
  .sheet-foot { justify-content: flex-end; }
}
@media (max-width: 639px) {
  .sheet.sheet-editor { height: calc(100dvh - var(--sat) - 8px); }
}

.action-list { display: flex; flex-direction: column; gap: 6px; }
.action-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 54px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  text-align: left;
  font-weight: 600;
  font-size: 15.5px;
}
.action-item .i { color: var(--accent-text); }
.action-item.danger, .action-item.danger .i { color: var(--red); }
.action-item:disabled { opacity: .45; }
.ai-text { display: flex; flex-direction: column; min-width: 0; }
.ai-text small { color: var(--text3); font-weight: 400; font-size: 13px; margin-top: 1px; }

.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 12px 6px;
  border-radius: 13px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.more-item .i { width: 25px; height: 25px; color: var(--accent-text); }
.more-item.active { border-color: var(--accent-line); background: var(--accent-dim); }
.more-user { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.more-user .grow { display: flex; flex-direction: column; line-height: 1.3; }

/* ===== Toasts ===== */
.toasts {
  position: fixed;
  z-index: 400;
  top: calc(var(--sat) + 10px);
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  padding: 12px 14px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--card2) 94%, transparent);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 14.5px;
  line-height: 1.4;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-10px) scale(.98);
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: none; }
.toast > .i { margin-top: 0; }
.toast span { overflow-wrap: anywhere; }
.toast-success > .i { color: var(--green); }
.toast-error { border-color: var(--red-line); }
.toast-error > .i { color: var(--red); }
.toast-info > .i { color: var(--accent-text); }
@media (min-width: 900px) {
  .toasts { top: auto; bottom: calc(24px + var(--sab)); left: auto; right: 24px; align-items: flex-end; width: 400px; }
  .toast { transform: translateY(10px) scale(.98); }
}

/* ===== Savebar ===== */
.savebar {
  position: fixed;
  z-index: 55;
  left: calc(10px + var(--sal));
  right: calc(10px + var(--sar));
  bottom: calc(var(--tabbar-h) + var(--sab) + 10px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card2) 95%, transparent);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: pageIn .2s ease both;
}
.savebar-text { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.savebar-text small { display: block; color: var(--text3); font-weight: 400; font-size: 12.5px; }
html.kb .savebar { bottom: calc(var(--sab) + 10px); }
@media (min-width: 900px) {
  .savebar { left: calc(var(--side-w) + var(--sal) + 32px); right: calc(32px + var(--sar)); bottom: calc(20px + var(--sab)); max-width: 1240px; margin: 0 auto; }
}
.has-savebar { padding-bottom: 76px; }

/* ===== Dashboard ===== */
.dash-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'status' 'players' 'join' 'charts' 'addon';
}
.dash-grid .a-status { grid-area: status; }
.dash-grid .a-players { grid-area: players; }
.dash-grid .a-join { grid-area: join; }
.dash-grid .a-charts { grid-area: charts; }
.dash-grid .a-addon { grid-area: addon; }
@media (min-width: 700px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: 'status status' 'players join' 'charts charts' 'addon addon'; }
}
.dash-col { display: contents; }
@media (min-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-areas: none; align-items: start; }
  .dash-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .dash-main .chart { height: 150px; }
}
.status-card { --sc: var(--text3); overflow: hidden; }
.status-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sc), transparent);
  opacity: .85;
}
.status-card.s-running { --sc: var(--green); border-color: color-mix(in srgb, var(--green) 20%, transparent); box-shadow: 0 24px 60px -34px rgba(126, 216, 143, .55); }
.status-card.s-starting, .status-card.s-stopping { --sc: var(--yellow); }
.status-card.s-stopped { --sc: var(--red); }
.sc-top { display: flex; align-items: center; gap: 10px; }
.sc-top .btn-icon { margin: -6px -8px -6px auto; }
.sc-name { font-size: 25px; font-weight: 800; margin-top: 12px; letter-spacing: .2px; overflow-wrap: anywhere; }
.sc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text2); font-size: 14px; margin-top: 2px; }
.sc-meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text3); }
.sc-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-k { font: 500 10.5px var(--font-mono); letter-spacing: 1.3px; text-transform: uppercase; color: var(--text3); }
.stat-v { font-family: var(--font-mono); font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-v small { font-size: 13px; color: var(--text2); font-weight: 500; }
.stat-x { font: 12px var(--font-mono); color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 5px; border-radius: 5px; background: var(--card3); overflow: hidden; margin-top: 3px; }
.meter > i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--accent); transition: width .6s cubic-bezier(.2, .7, .3, 1); }
.meter.warn > i { background: var(--yellow); }
.meter.danger > i { background: var(--red); }

.power-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.power-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 8px 4px;
  border-radius: 13px;
  border: 1px solid;
  font-weight: 700;
  font-size: 14.5px;
  touch-action: manipulation;
  transition: transform .1s, opacity .15s, background .15s, filter .15s;
}
.power-btn .i { width: 25px; height: 25px; }
.power-btn.start { color: var(--green); background: var(--green-dim); border-color: var(--green-line); }
.power-btn.stop { color: var(--red); background: var(--red-dim); border-color: var(--red-line); }
.power-btn.restart { color: var(--yellow); background: var(--yellow-dim); border-color: var(--yellow-line); }
.power-btn:disabled { opacity: .3; filter: grayscale(.6); cursor: not-allowed; }
.power-btn:active:not(:disabled) { transform: scale(.96); }
.power-btn.loading > .i { display: none; }
.power-btn.loading::before { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
@media (min-width: 640px) { .power-btn { flex-direction: row; min-height: 54px; gap: 9px; } .power-btn .i { width: 21px; height: 21px; } }
@media (hover: hover) { .power-btn:hover:not(:disabled) { filter: brightness(1.15); } }

.plist { display: flex; flex-direction: column; }
.plist li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.plist li:last-child { border-bottom: 0; }
.plist .li-main b { font-weight: 650; }
.plist small { font-size: 13px; }

.copy-box { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 7px 7px 10px 13px;
  border-radius: var(--r-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
}
.copy-k { grid-column: 1; grid-row: 1; font: 500 10.5px var(--font-mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--text3); }
.copy-v { grid-column: 1 / -1; grid-row: 2; font: 600 clamp(14px, 4vw, 16px) var(--font-mono); color: var(--accent-2); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
.copy-row .btn { grid-column: 2; grid-row: 1; }


.addon-state { display: flex; align-items: flex-start; gap: 11px; }
.addon-state > .i { width: 24px; height: 24px; flex: none; }
.addon-state.ok > .i { color: var(--green); }
.addon-state.wait > .i { color: var(--yellow); }
.addon-state b { display: block; }

/* charts */
.charts { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); transition: opacity .2s; }
@media (min-width: 700px) { .charts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.charts.refetch { opacity: .5; }
.chart-box { min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.chart-label { font: 500 11px var(--font-mono); letter-spacing: 1.3px; text-transform: uppercase; color: var(--text2); }
.chart-read { font: 600 15px var(--font-mono); color: var(--text); white-space: nowrap; }
.chart-read small { color: var(--text3); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
.chart { position: relative; height: 124px; touch-action: pan-y; border-radius: 8px; outline-offset: 4px; }
.chart svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis text { fill: var(--text3); font: 10.5px var(--font-mono); }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .iso { fill: var(--accent); }
.chart .end, .chart .xh-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.chart .xh { stroke: var(--text2); stroke-width: 1; shape-rendering: crispEdges; }
.chart-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 0 12px; color: var(--text3); font-size: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); }
.chart-sum { margin-top: 4px; font: 11.5px var(--font-mono); color: var(--text3); min-height: 1.4em; }

/* ===== Console ===== */
.page-fill {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - var(--main-top) - var(--main-bottom));
  height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--sat) - var(--sab) - var(--main-top) - var(--main-bottom));
  min-height: 460px;
}
.page-fill > .page-head { margin-bottom: 12px; }
@media (min-width: 900px) {
  .page-fill { height: calc(100dvh - var(--sat) - var(--sab) - 76px); min-height: 520px; }
}
.con-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.page-fill > .tabs { flex: none; }
.log-wrap { position: relative; flex: 1 1 auto; min-height: 180px; }
.log {
  position: absolute;
  inset: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 0;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #0a0807;
  font: 12.5px/1.55 var(--font-mono);
  color: #d8d0c2;
}
.ln { display: flex; gap: 10px; padding: 1px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-t { flex: none; color: var(--text3); -webkit-user-select: none; user-select: none; }
.ln-x { min-width: 0; }
.lv-warn .ln-x { color: var(--yellow); }
.lv-error { background: rgba(255, 138, 117, .07); }
.lv-error .ln-x { color: var(--red); }
.lv-panel .ln-x { color: var(--accent-2); }
.lv-dim .ln-x { color: var(--text3); }
.ln-empty { padding: 20px 14px; color: var(--text3); font-family: var(--font-sans); font-size: 14px; }
@media (max-width: 480px) { .log { font-size: 11.5px; } .ln { gap: 7px; padding: 1px 10px; } }
.jump-btn {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  white-space: nowrap;
}
.jump-btn .i { width: 17px; height: 17px; }
.cmd-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--card);
}
.cmd-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.cmd-bar .input { border: 0; background: transparent; box-shadow: none; min-height: 44px; padding: 8px 4px; }
.cmd-prefix { color: var(--accent-text); font: 600 16px var(--font-mono); padding-left: 6px; }
.cmd-out { flex: none; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--card); overflow: hidden; }
.cmd-out-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--border); font: 600 13px var(--font-mono); color: var(--accent-2); }
.cmd-out pre { max-height: 26vh; overflow: auto; padding: 8px 12px 10px; font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }

/* ===== Players ===== */
.player-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.player-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.player-card:active { transform: scale(.99); }
.player-card.online { border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.player-card .li-end { align-self: center; }
@media (hover: hover) { .player-card:hover { border-color: var(--accent-line); } }
.pl-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.pl-name { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.act-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .act-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 70px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  text-align: center;
  line-height: 1.2;
  touch-action: manipulation;
}
.act .i { color: var(--accent-text); width: 22px; height: 22px; }
.act:disabled { opacity: .4; cursor: not-allowed; }
.act.loading > .i { display: none; }
.act.loading::before { content: ''; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
.act:active:not(:disabled) { transform: scale(.97); }

/* ===== World ===== */
.world-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .world-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } .world-layout .span-all { grid-column: 1 / -1; } }
.wh-top { display: flex; align-items: center; gap: 14px; }
.wh-icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--accent-dim); border: 1px solid var(--accent-line); color: var(--accent-text); }
.wh-icon .i { width: 26px; height: 26px; }
.wh-name { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.15;
  touch-action: manipulation;
}
.qbtn .i { width: 24px; height: 24px; color: var(--accent-text); }
.qbtn[data-q='night'] .i, .qbtn[data-q='midnight'] .i { color: var(--purple); }
.qbtn[data-q='day'] .i, .qbtn[data-q='noon'] .i, .qbtn[data-q='clear'] .i { color: var(--yellow); }
.qbtn[data-q='rain'] .i, .qbtn[data-q='thunder'] .i { color: var(--blue); }
.qbtn:disabled { opacity: .4; cursor: not-allowed; }
.qbtn:active:not(:disabled) { transform: scale(.96); }
.qbtn.loading > .i { display: none; }
.qbtn.loading::before { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
@media (min-width: 560px) { .quick-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.field-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.field-inline .input { width: auto; min-width: 150px; }

.rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; margin-top: 8px; }
@media (min-width: 900px) { .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}
.rule-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; cursor: pointer; }
.rule-label { font-weight: 600; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.rule-ctl .input:not(.num) { width: 140px; }
.rule-key { font: 11.5px var(--font-mono); color: var(--text3); overflow-wrap: anywhere; }
.rule-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.rule.saving .rule-ctl { opacity: .5; }
.rule.saved { animation: flash 1.2s ease; }

/* ===== Shop ===== */
.rank-list { display: flex; flex-direction: column; }
.rank-li { display: flex; align-items: center; gap: 11px; min-height: 54px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rank-li:last-child { border-bottom: 0; }
.rank { width: 26px; flex: none; text-align: center; font: 600 14px var(--font-mono); color: var(--text3); }
.rank.r1 { color: #ffd166; }
.rank.r2 { color: #c9c2b8; }
.rank.r3 { color: #e39a5e; }
.coins { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.coins small { color: var(--text3); font-weight: 400; font-size: 12px; }
.tx-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; }
.tx-icon .i { width: 19px; height: 19px; }
.c-blue { color: var(--blue); background: var(--blue-dim); }
.c-green { color: var(--green); background: var(--green-dim); }
.c-purple { color: var(--purple); background: var(--purple-dim); }
.c-yellow { color: var(--yellow); background: var(--yellow-dim); }
.c-accent { color: var(--accent-text); background: var(--accent-dim); }
.c-muted { color: var(--text3); background: rgba(168, 157, 142, .1); }
.c-red { color: var(--red); background: var(--red-dim); }
.tx-coins { font: 600 15px var(--font-mono); white-space: nowrap; }

.cats { display: flex; flex-direction: column; gap: 10px; }
.cat { border: 1px solid var(--border); border-radius: var(--r); background: var(--bg2); }
.cat[open] { border-color: var(--border-strong); }
.cat-sum {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 14px;
  cursor: pointer;
  list-style: none;
}
.cat-sum::-webkit-details-marker { display: none; }
.cat-name { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chev { color: var(--text3); transition: transform .2s; }
.cat[open] .cat-chev { transform: rotate(180deg); }
.cat-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 12px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item-card { padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.item-card .field .label { font-size: 12.5px; }
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.item-grid .span-2 { grid-column: 1 / -1; }
@media (min-width: 760px) { .item-grid { grid-template-columns: 2fr 1fr 1fr 2fr; } .item-grid .span-2 { grid-column: auto; } }
.ench { display: flex; flex-direction: column; gap: 6px; }
.ench:empty { display: none; }
.ench-row { display: flex; align-items: center; gap: 6px; }
.ench-row > .i { color: var(--purple); width: 18px; height: 18px; }
.ench-row .input.num { width: 64px; padding-left: 6px; padding-right: 6px; }
.ench-row .input:not(.num) { padding-left: 10px; padding-right: 10px; }
@media (max-width: 479px) { .ench-row > .i { display: none; } .item-card { padding: 10px; } .cat-body { padding: 4px 10px 10px; } }
.item-actions, .cat-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sell-head { display: flex; gap: 6px; padding: 0 2px 4px; font-size: 12.5px; color: var(--text3); font-weight: 600; }
.sell-list { display: flex; flex-direction: column; gap: 6px; }
.sell-row { display: flex; gap: 6px; align-items: center; }
.sell-row .input.num { width: 110px; }

/* ===== Chat & Lokasi ===== */
.chat-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); flex: 1 1 auto; min-height: 0; }
.page-fill .chat-layout { grid-template-rows: minmax(0, 1fr); }
.page-fill .chat-layout > * { min-height: 0; }
@media (min-width: 900px) { .chat-layout { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); } }
@media (max-width: 899px) { .chat-layout > .m-hidden { display: none; } }
@media (min-width: 900px) { .tabs.m-only { display: none; } }
.chat-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-feed-wrap { position: relative; flex: 1 1 auto; min-height: 200px; }
.chat-feed {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-head { display: flex; align-items: center; gap: 6px; margin: 10px 0 3px 2px; font-size: 12.5px; font-weight: 700; color: var(--text2); }
.msg-bubble {
  padding: 7px 11px 6px;
  border-radius: 4px 15px 15px 15px;
  background: var(--card2);
  border: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.msg.grouped .msg-bubble { border-radius: 15px; }
.msg.web .msg-bubble { background: color-mix(in srgb, var(--accent) 9%, var(--card2)); border-color: var(--accent-line); }
.msg.mine .msg-bubble { background: var(--accent); border-color: transparent; color: var(--accent-ink); border-radius: 15px 4px 15px 15px; }
.msg.mine.grouped .msg-bubble { border-radius: 15px; }
.msg-time { float: right; margin: 4px 0 0 10px; font: 10.5px var(--font-mono); color: var(--text3); }
.msg.mine .msg-time { color: color-mix(in srgb, var(--accent-ink) 62%, transparent); }
.msg.sys { align-self: center; max-width: 94%; margin: 8px 0; padding: 4px 12px; border-radius: 999px; background: var(--bg2); color: var(--text3); font-size: 12.5px; text-align: center; }
.day-sep { align-self: center; margin: 14px 0 4px; font: 500 10.5px var(--font-mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--text3); }
.chat-send { flex: none; display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--card); }
.chat-ro { padding: 12px 14px; border-top: 1px solid var(--border); }
.loc-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.page-fill .loc-col { overflow-y: auto; }
.loc-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.loc-row:last-child { border-bottom: 0; }
.coords { font: 600 15px var(--font-mono); color: var(--text); margin-top: 2px; }
.dist-big { font-size: 22px; font-weight: 800; line-height: 1.25; }
.dist-big em { font-style: normal; color: var(--accent-text); font-family: var(--font-mono); }
.dist-sub { color: var(--text2); font-size: 14px; margin-top: 4px; }

/* ===== Backups / schedules / misc ===== */
.task { display: flex; flex-direction: column; gap: 12px; }
.task.off { opacity: .72; }
.task-top { display: flex; align-items: flex-start; gap: 12px; }
.task-payload { display: block; padding: 8px 11px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; color: var(--accent-2); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.result-ok { color: var(--green); }
.result-bad { color: var(--red); }

.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cfg-row:last-child { border-bottom: 0; }
.cfg-row.stacked { flex-direction: column; align-items: stretch; gap: 8px; }
.cfg-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cfg-label { font-weight: 600; font-size: 15px; }
.cfg-key { font: 11.5px var(--font-mono); color: var(--text3); overflow-wrap: anywhere; }
.cfg-ctl { flex: none; }
.cfg-ctl .input { width: 150px; }
.cfg-row.changed .cfg-label::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
@media (max-width: 559px) {
  .cfg-row:not(.is-bool) { flex-direction: column; align-items: stretch; gap: 8px; }
  .cfg-row:not(.is-bool) .cfg-ctl .input { width: 100%; }
}

.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 12px; font-size: 14.5px; }
.crumbs a, .crumbs span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; border-radius: 8px; color: var(--text2); font-weight: 600; }
.crumbs a:active { background: var(--card2); }
.crumbs .cur { color: var(--text); }
.crumbs .sep { color: var(--text3); padding: 0; min-height: 0; }
.crumbs .sep .i { width: 14px; height: 14px; }
.editor {
  width: 100%;
  height: 100%;
  min-height: 55vh;
  padding: 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: #0a0807;
  color: var(--text);
  font: 16px/1.5 var(--font-mono);
  tab-size: 2;
  resize: none;
}
.editor:focus { outline: none; border-color: var(--accent); }
@media (min-width: 900px) { .editor { font-size: 13.5px; min-height: 60vh; } }
.sheet-editor .sheet-body { display: flex; flex-direction: column; gap: 8px; }
.editor-bar { display: flex; align-items: center; gap: 8px; }

.version-cmp { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.ver-box { padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg2); border: 1px solid var(--border); min-width: 0; }
.ver-box .stat-v { font-size: 18px; }
.ver-box.new { border-color: var(--yellow-line); }
.ver-arrow { color: var(--text3); }

.swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.swatch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
}
.swatch i { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.swatch.active { border-color: var(--accent); background: var(--accent-dim); }
.color-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.color-row .input.mono { max-width: 160px; }

.audit-li .li-title { font-size: 14.5px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 8px; border-radius: 8px; background: var(--accent-dim); color: var(--text); font-size: 13.5px; line-height: 1.25; }
.perm-chip .i { width: 14px; height: 14px; color: var(--accent-text); stroke-width: 2.4; }

/* ===== Landing ===== */
.landing {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(22px + var(--sat)) calc(var(--gutter) + var(--sar)) calc(32px + var(--sab)) calc(var(--gutter) + var(--sal));
  animation: pageIn .3s ease backwards;
}
.land-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.land-head { display: flex; align-items: center; gap: 16px; margin: 10px 0 20px; }
.land-logo { width: 64px; height: 64px; flex: none; image-rendering: pixelated; filter: drop-shadow(0 10px 22px var(--accent-glow)); animation: float 5s ease-in-out infinite; }
.land-titles { min-width: 0; flex: 1; }
.land-login-jump { flex: none; }
@media (min-width: 860px) { .land-login-jump { display: none; } }
.eyebrow { font: 500 11px var(--font-mono); letter-spacing: 2px; text-transform: uppercase; color: var(--accent-text); }
.land-title { font-size: clamp(28px, 8vw, 46px); font-weight: 900; line-height: 1.04; letter-spacing: .3px; overflow-wrap: anywhere; }
.land-motd { color: var(--text2); margin-top: 4px; }
.land-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.land-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 860px) {
  .land-grid { grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); align-items: start; }
  .land-side { position: sticky; top: calc(24px + var(--sat)); }
  .land-head { margin: 14px 0 28px; }
}
.land-status { padding: 20px 18px; }
.big-state { display: flex; align-items: center; gap: 16px; }
.big-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--text3); }
.big-state.on .big-dot { background: var(--green); box-shadow: 0 0 0 6px rgba(126, 216, 143, .14), 0 0 26px rgba(126, 216, 143, .75); animation: pulse 2.4s ease-in-out infinite; }
.big-state.mid .big-dot { background: var(--yellow); box-shadow: 0 0 0 6px rgba(255, 209, 102, .14); animation: blink 1s steps(2) infinite; }
.big-state.off .big-dot { background: var(--red); box-shadow: 0 0 0 6px rgba(255, 138, 117, .12); }
.big-label { font-size: 26px; font-weight: 800; line-height: 1.15; }
.big-state.on .big-label { color: var(--green); }
.big-state.mid .big-label { color: var(--yellow); }
.big-sub { color: var(--text2); font-size: 15px; margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.stat-grid .stat { padding: 11px 13px; border-radius: var(--r-sm); background: var(--bg2); border: 1px solid var(--border); }
.land-players { margin-top: 12px; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: flex-start; gap: 12px; }
.steps li > div { flex: 1; min-width: 0; padding-top: 3px; color: var(--text2); font-size: 15px; }
.steps b { color: var(--text); }
.step-n {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  color: var(--accent-text);
  font: 600 13px var(--font-mono);
}
.note-text { white-space: pre-wrap; color: var(--text); overflow-wrap: anywhere; }
.login-card { display: flex; flex-direction: column; gap: 12px; }
.login-card .card-head { margin-bottom: 0; }
.land-foot { text-align: center; margin-top: 12px; }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===== Spacing utilities ===== */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mb-12 { margin-bottom: 12px; }
.self-center { align-self: center; }

/* ===== File manager rows ===== */
.file-li { padding: 0; gap: 4px; }
.li-open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 0;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.li-open .li-title { overflow-wrap: anywhere; }
a.li-open { color: inherit; }
@media (hover: hover) { .li-open:hover .li-title { color: var(--accent-text); } }

/* ===== Savebar on small phones ===== */
@media (max-width: 479px) {
  .savebar { padding-left: 12px; gap: 6px; }
  .savebar-text { font-size: 13px; }
  .savebar-text small { display: none; }
}
