/* HM Enterprise — shared dashboard prototype styles */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 4px 24px rgba(15, 23, 42, 0.08), 0 12px 48px rgba(15, 23, 42, 0.06);
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-on-dark: #f1f5f9;
  --text-on-dark-muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --chart-1: #2563eb;
  --chart-2: #7c3aed;
  --chart-3: #0d9488;
  --chart-4: #ea580c;
  --topbar-h: 56px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f14;
  --bg-elevated: #141922;
  --bg-sidebar: #080b10;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-on-dark: #e2e8f0;
  --text-on-dark-muted: #94a3b8;
  --border: #1e293b;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

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

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-badge span.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.brand-meta {
  font-size: 0.75rem;
  color: var(--text-on-dark-muted);
  margin-top: 0.35rem;
}

.nav-section {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-on-dark-muted);
  padding: 1rem 1.25rem 0.4rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  color: var(--text-on-dark-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-on-dark);
}
.nav-link.active {
  background: var(--bg-sidebar-hover);
  color: #fff;
  border-left-color: var(--accent);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: var(--text-on-dark-muted);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--bg);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.05);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.grid-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1200px) {
  .grid-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .grid-kpis {
    grid-template-columns: 1fr;
  }
}

.kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  opacity: 0.85;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.kpi-delta {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kpi-delta.up {
  color: var(--success);
}
.kpi-delta.down {
  color: var(--danger);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 650;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

table.data th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data tr:hover td {
  background: var(--accent-soft);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-neutral {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.chart-bars {
  padding: 1rem 1.1rem 1.15rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 56px;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
}

.bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--chart-1), var(--chart-2));
}

.bar-val {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0 1.1rem 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.stack-list {
  padding: 0.35rem 0;
}

.stack-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.stack-item:last-child {
  border-bottom: none;
}

.stack-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.stack-body strong {
  display: block;
  font-weight: 600;
}

.stack-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.1rem 1rem;
}

.pill {
  padding: 0.35rem 0.65rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.stat-inline {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1.1rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.stat-inline:last-of-type {
  border-bottom: none;
}
.stat-inline span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 960px;
}

.hub-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.hub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.hub-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.hub-card p {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.alert-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

html[data-theme="dark"] .alert-strip {
  border-color: rgba(251, 191, 36, 0.2);
}
