/* RCP dashboard — dark, practical, single column of intent. */

:root {
  --bg: #0f1419;
  --bg2: #161d26;
  --panel: #1a2230;
  --border: #2a3547;
  --text: #dbe4f0;
  --muted: #8b98ab;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { margin-left: auto; }

.app { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
  width: 200px; min-width: 200px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.nav { flex: 1; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  background: none; border: none; color: var(--muted);
  text-align: left; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; cursor: pointer; transition: background .12s, color .12s;
}
.nav-item:hover { background: #1f2a3a; color: var(--text); }
.nav-item.active { background: #24344d; color: #fff; font-weight: 600; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.conn.online .pulse { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.conn.offline .pulse { background: var(--danger); }

/* Main */
.main { flex: 1; overflow-y: auto; padding: 24px 28px; }
.view { display: none; }
.view.active { display: block; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-head h1 { margin: 0; }

/* Panels & cards */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { width: 60px; min-width: 60px; } .brand-name, .nav-item { font-size: 0; } .nav-item { text-align: center; padding: 10px 0; } }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
}
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .u { color: var(--muted); font-size: 13px; font-weight: 400; }

/* Buttons */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--accent2); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { background: #223048; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #f87171; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; align-items: center; }
.btn-group.right { margin-left: auto; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

/* Forms */
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password] {
  width: 100%; margin-top: 6px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #0f1520; color: var(--text); font-size: 14px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.msg { display: block; margin-top: 10px; font-size: 13px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* Login */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 50; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 320px; }
.login-brand { justify-content: center; }
.login-brand .brand-name { font-size: 26px; }
.login-card .muted { text-align: center; margin: 4px 0 20px; }

/* Terminal */
.term-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.term-tab {
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.term-tab.active { background: #24344d; color: #fff; border-color: #33507a; }
.term-tab .close { color: var(--muted); background: none; border: none; cursor: pointer; padding: 0 2px; font-size: 12px; }
.term-tab .close:hover { color: var(--danger); }
.term-box { background: #0a0e14; border: 1px solid var(--border); border-radius: 10px; padding: 8px; height: calc(100vh - 190px); }
.term-pane { height: 100%; }
.term-pane.hidden { display: none; }

/* Files & process tables */
.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.crumb { cursor: pointer; color: var(--accent2); }
.crumb.sep { color: var(--muted); }
.file-table {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: auto;
}
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px 150px 120px; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--border); align-items: center;
}
.row:last-child { border-bottom: none; }
.row.head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.row.proc { grid-template-columns: minmax(0, 1fr) 70px 90px 70px 70px 90px 60px 90px; }
@media (max-width: 1200px) { .row.proc { grid-template-columns: minmax(0, 1fr) 70px 90px 70px 70px 90px; } .row.proc .mono, .row.proc .act { display: none; } }
.row .err { color: var(--danger); }
.row:hover { background: #1f2a3a; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.row .name.file:hover { text-decoration: underline; }
.row .act { display: flex; gap: 4px; }
.row .act button {
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.row .act button:hover { background: #2b3a52; color: #fff; }
.row .act button.del:hover { color: var(--danger); }
.mono { font-family: var(--mono); font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop */
.desktop-wrap { height: calc(100vh - 130px); background: #0a0e14; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; position: relative; }
.desktop-wrap iframe { width: 100%; height: 100%; border: none; }
.desktop-note { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 24px; }

/* Fullscreen desktop: the wrapper fills the entire browser viewport.
   (The :fullscreen UA style already sizes the element to the viewport;
   these rules only remove the panel chrome that would look wrong there.) */
.desktop-wrap:fullscreen,
.desktop-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: none;
  border-radius: 0;
  background: #000;
}

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: 380px; max-width: 92vw; }
.modal-card p { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #24344d; border: 1px solid #33507a; color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* Bars / meters */
.meter { height: 6px; background: #0f1520; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter > i.warn { background: var(--warn); }
.meter > i.danger { background: var(--danger); }
.meter > i.ok { background: var(--ok); }

table.kv { border-collapse: collapse; width: 100%; }
table.kv td { padding: 4px 0; border-bottom: 1px solid #202a3a; font-size: 13px; }
table.kv td:last-child { text-align: right; font-family: var(--mono); }
