/* ============ Minecraft Panel — design system ============ */
:root {
  color-scheme: dark;
  --page: #0a0c14;
  --bg: #0e1119;
  --surface: #151a26;
  --surface-2: #1b2130;
  --surface-3: #232b3d;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --ink: #f4f6fb;
  --text: #cdd3e1;
  --muted: #8b93a7;
  --faint: #5c6479;
  --accent: #3ddc84;
  --accent-2: #2bb673;
  --accent-ink: #04120a;
  --blue: #5b9dff;
  --amber: #ffb547;
  --red: #ff5c6c;
  --red-2: #e0384a;
  --purple: #b388ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(61, 220, 132, .06), transparent 60%), var(--page);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(61, 220, 132, .3); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #2f3850; }

/* ============ Login ============ */
.login-wrap {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% 0%, rgba(61, 220, 132, .08), transparent 60%), var(--page);
  z-index: 100;
}
.login-card {
  width: min(380px, 92vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 28px; box-shadow: var(--shadow);
}
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-logo .cube { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: var(--accent-ink); flex: none; }
.cube svg { width: 20px; height: 20px; }
.cube svg use { color: inherit; }
.login-logo h1 { font-size: 18px; margin: 0; color: var(--ink); letter-spacing: .2px; }
.login-logo p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 12px; }

/* ============ App shell ============ */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--bg), var(--page));
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; }
.brand .cube { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: var(--accent-ink); flex: none; }
.brand b { color: var(--ink); font-size: 15px; }
.brand span { display: block; font-size: 11px; color: var(--muted); }
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-weight: 500; font-size: 13.5px; margin-bottom: 2px; cursor: pointer; transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); transition: color .12s; }
.nav a:hover { background: var(--surface); }
.nav a.active { background: rgba(61, 220, 132, .12); color: var(--ink); }
.nav a.active svg { color: var(--accent); }
.nav .nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); padding: 14px 12px 6px; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); display: flex; justify-content: space-between; align-items: center; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 60px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: rgba(14, 17, 25, .7); backdrop-filter: blur(8px); flex: none;
}
.topbar h2 { font-size: 16px; color: var(--ink); margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }
.content { padding: 22px; overflow-y: auto; flex: 1; min-height: 0; }

/* ============ Status pill ============ */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line-2); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
.pill.on { color: var(--accent); border-color: rgba(61, 220, 132, .3); background: rgba(61, 220, 132, .08); }
.pill.on .dot { background: var(--accent); box-shadow: 0 0 10px rgba(61, 220, 132, .7); animation: pulse 2s infinite; }
.pill.off { color: var(--red); border-color: rgba(255, 92, 108, .3); background: rgba(255, 92, 108, .08); }
.pill.off .dot { background: var(--red); }
.pill.warn { color: var(--amber); border-color: rgba(255, 181, 71, .3); background: rgba(255, 181, 71, .08); }
.pill.warn .dot { background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .5); } 70% { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); border-color: rgba(255, 92, 108, .35); background: rgba(255, 92, 108, .08); }
.btn.danger:hover { background: var(--red-2); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 8px; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* ============ Inputs ============ */
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; outline: none; transition: border .12s, box-shadow .12s;
}
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(61, 220, 132, .12); }
select.input { cursor: pointer; }
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* ============ Cards / grid ============ */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 14px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 15px; height: 15px; color: var(--faint); }

/* Stat tile */
.stat { position: relative; overflow: hidden; }
.stat .val { font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .val small { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 5px; }
.stat .spark { position: absolute; right: 0; bottom: 0; left: 0; height: 40px; opacity: .8; }
.stat .ico { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.stat .ico svg { width: 18px; height: 18px; }

/* Meter bar */
.meter { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s ease; }
.meter.blue > i { background: linear-gradient(90deg, #3b7de0, var(--blue)); }
.meter.amber > i { background: linear-gradient(90deg, #e0952f, var(--amber)); }
.meter.red > i { background: linear-gradient(90deg, var(--red-2), var(--red)); }

/* ============ Tables ============ */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 13.5px; }
.table tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.tag.green { background: rgba(61, 220, 132, .14); color: var(--accent); }
.tag.blue { background: rgba(91, 157, 255, .14); color: var(--blue); }
.tag.red { background: rgba(255, 92, 108, .14); color: var(--red); }
.tag.amber { background: rgba(255, 181, 71, .14); color: var(--amber); }

/* ============ Console ============ */
.console-wrap { display: flex; flex-direction: column; height: calc(100vh - 60px - 44px); }
.console {
  flex: 1; background: #070a10; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; overflow-y: auto; white-space: pre-wrap; word-break: break-word; color: #c6cede;
}
.console .ln { display: block; }
.console .ln.info { color: #9fb0c9; }
.console .ln.warn { color: var(--amber); }
.console .ln.err { color: var(--red); }
.console .ln.panel { color: var(--accent); }
.console .ln .t { color: var(--faint); }
.cmd-row { display: flex; gap: 10px; margin-top: 12px; }
.cmd-row .input { font-family: var(--mono); }

/* ============ File manager ============ */
.crumbs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 13px; }
.crumbs a { color: var(--muted); cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--surface-2); color: var(--ink); }
.crumbs span { color: var(--faint); }
.filerow { display: grid; grid-template-columns: 1fr 120px 170px 120px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: default; font-size: 13.5px; }
.filerow:hover { background: var(--surface-2); }
.filerow .fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.filerow .fname svg { width: 18px; height: 18px; flex: none; }
.filerow .fname .clk { color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .fname .clk:hover { color: var(--accent); }
.filerow .facts { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s; }
.filerow:hover .facts { opacity: 1; }
.dropzone.drag { outline: 2px dashed var(--accent); outline-offset: -6px; background: rgba(61, 220, 132, .04); }

/* Code editor */
.editor-wrap { display: grid; grid-template-columns: 52px 1fr; background: #070a10; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; height: 62vh; }
.editor-gutter { background: #0b0f17; color: var(--faint); font-family: var(--mono); font-size: 12.5px; line-height: 1.6; text-align: right; padding: 12px 8px; overflow: hidden; user-select: none; white-space: pre; }
.editor-ta { border: none; outline: none; resize: none; background: transparent; color: #dbe3f2; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; padding: 12px 14px; white-space: pre; overflow: auto; tab-size: 2; }

/* ============ Modal / toast ============ */
.overlay { position: fixed; inset: 0; background: rgba(4, 6, 12, .62); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 200; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 94vw); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: pop .16s; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.modal-body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast { min-width: 240px; max-width: 380px; background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--muted); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13.5px; color: var(--text); animation: slidein .2s; }
.toast.ok { border-left-color: var(--accent); }
.toast.err { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ============ misc ============ */
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.right { margin-left: auto; }
.sp { flex: 1; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.chart-box { height: 180px; position: relative; }
.chart-box canvas { width: 100%; height: 100%; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.mobile-toggle { display: none; }

/* ============ responsive ============ */
@media (max-width: 900px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .mobile-toggle { display: inline-flex; }
  .filerow { grid-template-columns: 1fr 80px; }
  .filerow .fsize, .filerow .fmod { display: none; }
}
