:root {
  --bg0: #0c1117;
  --bg1: #131a22;
  --bg2: #1a2330;
  --sidebar: #090d12;
  --ink: #e8eef4;
  --muted: #8b9aab;
  --line: rgba(232, 238, 244, 0.09);
  --line-strong: rgba(232, 238, 244, 0.14);
  --accent: #2fd39a;
  --accent-dim: rgba(47, 211, 154, 0.12);
  --accent-ink: #041a12;
  --danger: #ef6a5a;
  --warn: #e0b04a;
  --info: #5b9fd4;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 248px;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(47, 211, 154, 0.28);
  color: var(--ink);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid rgba(47, 211, 154, 0.65);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(47, 211, 154, 0.65);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.hidden {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, #0d131a 0%, var(--sidebar) 40%),
    var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.75rem 1rem;
  gap: 0.75rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 154, 171, 0.35) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(139, 154, 171, 0.35);
  border-radius: 999px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.55rem 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
}

.sidebar-brand strong {
  display: block;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.sidebar-brand span {
  display: block;
  font-size: 0.68rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin-top: 0.15rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--accent) 0%, #1a9f70 55%, #0d6b4c 100%);
  box-shadow: 0 0 0 1px rgba(47, 211, 154, 0.25), 0 6px 16px rgba(47, 211, 154, 0.18);
  flex-shrink: 0;
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 3px;
  background: rgba(4, 26, 18, 0.35);
}

.sidebar-nav {
  display: grid;
  gap: 0.15rem;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.nav-group-label {
  margin: 0.85rem 0.65rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(139, 154, 171, 0.75);
}

.nav-group-label:first-child {
  margin-top: 0.15rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.nav-item.is-active {
  color: var(--ink);
  background: var(--accent-dim);
  border-color: rgba(47, 211, 154, 0.22);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 1.1rem;
  text-align: center;
  font-size: 0.72rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-item.is-active .nav-icon {
  opacity: 1;
  color: var(--accent);
}

.nav-text {
  flex: 1;
}

.sidebar-foot {
  margin-top: auto;
  flex-shrink: 0;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid var(--line);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.35rem 0.4rem;
}

.sidebar-clock {
  margin: 0.35rem 0.4rem 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: rgba(139, 154, 171, 0.9);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 211, 154, 0.18);
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47, 211, 154, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(47, 211, 154, 0.08); }
}

.sidebar-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(47, 211, 154, 0.06), transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(91, 159, 212, 0.04), transparent 45%),
    var(--bg0);
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
}

.admin-top-left {
  min-width: 0;
}

.admin-eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.admin-top h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.user-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.55rem;
  margin-left: 0.15rem;
  border-left: 1px solid var(--line-strong);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg1);
  margin-right: 0.25rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: linear-gradient(145deg, #2a3a4a, #1a2633);
  color: var(--accent);
  border: 1px solid rgba(47, 211, 154, 0.25);
}

.user-chip-text {
  display: grid;
  line-height: 1.15;
  padding-right: 0.25rem;
}

.user-label {
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 600;
  font-family: var(--mono);
}

.user-role {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-content {
  padding: 1.35rem 1.75rem 2.75rem;
  display: grid;
  gap: 1.15rem;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  animation: contentIn 0.28s ease both;
}

@keyframes contentIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view[hidden] {
  display: none !important;
}

.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
}

.panel-head {
  margin: -1.15rem -1.25rem 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  border-radius: var(--radius) var(--radius) 0 0;
}

.panel-head.section-head,
.panel > .section-head.panel-head {
  align-items: center;
}

.panel-head h2,
h2 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
}

.section-head-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.count {
  font-size: 0.72rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-weight: 700;
  font-family: var(--mono);
}

/* Forms */
.token-form,
.add-form {
  display: grid;
  grid-template-columns: 1.4fr 0.55fr 0.9fr auto;
  gap: 0.85rem;
  align-items: end;
  max-width: 960px;
}

.token-form:has(#token-days-wrap:not(.hidden)) {
  grid-template-columns: 1.2fr 0.5fr 0.85fr 0.7fr auto;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

input:focus,
select:focus {
  border-color: rgba(47, 211, 154, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 211, 154, 0.12);
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b9aab' d='M1.4 0.6L6 5.2 10.6 0.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

select option {
  background: var(--bg1);
  color: var(--ink);
}

.form-hint {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: transform 0.12s ease, background 0.15s, opacity 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-start {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled),
.btn-start:hover:not(:disabled) {
  background: #45e0aa;
  filter: brightness(1.04);
}

.btn-stop {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(232, 93, 76, 0.45);
}

.btn-stop:hover:not(:disabled) {
  background: rgba(232, 93, 76, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(230, 235, 232, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger-soft {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
}

.btn-danger-soft:hover {
  color: var(--danger);
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

/* Token list — compact admin table */
.tokens-page {
  display: grid;
  gap: 1.15rem;
}

.token-list,
.tokens-table-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tokens-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.tokens-table-head {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) 5.5rem 5.5rem 7rem 5.5rem minmax(9rem, 1.1fr) 5.5rem;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tokens-col-actions {
  text-align: right;
}

.tokens-table-body {
  max-height: min(62vh, 720px);
  overflow: auto;
  scrollbar-width: thin;
}

.tokens-tr {
  border-bottom: 1px solid var(--line);
}

.tokens-tr:last-child {
  border-bottom: none;
}

.tokens-tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tokens-tr.is-expanded {
  background: rgba(47, 211, 154, 0.04);
}

.tokens-tr.is-revoked {
  opacity: 0.62;
}

.tokens-tr.is-expired:not(.is-revoked) {
  box-shadow: inset 3px 0 0 var(--danger);
}

.tokens-tr-main {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) 5.5rem 5.5rem 7rem 5.5rem minmax(9rem, 1.1fr) 5.5rem;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
}

.tokens-td {
  min-width: 0;
}

.tokens-name {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tokens-sub {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
}

.tokens-td-seats {
  display: grid;
  gap: 0.3rem;
}

.tokens-seat-bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.tokens-seat-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.tokens-tr .seat-meter.full + .tokens-seat-bar span,
.tokens-td-seats .seat-meter.full ~ .tokens-seat-bar span {
  background: var(--danger);
}

.tokens-td-expiry {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.tokens-td-expiry.is-expired {
  color: var(--danger);
}

.tokens-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.tokens-status--active {
  color: var(--accent);
  border-color: rgba(47, 211, 154, 0.35);
  background: rgba(47, 211, 154, 0.1);
}

.tokens-status--expired,
.tokens-status--revoked {
  color: #f0a098;
  border-color: rgba(239, 106, 90, 0.35);
  background: rgba(239, 106, 90, 0.1);
}

.tokens-status--full {
  color: #e8c878;
  border-color: rgba(224, 176, 74, 0.4);
  background: rgba(224, 176, 74, 0.1);
}

.tokens-td-secret {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.tokens-secret-code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
}

.tokens-td-actions {
  display: flex;
  justify-content: flex-end;
}

.tokens-tr-detail {
  margin: 0 0.75rem 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}

.tokens-tr-detail.hidden {
  display: none !important;
}

.tokens-detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem 1.25rem;
}

.tokens-detail-label {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tokens-seats-empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.seat-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-family: var(--mono);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  width: fit-content;
}

.seat-meter.full {
  border-color: rgba(232, 93, 76, 0.4);
  color: var(--danger);
}

.seat-meter.open {
  border-color: rgba(61, 214, 140, 0.35);
  color: var(--accent);
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-badge.trial {
  color: var(--warn);
  border-color: rgba(212, 168, 75, 0.4);
}

.plan-badge.paid {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.35);
}

.plan-badge.lifetime {
  color: var(--ink);
}

.plan-badge.expired {
  color: var(--danger);
  border-color: rgba(232, 93, 76, 0.45);
}

.token-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* legacy card hooks (dialogs / other pages) */
.token-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.75rem;
}

.token-secret {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.token-secret code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  word-break: break-all;
}

@media (max-width: 1100px) {
  .tokens-table-wrap {
    overflow-x: auto;
  }

  .tokens-table-head,
  .tokens-tr-main {
    min-width: 920px;
  }
}

@media (max-width: 700px) {
  .tokens-table-head {
    display: none;
  }

  .tokens-table-body {
    max-height: none;
  }

  .tokens-table-wrap {
    overflow: visible;
  }

  .tokens-tr-main {
    min-width: 0;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
  }

  .tokens-td-license,
  .tokens-td-secret,
  .tokens-td-actions,
  .tokens-col-actions {
    grid-column: 1 / -1;
  }

  .tokens-td-actions {
    justify-content: flex-start;
  }

  .tokens-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Schedule */
fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.schedule-form {
  display: grid;
  gap: 1.25rem;
  margin-top: 0.5rem;
  max-width: 720px;
}

.sched-fieldset {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  display: grid;
  gap: 0.85rem;
}

.sched-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  grid-template-columns: none !important;
  font-size: 0.9rem;
  color: var(--ink);
}

.check-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.impact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.hm {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hm input {
  width: 4.5rem;
}

.hm span {
  color: var(--muted);
}

.schedule-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.seat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.seat-chip {
  font-size: 0.75rem;
  font-family: var(--mono);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.seat-chip.online {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.35);
  background: var(--accent-dim);
}

/* Accounts */
.account-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.account-filter {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.account-filter-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-filter select,
.account-filter input[type="search"] {
  min-width: 140px;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
  font-size: 0.88rem;
}

.account-filter-search {
  flex: 1 1 200px;
  min-width: min(100%, 220px);
}

.account-filter-search input[type="search"] {
  width: 100%;
  min-width: 0;
}

.account-filter-clear {
  margin-left: auto;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.summary-chip {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}

.summary-chip-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-chip strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.summary-chip-sub {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}

.summary-chip .pos {
  color: var(--accent);
}

.summary-chip .neg {
  color: var(--danger);
}

.account-list {
  display: grid;
  gap: 0;
}

.accounts-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.accounts-table-head {
  display: grid;
  grid-template-columns: 6.5rem minmax(11rem, 1.6fr) minmax(6rem, 0.9fr) 5.5rem 5.5rem 5.5rem 4.5rem 5rem minmax(12rem, 1.1fr);
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 2;
}

.accounts-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.accounts-table-head .accounts-col-num {
  font-family: inherit;
  font-size: inherit;
}

.accounts-col-actions {
  text-align: right;
}

.accounts-table-body {
  max-height: min(68vh, 820px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 154, 171, 0.35) transparent;
}

.accounts-tr {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.accounts-tr:last-child {
  border-bottom: none;
}

.accounts-tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accounts-tr.is-expanded {
  background: rgba(47, 211, 154, 0.04);
}

.accounts-tr-main {
  display: grid;
  grid-template-columns: 6.5rem minmax(11rem, 1.6fr) minmax(6rem, 0.9fr) 5.5rem 5.5rem 5.5rem 4.5rem 5rem minmax(12rem, 1.1fr);
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
}

.accounts-td {
  min-width: 0;
}

.accounts-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounts-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounts-td-token {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounts-td-status,
.accounts-td-trading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.accounts-td-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.accounts-tr-detail {
  margin: 0 0.75rem 0.85rem;
  padding: 1rem 1.1rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  display: grid;
  gap: 0.9rem;
}

.accounts-tr-detail.hidden {
  display: none !important;
}

.accounts-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.95rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.accounts-pager-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.accounts-pager-nav {
  display: flex;
  gap: 0.4rem;
}

.accounts-page-size {
  min-width: 6rem;
}

@media (max-width: 1200px) and (min-width: 901px) {
  .accounts-table-wrap {
    overflow-x: auto;
  }

  .accounts-table-head,
  .accounts-tr-main {
    min-width: 980px;
  }
}

.account-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  padding: 1rem 1.1rem 0.9rem;
  display: grid;
  gap: 0.9rem;
  transition: border-color 0.15s;
}

.account-card:hover {
  border-color: rgba(61, 214, 140, 0.22);
}

.account-card.is-new {
  animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.account-identity {
  min-width: 0;
  flex: 1 1 220px;
}

.acc-name {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.acc-broker {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  font-family: var(--mono);
}

.acc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.account-wallet {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  flex-shrink: 0;
  text-align: right;
}

.wallet-today {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  min-width: 7.5rem;
}

.wallet-today.pos {
  border-color: rgba(61, 214, 140, 0.35);
  background: rgba(61, 214, 140, 0.08);
}

.wallet-today.neg {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
}

.wallet-today-value {
  display: block;
  margin-top: 0.1rem;
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.wallet-today.pos .wallet-today-value {
  color: var(--accent);
}

.wallet-today.neg .wallet-today-value {
  color: var(--danger);
}

.wallet-balance-block {
  min-width: 0;
}

.wallet-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wallet-value {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.wallet-cur {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.wallet-sub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.wallet-sub strong {
  color: var(--ink);
  font-weight: 600;
}

.account-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.metric-value.metric-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.metric-value.pos {
  color: var(--accent);
}

.metric-value.neg {
  color: var(--danger);
}

.account-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}

.meta-sep {
  opacity: 0.5;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.dot.on { background: var(--accent); }
.dot.off { background: var(--danger); }
.dot.idle { background: var(--warn); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-left: auto;
}

.token-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.token-snip {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-icon:hover {
  color: var(--ink);
  border-color: rgba(61, 214, 140, 0.45);
}

.btn-icon.copied {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.55);
}

.empty {
  color: var(--muted);
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  padding: 1.35rem 1rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

/* Dialogs */
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg1);
  color: var(--ink);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 2rem);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

dialog::backdrop {
  background: rgba(4, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-body {
  padding: 1.35rem;
  display: grid;
  gap: 0.85rem;
}

.dialog-body h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.dialog-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.token-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.token-box code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--accent);
}

.hint {
  font-size: 0.82rem !important;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.password-ok {
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

#limits-clear-lock {
  margin-right: auto;
}

#password-dialog .dialog-body label {
  display: grid;
  gap: 0.35rem;
}

/* Login */
.login-page {
  background:
    radial-gradient(ellipse 55% 45% at 50% -5%, rgba(47, 211, 154, 0.1), transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(91, 159, 212, 0.08), transparent 55%),
    var(--bg0);
}

.login-page .login-wrap {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.login-brand {
  text-align: left;
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.login-brand .brand-mark {
  display: block;
  margin: 0;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.login-product {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.login-brand h1 {
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-size: clamp(1.55rem, 4vw, 1.85rem);
  letter-spacing: -0.02em;
}

.login-tagline {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.login-foot {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.login-form {
  display: grid;
  gap: 0.85rem;
  padding: 1.35rem 1.25rem;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.login-submit {
  width: 100%;
  margin-top: 0.35rem;
}

/* Summary page (kept compatible) */
.bg-grid {
  display: none;
}

.top {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.5rem 2rem 1rem;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary-product {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warn);
}

.brand h1 {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.brand-sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.summary-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 2rem 3rem;
  box-sizing: border-box;
}

.back-link {
  color: var(--ink);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.stat-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg1);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-card strong {
  font-size: 1.15rem;
}

.summary-meta {
  margin: 0 0 1rem;
}

.summary-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.summary-filter {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.summary-filter select {
  min-width: 160px;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
}

.summary-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.summary-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.summary-tab.is-active {
  color: var(--ink);
  border-color: rgba(61, 214, 140, 0.45);
  background: var(--accent-dim);
}

.summary-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg1);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.summary-table th,
.summary-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.summary-table th {
  color: var(--muted);
  font-weight: 500;
}

.summary-table tr:last-child td {
  border-bottom: none;
}

.summary-table .pos {
  color: var(--accent);
}

.summary-table .neg {
  color: var(--danger);
}

.empty-inline {
  padding: 1rem;
  color: var(--muted);
  margin: 0;
}

.symbol-totals {
  margin-top: 2rem;
}

.symbol-totals h2 {
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

@media (max-width: 900px) {
  body.admin {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
  }

  .sidebar-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0.35rem;
  }

  .nav-group-label {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
    gap: 0.25rem;
  }

  .nav-item {
    width: auto;
    padding: 0.5rem 0.7rem;
  }

  .nav-item.is-active {
    box-shadow: none;
  }

  .sidebar-foot {
    display: none;
  }

  .sidebar-clock {
    display: none;
  }

  .user-bar-actions {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .admin-top {
    align-items: flex-start;
  }

  .user-chip-text .user-role {
    display: none;
  }

  .token-form,
  .add-form {
    grid-template-columns: 1fr;
  }

  .account-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .account-card-head {
    flex-direction: column;
  }

  .account-wallet {
    text-align: left;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .accounts-table-head {
    display: none;
  }

  .accounts-table-body {
    max-height: none;
  }

  .accounts-tr-main {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
  }

  .accounts-td-status {
    grid-column: 1 / 2;
  }

  .accounts-td-trading {
    grid-column: 2 / 3;
    justify-content: flex-end;
  }

  .accounts-td-account {
    grid-column: 1 / -1;
  }

  .accounts-td-token {
    grid-column: 1 / -1;
  }

  .accounts-tr-main .accounts-col-num {
    text-align: left;
  }

  .accounts-td-actions,
  .accounts-col-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: left;
  }

  .accounts-tr-detail {
    margin: 0 0.55rem 0.75rem;
  }

  .accounts-pager {
    flex-direction: column;
    align-items: stretch;
  }

  .accounts-pager-nav {
    width: 100%;
  }

  .accounts-pager-nav .btn {
    flex: 1;
  }

  .wallet-today {
    min-width: 0;
  }

  .account-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .account-filter-clear {
    margin-left: 0;
  }

  .account-card-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
    margin-left: 0;
  }

  .summary-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .account-summary {
    grid-template-columns: 1fr;
  }

  .account-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-stats {
    grid-template-columns: 1fr;
  }
}

/* Users admin */
.users-intro {
  margin: 0 0 1rem;
}

.user-form {
  margin-top: 0;
}

.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 900px;
}

.user-form-grid > .user-token-fieldset,
.user-form-grid > .login-error,
.user-form-grid > .user-form-actions {
  grid-column: 1 / -1;
}

.user-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.token-pick-hint {
  margin: 0 0 0.65rem !important;
}

.user-token-fieldset {
  border-radius: 10px;
}

.token-pick-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0;
  background: var(--bg2);
}

.token-pick-fieldset legend {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.25rem;
}

.token-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
  max-height: 240px;
  overflow: auto;
  margin-top: 0.25rem;
}

.token-pick {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s, background 0.15s;
}

.token-pick:hover {
  border-color: rgba(61, 214, 140, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.token-pick.is-selected {
  border-color: rgba(61, 214, 140, 0.45);
  background: rgba(61, 214, 140, 0.08);
}

.token-pick input[type="checkbox"] {
  width: auto;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.token-pick-body {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.token-pick-name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.token-pick-meta {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  line-height: 1.35;
}

.user-list {
  display: grid;
  gap: 0.85rem;
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  padding: 1rem 1.1rem 0.9rem;
  display: grid;
  gap: 0.85rem;
  transition: border-color 0.15s;
}

.user-card:hover {
  border-color: rgba(61, 214, 140, 0.22);
}

.user-card.is-admin {
  border-color: rgba(61, 214, 140, 0.28);
  background: linear-gradient(135deg, rgba(61, 214, 140, 0.06), var(--bg2) 45%);
}

.user-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid rgba(61, 214, 140, 0.28);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-card.is-admin .user-avatar {
  background: rgba(61, 214, 140, 0.18);
}

.user-identity-text {
  min-width: 0;
}

.user-card-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.user-card-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.role-badge--admin {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.4);
  background: rgba(61, 214, 140, 0.1);
}

.role-badge--sub-admin {
  color: var(--warn);
  border-color: rgba(212, 168, 75, 0.4);
  background: rgba(212, 168, 75, 0.08);
}

.role-badge--readonly {
  color: var(--muted);
  border-color: rgba(230, 235, 232, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.role-badge--write {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.35);
  background: rgba(61, 214, 140, 0.08);
}

.user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.user-readonly-row {
  grid-column: 1 / -1;
}

.readonly-banner {
  margin: 0;
  padding: 0.7rem 1.75rem;
  border: none;
  border-bottom: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 0;
  background: rgba(212, 168, 75, 0.1);
  color: var(--warn);
  font-size: 0.85rem;
}

.readonly-hint {
  font-size: 0.75rem;
  color: var(--muted);
  align-self: center;
}

body.is-readonly .bulk-actions {
  display: none !important;
}

.user-card-metrics {
  display: grid;
  grid-template-columns: minmax(7rem, 0.35fr) 1fr;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.user-metric {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.user-metric--wide {
  min-width: 0;
}

.user-metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.user-token-chips {
  margin-top: 0.15rem;
}

.seat-chip--all {
  border-color: rgba(61, 214, 140, 0.35);
  color: var(--accent);
}

.seat-chip--empty {
  opacity: 0.75;
  font-style: italic;
}

.user-card-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 2rem;
}

.user-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  width: 100%;
}

.user-protected {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  width: 100%;
  text-align: right;
}

.user-dialog {
  max-width: 520px;
}

.dialog-sub {
  margin: -0.35rem 0 0 !important;
  font-size: 0.85rem !important;
  color: var(--muted) !important;
}

@media (max-width: 720px) {
  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-card-metrics {
    grid-template-columns: 1fr;
  }

  .user-card-foot {
    justify-content: flex-start;
  }

  .user-protected {
    text-align: left;
  }

  .token-pick-list {
    grid-template-columns: 1fr;
  }
}

.account-limits {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.account-limits.is-locked {
  border-color: rgba(212, 168, 75, 0.45);
  background: rgba(212, 168, 75, 0.08);
}

.account-limits-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.account-limits-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-limits-values {
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--ink);
}

.limit-lock-badge,
.pill-warn {
  font-size: 0.72rem;
  color: var(--warn);
  font-family: var(--mono);
}

.limit-progress {
  display: grid;
  gap: 0.25rem;
}

.limit-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.limit-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.limit-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.limit-bar-fill.is-hit {
  background: var(--warn);
}

.limits-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.limits-dialog {
  max-width: 460px;
}

.limits-status-line {
  margin: 0 !important;
}

@media (max-width: 520px) {
  .limits-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Dashboard */
.dash-panel {
  margin-bottom: 0;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.dash-kpi {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.dash-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.15s;
}

.dash-kpi:hover {
  border-color: var(--line-strong);
}

.dash-kpi:hover::before {
  background: var(--accent);
}

.dash-kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dash-kpi-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.dash-kpi-value.pos { color: var(--accent); }
.dash-kpi-value.neg { color: var(--danger); }

.dash-kpi-sub {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  margin: 1rem 0;
}

.dash-alerts,
.dash-leaders {
  display: grid;
  gap: 0.55rem;
}

.dash-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.dash-alert--ok {
  border-color: rgba(61, 214, 140, 0.3);
  background: rgba(61, 214, 140, 0.06);
}

.dash-alert--warn {
  border-color: rgba(212, 168, 75, 0.4);
  background: rgba(212, 168, 75, 0.08);
}

.dash-alert--info {
  border-color: rgba(120, 160, 220, 0.35);
  background: rgba(120, 160, 220, 0.06);
}

.dash-alert-text {
  font-size: 0.88rem;
  line-height: 1.35;
}

.dash-leaders-split {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dash-leader-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dash-leader-row:hover {
  border-color: rgba(61, 214, 140, 0.3);
}

.dash-leader-rank {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.dash-leader-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-leader-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.dash-leader-pnl {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  justify-self: end;
}

.dash-leader-pnl.pos { color: var(--accent); }
.dash-leader-pnl.neg { color: var(--danger); }

.dash-fleet {
  display: grid;
  gap: 0.55rem;
}

.dash-fleet-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) auto;
  gap: 0.75rem 1.25rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  transition: border-color 0.15s, background 0.15s;
}

.dash-fleet-row:hover {
  border-color: var(--line-strong);
  background: rgba(26, 35, 48, 0.92);
}

.dash-fleet-row.is-locked {
  border-color: rgba(212, 168, 75, 0.4);
}

.dash-fleet-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  min-width: 0;
}

.dash-fleet-name {
  font-size: 0.95rem;
}

.dash-fleet-meta {
  width: 100%;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
}

.dash-fleet-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.dash-fleet-stats .pos strong { color: var(--accent); }
.dash-fleet-stats .neg strong { color: var(--danger); }

.dash-fleet-stats strong {
  color: var(--ink);
  font-weight: 600;
}

.dash-fleet-actions {
  justify-self: end;
}

.empty-inline {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .dash-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-fleet-row {
    grid-template-columns: 1fr;
  }

  .dash-fleet-actions {
    justify-self: start;
  }

  .dash-leader-row {
    grid-template-columns: 2rem 1fr auto;
  }

  .dash-leader-meta {
    display: none;
  }
}

@media (max-width: 520px) {
  .dash-kpis {
    grid-template-columns: 1fr;
  }
}

.nav-admin-only.hidden {
  display: none;
}

/* Activity + Telegram alerts */
.activity-page {
  display: grid;
  gap: 1.15rem;
}

.activity-exports-intro {
  margin: 0 0 0.95rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.activity-export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.activity-export-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.activity-export-btn:hover {
  border-color: rgba(47, 211, 154, 0.35);
  background: rgba(47, 211, 154, 0.06);
}

.activity-export-btn:active {
  transform: scale(0.98);
}

.activity-export-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(47, 211, 154, 0.1);
  color: var(--accent);
  font-size: 0.85rem;
}

.activity-export-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.activity-export-text strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.activity-export-text span {
  font-size: 0.72rem;
  color: var(--muted);
}

.activity-toolbar {
  margin-bottom: 0.95rem;
}

.activity-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.activity-table-head {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1.5fr) minmax(0, 1fr) 8.5rem;
  gap: 0.75rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.activity-list {
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 640px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 154, 171, 0.35) transparent;
}

.activity-list.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.activity-row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1.5fr) minmax(0, 1fr) 8.5rem;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.activity-when {
  display: grid;
  gap: 0.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.activity-when-date {
  color: var(--ink);
  font-weight: 500;
}

.activity-when-time {
  font-size: 0.7rem;
  opacity: 0.9;
}

.activity-event {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-badge--auth {
  border-color: rgba(91, 159, 212, 0.4);
  background: rgba(91, 159, 212, 0.12);
  color: #9ec5e8;
}

.activity-badge--start {
  border-color: rgba(47, 211, 154, 0.4);
  background: rgba(47, 211, 154, 0.12);
  color: var(--accent);
}

.activity-badge--danger {
  border-color: rgba(239, 106, 90, 0.4);
  background: rgba(239, 106, 90, 0.1);
  color: #f0a098;
}

.activity-badge--warn {
  border-color: rgba(224, 176, 74, 0.4);
  background: rgba(224, 176, 74, 0.1);
  color: #e8c878;
}

.activity-badge--token {
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.1);
  color: #c4b5fd;
}

.activity-badge--user {
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(125, 211, 252, 0.1);
  color: #a5d8f5;
}

.activity-badge--info {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
}

.activity-detail {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-target {
  font-size: 0.86rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-actor-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.activity-actor-avatar {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  background: linear-gradient(145deg, #2a3a4a, #1a2633);
  color: var(--accent);
  border: 1px solid rgba(47, 211, 154, 0.22);
}

.activity-actor {
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-log-panel .empty {
  margin: 0.85rem;
}

@media (max-width: 1100px) {
  .activity-export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .activity-export-grid {
    grid-template-columns: 1fr;
  }

  .activity-table-head {
    display: none;
  }

  .activity-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.9rem 0.95rem;
  }

  .activity-when {
    order: -1;
  }

  .activity-actor-cell {
    margin-top: 0.15rem;
  }
}

#view-settings.is-active:not([hidden]) {
  display: block;
}

.settings-tabs {
  display: flex;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}

.settings-tab:hover {
  color: var(--ink);
  background: var(--bg2);
}

.settings-tab.is-active {
  color: var(--ink);
  border-color: rgba(61, 214, 140, 0.45);
  background: var(--accent-dim);
}

.settings-pane[hidden] {
  display: none !important;
}

.settings-pane.is-active {
  display: block;
}

.settings-pane-intro {
  margin: 0 0 0.35rem;
  max-width: 42rem;
  line-height: 1.45;
}

/* Fleet profits */
.profits-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profits-stats .stat-card {
  padding: 0.85rem 0.95rem;
}

.profits-stats .stat-card strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.profits-toolbar {
  margin-bottom: 0.85rem;
}

.profits-table-wrap {
  max-height: min(48vh, 520px);
  overflow: auto;
}

.profits-table-wrap .metric-mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  .profits-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .profits-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.alerts-form {
  display: grid;
  gap: 1.25rem;
  margin-top: 0.5rem;
  max-width: 720px;
}

.alerts-form .sched-fieldset {
  gap: 1rem;
}

.alerts-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.alerts-form-grid label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.alerts-form #alert-token-hint {
  margin: 0;
}

.alerts-notify-row {
  gap: 0.85rem 1.5rem;
}

.alerts-form .schedule-actions {
  margin-top: 0.15rem;
}

.alerts-form .login-error,
.alerts-form .password-ok {
  margin: 0;
}

@media (max-width: 700px) {
  .alerts-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Strategy Master + per-account strategy rows */
.strategies-page {
  display: grid;
  gap: 1.15rem;
}

.strategies-list-panel .settings-pane-intro {
  margin-bottom: 0.95rem;
}

.strategy-list,
.strategies-table-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.strategies-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.strategies-table-head {
  display: grid;
  grid-template-columns: minmax(11rem, 1.5fr) 5rem minmax(7rem, 1.2fr) minmax(6.5rem, 0.95fr) 4.5rem 7.5rem 5.5rem 5rem;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.strategies-col-actions {
  text-align: right;
}

.strategies-table-body {
  max-height: min(62vh, 720px);
  overflow: auto;
  scrollbar-width: thin;
}

.strategies-tr {
  border-bottom: 1px solid var(--line);
}

.strategies-tr:last-child {
  border-bottom: none;
}

.strategies-tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.strategies-tr.is-expanded {
  background: rgba(47, 211, 154, 0.04);
}

.strategies-tr.is-disabled .strategies-name {
  color: var(--muted);
}

.strategies-tr-main {
  display: grid;
  grid-template-columns: minmax(11rem, 1.5fr) 5rem minmax(7rem, 1.2fr) minmax(6.5rem, 0.95fr) 4.5rem 7.5rem 5.5rem 5rem;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
}

.strategies-td {
  min-width: 0;
}

.strategies-name {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategies-sub {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategies-td-magic code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}

.strategies-td-windows,
.strategies-td-news {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategies-flag,
.strategies-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.strategies-flag.is-on,
.strategies-status.is-enabled {
  color: var(--accent);
  border-color: rgba(47, 211, 154, 0.35);
  background: rgba(47, 211, 154, 0.1);
}

.strategies-flag.is-off,
.strategies-status.is-disabled {
  color: var(--muted);
}

.strategies-td-actions {
  display: flex;
  justify-content: flex-end;
}

.strategies-tr-detail {
  margin: 0 0.75rem 0.85rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}

.strategies-tr-detail.hidden {
  display: none !important;
}

.strategy-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.strategy-form-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.strategy-windows-label {
  grid-column: 1 / -1;
}

.account-strategies {
  margin: 0.75rem 0 0.35rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--line);
}

.account-strategies-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
  color: var(--muted);
}

.strategy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.strategy-row:first-of-type {
  border-top: none;
  padding-top: 0;
}

.strategy-name {
  display: block;
  font-size: 0.92rem;
}

.strategy-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.strategy-tags {
  margin-top: 0.35rem;
}

.strategy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 1100px) {
  .strategies-table-wrap {
    overflow-x: auto;
  }

  .strategies-table-head,
  .strategies-tr-main {
    min-width: 1020px;
  }
}

@media (max-width: 700px) {
  .strategies-table-head {
    display: none;
  }

  .strategies-table-body {
    max-height: none;
  }

  .strategies-table-wrap {
    overflow: visible;
  }

  .strategies-tr-main {
    min-width: 0;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
  }

  .strategies-td-name,
  .strategies-td-windows,
  .strategies-td-news,
  .strategies-td-actions,
  .strategies-col-actions {
    grid-column: 1 / -1;
  }

  .strategies-td-actions {
    justify-content: flex-start;
  }

  .strategy-form-grid {
    grid-template-columns: 1fr;
  }
}
