@import url('../design-tokens.css');

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--lb-font);
  background: var(--lb-bg-app);
  color: var(--lb-text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lb-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--lb-sidebar-width);
  background: var(--lb-bg-sidebar);
  border-right: 1px solid var(--lb-border);
  padding: 1.25rem 1rem;
  flex-shrink: 0;
  box-shadow: var(--lb-shadow);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--lb-border-light);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #006bb4, #00a9e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.sidebar h1 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--lb-text-heading);
  letter-spacing: -0.02em;
}

.sidebar .sidebar-sub {
  font-size: 0.72rem;
  color: var(--lb-text-muted);
  margin: 0.15rem 0 0;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lb-text-muted);
  margin: 1rem 0 0.35rem 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.15rem;
  border: none;
  border-radius: var(--lb-radius);
  background: transparent;
  color: var(--lb-text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--lb-bg-hover);
  color: var(--lb-text-primary);
  text-decoration: none;
}

.badge-warn { background: #fef3e8; color: #b5651d; }
.badge-ok { background: #e8f5ee; color: #2d6a4f; }

.dns-viewer-panel { margin-top: 0.5rem; }
.dns-viewer-head { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.dns-viewer-msg { font-style: italic; color: var(--lb-text-secondary); font-size: 0.88rem; }
.dns-viewer-meta { font-size: 0.82rem; color: var(--lb-text-muted); margin: 0.35rem 0; }
.dns-viewer-sub { margin: 1rem 0 0.35rem; font-size: 0.9rem; }
.dns-viewer-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.75rem; }
.dns-content { word-break: break-all; max-width: 280px; font-size: 0.82rem; }
.dns-email-row { background: #f8fbff; }
.kpi-inline { display: flex; gap: 1.25rem; font-size: 0.85rem; margin: 0.5rem 0; }
.error-text { color: #c0392b; font-size: 0.88rem; }
.form-label { display: block; font-size: 0.82rem; margin-bottom: 0.75rem; }
.form-input {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.6rem;
  border: 1px solid var(--lb-border); border-radius: 6px; font: inherit;
}
.sidebar-admin { background: linear-gradient(180deg, #fff 0%, #f6f9fc 100%); }
.btn-sm { font-size: 0.82rem; padding: 0.35rem 0.65rem; }

.nav-link.active {
  background: var(--lb-accent-soft);
  color: var(--lb-accent);
  font-weight: 600;
}

.main {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  overflow: auto;
  max-width: 1400px;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--lb-text-heading);
  margin: 0 0 0.35rem;
}

.page-lead {
  color: var(--lb-text-secondary);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  max-width: 52rem;
}

/* Wazuh-style alert summary bar */
.wz-alerts-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: var(--lb-shadow);
}

@media (max-width: 900px) {
  .wz-alerts-bar { grid-template-columns: repeat(2, 1fr); }
}

.wz-alert-stat {
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--lb-border-light);
  text-align: center;
}

.wz-alert-stat--link {
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  cursor: pointer;
}

.wz-alert-stat--link:hover {
  background: var(--lb-accent-soft);
  text-decoration: none;
}

.wz-alert-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--lb-text-muted);
  text-transform: none;
  margin-top: 0.2rem;
}

.wz-alert-cta {
  display: block;
  font-size: 0.72rem;
  color: var(--lb-accent);
  margin-top: 0.45rem;
  font-weight: 600;
}

.discover-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.wz-alert-stat:last-child { border-right: none; }

.wz-alert-stat strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.wz-alert-stat span {
  font-size: 0.72rem;
  color: var(--lb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wz-sev-critical strong { color: var(--lb-sev-critical); }
.wz-sev-high strong { color: var(--lb-sev-high); }
.wz-sev-med strong { color: var(--lb-sev-med); }
.wz-sev-low strong { color: var(--lb-sev-low); }

/* Section blocks */
.wz-section {
  margin-bottom: 1.75rem;
}

.wz-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lb-text-muted);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--lb-border-light);
}

.wz-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.wz-feature-card {
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  padding: 1.1rem 1.15rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  box-shadow: var(--lb-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wz-feature-card:hover {
  border-color: #b8c4d8;
  box-shadow: 0 2px 8px rgba(26, 28, 33, 0.08);
}

.wz-feature-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--lb-radius);
  background: var(--lb-bg-subtle);
  border: 1px solid var(--lb-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.wz-feature-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lb-text-heading);
}

.wz-feature-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--lb-text-secondary);
}

.card {
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--lb-shadow);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-wazuh { background: #e6f7fc; color: #006bb4; border: 1px solid #b3e4f5; }
.badge-onboard { background: #f0e8f8; color: #6b4c9a; border: 1px solid #d4c4e8; }
.badge-sev-high { background: #fce8e6; color: var(--lb-sev-high); }

.hub-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; }
@media (max-width: 900px) { .hub-grid { grid-template-columns: 1fr; } }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--lb-border-light);
  font-size: 0.875rem;
}

.tabs { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.tab {
  padding: 0.35rem 0.75rem;
  border-radius: var(--lb-radius);
  border: 1px solid var(--lb-border);
  background: var(--lb-bg-card);
  color: var(--lb-text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
}
.tab.active { border-color: var(--lb-accent); color: var(--lb-accent); background: var(--lb-accent-soft); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; font-size: 0.85rem; }
.kv dt { color: var(--lb-text-muted); }
code {
  font-family: var(--lb-mono);
  font-size: 0.8rem;
  background: var(--lb-bg-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--lb-border-light);
}

.btn {
  padding: 0.4rem 0.9rem;
  border-radius: var(--lb-radius);
  border: 1px solid var(--lb-border);
  background: var(--lb-bg-card);
  color: var(--lb-text-primary);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-primary { background: var(--lb-accent); border-color: var(--lb-accent); color: #fff; }
.btn-primary:hover { background: var(--lb-accent-hover); }

.status-pill {
  font-size: 0.72rem;
  color: var(--lb-text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--lb-bg-subtle);
  border-radius: var(--lb-radius);
  border: 1px solid var(--lb-border-light);
}

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  color: var(--lb-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid var(--lb-border);
  background: var(--lb-bg-subtle);
}
.data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--lb-border-light);
}
.data-table tbody tr:hover { background: var(--lb-bg-subtle); }

.tenant-health-ok { color: var(--lb-sev-low); font-weight: 600; }
.tenant-health-warn { color: var(--lb-sev-med); font-weight: 600; }
.tenant-health-bad { color: var(--lb-sev-high); font-weight: 600; }

/* Console v2 — KPI bar */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) { .kpi-bar { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--lb-shadow);
  transition: border-color 0.15s, transform 0.1s;
}
.kpi-card:hover {
  border-color: var(--lb-accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.kpi-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--lb-text-heading);
}
.kpi-label {
  display: block;
  font-size: 0.72rem;
  color: var(--lb-text-muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card--red .kpi-value { color: var(--lb-sev-high); }
.kpi-card--amber .kpi-value { color: var(--lb-sev-med); }
.kpi-card--blue .kpi-value { color: var(--lb-accent); }

/* Health cards (Overview port) */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.health-card {
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--lb-shadow);
  border-left: 4px solid var(--lb-border);
}
.health-card--health-ok { border-left-color: var(--lb-sev-low); }
.health-card--health-warn { border-left-color: var(--lb-sev-med); }
.health-card--health-bad { border-left-color: var(--lb-sev-high); }
.health-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.health-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.health-card-meta {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--lb-text-secondary);
}
.health-score-line {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.health-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.health-badge--health-ok { background: #e8f5e9; color: #2e7d32; }
.health-badge--health-warn { background: #fff8e1; color: #f57c00; }
.health-badge--health-bad { background: #fce8e6; color: var(--lb-sev-high); }
.health-badge--health-unknown { background: var(--lb-bg-subtle); color: var(--lb-text-muted); }
.health-issue-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--lb-text-secondary);
}

/* Agentic incidents strip */
.incident-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.incident-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--lb-bg-card);
  border: 1px solid var(--lb-border);
  border-radius: var(--lb-radius);
  text-decoration: none;
  color: inherit;
}
.incident-card:hover { border-color: var(--lb-accent); text-decoration: none; }
.incident-card p {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--lb-text-secondary);
}
.incident-card--critical { border-left: 4px solid var(--lb-sev-critical); }
.incident-card--warn { border-left: 4px solid var(--lb-sev-med); }
.incident-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--lb-accent);
  white-space: nowrap;
}
