/* SILS CMMS Demo — app shell */
.demo-banner {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: var(--white);
  padding: 0.55rem 0;
  font-size: var(--text-xs);
}
.demo-banner-inner {
  width: min(100% - 1.75rem, var(--max));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.demo-banner strong { color: var(--accent-light); }
.demo-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.demo-wrap {
  width: min(100% - 1.25rem, var(--max));
  margin: 1.25rem auto 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--white);
  min-height: 620px;
  display: flex;
  flex-direction: column;
}

.demo-app {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 560px;
}

.demo-sidebar {
  background: var(--brand-dark);
  color: rgba(255, 255, 255, 0.88);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}
.demo-sidebar-brand {
  padding: 0 1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}
.demo-sidebar-brand span {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--white);
}
.demo-sidebar-brand small {
  font-size: 0.75rem;
  opacity: 0.65;
}
.demo-nav { flex: 1; }
.demo-nav button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.demo-nav button:hover { background: rgba(255, 255, 255, 0.06); }
.demo-nav button.active {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent);
  color: var(--white);
  font-weight: 600;
}
.demo-nav-icon {
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
  font-size: 0.9rem;
}
.demo-sidebar-foot {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  opacity: 0.55;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-main {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  min-width: 0;
}
.demo-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.demo-topbar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand);
}
.demo-topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-xs);
  color: var(--muted);
}
.demo-user-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.demo-content {
  padding: 1.25rem;
  flex: 1;
  overflow: auto;
}

.demo-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.demo-kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.demo-kpi-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.demo-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.1;
}
.demo-kpi-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }
.demo-kpi.warn .demo-kpi-value { color: var(--accent); }
.demo-kpi.ok .demo-kpi-value { color: #059669; }

.demo-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
}

.demo-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.demo-panel-head {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.demo-panel-head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand);
}
.demo-panel-body { padding: 0.75rem 1rem; }

.demo-bar-chart { display: flex; flex-direction: column; gap: 0.55rem; }
.demo-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.demo-bar-track {
  height: 8px;
  background: var(--paper);
  border-radius: 999px;
  overflow: hidden;
}
.demo-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-light), var(--brand));
  transition: width 0.4s ease;
}
.demo-bar-fill.warn { background: linear-gradient(90deg, var(--accent-light), var(--accent)); }

.demo-table-wrap { overflow-x: auto; }
.demo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.demo-table th,
.demo-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.demo-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  background: var(--paper);
}
.demo-table tr:last-child td { border-bottom: none; }
.demo-table tr:hover td { background: rgba(26, 86, 219, 0.03); }

.demo-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.demo-badge.open { background: #dbeafe; color: #1d4ed8; }
.demo-badge.progress { background: #fef3c7; color: #b45309; }
.demo-badge.done { background: #d1fae5; color: #047857; }
.demo-badge.critical { background: #fee2e2; color: #b91c1c; }
.demo-badge.high { background: #ffedd5; color: #c2410c; }
.demo-badge.medium { background: #fef9c3; color: #a16207; }
.demo-badge.low { background: #e0e7ff; color: #4338ca; }
.demo-badge.ok { background: #d1fae5; color: #047857; }
.demo-badge.warn { background: #fef3c7; color: #b45309; }

.demo-health {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.demo-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.demo-health-dot.ok { background: #10b981; }
.demo-health-dot.warn { background: var(--accent); }
.demo-health-dot.bad { background: #ef4444; }

.demo-btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  color: var(--brand);
  transition: background 0.15s, border-color 0.15s;
}
.demo-btn-sm:hover { background: var(--paper); border-color: var(--brand-light); }
.demo-btn-sm.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}
.demo-btn-sm.primary:hover { background: var(--brand-light); }
.demo-btn-sm.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.demo-alert-list { display: flex; flex-direction: column; gap: 0.5rem; }
.demo-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 0.8125rem;
}
.demo-alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.demo-alert-icon.ai { background: #ede9fe; color: #6d28d9; }
.demo-alert-icon.stock { background: #fef3c7; color: #b45309; }
.demo-alert-body { flex: 1; min-width: 0; }
.demo-alert-body strong { display: block; font-size: 0.8125rem; margin-bottom: 0.1rem; }
.demo-alert-body p { margin: 0; color: var(--muted); font-size: 0.75rem; }

.demo-config-tree { font-size: 0.8125rem; }
.demo-config-node {
  padding: 0.35rem 0;
  padding-left: calc(var(--depth, 0) * 1.1rem);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.demo-config-node::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.7rem;
}
.demo-config-node.root::before { content: "◆"; color: var(--brand-light); }

.demo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 61, 0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.demo-modal-backdrop.open { opacity: 1; visibility: visible; }
.demo-modal {
  background: var(--white);
  border-radius: var(--radius);
  width: min(100%, 420px);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.demo-modal h3 { margin: 0 0 0.75rem; font-size: 1rem; color: var(--brand); }
.demo-modal select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}
.demo-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.demo-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--brand-dark);
  color: var(--white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  z-index: 300;
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  max-width: 320px;
}
.demo-toast.show { transform: translateY(0); opacity: 1; }

.demo-view { display: none; }
.demo-view.active { display: block; }

@media (max-width: 960px) {
  .demo-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .demo-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .demo-app { grid-template-columns: 1fr; }
  .demo-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }
  .demo-sidebar-brand { display: none; }
  .demo-sidebar-foot { display: none; }
  .demo-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: 100%;
  }
  .demo-nav button {
    width: auto;
    padding: 0.45rem 0.65rem;
    border-left: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
  }
  .demo-nav button.active {
    background: rgba(255, 255, 255, 0.15);
    border-left: none;
  }
  .demo-kpi-row { grid-template-columns: 1fr 1fr; }
}
