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

:root {
  --bg-main: #0B0D10;
  --bg-sidebar: #0E1116;
  --bg-card: #12151A;
  --bg-input: #171B22;
  --border-color: #232830;
  --border-light: #2D333E;

  --accent: #E8933F;
  --accent-hover: #F5A623;
  --accent-dim: rgba(232, 147, 63, 0.12);

  --text-main: #E7E9EC;
  --text-muted: #8B94A0;
  --text-dim: #5A626F;

  --success: #4ADE80;
  --warning: #FBBF24;
  --danger: #F87171;
  --danger-hover: #EF4444;

  --badge-green-bg: rgba(74, 222, 128, 0.12);
  --badge-green-text: #4ADE80;
  --badge-yellow-bg: rgba(251, 191, 36, 0.12);
  --badge-yellow-text: #FBBF24;
  --badge-red-bg: rgba(248, 113, 113, 0.12);
  --badge-red-text: #F87171;
  --badge-gray-bg: rgba(139, 148, 160, 0.15);
  --badge-gray-text: #8B94A0;

  --mono-data: #C4CDD8;

  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
}

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

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

code, pre, .font-mono {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  color: var(--mono-data);
}

/* SIGNATURE SIGNAL LINE MOTIF */
.signal-divider {
  height: 1px;
  width: 100%;
  background-image: linear-gradient(to right, var(--border-color) 50%, rgba(255, 255, 255, 0) 0%);
  background-position: bottom;
  background-size: 8px 1px;
  background-repeat: repeat-x;
  margin: 16px 0;
}

.signal-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.signal-live-bar {
  display: inline-block;
  width: 12px;
  height: 3px;
  background: var(--success);
  border-radius: 1px;
  animation: signalPulse 2.5s infinite ease-in-out;
}

.signal-live-bar.down {
  background: var(--danger);
  animation: none;
}

@keyframes signalPulse {
  0%, 100% { opacity: 0.35; transform: scaleX(0.85); }
  50% { opacity: 1; transform: scaleX(1.15); }
}

/* DASHBOARD LAYOUT */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar-header {
  padding: 0 16px 14px 16px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #141820;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.brand-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
}

.brand-name {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.sidebar-nav-group {
  padding: 12px 16px 4px 16px;
}

.sidebar-group-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background 0.12s ease, color 0.12s ease;
  text-align: left;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-tab.active {
  background: #171C24;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  font-weight: 600;
}

.nav-tab svg {
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px 0 16px;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  background: var(--bg-main);
}

.tab-pane {
  animation: fadeIn 0.15s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.page-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.page-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

/* CARDS & PANELS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* METRICS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.metric-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.metric-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--mono-data);
  margin-top: 4px;
}

/* CHARTS GRID */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* DATA TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.84rem;
}

.data-table th {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.data-table tr.highlight-new {
  animation: flashRow 1.5s ease-out;
}

@keyframes flashRow {
  0% { background: rgba(232, 147, 63, 0.2); }
  100% { background: transparent; }
}

/* BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #0B0D10;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #171B22;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.12s ease;
}

.btn-secondary:hover {
  border-color: var(--border-light);
  background: #1C212A;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #F87171;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}

.btn-danger:hover {
  background: var(--danger);
  color: #0B0D10;
}

/* FORMS */
label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  padding: 7px 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.12s ease;
}

input.font-mono, textarea.font-mono {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--mono-data);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full-width {
  grid-column: span 2;
}

.helper-text {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.73rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: none;
}

/* BADGES & TAGS */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.active, .badge.status-2xx {
  background: var(--badge-green-bg);
  color: var(--badge-green-text);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.badge.status-4xx {
  background: var(--badge-yellow-bg);
  color: var(--badge-yellow-text);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge.inactive, .badge.status-5xx {
  background: var(--badge-red-bg);
  color: var(--badge-red-text);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.tag-pill {
  display: inline-block;
  background: #191E27;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  margin-right: 4px;
}

/* PROGRESS BAR */
.progress-bar-container {
  width: 100%;
  background: #1C212B;
  height: 6px;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.progress-bar-fill.danger {
  background: var(--danger);
}

/* SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .15s;
  border-radius: 2px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: #8B94A0;
  transition: .15s;
  border-radius: 1px;
}

input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before {
  transform: translateX(14px);
  background-color: #0B0D10;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.modal-box.sm { max-width: 420px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.error-banner {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--danger);
  color: #F87171;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.hidden { display: none !important; }

/* TOAST */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--accent); }

/* TIMELINE BARS (HEALTH) */
.timeline-bar-grid {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 48px;
  padding: 8px 0;
}

.timeline-bar {
  flex: 1;
  background: var(--success);
  height: 100%;
  border-radius: 1px;
  opacity: 0.85;
}

.timeline-bar.down {
  background: var(--danger);
}

.timeline-bar:hover {
  opacity: 1;
}

@media (max-width: 860px) {
  .dashboard-layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: 100%; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: span 1; }
}
