/* ── Tokens — deep black (trinity-inspired), warm orange accent ── */
:root {
  --accent:        #f2b48c;   /* warm peach-orange accent */
  --accent-dim:    #f2b48c14;
  --accent-glow:   #f2b48c22;
  --accent-bright: #f8cdaf;
  --accent-2:      #e89d70;
  --blue:          #9dbfe0;
  --blue-dim:      #9dbfe018;
  --green:         #94cfa6;
  --green-dim:     #94cfa618;
  --red:           #e79191;
  --red-dim:       #e7919118;
  --yellow:        #eccf8b;

  --bg-0:          #080808;   /* true black background */
  --bg-1:          #0e0e0e;   /* card — almost black */
  --bg-2:          #141414;
  --bg-3:          #1c1c1c;
  --bg-hover:      #111111;
  --text-0:        #f5f0ef;
  --text-1:        #a09898;
  --text-2:        #685f5f;
  --border-0:      #ffffff06;
  --border-1:      #ffffff0c;
  --border-2:      #ffffff14;
  --border-accent: #f2b48c33;

  --font-sans:     'Onest', system-ui, sans-serif;
  --font-display:  'Unbounded', 'Onest', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;

  --radius:        11px;
  --radius-lg:     14px;
  --radius-xl:     16px;
  --radius-pill:   999px;
  --sidebar-w:     240px;
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg-0:    #faf8f6;
  --bg-1:    #ffffff;
  --bg-2:    #f4f1ee;
  --bg-3:    #e9e4df;
  --bg-hover:#f2eeeb;
  --text-0:  #1a1614;
  --text-1:  #6a6068;
  --text-2:  #9a9098;
  --border-0:#00000006;
  --border-1:#0000000d;
  --border-2:#00000016;
  --border-accent:#f2b48c55;
}

/* ── Black theme — deep neutral charcoal ── */
[data-theme="black"] {
  --bg-0:    #050505;
  --bg-1:    #0c0c0c;
  --bg-2:    #141414;
  --bg-3:    #1c1c1c;
  --bg-hover:#111111;
  --text-0:  #f0f0f0;
  --text-1:  #a8a8a8;
  --text-2:  #5e5e5e;
  --border-0:#ffffff05;
  --border-1:#ffffff0d;
  --border-2:#ffffff18;
  --border-accent: #f2b48c22;
  --shadow-sm: 0 1px 2px #00000060;
  --shadow-md: 0 4px 12px #00000050;
  --glow-accent: 0 0 0 3px #f2b48c18;
}

[data-theme="black"] .card,
[data-theme="black"] .server-card,
[data-theme="black"] .modal {
  box-shadow: var(--shadow-sm);
}

[data-theme="black"] .card:hover,
[data-theme="black"] .server-card:hover {
  box-shadow: var(--shadow-md);
}

.btn-icon-panel {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-2);
  background: color-mix(in srgb, var(--bg-2) 50%, transparent);

  border: 1px solid var(--border-1);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-icon-panel:hover { color: var(--text-0); border-color: var(--border-2); }
.btn-icon-panel:active { opacity: .8; }
.btn-icon-panel img { width:18px; height:18px; vertical-align:middle; filter: brightness(0) invert(1); opacity:.6; transition: opacity .15s; }
[data-theme="light"] .btn-icon-panel img { filter: brightness(0); opacity:.35; }
.btn-icon-panel:hover img { opacity:1; }

.panel-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
}
.panel-burger span {
  width: 20px; height: 2px;
  background: var(--text-0);
  border-radius: 2px;
  transition: all .2s;
  transform-origin: center;
}
.panel-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.panel-burger.open span:nth-child(2) { opacity: 0; }
.panel-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text-0);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select {
  font-family: var(--font-sans);
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  color: var(--text-0);
  padding: 8px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus { border-color: var(--border-accent); box-shadow: 0 0 0 3px var(--accent-dim); }
input[type="checkbox"], input[type="radio"] { margin: 0; padding: 0; width: auto; height: auto; }
textarea { resize: vertical; font-family: var(--font-mono); font-size: .82rem; }

/* ── Layout ── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -1px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .dot { color: var(--accent); }
.sidebar-logo .sub {
  font-family: var(--font-sans);
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
  display: block;
  margin-top: 1px;
}
.sidebar-section {
  padding: 16px 12px 4px;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--text-2);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sidebar-nav { padding: 4px 8px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-1);
  transition: all .15s;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item:hover  { background: var(--bg-hover); color: var(--text-0); }
.nav-item.active { background: var(--bg-3); color: var(--text-0); border: 1px solid var(--border-1); }
.nav-item .icon  { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: .7rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
}
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-1);
  font-size: .8rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-footer a { color: var(--text-2); transition: color .2s; }
.sidebar-footer a:hover { color: var(--red); }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-1);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.topbar-title { font-family: var(--font-display); font-size: .95rem; font-weight: 700; letter-spacing: -.5px; }
.topbar-breadcrumb { font-size: .82rem; color: var(--text-2); }
.topbar-breadcrumb a { color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { flex: 1; overflow-y: auto; padding: 28px 28px 48px; animation: fadeUp .4s var(--ease-out) both; }

/* ── Cards / Bento ── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: 0 6px 20px -10px rgba(0,0,0,.3); transition-duration: var(--dur-lg); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.01em;
  text-transform: lowercase;
  color: var(--text-0);
  line-height: 1.2;
  margin: 0 0 10px;
}
.section-label {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--text-2);
  letter-spacing: .02em;
  text-transform: none;
  margin-bottom: 12px;
}

/* ── Page head (trinity "Сегодня" style) ── */
.page-head { margin-bottom: 24px; }
.page-head-eyebrow { font-family: var(--font-mono); font-size: .74rem; color: var(--text-2); margin-bottom: 4px; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
}
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Big stat number (dashboard / balance cards) */
.stat-label   { font-family: var(--font-mono); font-size: .74rem; color: var(--text-2); }
.stat-big     { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; }
.stat-sub     { font-size: .78rem; color: var(--text-2); margin-top: 4px; }

/* ── Segmented control + range tabs ── */
.seg, .range-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--border-1);
}
.seg-item, .range-tab {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.seg-item:hover, .range-tab:hover { color: var(--text-0); }
.seg-item.active { background: var(--bg-3); color: var(--text-0); }
.range-tab.active { background: var(--accent); color: #2a1508; font-weight: 600; }

/* ── Top pill navbar (trinity-style) ── */
.topnav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px 6px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topnav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.5px;
  flex-shrink: 0;
  transition: border-color .15s;
}
.topnav-logo:hover { border-color: var(--border-2); }
.topnav-logo .dot { color: var(--accent); }
.topnav-center {
  display: inline-flex;
  gap: 2px;
  margin: 0 auto;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-1);
  border: 1px solid var(--border-1);
}
.topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.topnav-item:hover { color: var(--text-0); }
.topnav-item.active { background: var(--bg-3); color: var(--text-0); }
.topnav-item .ic { width: 15px; height: 15px; opacity: .7; }
.topnav-item.active .ic { opacity: 1; }
.topnav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.topnav-profile-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 16px 5px 5px; margin-left: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  text-decoration: none;
  flex: 0 0 auto; max-width: none;
  transition: border-color .15s;
}
.topnav-profile-pill:hover { border-color: var(--border-accent); }
.topnav-avatar-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3);
  font-family: var(--font-display); font-size: .8rem; font-weight: 800;
  color: var(--accent); flex-shrink: 0;
}
.topnav-bal-amount {
  font-family: var(--font-mono); font-size: .88rem; font-weight: 600;
  color: var(--accent); white-space: nowrap;
}
.topnav-topup {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; line-height: 1;
  background: var(--accent); color: #2a1508;
  font-size: 1.3rem; font-weight: 700;
  text-decoration: none; flex-shrink: 0;
  transition: opacity .15s;
}
.topnav-topup .material-symbols-outlined { font-size: 1.25rem; line-height: 1; }
.topnav-topup:hover { opacity: .85; }
.block-eyebrow {
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: .12em;
  color: var(--text-3);
  margin-bottom: var(--sp-1);
  font-size: .68rem;
  display: block;
}

/* Dropdown for admin extra links */
.topnav-more { position: relative; }
.topnav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
  box-shadow: 0 12px 32px #00000055;
}
.topnav-dropdown.open { display: flex; }
.topnav-dropdown a {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: .84rem;
  color: var(--text-1);
  transition: background .15s, color .15s;
}
.topnav-dropdown a:hover { background: var(--bg-hover); color: var(--text-0); }
.topnav-dropdown a.active { background: var(--bg-3); color: var(--text-0); }

/* Centered column layout (replaces sidebar) */
.layout { display: block; height: auto; min-height: 100vh; overflow: visible; }
.main { display: block; }
.content { max-width: 1120px; margin: 0 auto; padding: 20px 24px 96px; }

@media (max-width: 860px) {
  .topnav-center { display: none; }
  .topnav { padding: 12px 14px 4px; }
  .content { padding: 12px 14px 96px; }
  .panel-burger { display: flex; }
  .topnav-desktop-only { display: none; }
}
@media (max-width: 560px) {
  .topnav { gap: 6px; }
  .topnav-logo { padding: 7px 12px; font-size: .9rem; flex-shrink: 1; min-width: 0; }
  .topnav-right { gap: 6px; }
  .topnav-profile-pill { padding: 4px 10px 4px 4px; gap: 7px; margin-left: 4px; }
  .topnav-avatar-sm { width: 28px; height: 28px; font-size: .72rem; }
  .topnav-bal-amount { font-size: .76rem; }
  .topnav-topup { width: 30px; height: 30px; font-size: 1.1rem; }
  .btn-icon-panel { padding: 5px 9px; font-size: .68rem; }
  .btn-icon-panel img { width: 15px; height: 15px; }
  .panel-burger { padding: 5px 4px; }
}

/* ── Timing ── */
:root {
  --dur: .22s;
  --dur-lg: .4s;
  --ease: cubic-bezier(.32,.72,.24,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.2,.64,1);
}

/* ── Entrance motion ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.97); }
  100% { opacity: 1; transform: none; }
}
.page-head {
  animation: fadeUp .4s var(--ease-out) both;
}
.card, .server-card {
  animation: fadeUp .4s var(--ease-out) both;
}
.card:nth-child(2), .server-card:nth-child(2) { animation-delay: .04s; }
.card:nth-child(3), .server-card:nth-child(3) { animation-delay: .08s; }
.card:nth-child(4), .server-card:nth-child(4) { animation-delay: .12s; }
.card:nth-child(5), .server-card:nth-child(5) { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) {
  .page-head { animation: none; }
  .card, .server-card { animation: none; }
  .card:hover, .server-card:hover { transform: none; box-shadow: none; }
  .btn:active { transform: none; }
}

/* ── Balance hero (narrow balance + wide chart) ── */
.balance-hero { display: grid; grid-template-columns: 340px 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 720px) { .balance-hero { grid-template-columns: 1fr; } }
.spark { width: 100%; height: 150px; display: block; overflow: visible; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: var(--accent-dim); stroke: none; }
.spark .base { stroke: var(--border-1); stroke-width: 1; }
.spark path.line, .spark path.area, .spark .base { pointer-events: none; }
.spark-dot { fill: var(--accent); opacity: 0; transition: opacity .12s, r .12s; pointer-events: none; }
.spark:hover .spark-dot { opacity: .85; }
.spark-dot.active { opacity: 1; r: 5; }
.spark-hit { fill: transparent; pointer-events: all; cursor: pointer; }
.spark-tip { position: absolute; transform: translate(-50%, -100%); background: var(--bg-0); border: 1px solid var(--border-1); color: var(--text-1); padding: 4px 8px; border-radius: 8px; font-size: .72rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.spark-tip.show { opacity: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Server card ── */
.server-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  cursor: pointer;
}
.server-card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: 0 6px 20px -10px rgba(0,0,0,.3); }
.server-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.server-name { font-weight: 700; font-size: .95rem; }
.server-id { font-family: var(--font-mono); font-size: .72rem; color: var(--text-2); margin-top: 2px; }
.server-game { font-size: .78rem; color: var(--text-2); margin-top: 4px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.status-pill::before { content: '●'; font-size: .55rem; }
.status-running { background: var(--green-dim); color: var(--green); border: 1px solid #8ecfa340; }
.status-offline { background: var(--red-dim);   color: var(--red);   border: 1px solid #e88a8a40; }
.status-starting{ background: var(--blue-dim);  color: var(--blue);  border: 1px solid #93bfe840; }
.status-stopping{ background: #f5d97f18;        color: var(--yellow);border: 1px solid #f5d97f40; }
.server-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-mini { background: var(--bg-2); border-radius: var(--radius); padding: 8px 10px; }
.stat-mini-label { font-size: .68rem; color: var(--text-2); font-family: var(--font-mono); letter-spacing: .04em; }
.stat-mini-val { font-size: .9rem; font-weight: 700; margin-top: 2px; }
.server-actions { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: .82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease), transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { opacity: .85; transform: translateY(.5px) scale(.98); transition-duration: .08s; }
.btn-primary {
  background: var(--accent);
  color: #2a1508;
  border-color: transparent;
}
.btn-primary:hover { background: var(--accent-bright); }
.btn-ghost {
  background: var(--bg-2);
  color: var(--text-1);
  border-color: var(--border-1);
}
.btn-ghost:hover { border-color: var(--border-2); color: var(--text-0); background: var(--bg-3); }
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 24%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--red) 18%, transparent); }
.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 24%, transparent);
}
.btn-success:hover { background: color-mix(in srgb, var(--green) 18%, transparent); }
.btn-sm { padding: 6px 13px; font-size: .78rem; }
.btn-icon-only { padding: 8px 10px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Topup amount preset chips */
.donate-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.donate-chip {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text-2);
  padding: 6px 14px;
  font-size: .82rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.donate-chip:hover { border-color: var(--accent-2); color: var(--text-0); }
.donate-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.pin-btn.pinned, .pin-btn.pinned .material-symbols-outlined { color: var(--accent); }
.pin-btn.pinned { border-color: var(--accent); }

.pin-inline { display:inline-flex;align-items:center;justify-content:center;padding:2px;margin:0 2px 0 0;border:none;background:transparent;color:var(--text-2);cursor:pointer;border-radius:6px;line-height:1;vertical-align:middle; }
.pin-inline:hover { color:var(--accent);background:var(--bg-2); }
.pin-inline.pinned, .pin-inline.pinned .material-symbols-outlined { color:var(--accent); }
.pin-inline .material-symbols-outlined { font-size:1.05em;font-variation-settings:'FILL' 0; }

/* ── Progress bars ── */
.progress-wrap { background: var(--bg-3); border-radius: var(--radius-pill); height: 5px; overflow: hidden; margin-top: 4px; }
.progress-bar  { height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width .4s; }
.progress-bar.high { background: var(--red); }
.progress-bar.mid  { background: var(--yellow); }
.progress-bar.low  { background: var(--green); }

/* ── Console ── */
.console-wrap {
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 480px;
}
.console-bar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-1);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-2);
}
.console-bar .dot { width: 10px; height: 10px; border-radius: 50%; }
.console-output {
  flex: 1;
  overflow-y: auto;
  cursor: text;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
}
/* Системные строки (подключение, ошибки WS) */
.console-output .log-sys   { color: var(--text-2); font-style: italic; }
.console-output .log-ok    { color: var(--green); }
.console-output .log-dim   { color: var(--text-2); }
.console-output .log-error { color: var(--red); }

/* Строки лога */
.console-output .log-line  { display: flex; gap: 6px; align-items: baseline; }
.console-output .log-plain { color: var(--text-1); }

.console-output .log-time  {
  color: var(--text-2);
  font-size: .75rem;
  flex-shrink: 0;
  min-width: 58px;
}
.console-output .log-level {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
  padding: 1px 5px;
  border-radius: 3px;
}
.console-output .lvl-info  { background: #93bfe818; color: var(--blue); }
.console-output .lvl-warn  { background: #f5d97f18; color: var(--yellow); }
.console-output .lvl-error { background: #e88a8a18; color: var(--red); }
.console-output .lvl-debug { background: #ffffff08; color: var(--text-2); }
.console-output .log-msg   { color: var(--text-0); word-break: break-word; flex: 1; }
.console-input-row {
  border-top: 1px solid var(--border-1);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-1);
}
.console-input-row input { font-family: var(--font-mono); font-size: .82rem; flex: 1; }

.console-mode-toggle {
  padding: 3px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-1);
  background: var(--bg-3);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.console-mode-toggle:hover { border-color: var(--border-2); }
.console-mode-toggle.chat-mode {
  background: var(--accent-dim);
  border-color: var(--border-accent);
}
.console-mode-toggle.chat-mode #consoleModeLabel { color: var(--accent); }

/* ── File manager ── */
.file-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .8rem;
  flex: 1;
}
.breadcrumb-bar a { color: var(--accent); }
.breadcrumb-bar span { color: var(--text-2); }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th {
  text-align: left;
  font-size: .72rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-1);
}
.file-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-0); font-size: .88rem; }
.file-table tr:hover td { background: var(--bg-hover); }
.file-table .file-name { display: flex; align-items: center; gap: 8px; color: var(--text-0); font-weight: 500; cursor: pointer; }
.file-table .file-name:hover { color: var(--accent); }
.file-icon {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
  letter-spacing: .02em;
  text-transform: lowercase;
}
.file-icon-dir {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--border-accent);
}
.file-size { font-family: var(--font-mono); font-size: .78rem; color: var(--text-2); }
.file-date { font-family: var(--font-mono); font-size: .78rem; color: var(--text-2); }
.file-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.file-table tr:hover .file-actions { opacity: 1; }
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
@media (max-width:768px) { .table-wrap table { min-width:700px; } }

/* ── Editor ── */
.editor-wrap { display: flex; flex-direction: column; gap: 12px; }
.editor-textarea {
  min-height: 520px;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.7;
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 16px;
  resize: vertical;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 2;
  -moz-tab-size: 2;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: #00000080;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 28px;
  min-width: 360px;
  max-width: 560px;
  width: 90%;
  box-shadow: 0 20px 60px #00000060;
  transform: translateY(12px) scale(.97);
  transition: transform .35s cubic-bezier(.34,1.2,.64,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Toast ── */
#toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-1);
  background: var(--bg-2);
  font-size: .85rem;
  box-shadow: 0 4px 16px #00000040;
  animation: slideIn .2s ease;
  max-width: 320px;
  display: flex; gap: 8px; align-items: center;
}
.toast.ok    { border-color: #8ecfa340; color: var(--green); }
.toast.err   { border-color: #e88a8a40; color: var(--red);   }
.toast.info  { border-color: var(--border-accent); color: var(--accent); }
@keyframes slideIn { from { opacity:0; transform: translateX(16px); } to { opacity:1; transform:none; } }

/* ── Misc ── */
.label { font-size: .78rem; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row:last-child { margin-bottom: 0; }

.token-field { position: relative; }
.token-field input { padding-right: 42px; font-family: var(--font-mono); letter-spacing: .3px; }
.token-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-2); transition: color .2s ease, background-color .2s ease;
}
.token-eye:hover { color: var(--text-0); background: var(--bg-3); }
.token-eye svg {
  position: absolute; width: 18px; height: 18px;
  transition: opacity .25s ease, transform .25s ease;
}
.token-eye .eye-on  { opacity: 1; transform: scale(1) rotate(0deg); }
.token-eye .eye-off { opacity: 0; transform: scale(.7) rotate(-12deg); }
.token-eye.revealed .eye-on  { opacity: 0; transform: scale(.7) rotate(12deg); }
.token-eye.revealed .eye-off { opacity: 1; transform: scale(1) rotate(0deg); }
.dl-grid { display: flex; flex-direction: column; }
.dl-grid .dl-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  border-bottom: 1px solid var(--border-0);
  padding: 8px 0;
  font-size: .86rem;
}
.dl-grid .dl-row:last-child { border-bottom: none; }
.dl-grid .dl-key { color: var(--text-2); flex-shrink: 0; min-width: 100px; }
.dl-grid .dl-val { color: var(--text-0); text-align: right; margin-left: auto; font-weight: 500; }
.dl-grid .dl-val.accent { color: var(--accent); }
.dl-grid .dl-val.mono { font-family: var(--font-mono); font-size: .82rem; }
.dl-grid.current {
  margin-bottom: var(--sp-5);
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
}
.form-grid { display: flex; flex-direction: column; gap: 0; margin-bottom: var(--sp-3); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; }
.profile-full { grid-column: 1 / -1; }
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }
.divider { height: 1px; background: var(--border-1); margin: 20px 0; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }
.spin { animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.monospace { font-family: var(--font-mono); font-size: .82rem; }

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
}
.login-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) both;
}
.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-0);
  transition: opacity .15s;
}
.login-logo:hover { opacity: .8; }
.login-error { background: var(--red-dim); border: 1px solid #e88a8a40; color: var(--red); border-radius: var(--radius); padding: 10px 14px; font-size: .85rem; }

/* ── Auth pages (login / register) ── */
.login-page {
  background:
    radial-gradient(1100px 620px at 88% -12%, var(--accent-glow), transparent 60%),
    radial-gradient(900px 520px at -8% 112%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 55%),
    var(--bg-0);
}
.auth-switchers {
  position: fixed;
  top: 16px; right: 16px;
  display: flex; gap: 8px; z-index: 50;
}
.auth-wrap {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 30px 90px -50px rgba(0,0,0,.7);
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) both;
}
.auth-brand {
  padding: 44px 40px;
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg-2);
  border-right: 1px solid var(--border-1);
  display: flex; flex-direction: column; gap: 24px;
}
.auth-brand-logo {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 800; letter-spacing: -1.5px; color: var(--text-0);
}
.auth-brand-logo .dot { color: var(--accent); }
.auth-brand-tag { font-size: .95rem; color: var(--text-1); line-height: 1.5; }
.auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; font-size: .85rem; color: var(--text-2); line-height: 1.4; }
.auth-feature .material-symbols-outlined { color: var(--accent); font-size: 1.35rem; flex-shrink: 0; margin-top: 1px; }
.auth-feature b { color: var(--text-1); font-weight: 600; }
.auth-feature div span { display: block; }
.auth-card { padding: 44px 40px; display: flex; flex-direction: column; gap: 16px; }
.auth-head { text-align: center; }
.auth-head .login-logo { font-size: 1.5rem; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: .8rem; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--border-1); }
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; width: calc(100vw - 28px); margin: 16px 0; }
  .auth-brand {
    gap: 14px;
    padding: 22px 22px 18px;
    border-right: none;
    border-bottom: 1px solid var(--border-1);
    background:
      radial-gradient(130% 120% at 50% -20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 66%),
      var(--bg-2);
  }
  .auth-brand-logo { font-size: 1.5rem; letter-spacing: -1px; }
  .auth-brand-tag { font-size: .87rem; }
  .auth-features {
    flex-direction: row;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
  }
  .auth-feature { flex: 1; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
  .auth-feature .material-symbols-outlined { font-size: 1.3rem; margin-top: 0; }
  .auth-feature b { font-size: .76rem; }
  .auth-feature div span { display: none; }
  .auth-head { display: none; }
  .auth-card { padding: 22px 22px 26px; gap: 14px; }
}
@media (max-width: 380px) {
  .auth-brand { padding: 20px 18px 16px; }
  .auth-card { padding: 20px 18px 24px; }
  .auth-feature b { font-size: .7rem; }
  .auth-feature .material-symbols-outlined { font-size: 1.15rem; }
}

/* ── Settings ── */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border-0); gap: 16px; }
.settings-row:last-child { border-bottom: none; }
.settings-label { font-weight: 600; font-size: .9rem; }
.settings-desc  { font-size: .8rem; color: var(--text-2); margin-top: 2px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .mobile-menu-btn { display: none !important; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px 16px 80px; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: .85rem; }
}

@media (max-width: 640px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}

@media (max-width: 480px) {
  .content { padding: 12px 10px 80px; }
  .card { border-radius: var(--radius); }
  .topbar-breadcrumb { display: none; }
  .stat-mini { padding: 10px 12px; }
  .stat-mini-val { font-size: 1.1rem; }
  .modal { min-width: 0; width: calc(100vw - 24px); max-width: 100%; padding: 20px 16px; }
  .file-table { font-size: .78rem; }
  .file-table td, .file-table th { padding: 6px 8px; }
  #toasts { right: 8px; bottom: 72px; left: 8px; }
  .toast { max-width: 100%; }
  .btn { padding: 7px 12px; font-size: .82rem; }
  .btn-sm { padding: 4px 8px; font-size: .75rem; }
  .section-label { font-size: .7rem; }
  .login-card { width: calc(100vw - 32px); min-width: 0; padding: 24px 16px; }
  .console-output { font-size: .75rem; }
  .log-time { display: none; }
}

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: #00000060; 
}

.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--border-1);
  font-size: 1rem; cursor: pointer; color: var(--text-1); flex-shrink: 0;
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #000000b3;
  opacity: 0;
  transition: opacity .25s ease;
}
.drawer-backdrop.open { display: block; opacity: 1; }

.mobile-drawer {
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 151;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-1);
  border-top: 1px solid var(--border-2);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  gap: 4px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -8px 32px #00000045;
}
.mobile-drawer.open { transform: translateY(0); }
.drawer-handle {
  width: 36px; height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 0 auto 14px;
  flex-shrink: 0;
}
.drawer-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 4px;
}

.drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; border-radius: var(--radius-lg);
  color: var(--text-1); font-size: .95rem; font-weight: 500;
  text-decoration: none; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.drawer-chevron { color: var(--text-2); margin-left: auto; }
.drawer-item.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.mnav-icon { display: flex; }
.mnav-icon img {
  width: 20px; height: 20px;
  filter: brightness(0) invert(45%);
  transition: filter .15s;
}
.drawer-item.active .mnav-icon img {
  filter: brightness(0) saturate(100%) invert(72%) sepia(30%) saturate(500%) hue-rotate(340deg) brightness(110%);
}
.drawer-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}

/* ── Polish — flat, minimalist ── */
:root {
  --glass-bg:     var(--bg-1);
  --glass-border: var(--border-1);
  --glass-shadow: none;
  --glass-blur:   none;
}

/* Flat surfaces — no blur, no glow. Mobile floating nav keeps a light blur only. */
input, textarea, select {
  border-radius: var(--radius) !important;
  background: var(--bg-2) !important;
  border-color: var(--border-1) !important;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease) !important;
}
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus {
  border-color: var(--border-accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  outline: none !important;
}
/* ── Drag & drop server reordering ── */
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }
.dragging { opacity: .4; transform: scale(.97); }
.drag-over { box-shadow: inset 0 0 0 2px var(--accent); }

/* ── API-карточка (profile.php) ───────────────────────────── */
.token-copy {
  position: absolute; top: 50%; right: 42px; transform: translateY(-50%);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-2); background: none; border: none; cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.token-copy:hover { color: var(--text-0); background: var(--bg-3); }
.token-copy svg { width: 16px; height: 16px; }
.api-card code { font-family: var(--font-mono); }
.lang-chip {
  font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text-2);
  cursor: pointer; transition: all .15s ease;
}
.lang-chip:hover { color: var(--text-0); border-color: var(--border-2); }
.lang-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.input-sm {
  font-size: .8rem; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--bg-2); color: var(--text-0);
}
.api-cat {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin: 14px 0 6px;
}
.api-cat:first-child { margin-top: 0; }
.api-item {
  border: 1px solid var(--border-1); border-radius: var(--radius-lg);
  padding: 10px 12px; margin-bottom: 8px; background: var(--bg-1);
}
.api-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-method {
  font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 6px; letter-spacing: .03em;
  background: var(--bg-3); color: var(--text-1);
}
.api-get { background: #2b6cb01a; color: #63b3ed; }
.api-post { background: #2f855a1a; color: #68d391; }
.api-patch, .api-put { background: #b7791f1a; color: #f6ad55; }
.api-delete { background: #c530301a; color: #fc8181; }
.api-path { font-size: .82rem; color: var(--text-0); }
.api-desc { font-size: .8rem; color: var(--text-2); margin: 6px 0; line-height: 1.4; }
.api-curl {
  display: flex; align-items: flex-start; gap: 6px; position: relative;
  background: var(--bg-3); border-radius: 8px; padding: 8px 38px 8px 10px;
  overflow-x: auto;
}
.api-curl code { font-size: .74rem; color: var(--text-1); white-space: pre; }
.api-curl .btn-icon-panel {
  position: absolute; top: 4px; right: 4px; padding: 2px 6px; font-size: .9rem; cursor: pointer;
}
