/* RavenMC Panel — premium dark theme.
 * Single accent (#7c5cff) on near-black; logical CSS properties throughout
 * so RTL (Persian) mirrors automatically via html[dir="rtl"]. System fonts
 * only — no external font/CDN requests. */

:root {
  --bg: #0b0e14;
  --bg-deep: #070a10;
  --bg-raised: #11151f;
  --bg-card: #121724;
  --bg-input: #0d1119;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e8ebf4;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-bright: #9b7fff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sidebar-w: 248px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(124, 92, 255, 0.09), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(124, 92, 255, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Vazirmatn", Tahoma, Arial, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08em 0.4em;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232a3a; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------- boot splash */

.boot-splash {
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: center;
}
.boot-mark {
  width: 54px;
  height: 54px;
  background: linear-gradient(160deg, var(--accent-bright), var(--accent));
  clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%);
  animation: bootpulse 1.2s ease-in-out infinite alternate;
}
.boot-text { color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; font-size: 12px; }
@keyframes bootpulse {
  from { transform: scale(0.92); opacity: 0.6; }
  to { transform: scale(1.06); opacity: 1; }
}

/* ------------------------------------------------------------------ brand */

.brand { display: flex; align-items: center; gap: 11px; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 15px; letter-spacing: 0.02em; }
.brand small { font-size: 11px; }
.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  background: linear-gradient(160deg, var(--accent-bright), var(--accent));
  clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%);
  filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.55));
}
.brand-lg { justify-content: center; margin-block-end: 18px; }
.brand-lg .brand-mark { width: 40px; height: 40px; }
.brand-lg strong { font-size: 19px; }

/* ----------------------------------------------------------------- layout */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  inset-block-start: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background: linear-gradient(180deg, var(--bg-raised), var(--bg-deep));
  border-inline-end: 1px solid var(--border);
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; overflow-y: auto; }
.nav-group-label {
  margin: 14px 10px 6px;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  box-shadow: inset 2px 0 0 var(--accent);
}
.icon { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; opacity: 0.9; }

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-block-start: 1px solid var(--border);
  padding-block-start: 14px;
}
.user-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 26px;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile hamburger: hidden on desktop; the off-canvas sidebar + overlay are
   only activated by the ≤820px media query below. The .topbar scope is
   required so this wins over the later `.btn { display: inline-flex }` rule. */
.topbar .menu-btn { display: none; align-items: center; justify-content: center; padding: 8px; }
.topbar .menu-btn .icon { width: 20px; height: 20px; }
.nav-overlay { display: none; }

.view { padding: 22px 26px 40px; max-width: 1180px; width: 100%; margin-inline: auto; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-name { display: flex; align-items: center; gap: 9px; font-size: 18px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-raised));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-card { padding: 18px; }
.card-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-block-end: 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
}
.stat-grid.small { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.stat-value { font-size: 21px; font-weight: 700; letter-spacing: 0.01em; }
.stat.good .stat-value { color: var(--good); }
.stat.warn .stat-value { color: var(--warn); }

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 18px;
  margin: 0;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- toolbar */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar input { flex: 1 1 220px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent-bright); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.chip.ok { color: var(--good); border-color: rgba(52, 211, 153, 0.35); }
.chip.info { color: var(--info); border-color: rgba(96, 165, 250, 0.35); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.good { background: var(--good); box-shadow: 0 0 8px rgba(52, 211, 153, 0.7); }

/* ----------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: start;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--bg-raised);
  padding: 10px 14px;
  border-block-end: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 14px; border-block-end: 1px solid rgba(148, 163, 184, 0.07); vertical-align: middle; }
tbody tr:last-child td { border-block-end: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(124, 92, 255, 0.05); }
td.wrap { max-width: 320px; overflow-wrap: anywhere; }
td.actions { white-space: nowrap; }
td.actions .btn { margin-inline-end: 6px; }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.good { color: var(--good); background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); }
.badge.warn { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); }
.badge.bad { color: var(--bad); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); }
.badge.info { color: var(--info); background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.35); }
.badge.muted { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.25); }

.badge.role-owner { color: #e9d5ff; background: rgba(124, 92, 255, 0.2); border-color: rgba(124, 92, 255, 0.55); }
.badge.role-admin { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.4); }
.badge.role-moderator { color: #93c5fd; background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.4); }
.badge.role-helper { color: #5eead4; background: rgba(45, 212, 191, 0.1); border-color: rgba(45, 212, 191, 0.4); }
.badge.role-builder { color: #bef264; background: rgba(163, 230, 53, 0.1); border-color: rgba(163, 230, 53, 0.35); }
.badge.role-player { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.25); }

.badge.type-warn { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); }
.badge.type-kick { color: #fb923c; background: rgba(251, 146, 60, 0.12); border-color: rgba(251, 146, 60, 0.4); }
.badge.type-mute { color: var(--info); background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.35); }
.badge.type-ban { color: var(--bad); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-raised); border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(160deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 92, 255, 0.35);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--bad);
}
.btn.danger:hover { background: rgba(248, 113, 113, 0.18); }
.btn.small { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.wide { width: 100%; justify-content: center; }

.lang-select {
  align-self: flex-start;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  cursor: pointer;
}

/* ----------------------------------------------------------------- inputs */

input, select, textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #5b6478; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
.search { max-width: 340px; }
input[type="date"] { width: auto; }
input[type="checkbox"] { width: auto; }

.field { display: flex; flex-direction: column; gap: 6px; margin-block-end: 14px; }
.field > span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field small { color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------------------------ login */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 30px 28px 22px; }
.login-form h1 { font-size: 20px; margin-block-end: 4px; text-align: center; }
.login-form > .muted { text-align: center; margin: 0 0 20px; }
.login-error {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin: 0 0 14px;
}
.login-notice { color: var(--info); font-size: 13px; margin: 0 0 12px; }
.login-foot { margin-block-start: 16px; display: flex; justify-content: center; border-block-start: 1px solid var(--border); padding-block-start: 14px; }

/* ------------------------------------------------------------------ state */

.state-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 42px 20px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.state-block.error { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-block-start-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-mark {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(248, 113, 113, 0.15);
  color: var(--bad);
  border-radius: 50%;
  font-weight: 800;
}

/* ----------------------------------------------------------------- modals */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(4px);
  padding: 20px;
  animation: fadein 0.14s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-raised));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  animation: rise 0.16s ease-out;
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin-block-end: 12px; }
.modal-body { color: var(--text); margin: 0 0 8px; }
.modal-detail { color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.modal-error {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-block-start: 18px; }

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 44px));
}
.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-inline-start: 3px solid var(--good);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { border-inline-start-color: var(--bad); }

/* -------------------------------------------------------------- responsive */

@media (max-width: 960px) {
  .cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar .menu-btn { display: inline-flex; }
  /* Off-canvas sidebar: slides in from the inline-start edge (RTL aware).
     No horizontal overflow: the drawer is fixed, the content never moves. */
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 60;
    width: min(84vw, 320px);
    flex: none;
    height: 100vh;
    height: 100dvh;
    padding: 18px 14px;
    gap: 14px;
    border-inline-end: 1px solid var(--border-strong);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  [dir="rtl"] .sidebar { transform: translateX(102%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.nav-open { overflow: hidden; }
  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(6, 8, 12, 0.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .nav { flex-direction: column; flex-wrap: nowrap; overflow-y: auto; }
  .nav-group-label { display: block; }
  .nav-item { padding: 10px 12px; }
  .sidebar-foot { flex-direction: column; align-items: stretch; border-block-start: 1px solid var(--border); padding-block-start: 14px; }
  .view { padding: 16px 14px 32px; }
  .topbar { padding: 12px 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-block-start: 8px; }
}

/* ---- Phase 67: punishment policy manager ---- */
.policy-item { display: flex; gap: 6px; align-items: center; }
.policy-item .rank-item { flex: 1 1 auto; min-width: 0; }
.policy-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-end: 12px; }
.stage-rows { display: flex; flex-direction: column; gap: 8px; }
.stage-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
}
.stage-ord { font-weight: 700; color: var(--muted); min-width: 26px; }
.stage-amount { width: 84px; }
.stage-unit { width: auto; }
.perm-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- staff ranks & permissions editor (0.5.0) ---- */
.rank-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rank-list { display: flex; flex-direction: column; gap: 6px; min-width: 190px; flex: 0 0 auto; }
.rank-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: var(--text); cursor: pointer; text-align: start;
}
.rank-item:hover { border-color: var(--accent); }
.rank-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rank-name { font-weight: 600; }
.rank-editor { flex: 1 1 420px; min-width: 300px; }
.perm-category { margin-block-start: 18px; }
.perm-category h3 { margin: 0 0 8px; font-size: 0.95rem; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.perm-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.perm-row.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.perm-row input[type="checkbox"] { margin-block-start: 3px; accent-color: var(--accent); }
.perm-row.disabled, .perm-row input:disabled { cursor: not-allowed; opacity: 0.75; }
.perm-text { display: flex; flex-direction: column; gap: 2px; }
.perm-node { font-size: 0.78rem; color: var(--muted); direction: ltr; }
.badge.staffrank { border: 1px solid var(--accent); color: var(--accent); }

/* ---- rank display order (one authoritative staff-list ordering) ---- */
.rank-order-card { margin-block-end: 16px; }
.order-list { display: flex; flex-direction: column; gap: 6px; margin-block: 12px; }
.order-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px;
  background: transparent; touch-action: pan-y;
}
.order-row.pinned { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.order-row.dragging {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent);
  opacity: 0.9; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.order-list.ordering .order-row:not(.dragging) { transition: transform 0.08s ease-out; }
.order-pos {
  min-width: 22px; text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--muted);
}
.order-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 1px dashed var(--border);
  color: var(--muted); cursor: grab; touch-action: none; user-select: none;
}
.order-handle:hover { color: var(--accent); border-color: var(--accent); }
.order-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.order-handle.locked { border-style: solid; cursor: default; opacity: 0.6; }
.order-grip { font-size: 16px; line-height: 1; letter-spacing: -2px; }
.order-row.dragging .order-handle { cursor: grabbing; }
.order-name { font-weight: 600; }
.order-id { direction: ltr; }
.order-move { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.order-preview {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  margin-block-end: 12px;
}
.order-chain { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.order-chip {
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 0.8rem;
}
.order-chip.first { border-color: var(--accent); color: var(--accent); }
.order-sep { color: var(--muted); }

/* Touch targets: a 30px grip is a mouse-sized affordance. On a narrow screen
   the handle and the move buttons grow towards the 44px guideline - scoped to
   this control so no other toolbar changes size. */
@media (max-width: 820px) {
  .order-row { padding: 11px 12px; gap: 8px; }
  .order-handle { width: 40px; height: 40px; }
  .order-grip { font-size: 18px; }
  .order-move button { min-height: 40px; padding-inline: 12px; }
}

/* ---- 0.6.3: player-rank duration presets (owner-editable) ---- */
.preset-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
}
.preset-row + .preset-row { margin-block-start: 6px; }
.preset-label { font-weight: 600; }
.preset-spacer { flex: 1 1 auto; }

/* ---- phase 6: palettes, appearance, motd, messages ---- */
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; outline: 1px solid var(--border); padding: 0;
}
.swatch.active { border-color: var(--text); outline-color: var(--accent); }
.appearance-editor .kv dd { display: flex; align-items: center; }
.rank-preview { font-weight: 600; direction: ltr; }
.motd-preview {
  border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px;
  font-family: var(--mono, monospace); font-size: 0.85rem; direction: ltr;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.message-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.message-row code { min-width: 120px; font-size: 0.78rem; color: var(--muted); }
.message-row input { flex: 1 1 220px; }
.toolbar.wrap { flex-wrap: wrap; }
.badge.info { border: 1px solid var(--accent); color: var(--accent); }

/* ---- phase 66: playtime chart + skin previews ---- */
.skin-head {
  flex: 0 0 auto; border-radius: 8px; border: 1px solid var(--border);
  background-color: #10141d; background-repeat: no-repeat;
  image-rendering: pixelated; display: flex; align-items: center;
  justify-content: center;
}
.skin-head.empty { border-style: dashed; }
.skin-head-mark { color: var(--muted); font-weight: 700; font-size: 1.2rem; }
.skin-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.skin-inline { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1 1 auto; min-width: 220px; }
.spark {
  display: flex; align-items: flex-end; gap: 4px; height: 64px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}
.spark-bar {
  flex: 1 1 0; min-height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent));
}
.spark-bar.zero { background: var(--border); }
.modal textarea {
  width: 100%; font-family: var(--mono, monospace); font-size: 0.78rem;
  direction: ltr; resize: vertical;
}

/* ------------------------------------------------------- knockback manager */
/* The profile list is a rail of buttons; the editor fills the rest. All sizes
 * use the shared spacing scale and logical properties so the RTL catalog and
 * the mobile breakpoint behave like every other section. */
.cols-kb { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.kb-modes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.kb-mode {
  display: grid; gap: 3px; text-align: start; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-raised); color: inherit; font: inherit;
}
.kb-mode:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.kb-mode.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised)); }
.kb-mode-name { font-weight: 650; }
.kb-mode-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.kb-params { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.kb-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px;
  align-items: center; padding: 10px 0; border-top: 1px solid var(--border);
}
.kb-row-label { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kb-row-label code { font-size: 0.72rem; color: var(--muted); }
.kb-row-edit { display: flex; gap: 8px; align-items: center; }
.kb-input { width: 110px; }
.kb-preset-detail { margin-top: 12px; }
@media (max-width: 900px) {
  .cols-kb { grid-template-columns: 1fr; }
}
