@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&display=swap');

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

:root {
  --bg:          #0A0A12;
  --panel-bg:    #0D0D18;
  --fg:          #00CC00;
  --fg-bright:   #55FF55;
  --fg-dim:      #00CC00aa;
  --cyan:        #55FFFF;
  --yellow:      #FFFF55;
  --red:         #FF5555;
  --orange:      #FFAA33;
  --magenta:     #FF55FF;
  --white:       #FFFFFF;
  --white-cc:    #FFFFFFcc;
  --white-dim:   #FFFFFF66;
  --grey:        #555555;
  --dgrey:       #282828;
  --border:      #00CC0033;
  --border-hl:   #00CC0055;
  --font:        'IBM Plex Mono', 'Consolas', 'DejaVu Sans Mono', monospace;
  --panel-width: 380px;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 300;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.crt-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px);
}

.hidden { display: none !important; }

/* ── Auth ─────────────────────────────────────────────────────────────── */

.auth-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100vh; background: #000;
  padding-bottom: 18vh;
}

.auth-header {
  display: flex; flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.lotus-logo {
  margin: 0 0 20px; font-size: 14px;
  line-height: 1.4; white-space: pre;
  letter-spacing: 0;
  transform: translateX(-4ch);
}
.l-bright { color: rgba(232,121,249,0.95); text-shadow: 0 0 8px rgba(232,121,249,0.8), 0 0 18px rgba(192,132,252,0.4); }
.l-dim    { color: rgba(192,132,252,0.45); }
.l-gold   { color: rgba(255,223,100,0.95); text-shadow: 0 0 8px rgba(255,223,100,0.7), 0 0 14px rgba(255,180,50,0.3); }

.auth-company {
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 0 12px rgba(255,255,255,0.25);
  margin-bottom: 4px;
  text-align: center;
}
.auth-slogan {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: rgba(74,222,128,0.80);
  text-shadow: 0 0 6px rgba(74,222,128,0.4);
  margin-bottom: 28px;
  text-transform: uppercase;
  text-align: center;
}

.auth-terminal {
  width: min(60ch, 90vw);
  text-align: left;
  border: 1px solid rgba(74,222,128,0.35);
  border-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 0 12px rgba(74,222,128,0.15);
  background: rgba(0,0,0,0.4);
  cursor: text;
  min-height: 60px;
}

.term-line {
  font-size: 13px; letter-spacing: 0.06em;
  line-height: 1.6;
  word-break: break-all;
}

.term-text {
  color: rgba(74,222,128,0.95);
  text-shadow: 0 0 5px rgba(74,222,128,0.5);
}

.term-placeholder {
  color: rgba(74,222,128,0.25);
  text-shadow: none;
  margin-left: 2ch;
}

.term-cursor {
  display: inline-block;
  width: 8px;
  background: rgba(74,222,128,0.9);
  animation: cursor-blink 0.8s step-end infinite;
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hidden-input {
  position: fixed;
  top: -100px; left: -100px;
  width: 1px; height: 1px;
  opacity: 0;
  font-size: 16px;
}

.status-error { color: var(--red) !important; text-shadow: 0 0 8px rgba(255,85,85,0.5) !important; }
.status-ok    { color: var(--fg-bright) !important; text-shadow: 0 0 8px rgba(85,255,85,0.5) !important; }
.status-busy  { color: var(--yellow) !important; text-shadow: 0 0 8px rgba(255,255,85,0.4) !important; }

/* ── Dashboard layout ─────────────────────────────────────────────────── */

#dashboard-phase {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.dash-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Main terminal (left) ─────────────────────────────────────────────── */

.main-terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-right 0.3s ease;
}

/* ── Topbar (billing style) ───────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-logo {
  font-size: 6px;
  line-height: 1.2;
  white-space: pre;
  margin: 0;
  color: #FF55FF;
  flex-shrink: 0;
  user-select: none;
}
.topbar-logo .logo-gold {
  color: rgba(255,223,100,0.95);
}

.topbar-company {
  color: var(--white);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.topbar-sub {
  color: var(--fg-dim);
  font-size: 8px;
  margin-top: 1px;
}

.topbar-center {
  font-size: 8px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--fg-dim);
  flex-shrink: 0;
}
.topbar-center span {
  color: #00CC00dd;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-time {
  font-size: 9px;
  font-weight: 300;
  text-align: right;
  line-height: 1.5;
}
.topbar-time .time-val { color: var(--white); }
.topbar-time .date-val { color: #FFFFFFaa; }

.badge-env {
  font-size: 8px;
  padding: 1px 5px;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  border-radius: 2px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px rgba(255,255,85,0.4);
}

.topbar-refresh {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 300;
  padding: 2px 6px;
  border: 1px solid #00CC0088;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.topbar-refresh:hover {
  color: var(--fg-bright);
  border-color: var(--fg);
  background: #00CC0022;
}

.topbar-logout {
  font-family: var(--font);
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--red);
  border-radius: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.topbar-logout:hover {
  background: rgba(255,85,85,0.15);
}

/* ── Terminal body ────────────────────────────────────────────────────── */

.terminal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hl) transparent;
}

/* ── Sections (billing style) ─────────────────────────────────────────── */

.section {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.section.flex-grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.section-title {
  padding: 5px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.section-body {
  padding: 6px 12px;
  font-size: 10px;
}

.section.flex-grow .section-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hl) transparent;
}

/* ── Status rows ──────────────────────────────────────────────────────── */

.s-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
  font-size: 10px;
  font-weight: 300;
}

.s-label { color: var(--fg-dim); }
.s-val   { text-align: right; color: var(--white-cc); }

.c-green  { color: var(--fg-bright) !important; }
.c-yellow { color: var(--yellow) !important; }
.c-red    { color: var(--red) !important; }
.c-cyan   { color: var(--cyan) !important; }
.c-white  { color: var(--white) !important; }
.c-dim    { color: var(--white-dim) !important; }

/* ── Service status dots ──────────────────────────────────────────────── */

.svc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  font-size: 10px;
  font-weight: 300;
}

.svc-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.svc-dot.on   { background: var(--fg-bright); box-shadow: 0 0 4px var(--fg); }
.svc-dot.off  { background: var(--red); box-shadow: 0 0 4px var(--red); }
.svc-dot.warn { background: var(--yellow); box-shadow: 0 0 4px var(--yellow); }

.svc-name   { color: var(--white-cc); }
.svc-detail { color: var(--white-dim); margin-left: auto; font-size: 9px; }

.term-loading { color: var(--fg-dim); font-style: italic; }

/* ── Log pane ─────────────────────────────────────────────────────────── */

.log-line { font-size: 10px; color: var(--grey); line-height: 1.4; }
.log-line.dim { color: var(--dgrey); }

.hint { color: var(--grey); font-size: 9px; line-height: 1.5; margin-top: 4px; }

/* ── Side panel (right) ───────────────────────────────────────────────── */

.side-panel {
  width: var(--panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--panel-bg);
  overflow: hidden;
  transition: width 0.3s ease, opacity 0.3s ease;
}

.side-panel.collapsed {
  width: 0;
  border-left: none;
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 400;
}

.panel-pin {
  font-family: var(--font);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--grey);
  border-radius: 0;
  background: transparent;
  color: var(--grey);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.panel-pin:hover {
  color: var(--fg);
  border-color: var(--fg);
}
.panel-pin.pinned {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: rotate(180deg);
}

/* ── Panel navigation ─────────────────────────────────────────────────── */

.panel-nav {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-nav-item {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(0,204,0,0.08);
  color: var(--grey);
  font-family: var(--font);
  font-size: 10px;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.06em;
  transition: color 0.15s, background 0.15s;
}
.panel-nav-item:last-child { border-bottom: none; }
.panel-nav-item:hover {
  color: var(--fg);
  background: rgba(0,204,0,0.05);
}
.panel-nav-item.active {
  color: var(--fg-bright);
  background: rgba(0,204,0,0.08);
  border-left: 2px solid var(--fg-bright);
}

/* ── Panel content ────────────────────────────────────────────────────── */

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hl) transparent;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-sec-title {
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

/* ── Panel toggle tab ─────────────────────────────────────────────────── */

.panel-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 60px;
  border: 1px solid var(--border-hl);
  border-right: none;
  border-radius: 4px 0 0 4px;
  background: var(--panel-bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.panel-toggle.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel-toggle:hover {
  background: rgba(0,204,0,0.1);
  color: var(--fg-bright);
  width: 24px;
}

/* ── Form elements (panel) ────────────────────────────────────────────── */

.input-field {
  background: var(--bg);
  border: 1px solid var(--grey);
  color: var(--white);
  font-family: var(--font);
  font-size: 10px;
  padding: 5px 8px;
  outline: none;
  width: 100%;
}
.input-field:focus {
  border-color: var(--fg);
  box-shadow: 0 0 6px rgba(0,204,0,0.2);
}

textarea {
  background: var(--bg);
  border: 1px solid var(--border-hl);
  color: var(--white);
  font-family: var(--font);
  font-size: 10px;
  padding: 8px;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  width: 100%;
}
textarea:focus {
  border-color: var(--fg);
  box-shadow: 0 0 6px rgba(0,204,0,0.2);
}

.term-btn {
  font-family: var(--font);
  font-size: 9px;
  font-weight: 400;
  padding: 4px 12px;
  border: 1px solid;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.06em;
}
.term-btn:hover { opacity: 0.8; }
.term-btn:disabled { opacity: 0.35; cursor: default; }

.term-btn.green   { color: var(--fg-bright); border-color: #00CC00cc; }
.term-btn.green:hover { background: #00CC0022; }
.term-btn.cyan    { color: var(--cyan); border-color: var(--cyan); }
.term-btn.cyan:hover { background: rgba(85,255,255,0.08); }
.term-btn.magenta { color: var(--magenta); border-color: var(--magenta); }
.term-btn.magenta:hover { background: rgba(255,85,255,0.08); }
.term-btn.dim     { color: var(--grey); border-color: var(--grey); }
.term-btn.dim:hover { color: var(--fg); border-color: var(--fg); }

.meta { color: var(--grey); font-size: 9px; }
.desc { color: var(--grey); font-size: 9px; line-height: 1.6; }
.msg-ok    { color: var(--fg-bright); font-size: 10px; }
.msg-error { color: var(--red); font-size: 10px; }

/* ── Audit ────────────────────────────────────────────────────────────── */

.audit-table { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }

.audit-row {
  display: flex; gap: 6px; font-size: 9px; line-height: 1.6;
}
.audit-time   { color: var(--grey); flex-shrink: 0; min-width: 75px; }
.audit-action { flex-shrink: 0; min-width: 85px; }
.audit-user   { color: var(--white); }
.audit-detail { color: var(--grey); }
.audit-ip     { color: var(--dgrey); }

.act-login  { color: var(--fg-bright); }
.act-logout { color: var(--yellow); }
.act-prompt { color: var(--cyan); }
.act-ott    { color: var(--magenta); }
.act-fail   { color: var(--red); }
.act-default { color: var(--grey); }

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root { --panel-width: 100vw; }

  .side-panel {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    z-index: 20;
  }

  .topbar-center { display: none; }
  .topbar-logo { display: none; }
  .topbar { padding: 4px 10px; }
}

@media (max-width: 480px) {
  .topbar-company { font-size: 9px; }
  .topbar-sub { font-size: 7px; }
  .badge-env { display: none; }
  .topbar-time { display: none; }
}
