/* ============================================================
   Sovereign IT – Demo Pages Stylesheet
   ============================================================ */

/* ── Demo Page Layout ──────────────────────────────────────── */
.demo-page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1a4a7a 100%);
  padding: 6rem 0 3rem;
  margin-top: 64px;
}
.demo-page-hero h1 { color: var(--white); font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: .6rem; }
.demo-page-hero p { color: rgba(255,255,255,.78); font-size: 1rem; max-width: 660px; margin-bottom: 0; }

.demo-live-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(37,99,235,.25); color: #93c5fd;
  border: 1px solid rgba(37,99,235,.4);
  font-size: .75rem; font-weight: 700; padding: .3rem .8rem;
  border-radius: 20px; margin-bottom: .9rem; letter-spacing: .06em;
  text-transform: uppercase;
}
.demo-live-badge::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #60a5fa; display: inline-block;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.75); }
}

.demo-back-link {
  display: inline-flex; align-items: center; gap: .4rem;
  color: rgba(255,255,255,.65); font-size: .85rem; text-decoration: none;
  margin-bottom: 1.25rem; transition: color .18s;
}
.demo-back-link:hover { color: var(--white); }
.demo-back-link svg { width: 16px; height: 16px; }

/* ── Main Demo Container ────────────────────────────────────── */
.demo-container {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
}
.demo-section {
  padding: 2.5rem 0 3rem;
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem;
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
  padding: 1.5rem; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--accent);
}
.kpi-card.green::before  { background: #16a34a; }
.kpi-card.orange::before { background: #ea580c; }
.kpi-card.purple::before { background: #7c3aed; }
.kpi-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400); margin-bottom: .4rem;
}
.kpi-value {
  font-size: 1.85rem; font-weight: 800; color: var(--navy); line-height: 1.1;
}
.kpi-sub {
  font-size: .8rem; color: var(--gray-400); margin-top: .25rem;
}
.kpi-change {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .78rem; font-weight: 600; margin-top: .3rem;
  padding: .15rem .5rem; border-radius: 12px;
}
.kpi-change.up   { background: #f0fdf4; color: #16a34a; }
.kpi-change.down { background: #fef2f2; color: #dc2626; }

/* ── Data Table Panel ───────────────────────────────────────── */
.dt-panel {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dt-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  gap: 1rem; flex-wrap: wrap;
}
.dt-toolbar-left {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; flex: 1;
}
.dt-toolbar h3 {
  font-size: 1rem; font-weight: 700; color: var(--navy); white-space: nowrap;
}
.dt-search {
  position: relative; flex: 1; min-width: 200px; max-width: 320px;
}
.dt-search input {
  width: 100%; padding: .5rem .75rem .5rem 2.2rem;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: .875rem; font-family: inherit; color: var(--gray-800);
  background: var(--gray-50); transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.dt-search input:focus {
  border-color: var(--accent); background: var(--white);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.dt-search-icon {
  position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); pointer-events: none;
}
.dt-filter {
  padding: .5rem .75rem; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-size: .875rem; font-family: inherit;
  color: var(--gray-800); background: var(--gray-50);
  cursor: pointer; outline: none; transition: border-color .18s;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center;
  padding-right: 1.8rem;
}
.dt-filter:focus { border-color: var(--accent); }

.dt-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem 1rem; border-radius: 8px; font-size: .875rem;
  font-weight: 600; font-family: inherit; cursor: pointer;
  border: none; transition: var(--transition); white-space: nowrap;
}
.dt-btn-primary { background: var(--accent); color: var(--white); }
.dt-btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.dt-btn-ghost {
  background: transparent; color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}
.dt-btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--light-blue); }
.dt-btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.dt-btn-danger { background: #fef2f2; color: #dc2626; border: 1.5px solid #fecaca; }
.dt-btn-danger:hover { background: #dc2626; color: var(--white); }

/* ── Table ──────────────────────────────────────────────────── */
.dt-wrapper { overflow-x: auto; }
.dt-table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
  min-width: 600px;
}
.dt-table thead tr { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.dt-table thead th {
  padding: .75rem 1rem; text-align: left; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--gray-600);
  white-space: nowrap; user-select: none;
}
.dt-table thead th.sortable { cursor: pointer; }
.dt-table thead th.sortable:hover { color: var(--accent); }
.dt-table thead th .sort-arrow { margin-left: .3rem; opacity: .4; font-size: .75rem; }
.dt-table thead th.sort-asc .sort-arrow,
.dt-table thead th.sort-desc .sort-arrow { opacity: 1; color: var(--accent); }
.dt-table thead th.sort-asc  .sort-arrow::after { content: ' ↑'; }
.dt-table thead th.sort-desc .sort-arrow::after { content: ' ↓'; }
.dt-table thead th:not(.sort-asc):not(.sort-desc) .sort-arrow::after { content: ' ↕'; }

.dt-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.dt-table tbody tr:hover { background: #f8faff; }
.dt-table tbody tr:last-child { border-bottom: none; }
.dt-table td { padding: .75rem 1rem; color: var(--gray-800); vertical-align: middle; }
.dt-table td.muted { color: var(--gray-400); }
.dt-table td .actions { display: flex; gap: .4rem; }

/* Expandable row */
.dt-expand-row {
  display: none; background: var(--light-blue);
  border-bottom: 1px solid #bfdbfe;
}
.dt-expand-row.open { display: table-row; }
.dt-expand-row td { padding: .75rem 1.25rem; color: var(--gray-800); font-size: .85rem; line-height: 1.65; }
.dt-expand-btn { cursor: pointer; font-size: .85rem; color: var(--accent); background: none; border: none; font-family: inherit; padding: 0; }
.dt-expand-btn:hover { text-decoration: underline; }

/* ── Status Badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-block; font-size: .75rem; font-weight: 700;
  padding: .22rem .7rem; border-radius: 20px; white-space: nowrap;
}
.s-aktiv, .s-abgeschlossen, .s-gelöst, .s-genehmigt {
  background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0;
}
.s-inaktiv, .s-archiviert, .s-geschlossen, .s-abgelehnt, .s-fehler {
  background: #fef2f2; color: #dc2626; border: 1px solid #fecaca;
}
.s-testphase, .s-entwurf, .s-läuft, .s-in-bearbeitung {
  background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa;
}
.s-offen, .s-neu {
  background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe;
}

/* Priority badges */
.p-hoch   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.p-mittel { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.p-niedrig{ background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Quality stars */
.quality-stars { color: #f59e0b; font-size: .95rem; letter-spacing: .05rem; }

/* SLA indicator */
.sla-ok  { color: #16a34a; font-weight: 700; font-size: .8rem; }
.sla-due { color: #dc2626; font-weight: 700; font-size: .8rem; }

/* ── Pagination ─────────────────────────────────────────────── */
.dt-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem; border-top: 1px solid var(--gray-200);
  flex-wrap: wrap; gap: .75rem;
}
.dt-info { font-size: .82rem; color: var(--gray-400); }
.dt-pagination { display: flex; gap: .4rem; align-items: center; }
.dt-page-btn {
  padding: .35rem .7rem; border: 1.5px solid var(--gray-200);
  border-radius: 7px; font-size: .8rem; font-weight: 600; cursor: pointer;
  background: var(--white); color: var(--gray-600); transition: var(--transition);
  font-family: inherit;
}
.dt-page-btn:hover { border-color: var(--accent); color: var(--accent); }
.dt-page-btn.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
.dt-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Empty State ────────────────────────────────────────────── */
.dt-empty {
  text-align: center; padding: 3rem 1rem; color: var(--gray-400);
}
.dt-empty svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .4; }
.dt-empty p { font-size: .9rem; }

/* ── Loading skeleton ────────────────────────────────────────── */
.dt-loading { text-align: center; padding: 2.5rem 1rem; color: var(--gray-400); font-size: .9rem; }
.dt-skeleton { height: 44px; background: var(--gray-100); border-radius: 6px; margin-bottom: 2px; animation: shimmer 1.2s infinite; }
@keyframes shimmer {
  0%   { opacity: 1; }
  50%  { opacity: .5; }
  100% { opacity: 1; }
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,38,68,.7); z-index: 2000;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { transform: scale(.95) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; color: var(--navy); }
.modal-close {
  background: none; border: none; cursor: pointer; padding: .25rem;
  color: var(--gray-400); font-size: 1.3rem; line-height: 1;
  transition: color .18s;
}
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: .75rem;
}

/* Form fields inside modal */
.mf-group { margin-bottom: 1rem; }
.mf-label { display: block; font-size: .83rem; font-weight: 600; color: var(--gray-800); margin-bottom: .35rem; }
.mf-input, .mf-select, .mf-textarea {
  width: 100%; padding: .55rem .85rem;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: .875rem; font-family: inherit; color: var(--gray-800);
  background: var(--white); transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.mf-input:focus, .mf-select:focus, .mf-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.mf-select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
  padding-right: 2.2rem;
}
.mf-textarea { resize: vertical; min-height: 80px; }
.mf-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ── Toast notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 3000;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--navy); color: var(--white);
  padding: .75rem 1.25rem; border-radius: 10px; font-size: .875rem;
  font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,.25);
  pointer-events: auto; animation: toast-in .25s ease;
  display: flex; align-items: center; gap: .6rem; max-width: 320px;
}
.toast.success { background: #15803d; }
.toast.error   { background: #dc2626; }
.toast.info    { background: var(--accent); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.toast-out { animation: toast-out .25s ease forwards; }
@keyframes toast-out {
  to { transform: translateX(20px); opacity: 0; }
}

/* ── Demo CTA ───────────────────────────────────────────────── */
.demo-cta {
  background: linear-gradient(135deg, var(--navy), #1a4a7a);
  border-radius: var(--radius-lg); padding: 2.5rem;
  text-align: center; margin: 2rem 0 3rem;
}
.demo-cta h3 { color: var(--white); margin-bottom: .6rem; font-size: 1.3rem; }
.demo-cta p  { color: rgba(255,255,255,.75); margin-bottom: 1.5rem; max-width: 560px; margin-left: auto; margin-right: auto; }

/* ── Role Switcher ──────────────────────────────────────────── */
.role-switcher {
  display: flex; align-items: center; gap: .65rem;
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
  border: 1px solid #dbeafe;
  border-radius: 16px; padding: .85rem 1rem;
  margin-bottom: 1.5rem; flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(37,99,235,.08), 0 2px 8px rgba(15,38,68,.05);
}
.role-switcher-label {
  font-size: .72rem; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em; margin-right: .25rem; white-space: nowrap;
}
.role-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border: 1.5px solid transparent;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  cursor: pointer;
  font-size: .84rem; font-weight: 700; color: var(--navy);
  transition: all .18s ease; font-family: inherit; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(15,38,68,.06);
}
.role-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37,99,235,.12);
}
.role-btn.active {
  color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.22);
}
.role-btn.role-al.active { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #1d4ed8; }
.role-btn.role-tl.active { background: linear-gradient(135deg, #16a34a, #15803d); border-color: #15803d; }
.role-btn.role-ma.active { background: linear-gradient(135deg, #7c3aed, #6d28d9); border-color: #6d28d9; }
.role-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 800; flex-shrink: 0;
}
.role-btn.active .role-avatar { background: rgba(255,255,255,.2); color: #fff; }
.role-btn:not(.active).role-al { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.role-btn:not(.active).role-tl { border-color: #bbf7d0; color: #15803d; background: #f0fdf4; }
.role-btn:not(.active).role-ma { border-color: #e9d5ff; color: #7e22ce; background: #faf5ff; }
.role-btn:not(.active) .role-avatar.al { background: #dbeafe; color: #1d4ed8; }
.role-btn:not(.active) .role-avatar.tl { background: #dcfce7; color: #15803d; }
.role-btn:not(.active) .role-avatar.ma { background: #f3e8ff; color: #7e22ce; }
.role-context-bar {
  display: flex; align-items: flex-start; gap: .75rem;
  border-radius: 8px; padding: .7rem 1.1rem; margin-bottom: 1.25rem;
  font-size: .84rem; border-left: 3px solid; flex-wrap: wrap;
}
.role-context-bar.al { background: #eff6ff; border-color: #2563eb; color: #1e40af; }
.role-context-bar.tl { background: #f0fdf4; border-color: #16a34a; color: #14532d; }
.role-context-bar.ma { background: #fdf4ff; border-color: #7c3aed; color: #581c87; }
.role-context-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.role-context-text strong { display: block; font-size: .85rem; font-weight: 700; }
.role-context-text span { font-size: .78rem; opacity: .8; }
.role-tag {
  display: inline-flex; align-items: center;
  padding: .18rem .6rem; border-radius: 20px; font-size: .73rem; font-weight: 700;
}
.role-tag.al { background: #dbeafe; color: #1d4ed8; }
.role-tag.tl { background: #dcfce7; color: #15803d; }
.role-tag.ma { background: #f3e8ff; color: #7e22ce; }
.kpi-grid-3 { grid-template-columns: repeat(3,1fr) !important; }
/* Hide/show role-gated views */
.role-view { display: none; }
.role-view.active { display: block; }

/* ── Approval / Action Bars ─────────────────────────────────── */
.approval-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff7ed; border: 1.5px solid #fed7aa; border-radius: 10px;
  padding: .7rem 1.1rem; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem;
}
.approval-bar .approval-info { font-size: .84rem; color: #92400e; font-weight: 600; }
.approval-bar .approval-actions { display: flex; gap: .4rem; }
.btn-approve { background: #16a34a; color: #fff; border: none; border-radius: 7px; padding: .35rem .85rem; font-size: .82rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-approve:hover { background: #15803d; }
.btn-reject  { background: #dc2626; color: #fff; border: none; border-radius: 7px; padding: .35rem .85rem; font-size: .82rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-reject:hover  { background: #b91c1c; }
.btn-delegate { background: #fff; color: var(--navy); border: 1.5px solid var(--gray-200); border-radius: 7px; padding: .35rem .85rem; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(2,1fr) !important; }
}
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dt-toolbar { flex-direction: column; align-items: stretch; }
  .dt-toolbar-left { flex-direction: column; align-items: stretch; }
  .dt-search { max-width: 100%; }
  .mf-row { grid-template-columns: 1fr; }
  .role-switcher { gap: .35rem; padding: .7rem .85rem; }
  .role-btn { padding: .45rem .85rem; font-size: .8rem; }
  .role-context-bar { padding: .6rem .85rem; font-size: .8rem; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-grid-3 { grid-template-columns: 1fr !important; }
  .role-btn { padding: .4rem .65rem; font-size: .76rem; gap: .35rem; }
  .role-avatar { width: 20px; height: 20px; font-size: .58rem; }
  .role-switcher-label { font-size: .68rem; }
  .kpi-card { padding: 1.1rem 1.25rem; }
}

/* ── Demo App Switcher Bar ──────────────────────────────────── */
.demo-app-switcher {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 1px 4px rgba(15,38,68,.06);
}
.demo-app-switcher-inner {
  display: flex; align-items: center; gap: .4rem;
  padding: .6rem 0; overflow-x: auto; flex-wrap: nowrap;
  scrollbar-width: none;
}
.demo-app-switcher-inner::-webkit-scrollbar { display: none; }
.demo-app-switcher-label {
  font-size: .7rem; font-weight: 800; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .07em;
  white-space: nowrap; margin-right: .25rem; flex-shrink: 0;
}
.demo-app-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .35rem .85rem; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  text-decoration: none; transition: all .15s;
  border: 1.5px solid var(--gray-200); color: var(--gray-600);
  background: var(--gray-50); flex-shrink: 0;
}
.demo-app-chip:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--light-blue); transform: translateY(-1px);
}
.demo-app-chip-active {
  background: var(--accent); color: var(--white) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 3px 10px rgba(37,99,235,.25);
}
.demo-app-chip-active:hover { transform: none; }
.demo-app-chip-more {
  margin-left: .35rem;
  background: var(--gray-100); color: var(--gray-500);
  border-style: dashed;
}
.demo-app-chip-more:hover { background: var(--white); }

/* ── Demo App Shell ─────────────────────────────────────────── */
.demo-app-shell {
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.12), transparent 28%),
    linear-gradient(180deg, #e8efff 0%, #eef3f9 20%, #f4f7fb 100%);
  min-height: 70vh;
  padding: 1.5rem 0 2.5rem;
}

.miniapp-frame {
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(15,23,42,.12);
  overflow: hidden;
  backdrop-filter: blur(16px);
}
.miniapp-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(226,232,240,.9);
  background: rgba(248,250,252,.92);
}
.miniapp-topbar-main, .miniapp-topbar-actions, .miniapp-meta, .miniapp-search {
  display: flex; align-items: center; gap: .75rem;
}
.miniapp-dot-row { display: inline-flex; gap: .35rem; }
.miniapp-dot-row span {
  width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1;
}
.miniapp-dot-row span:nth-child(1) { background: #f87171; }
.miniapp-dot-row span:nth-child(2) { background: #fbbf24; }
.miniapp-dot-row span:nth-child(3) { background: #34d399; }
.miniapp-meta { flex-wrap: wrap; }
.miniapp-title { font-size: .98rem; font-weight: 800; color: var(--navy); }
.miniapp-subtitle { font-size: .78rem; color: var(--gray-400); }
.miniapp-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
  color: #1d4ed8; background: #dbeafe; border: 1px solid #bfdbfe;
}
.miniapp-pill.success { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.miniapp-pill.warn { color: #9a3412; background: #ffedd5; border-color: #fdba74; }
.miniapp-layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 980px;
}
.miniapp-sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #162338 100%);
  color: rgba(255,255,255,.84);
  padding: 1.2rem;
  border-right: 1px solid rgba(255,255,255,.06);
}
.miniapp-brand {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1.3rem;
}
.miniapp-brand-icon {
  width: 40px; height: 40px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff; font-size: 1.1rem; box-shadow: 0 10px 25px rgba(37,99,235,.35);
}
.miniapp-brand-copy strong { display: block; font-size: .92rem; color: #fff; }
.miniapp-brand-copy span { font-size: .75rem; color: rgba(255,255,255,.58); }
.miniapp-sidebar-group { margin-top: 1.2rem; }
.miniapp-sidebar-label {
  display: block; margin-bottom: .55rem; font-size: .68rem; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 800; color: rgba(255,255,255,.42);
}
.miniapp-nav { display: flex; flex-direction: column; gap: .35rem; }
.miniapp-nav a, .miniapp-nav button {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  width: 100%; padding: .78rem .85rem; border-radius: 14px; border: 1px solid transparent;
  background: transparent; color: rgba(255,255,255,.8); text-decoration: none;
  font-size: .84rem; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .18s ease;
}
.miniapp-nav a:hover, .miniapp-nav button:hover,
.miniapp-nav a.active, .miniapp-nav button.active {
  background: rgba(255,255,255,.08); border-color: rgba(191,219,254,.18); color: #fff;
}
.miniapp-nav small {
  padding: .12rem .42rem; border-radius: 999px; background: rgba(96,165,250,.18);
  color: #bfdbfe; font-size: .68rem; font-weight: 700;
}
.miniapp-sidebar-card {
  margin-top: 1rem; padding: 1rem; border-radius: 18px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
}
.miniapp-sidebar-card h4 { font-size: .86rem; color: #fff; margin-bottom: .35rem; }
.miniapp-sidebar-card p { font-size: .76rem; line-height: 1.55; color: rgba(255,255,255,.66); margin-bottom: .8rem; }
.miniapp-sidebar-card .btn,
.miniapp-sidebar-card .btn-outline {
  width: 100%; justify-content: center;
}
.miniapp-workspace {
  background: linear-gradient(180deg, rgba(248,250,252,.92) 0%, rgba(241,245,249,.96) 100%);
  padding: 1.25rem;
}
.miniapp-workspace-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.miniapp-workspace-title h2 { font-size: 1.45rem; color: var(--navy); margin-bottom: .2rem; }
.miniapp-workspace-title p { margin: 0; font-size: .88rem; color: var(--gray-400); max-width: 720px; }
.miniapp-utilitybar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.15rem; padding: .95rem 1rem;
  border-radius: 18px; background: rgba(255,255,255,.88); border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 10px 25px rgba(15,23,42,.05);
}
.miniapp-utilitybar-left, .miniapp-utilitybar-right {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.miniapp-search input {
  min-width: 220px; padding: .62rem .9rem; border-radius: 12px; border: 1px solid var(--gray-200);
  background: #fff; font: inherit; outline: none;
}
.miniapp-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.miniapp-stat-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1rem;
}
.miniapp-stat {
  background: rgba(15,23,42,.92); color: #fff; border-radius: 18px; padding: 1rem 1.05rem;
  box-shadow: 0 12px 30px rgba(15,23,42,.18);
}
.miniapp-stat span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.58); margin-bottom: .45rem; }
.miniapp-stat strong { display: block; font-size: 1.28rem; }
.miniapp-stat em { display: block; margin-top: .35rem; font-style: normal; font-size: .78rem; color: rgba(255,255,255,.68); }
.miniapp-panel-grid {
  display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr); gap: 1rem; align-items: start;
}
.miniapp-glass {
  background: rgba(255,255,255,.88); border: 1px solid rgba(226,232,240,.9);
  border-radius: 22px; box-shadow: 0 14px 35px rgba(15,23,42,.07);
}
.miniapp-glass.pad { padding: 1rem; }
.miniapp-section-title { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: .85rem; }
.miniapp-section-title h3 { font-size: 1rem; color: var(--navy); }
.miniapp-section-title p { margin: .2rem 0 0; color: var(--gray-400); font-size: .8rem; }
.miniapp-list { display: grid; gap: .75rem; }
.miniapp-list-item {
  padding: .9rem 1rem; border-radius: 16px; background: #fff; border: 1px solid var(--gray-100);
}
.miniapp-list-item strong { color: var(--navy); display: block; margin-bottom: .2rem; }
.miniapp-list-item span { color: var(--gray-400); font-size: .78rem; line-height: 1.45; }
@media (max-width: 1100px) {
  .miniapp-layout { grid-template-columns: 1fr; }
  .miniapp-sidebar { border-right: none; border-bottom: 1px solid rgba(255,255,255,.08); }
  .miniapp-panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .miniapp-topbar, .miniapp-workspace-header, .miniapp-utilitybar { flex-direction: column; align-items: stretch; }
  .miniapp-stat-strip, .kpi-grid { grid-template-columns: 1fr; }
  .miniapp-search input { min-width: 0; width: 100%; }
}
@media (max-width: 640px) {
  .demo-app-switcher {
    position: sticky; top: 64px; z-index: 45;
    backdrop-filter: blur(14px);
    background: rgba(255,255,255,.88);
  }
  .demo-app-switcher-inner { gap: .3rem; padding: .5rem 0; }
  .demo-app-switcher-label { display: none; }
  .demo-app-chip { padding: .38rem .7rem; font-size: .78rem; }
  .demo-app-chip-more { display: none; }
  .demo-app-shell { padding: .85rem 0 5.6rem; }
}

.demo-mobile-dock { display: none; }

/* ── Demo page-hero mobile tightening ────────────────────────── */
@media (max-width: 768px) {
  .demo-page-hero {
    padding: 4.5rem 0 2rem;
  }
  .demo-page-hero h1 { font-size: clamp(1.35rem, 5vw, 1.9rem); }
  .demo-page-hero p  { font-size: .92rem; }

  .demo-mobile-dock {
    position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: 80;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem;
    padding: .55rem; border-radius: 20px;
    background: rgba(15,23,42,.9);
    box-shadow: 0 16px 40px rgba(15,23,42,.24);
    backdrop-filter: blur(16px);
  }
  .demo-mobile-dock-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 42px; padding: .65rem .75rem; border-radius: 14px;
    text-decoration: none; font-size: .8rem; font-weight: 700;
    color: rgba(255,255,255,.86); background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
  }
  .demo-mobile-dock-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; border-color: rgba(96,165,250,.35);
  }
}
@media (max-width: 480px) {
  .demo-page-hero { padding: 4rem 0 1.5rem; }
  .demo-page-hero h1 { font-size: 1.3rem; }
}

/* ── Demo CTA mobile ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .demo-cta { padding: 1.75rem 1.25rem; }
  .demo-cta h3 { font-size: 1.1rem; }
  .demo-cta p  { font-size: .875rem; }
}

/* ── Modal mobile ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .modal-overlay { padding: .75rem .5rem; align-items: flex-end; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
}

/* ── Minimum touch target for action buttons ─────────────────── */
@media (max-width: 768px) {
  .dt-btn, .wf-btn, .kp-btn, .dms-btn { min-height: 36px; }
  .dt-btn-sm { min-height: 32px; }
}

/* ── Touch feedback – mobile tap states ─────────────────────── */
.dt-btn, .wf-btn, .kp-btn, .dms-btn { touch-action: manipulation; }
.kb-card:active    { transform: scale(.97) !important; box-shadow: var(--shadow-sm) !important; transition: transform .08s, box-shadow .08s; }
.ki-model-card:active { transform: scale(.98); background: #f0f6ff; }
.miniapp-list-item:active { background: var(--gray-100); }
.app-sidebar-item:active { background: var(--gray-100); }
.demo-app-chip:active { transform: scale(.96); }

/* ── Tab-pane fade-in animation ─────────────────────────────── */
.tab-pane.active,
.ki-tab-pane.active,
.role-view.active,
.app-topbar-nav-item { transition: color .15s; }
.tab-pane, .ki-tab-pane { animation: none; }
.tab-pane.active, .ki-tab-pane.active { animation: tabFadeIn .18s ease; }
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Kanban scroll gradient hint ────────────────────────────── */
.kanban-scroll-wrap {
  position: relative;
}
.kanban-scroll-hint {
  display: none;
}
@media (max-width: 768px) {
  .kanban-scroll-hint {
    display: flex; align-items: center; gap: .35rem;
    font-size: .73rem; color: var(--gray-400); font-weight: 600;
    margin-bottom: .5rem;
  }
  .kanban-scroll-hint::before,
  .kanban-scroll-hint::after {
    content: ''; flex: 1; height: 1px; background: var(--gray-200);
  }
}

/* ── Safe-area aware mobile dock ────────────────────────────── */
@media (max-width: 768px) {
  .demo-mobile-dock {
    bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
  }
  .demo-app-shell { padding-bottom: 5.6rem; }
}

/* ── Demo page: sticky KPI strip on mobile ──────────────────── */
@media (max-width: 640px) {
  .order-kpi-strip { position: sticky; top: calc(64px + 38px); z-index: 40; background: inherit; }
}

/* ── Progress bars: animate on load ────────────────────────── */
.prog-bar { transition: width .7s cubic-bezier(.4,0,.2,1); }

/* ── Better kpi-card at very small screens ──────────────────── */
@media (max-width: 360px) {
  .kpi-value { font-size: 1.5rem; }
  .kpi-card  { padding: 1.1rem; }
}
