:root {
  --red: #e23b2c;
  --red-bright: #f1543f;
  --red-dark: #8e2118;
  --red-deep: #4c130d;
  --red-soft: rgba(226, 59, 44, 0.13);
  --red-glow: rgba(226, 59, 44, 0.30);

  --bg: #100f12;
  --surface: #17171b;
  --panel: #222329;
  --panel-hi: #2c2d34;
  --line: #3a3b42;
  --black: #000000;

  --blue: #34465f;
  --blue-hi: #415672;
  --blue-deep: #1a2330;

  --green: #2f7d2a;
  --green-deep: #123010;
  --amber: #b8860b;
  --cyan: #3ecbd9;
  --cyan-dim: #1f5b63;

  --white: #f5f5f6;
  --text: #d6d7db;
  --text-dim: #94959c;
  --text-faint: #66676e;

  /* Glossy vertical gradient echoing the extruded logo lettering — the
     same tokens crabsmp.net's own button system is built from. */
  --grad-red: linear-gradient(180deg, var(--red-bright) 0%, var(--red) 48%, var(--red-dark) 100%);
  --grad-red-hi: linear-gradient(180deg, #ff6a54 0%, var(--red-bright) 48%, var(--red) 100%);
  --glow-red: 0 0 24px var(--red-glow);

  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-mono: 'VT323', 'Courier New', monospace;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;

  --border: 3px solid var(--black);
  --shadow-card: 0 10px 26px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 18px 40px rgba(0, 0, 0, 0.62);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Pixelated "stair-step" corner notch — the site's actual Minecraft GUI
     corner treatment. Override --notch/--notch2 per-element before using
     --pixel-clip (bigger notch on bigger panels, tiny on chips/buttons). */
  --notch: 6px;
  --notch2: 3px;
  --pixel-clip: polygon(
    0 var(--notch), var(--notch2) var(--notch), var(--notch2) var(--notch2), var(--notch) var(--notch2), var(--notch) 0,
    calc(100% - var(--notch)) 0, calc(100% - var(--notch)) var(--notch2), calc(100% - var(--notch2)) var(--notch2), calc(100% - var(--notch2)) var(--notch), 100% var(--notch),
    100% calc(100% - var(--notch)), calc(100% - var(--notch2)) calc(100% - var(--notch)), calc(100% - var(--notch2)) calc(100% - var(--notch2)), calc(100% - var(--notch)) calc(100% - var(--notch2)), calc(100% - var(--notch)) 100%,
    var(--notch) 100%, var(--notch) calc(100% - var(--notch2)), var(--notch2) calc(100% - var(--notch2)), var(--notch2) calc(100% - var(--notch)), 0 calc(100% - var(--notch))
  );

  /* Inset bevel — light top/left, dark bottom/right — for elements that
     don't get the full 3D-extrusion button treatment. */
  --bevel-raised-sm: inset 2px 2px 0 0 rgba(255, 255, 255, 0.13), inset -2px -2px 0 0 rgba(0, 0, 0, 0.55);
  --pixel-shadow: 2px 2px 0 rgba(0, 0, 0, 0.85);
  --pixel-shadow-sm: 1px 1px 0 rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

/* Same ambient hero photo as the login screen and every crabsmp.net page —
   every tab sits on this same backdrop, not just login. */
body {
  font-family: var(--font-body);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, var(--red-soft), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(62, 203, 217, 0.06), transparent 55%),
    linear-gradient(180deg, rgba(16, 15, 18, 0.55) 0%, rgba(16, 15, 18, 0.72) 45%, var(--bg) 88%),
    url('/media/hero-bg.jpg');
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-position: top left, top left, top left, center 15%;
  background-size: auto, auto, auto, cover;
  background-attachment: fixed;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; color: inherit; }

a { color: var(--red-bright); }

.hidden { display: none !important; }

::selection { background: var(--red); color: var(--white); }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) var(--surface); }
*::-webkit-scrollbar { width: 14px; height: 14px; }
*::-webkit-scrollbar-track { background: var(--surface); border-left: 2px solid var(--black); }
*::-webkit-scrollbar-thumb {
  background: var(--panel-hi);
  border: 2px solid var(--black);
  box-shadow: var(--bevel-raised-sm);
}
*::-webkit-scrollbar-thumb:hover { background: var(--red-dark); }

/* ---------- Login screen ---------- */
#login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}
/* Hero background treatment, straight off the crabsmp.net front page:
   a desaturated/darkened server screenshot with a red glow fading to bg. */
.login-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url('/media/hero-bg.jpg') center / cover no-repeat;
  filter: saturate(0.7) brightness(0.62) contrast(1.05);
  transform: scale(1.06);
}
.login-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, var(--red-soft), transparent 70%),
    linear-gradient(180deg, rgba(16, 15, 18, 0.35) 0%, rgba(16, 15, 18, 0.6) 55%, var(--bg) 100%);
}
.login-card {
  --notch: 8px;
  --notch2: 4px;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: var(--border);
  border-top: 4px solid var(--red);
  box-shadow: var(--shadow-pop), 0 0 60px rgba(226, 59, 44, 0.18);
  clip-path: var(--pixel-clip);
  padding: 36px 32px;
  text-align: center;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/media/crab_chestplate.png') no-repeat;
  background-position: -6px -6px;
  background-size: 140px;
  opacity: 0.05;
  image-rendering: pixelated;
  pointer-events: none;
}
.login-card img {
  height: 56px;
  margin: 0 auto 18px;
  position: relative;
  filter: drop-shadow(0 2px 10px rgba(226, 59, 44, 0.35));
  image-rendering: pixelated;
}
.login-card h1 {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 22px;
  position: relative;
  letter-spacing: 1px;
  text-shadow: var(--pixel-shadow-sm);
}
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--white);
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
}
.login-card input[type="password"]:focus { outline: none; border-color: var(--red); }
#login-error { color: var(--red-bright); font-size: 0.9rem; min-height: 1.3em; margin-bottom: 10px; }

/* ---------- Buttons ---------- */
/* Real 3D-extrusion button: a colored block sitting on a darker "shelf"
   that collapses flat when pressed — the actual crabsmp.net mc-btn. */
.btn {
  --notch: 5px;
  --notch2: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.4px;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel) 55%, #1b1c21);
  border: 2px solid var(--line);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 4px 0 var(--black), 0 6px 10px rgba(0, 0, 0, 0.4);
  text-shadow: var(--pixel-shadow-sm);
  clip-path: var(--pixel-clip);
  -webkit-tap-highlight-color: transparent;
  transition: background .12s var(--ease), border-color .12s var(--ease), transform .07s var(--ease), box-shadow .07s var(--ease);
}
.btn:hover {
  border-color: var(--red);
  color: var(--white);
  background: linear-gradient(180deg, #34353d, var(--panel-hi) 55%, var(--panel));
}
.btn:active {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 0 0 var(--black), 0 3px 8px rgba(0, 0, 0, 0.4);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-red {
  background: var(--grad-red);
  border-color: var(--red-dark);
  color: var(--white);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.22), inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 4px 0 var(--red-deep), 0 6px 10px rgba(0, 0, 0, 0.4);
}
.btn-red:hover { background: var(--grad-red-hi); border-color: var(--red-dark); }
.btn-red:active { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 0 0 var(--red-deep), 0 3px 8px rgba(0, 0, 0, 0.4); }
.btn-green {
  background: linear-gradient(180deg, #3f9938, var(--green) 55%, var(--green-deep));
  border-color: var(--green-deep);
  color: var(--white);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 4px 0 #0d2b0b, 0 6px 10px rgba(0, 0, 0, 0.4);
}
.btn-green:active { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 0 0 #0d2b0b, 0 3px 8px rgba(0, 0, 0, 0.4); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { --notch: 4px; --notch2: 2px; padding: 9px 13px; font-size: 8px; }
.btn-danger {
  background: linear-gradient(180deg, #6e1c14, var(--red-deep) 55%, #35100b);
  border-color: var(--black);
  color: #f1b9b1;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), inset 0 -3px 0 rgba(0, 0, 0, 0.4), 0 4px 0 var(--black), 0 6px 10px rgba(0, 0, 0, 0.4);
}
.btn-danger:active { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05), inset 0 -2px 0 rgba(0, 0, 0, 0.4), 0 0 0 var(--black), 0 3px 8px rgba(0, 0, 0, 0.4); }

/* ---------- App shell ---------- */
#app-view { min-height: 100vh; display: flex; flex-direction: column; }

header.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: rgba(16, 15, 18, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--black);
  box-shadow: 0 2px 0 var(--red), 0 10px 26px rgba(0, 0, 0, 0.55);
}
header.topbar img { height: 34px; filter: drop-shadow(0 1px 4px rgba(226, 59, 44, 0.4)); image-rendering: pixelated; }
header.topbar h1 {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  line-height: 1.6;
  color: var(--white);
  margin-right: auto;
  letter-spacing: 0.5px;
  text-shadow: var(--pixel-shadow);
}
.host-stats { display: flex; gap: 8px; }
.stat-chip {
  --notch: 4px;
  --notch2: 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  box-shadow: var(--bevel-raised-sm);
  clip-path: var(--pixel-clip);
}
.stat-chip b { color: var(--white); font-weight: 700; }

nav.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}
nav.tabs button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: none;
  border: 2px solid transparent;
  border-bottom-width: 3px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  text-shadow: var(--pixel-shadow-sm);
  transition: color .12s var(--ease), background .12s var(--ease), border-color .12s var(--ease);
}
.tab-ico {
  width: 19px;
  height: 19px;
  object-fit: contain;
  flex-shrink: 0;
  filter: grayscale(0.55) brightness(0.92) drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.5));
  opacity: 0.75;
  transition: filter .14s var(--ease), opacity .14s var(--ease), transform .14s var(--ease);
}
nav.tabs button:hover .tab-ico,
nav.tabs button.active .tab-ico {
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.5));
  opacity: 1;
  transform: scale(1.12) rotate(-5deg);
}
/* The active tab reads as a selected inventory slot — filled + raised,
   not just an underline. */
nav.tabs button.active {
  color: var(--white);
  background: var(--panel-hi);
  border-color: var(--line) var(--line) var(--red) var(--line);
  box-shadow: var(--bevel-raised-sm);
}
nav.tabs button:hover:not(.active) { color: var(--white); border-bottom-color: var(--red-dark); }

main { flex: 1; padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Cards ---------- */
.card {
  --notch: 8px;
  --notch2: 4px;
  background-color: var(--panel);
  border: var(--border);
  border-top: 3px solid var(--red-dark);
  box-shadow: var(--shadow-card), var(--bevel-raised-sm);
  clip-path: var(--pixel-clip);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1.8;
  color: var(--white);
  margin-bottom: 16px;
  letter-spacing: 0.3px;
  padding-left: 12px;
  border-left: 3px solid var(--red);
  text-shadow: var(--pixel-shadow-sm);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: none;
  transition: background .2s var(--ease);
}
.live-dot.live {
  background: var(--green);
  box-shadow: 0 0 0 rgba(47, 125, 42, 0.6);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 125, 42, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(47, 125, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 125, 42, 0); }
}

/* ---------- system / live graphs ---------- */
.disk-meter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.meter {
  --notch: 3px;
  --notch2: 1px;
  flex: 1;
  height: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: var(--bevel-raised-sm);
  clip-path: var(--pixel-clip);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--cyan-dim);
  transition: width .5s var(--ease), background .3s var(--ease);
}
.meter-fill.meter-warn { background: var(--amber); }
.meter-fill.meter-danger { background: var(--red); }
.meter-label { font-size: 0.95rem; color: var(--text-dim); font-family: var(--font-mono); white-space: nowrap; }

/* Fixed-width dual RX/TX readout — deliberately NOT sharing the big
   .graph-value slot CPU/Mem use, so real numbers (vs. the "—" placeholder)
   never widen the header and shift the row height under it. */
.net-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 1rem;
  min-width: 92px;
}
.net-line { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.net-dot { width: 7px; height: 7px; flex: none; }
.net-rx .net-dot { background: #5b8dee; }
.net-tx .net-dot { background: #e0a940; }
.net-rx b { color: #5b8dee; font-weight: 700; }
.net-tx b { color: #e0a940; font-weight: 700; }

.svc-spark { display: block; width: 100%; height: 26px; margin: 4px 0 10px; }

.graph-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.graph-panel {
  --notch: 6px;
  --notch2: 3px;
  background: var(--panel-hi);
  border: 2px solid var(--line);
  padding: 14px 16px 10px;
  box-shadow: var(--bevel-raised-sm);
  clip-path: var(--pixel-clip);
  /* Reserves the full header+canvas+footer height up front so a panel
     never grows once live numbers replace the "—" placeholders — that
     growth is what used to shove the rest of the page down a beat after
     the websocket connected. */
  min-height: 214px;
  display: flex;
  flex-direction: column;
}
.graph-cpu { border-top: 2px solid var(--red-dark); }
.graph-mem { border-top: 2px solid var(--cyan-dim); }
.graph-net { border-top: 2px solid #3a5590; }
.graph-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex: none; }
.graph-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 1.8;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}
.graph-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  font-family: var(--font-mono);
  text-shadow: var(--pixel-shadow);
}
.graph-cpu .graph-value { color: var(--red-bright); }
.graph-mem .graph-value { color: var(--cyan); }
.graph-canvas { display: block; width: 100%; height: 120px; flex: 1 1 auto; min-height: 0; }
.graph-foot { margin-top: 6px; font-size: 0.9rem; color: var(--text-faint); font-family: var(--font-mono); flex: none; }

.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.service-card {
  --notch: 6px;
  --notch2: 3px;
  background: var(--panel-hi);
  border: 2px solid var(--line);
  padding: 16px;
  box-shadow: var(--bevel-raised-sm);
  clip-path: var(--pixel-clip);
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.service-card:hover {
  border-color: var(--red-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow-pop), var(--glow-red);
}
.service-card .svc-name {
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.7;
  color: var(--white);
  margin-bottom: 8px;
  text-shadow: var(--pixel-shadow-sm);
}
.status-badge {
  --notch: 3px;
  --notch2: 1px;
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 0.3px;
  text-shadow: var(--pixel-shadow-sm);
  clip-path: var(--pixel-clip);
  margin-bottom: 10px;
}
.status-online { background: var(--green); color: var(--white); }
.status-stopped, .status-stopping { background: var(--amber); color: var(--black); }
.status-errored, .status-not_registered { background: var(--red-dark); color: var(--white); }
.svc-meta { font-size: 1rem; color: var(--text-dim); font-family: var(--font-mono); margin-bottom: 12px; line-height: 1.5; }
.svc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Console ---------- */
.console-controls { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.log-box {
  background: var(--black);
  border: 2px solid var(--line);
  border-top: 2px solid var(--red-dark);
  color: #9fe89f;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1.4;
  padding: 12px;
  height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: inset 0 5px 12px rgba(0, 0, 0, 0.75), inset 0 -2px 0 rgba(255, 255, 255, 0.05);
}
.console-input-row { display: flex; gap: 8px; margin-top: 10px; }
.console-input-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 1.05rem;
}

/* ---------- Backups ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
th {
  color: var(--text-dim);
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 0.5px;
}
td.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.schedule-row .switch-label, .schedule-row .schedule-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.schedule-row input[type="number"] {
  width: 60px;
  padding: 6px 8px;
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 1.05rem;
}
.schedule-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--red); }
#schedule-next { margin-left: auto; }
.toolbar input[type="text"] {
  padding: 8px 12px;
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--white);
  min-width: 200px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
}
.toolbar input[type="text"]:focus { outline: none; border-color: var(--red); }
.count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  font-family: var(--font-body);
  letter-spacing: 0;
}

/* ---------- Files ---------- */
#files-search-input { margin-left: auto; }
#files-dropzone { position: relative; transition: box-shadow .15s var(--ease); }
#files-dropzone.drag-over { box-shadow: var(--shadow-card), var(--bevel-raised-sm), inset 0 0 0 2px var(--red); }
.dropzone-hint {
  display: none;
  margin-top: 10px;
  padding: 8px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--red-bright);
  border: 1px dashed var(--red-dark);
}
#files-dropzone.drag-over .dropzone-hint { display: block; }
.breadcrumbs { font-family: var(--font-mono); font-size: 1.05rem; margin-bottom: 12px; color: var(--text-dim); }
.breadcrumbs button { background: none; border: none; color: var(--red-bright); cursor: pointer; padding: 0 4px; font-family: var(--font-mono); font-size: 1.05rem; }
.file-row-name { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.file-row-name.is-dir { font-weight: 800; color: var(--white); }
.editor-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px;
}
.editor-box {
  --notch: 7px;
  --notch2: 3px;
  background: var(--panel); border: var(--border); border-top: 4px solid var(--red);
  width: 100%; max-width: 900px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop);
  clip-path: var(--pixel-clip);
}
.editor-box header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.editor-box header strong { font-family: var(--font-mono); font-size: 1.1rem; }
.editor-box textarea {
  flex: 1; min-height: 400px; background: var(--bg); color: var(--white);
  font-family: var(--font-mono); font-size: 1.05rem; padding: 14px; border: none; resize: vertical;
}
.editor-box footer { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Confirm modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 600; padding: 20px;
}
.modal-box {
  --notch: 7px;
  --notch2: 3px;
  background: var(--panel); border: var(--border); border-top: 4px solid var(--red);
  max-width: 460px; width: 100%; padding: 28px; box-shadow: var(--shadow-pop);
  clip-path: var(--pixel-clip);
}
.modal-box h3 { font-family: var(--font-pixel); font-size: 11px; line-height: 1.7; color: var(--white); margin-bottom: 14px; text-shadow: var(--pixel-shadow-sm); }
.modal-box p { color: var(--text-dim); margin-bottom: 16px; line-height: 1.6; }
.modal-box input { width: 100%; padding: 10px 12px; background: var(--bg); border: 2px solid var(--line); color: var(--white); margin-bottom: 16px; font-family: var(--font-mono); font-size: 1.1rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  --notch: 5px;
  --notch2: 2px;
  position: fixed; bottom: 20px; right: 20px; z-index: 700;
  background: var(--panel-hi); border: 2px solid var(--line); border-left: 4px solid var(--red);
  padding: 12px 18px; max-width: 360px; font-size: 0.85rem; box-shadow: var(--shadow-pop);
  clip-path: var(--pixel-clip);
}
.toast.ok { border-left-color: var(--green); }

/* Dense tables (backups/files/players/allowlist) scroll horizontally on
   narrow screens instead of squeezing columns unreadably thin. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 460px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  /* iOS Safari can jank-scroll a fixed background photo — fall back to a
     normal scrolling background below desktop widths. */
  body { background-attachment: scroll; }

  main { padding: 16px; }
  .card { padding: 16px; }

  header.topbar { flex-wrap: wrap; row-gap: 10px; padding: 12px 16px; }
  .host-stats { flex-wrap: wrap; }

  nav.tabs { padding: 0 12px; }
  nav.tabs button { padding: 10px 12px; flex-shrink: 0; }

  .graph-grid, .services-grid { grid-template-columns: 1fr; }
  .graph-value { font-size: 1.5rem; }

  .modal-box, .editor-box { max-width: calc(100vw - 32px); }
  .editor-box textarea { min-height: 260px; }

  #schedule-next { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
  header.topbar h1 { display: none; }
  header.topbar img { height: 28px; }

  .login-card { padding: 28px 20px; }
  .login-card h1 { font-size: 0.5rem; }

  .card h2 { font-size: 8px; }
  .btn { font-size: 8px; padding: 10px 14px; }
  .btn-sm { font-size: 7px; padding: 8px 10px; }
  .stat-chip { font-size: 0.85rem; padding: 5px 8px; }

  th, td { padding: 8px 6px; }

  .toast { left: 16px; right: 16px; max-width: none; bottom: 16px; }
}
