/* PASI Niubiz DS26-aligned responsive refinement. */
:root {
  --niubiz-navy-950: #07162d;
  --niubiz-navy-900: #0b2345;
  --niubiz-navy-700: #173f70;
  --niubiz-lime-500: #b8d80a;
  --niubiz-lime-400: #c9e52b;
  --niubiz-sky-500: #22a7df;
  --niubiz-neutral-50: #f7f9fc;
  --niubiz-neutral-200: #dce3ed;
  --niubiz-neutral-600: #526078;
  --ux-sidebar-expanded: 280px;
  --ux-sidebar-collapsed: 76px;
  --ux-touch-target: 44px;
  --ux-focus: 0 0 0 3px rgba(34, 167, 223, .3);
  --font-sans: Montserrat, Inter, ui-sans-serif, system-ui, sans-serif;
}

html { overflow-x: clip; }
body { font-family: var(--font-sans); overflow-x: clip; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--niubiz-sky-500); outline-offset: 2px; }
.btn, .icon-btn, .nav-item { min-height: var(--ux-touch-target); }
.icon-btn:focus-visible, .btn:focus-visible { box-shadow: var(--ux-focus); }

.sidebar { width: var(--ux-sidebar-expanded); background: var(--niubiz-navy-950); }
.main-shell { margin-left: var(--ux-sidebar-expanded); }
.brand-badge { background: var(--niubiz-lime-500); color: var(--niubiz-navy-950); box-shadow: none; }
.nav-item.active { background: rgba(34, 167, 223, .14); box-shadow: inset 3px 0 var(--niubiz-lime-400); }
.nav-item.active::before { display: none; }
.sidebar-overlay { position: fixed; inset: 0; z-index: 39; background: rgba(3, 12, 27, .62); opacity: 0; visibility: hidden; transition: opacity .2s ease; }
.sidebar-overlay.visible { opacity: 1; visibility: visible; }
.topbar { background: rgba(7, 22, 45, .94); }
.page-title { overflow-wrap: anywhere; }
.page-subtitle { max-width: 70ch; }
.card, .stat-card, .metric-card { box-shadow: 0 8px 24px rgba(2, 12, 30, .18); }
.btn.primary { background: var(--niubiz-lime-500); color: var(--niubiz-navy-950); }
.btn.primary:hover { background: var(--niubiz-lime-400); }
.table-wrap { max-width: 100%; overscroll-behavior-inline: contain; }
table { min-width: 720px; }
th, td { overflow-wrap: anywhere; }
.form-grid > *, .split-grid > *, .content-grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }
.modal, [role="dialog"] { max-width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.drawer { width: min(520px, 100vw); max-height: 100dvh; overflow-y: auto; }
.chart-box, .mini-chart { max-width: 100%; overflow: hidden; }
.chart-box canvas, .mini-chart canvas { max-width: 100% !important; }

/* Login stays intentionally free of runtime and infrastructure detail. */
.pasi-login-v11 { min-height: 100dvh; padding: clamp(16px, 4vw, 48px); }
.pasi-login-shell { width: min(1120px, 100%); }
.pasi-login-card { min-width: 0; }
.pasi-login-form input { min-height: 48px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 58px; }
.password-wrap .icon-btn { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); box-shadow: none; }
.pasi-login-foot { justify-content: center; }

@media (max-width: 1199px) and (min-width: 768px) {
  .sidebar { width: var(--ux-sidebar-collapsed); }
  .main-shell { margin-left: var(--ux-sidebar-collapsed); }
  .brand-copy, .nav-group-title, .nav-item span, .nav-badge, .sidebar-footer .user-chip > div:not(.user-avatar), .env-chip { display: none; }
  .sidebar-brand, .nav-item { justify-content: center; }
  .nav-item { padding-inline: 8px; }
  .nav-item::after { content: attr(aria-label); position: absolute; left: calc(100% + 10px); top: 50%; z-index: 60; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--niubiz-navy-900); color: #fff; font-size: .78rem; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(-50%); pointer-events: none; }
  .nav-item:hover::after, .nav-item:focus-visible::after { opacity: 1; visibility: visible; }
  .grid-4, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions .btn { padding-inline: 12px; }
}

@media (max-width: 767px) {
  .layout-shell { display: block; }
  .sidebar { width: min(88vw, 320px); transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .main-shell { margin-left: 0; width: 100%; }
  .mobile-only { display: inline-flex; }
  .topbar-inner { min-height: 68px; padding: 10px 14px; }
  .topbar-left { width: 100%; }
  .topbar-left > div:last-child { min-width: 0; }
  .page-title { font-size: clamp(1.1rem, 5vw, 1.35rem); }
  .page-subtitle { display: none; }
  .topbar-actions { display: none; }
  .page-shell { padding: 16px 12px 32px; }
  .page-inner { gap: 14px; }
  .page-toolbar { align-items: stretch; }
  .page-toolbar, .toolbar, .filter-bar { flex-direction: column; }
  .page-toolbar .btn, .toolbar .btn, .filter-bar .btn, .form-actions .btn { width: 100%; }
  .content-grid, .split-grid, .form-grid, .grid-2, .grid-3, .grid-4, .stats-grid, .split, .studio-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .content-grid > *, .split-grid > *, .form-grid > * { grid-column: 1 !important; }
  .card { padding: 16px; border-radius: 16px; }
  .metric-card, .stat-card { min-height: auto; }
  table { min-width: 680px; }
  .table-wrap { border-radius: 12px; scrollbar-width: thin; }
  th, td { padding: 11px 12px; }
  .pagination { display: flex; max-width: 100%; flex-wrap: wrap; justify-content: center; }
  .modal, [role="dialog"] { width: calc(100vw - 20px); max-width: none; max-height: calc(100dvh - 20px); margin: 10px; border-radius: 16px; }
  .drawer { width: 100vw; }
  .chat-bubble { max-width: 92%; }
  .toast-wrap { inset: 12px 12px auto; }
  .toast { max-width: none; }
  .pasi-login-story { display: none; }
  .pasi-login-shell { display: block; }
  .pasi-login-card { width: 100%; padding: clamp(20px, 6vw, 30px); border-radius: 20px; }
  .pasi-login-card-head { align-items: flex-start; }
  .pasi-login-submit { width: 100%; min-height: 48px; }
}

@media (max-width: 359px) {
  .pasi-login-v11 { padding: 10px; }
  .pasi-login-card { padding: 18px 14px; }
  .card { padding: 14px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
