/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0a;
  --bg2:       #111111;
  --bg3:       #181818;
  --border:    #2a2a2a;
  --red:       #e63946;
  --red-dim:   #7a1e25;
  --orange:    #f4813f;
  --orange-dim:#7a3a1a;
  --text:      #e8e8e8;
  --text-dim:  #888;
  --radius:    14px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── AUTH PAGE ── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a0a0a 0%, #0a0a0a 70%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow), 0 0 60px rgba(230,57,70,0.08);
}

.logo { text-align: center; margin-bottom: 32px; }
.logo-icon { font-size: 2.4rem; color: var(--red); }
.logo h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: 2px; margin-top: 6px; }
.logo-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-dim);
                    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 12px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 1rem; outline: none;
  transition: border-color .2s;
}
.form-group input:focus { border-color: var(--red); }

.btn-primary {
  width: 100%; padding: 13px;
  background: var(--red); color: #fff;
  border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s;
  margin-top: 4px;
}
.btn-primary:hover { background: #c1121f; }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  width: 100%; padding: 10px;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; cursor: pointer; margin-top: 10px;
  transition: color .2s, border-color .2s;
}
.btn-ghost:hover { color: var(--text); border-color: #555; }

.totp-info { text-align: center; margin-bottom: 20px; }
.totp-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.totp-info p { color: var(--text-dim); font-size: 0.9rem; }

.error-msg {
  display: none; margin-top: 14px;
  background: rgba(230,57,70,0.15); border: 1px solid var(--red-dim);
  color: var(--red); padding: 10px 14px; border-radius: 8px;
  font-size: 0.88rem; text-align: center;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: rgba(10,10,10,0.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-left .logo-icon { font-size: 1.4rem; color: var(--red); }
.topbar-title { font-weight: 700; font-size: 1.1rem; letter-spacing: 1.5px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.online-badge { color: #4caf50; font-size: 0.82rem; }
.header-user { color: var(--text-dim); font-size: 0.88rem; }
.btn-logout {
  padding: 6px 14px; background: transparent;
  border: 1px solid var(--red-dim); color: var(--red);
  border-radius: 6px; font-size: 0.82rem; cursor: pointer;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(230,57,70,0.15); }

/* ── DASHBOARD LAYOUT ── */
.dashboard {
  max-width: 1300px; margin: 0 auto;
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* ── WIDGET ── */
.widget {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.widget-full { width: 100%; }

.widget-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-dim);
  margin-bottom: 16px;
}
.widget-icon { font-size: 1rem; }

/* ── CPU GAUGE ── */
.gauge-wrap { position: relative; text-align: center; }
.gauge { width: 100%; max-width: 140px; }
.gauge-val {
  position: absolute; bottom: -4px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem; font-weight: 700; color: var(--red);
}

/* ── BAR ── */
.bar-wrap { margin-top: 4px; }
.bar-track {
  height: 8px; background: var(--bg3);
  border-radius: 4px; overflow: hidden;
}
.bar-fill {
  height: 100%; background: var(--red);
  border-radius: 4px; transition: width .5s ease;
  width: 0%;
}
.bar-fill.orange { background: var(--orange); }
.bar-labels {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--text-dim); margin-top: 6px;
}
.stat-big { font-size: 2rem; font-weight: 700; color: var(--red); margin-top: 8px; }

/* ── INFO LIST ── */
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row {
  display: flex; justify-content: space-between;
  font-size: 0.88rem; color: var(--text-dim);
}
.info-row span:last-child { color: var(--text); font-weight: 500; }

/* ── NETWORK ── */
.net-stats { display: flex; align-items: center; gap: 12px; }
.net-item { display: flex; align-items: center; gap: 10px; flex: 1; }
.net-arrow { font-size: 1.4rem; color: var(--red); }
.net-arrow.up { color: var(--orange); }
.net-speed { font-size: 1.1rem; font-weight: 700; }
.net-label { font-size: 0.75rem; color: var(--text-dim); }
.net-divider { width: 1px; height: 40px; background: var(--border); }

/* ── PROCESS TABLE ── */
.proc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.proc-table th {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-weight: 500;
  text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px;
}
.proc-table td { padding: 8px 10px; border-bottom: 1px solid #1a1a1a; }
.proc-table tr:hover td { background: var(--bg3); }
.proc-table td:nth-child(3) { color: var(--red); }
.proc-table td:nth-child(4) { color: var(--orange); }

/* ── CHAT ── */
.chat-widget { display: flex; flex-direction: column; gap: 0; }
.chat-online-badge { margin-left: auto; font-size: 0.78rem; color: #4caf50; }

.chat-messages {
  height: 320px; overflow-y: auto;
  background: var(--bg3); border-radius: 10px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}

.msg { display: flex; flex-direction: column; max-width: 75%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; }
.msg.system { align-self: center; }

.msg-bubble {
  padding: 9px 14px; border-radius: 14px;
  font-size: 0.9rem; line-height: 1.4;
}
.msg.mine .msg-bubble { background: var(--red-dim); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .msg-bubble { background: var(--bg2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.system .msg-bubble { background: transparent; color: var(--text-dim); font-size: 0.78rem; font-style: italic; }

.msg-meta { font-size: 0.72rem; color: var(--text-dim); margin-top: 3px; padding: 0 4px; }

.chat-input-row {
  display: flex; gap: 10px; margin-top: 14px;
}
.chat-input-row input {
  flex: 1; padding: 11px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.92rem; outline: none;
  transition: border-color .2s;
}
.chat-input-row input:focus { border-color: var(--red); }

.btn-send {
  padding: 11px 20px;
  background: var(--red); color: #fff;
  border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-send:hover { background: #c1121f; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
  .dashboard { padding: 14px 12px; }
}
