:root{
  /* Light theme (default) */
  --p-bg-0:var(--color-gray-50,#f9fafb);
  --p-bg-1:var(--color-gray-100,#f2f4f7);
  --p-card:rgba(255,255,255,.80);
  --p-card-solid:#ffffff;
  --p-border:rgba(16,24,40,.10);
  --p-text:rgba(16,24,40,.95);
  --p-muted:rgba(16,24,40,.62);
  --p-accent:var(--color-brand-500,#465fff);
  --p-accent-2:var(--color-brand-300,#9cb9ff);
  --p-success:var(--color-success-500,#12b76a);
  --p-danger:var(--color-error-500,#f04438);
  --p-warning:var(--color-warning-500,#f79009);
  --p-shadow:var(--shadow-theme-lg, 0 12px 16px -4px rgba(16,24,40,.08));
  --p-radius:16px;
  --p-modal-backdrop-opacity:0.5;
  --p-modal-backdrop-color:rgba(0, 0, 0, 0.5);
  --bs-backdrop-opacity:0.5;
}

html.dark{
  /* Dark theme (RVU-like) */
  --p-bg-0:var(--color-gray-950,#0c111d);
  --p-bg-1:#0b1227;
  --p-card:rgba(15,26,52,.70);
  --p-card-solid:rgba(15,26,52,.92);
  --p-border:rgba(255,255,255,.10);
  --p-text:rgba(255,255,255,.92);
  --p-muted:rgba(255,255,255,.62);
  --p-shadow:var(--shadow-theme-xl, 0 20px 60px rgba(0,0,0,.45));
  --p-modal-backdrop-opacity:0.8;
  --p-modal-backdrop-color:rgba(0, 0, 0, 0.8);
  --bs-backdrop-opacity:0.8;
}

html,body{height:100%}
body{
  font-family:var(--font-outfit, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
  color:var(--p-text);
  --bs-body-color: var(--p-text);
  --bs-body-bg: transparent;
  background:
    radial-gradient(1200px 600px at 15% 10%, color-mix(in oklab, var(--p-accent) 25%, transparent), transparent 55%),
    radial-gradient(900px 520px at 80% 20%, color-mix(in oklab, var(--p-accent-2) 18%, transparent), transparent 55%),
    radial-gradient(850px 520px at 60% 85%, color-mix(in oklab, var(--p-success) 12%, transparent), transparent 55%),
    linear-gradient(180deg, var(--p-bg-0), var(--p-bg-1));
  overflow-x:hidden;
}

/* Layout shell */
.p-shell{
  display:flex;
  min-height:100vh;
  width:100%;
  --p-content-inset:clamp(12px, 1.1vw, 22px);
}
.p-sidebar{
  width:288px;
  flex:0 0 288px;
  background:linear-gradient(180deg, color-mix(in oklab, var(--p-card-solid) 75%, transparent), color-mix(in oklab, var(--p-card-solid) 88%, transparent));
  border-right:1px solid var(--p-border);
  backdrop-filter: blur(18px);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
  z-index:1030;
  display:flex;
  flex-direction:column;
}
.p-sidebar.is-collapsed{
  width:84px;
  flex:0 0 84px;
}
.p-sidebar.is-collapsed .p-brand__text,
.p-sidebar.is-collapsed .p-user__meta,
.p-sidebar.is-collapsed .p-nav__label{
  display:none;
}
.p-sidebar.is-collapsed .p-nav__link{justify-content:center}
.p-sidebar.is-collapsed .p-nav__icon{width:auto}
.p-sidebar.is-collapsed .p-user{justify-content:center}
.p-sidebar.is-collapsed .p-brand{justify-content:center}
.p-main{
  flex:1 1 auto;
  min-width:0;
  width:100%;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
.p-main > .td-main-header,
.p-main > .p-topbar{
  flex-shrink:0;
}
.p-main > .p-content,
.p-main > .td-main-content,
.p-main > #main-content{
  flex:1 1 auto;
  width:100%;
}
.p-app-footer{
  margin-top:auto;
  flex-shrink:0;
  width:100%;
  box-sizing:border-box;
}
.p-container{
  width:100%;
  max-width:none;
  margin:0;
  box-sizing:border-box;
}
.p-content{
  padding:18px var(--p-content-inset) 50px;
  box-sizing:border-box;
  width:100%;
}

/* RVU-like hero banner */
.p-hero{
  border-radius:var(--p-radius);
  border:1px solid var(--p-border);
  background:linear-gradient(90deg, color-mix(in oklab, var(--p-accent) 38%, transparent), color-mix(in oklab, var(--p-accent) 10%, transparent));
  box-shadow:var(--p-shadow);
}
.p-hero__inner{padding:16px 18px}
.p-hero__title{font-size:1.15rem; font-weight:800; letter-spacing:.2px}
.p-hero__sub{margin-top:2px}

/* Stat cards */
.p-stat{padding:14px 14px 12px}
.p-stat__label{color:var(--p-muted); font-size:.85rem}
.p-stat__value{font-size:1.55rem; font-weight:800; margin-top:6px; color:var(--p-text)}
.p-stat__hint{margin-top:2px; color:var(--p-muted)}

/* Topbar */
.p-topbar{
  height:64px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 18px;
  border-bottom:1px solid var(--p-border);
  background:linear-gradient(180deg, color-mix(in oklab, var(--p-card-solid) 72%, transparent), color-mix(in oklab, var(--p-card-solid) 45%, transparent));
  backdrop-filter: blur(18px);
  position:sticky;
  top:0;
  z-index:1020;
}
.p-topbar__title{display:flex; align-items:center; gap:10px; min-width:0}
.p-topbar__page{
  font-weight:700;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.p-topbar__actions{margin-left:auto; display:flex; align-items:center; gap:10px}

/* Brand + user */
.p-brand{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px}
.p-brand__link{
  display:flex; align-items:center; gap:10px;
  text-decoration:none; color:var(--p-text);
}
.p-brand__logo{
  width:38px; height:38px; border-radius:12px;
  display:grid; place-items:center;
  background:linear-gradient(135deg, rgba(70,95,255,.95), rgba(156,185,255,.55));
  box-shadow:0 18px 45px rgba(70,95,255,.25);
}
.p-brand__text{font-weight:800; letter-spacing:.3px}
.p-user{
  display:flex; align-items:center; gap:10px;
  padding:12px;
  border:1px solid var(--p-border);
  border-radius:var(--p-radius);
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent);
  margin-bottom:14px;
}
.p-user__avatar{
  width:38px; height:38px; border-radius:14px;
  display:grid; place-items:center;
  background:color-mix(in oklab, var(--p-accent) 18%, transparent);
  border:1px solid color-mix(in oklab, var(--p-accent) 35%, transparent);
}
.p-user__name{font-weight:700; line-height:1.1}
.p-user__role{font-size:.84rem; color:var(--p-muted)}

/* Nav */
.p-nav{display:flex; flex-direction:column; gap:8px; margin:10px 0 14px}
.p-nav__link{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:14px;
  text-decoration:none;
  color:var(--p-text);
  border:1px solid transparent;
  background:transparent;
  transition:transform .12s ease, background .12s ease, border-color .12s ease;
}
.p-nav__icon{width:22px; text-align:center; color:color-mix(in oklab, var(--p-text) 70%, transparent)}
.p-nav__link:hover{
  background:color-mix(in oklab, var(--p-card-solid) 35%, transparent);
  border-color:color-mix(in oklab, var(--p-border) 65%, transparent);
  transform:translateY(-1px);
}
.p-nav__link.is-active{
  background:linear-gradient(135deg, color-mix(in oklab, var(--p-accent) 22%, transparent), color-mix(in oklab, var(--p-accent-2) 10%, transparent));
  border-color:color-mix(in oklab, var(--p-accent) 35%, transparent);
}
.p-sidebar__footer{margin-top:auto; padding-top:10px; border-top:1px solid var(--p-border)}

/* Buttons / chips */
.p-iconbtn{
  width:40px; height:40px;
  border-radius:14px;
  border:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent);
  color:var(--p-text);
  display:grid; place-items:center;
}
html:not(.dark) .p-iconbtn:hover{
  background:#f2f4f7;
  border-color:#d0d5dd;
}
html.dark .p-iconbtn:hover{background:rgba(255,255,255,.05)}
.p-chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent);
  color:var(--p-text);
  text-decoration:none;
}
html:not(.dark) .p-chip:hover{background:#f2f4f7}
html.dark .p-chip:hover{background:rgba(255,255,255,.05)}

/* Profile dropdown */
.p-profile{gap:10px}
.p-profile.dropdown-toggle::after{margin-left:10px; opacity:.7}
.p-profile__avatar{
  width:28px; height:28px; border-radius:10px;
  display:grid; place-items:center;
  border:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-accent) 12%, transparent);
}
.p-profile__meta{flex-direction:column; line-height:1.1; align-items:flex-start}
.p-profile__name{font-weight:800; font-size:.9rem}
.p-profile__role{font-size:.75rem; color:var(--p-muted)}

.dropdown-menu{
  border-radius:14px;
  border:1px solid var(--p-border);
  background:var(--p-card-solid);
  box-shadow:var(--p-shadow);
}
.dropdown-item{color:var(--p-text)}
.dropdown-item:hover{background:color-mix(in oklab, var(--p-accent) 10%, transparent); color:var(--p-text)}
.dropdown-divider{border-top-color:var(--p-border)}
html:not(.dark) .dropdown-menu{background:#fff}

/* Content cards (bootstrap override-safe) */
.card{
  border-radius:var(--p-radius) !important;
  border:1px solid var(--p-border) !important;
  background:var(--p-card) !important;
  box-shadow:var(--p-shadow) !important;
}
.card-header{
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent) !important;
  border-bottom:1px solid var(--p-border) !important;
  color:var(--p-text) !important;
  padding-inline:var(--platform-table-inset-x, var(--bs-card-cap-padding-x, 1rem)) !important;
}
/* Align table columns with card header / panel title text */
.p-shell{
  --platform-table-inset-x:var(--bs-card-cap-padding-x, 1rem);
}
.p-shell .card > .table-responsive > .table > :not(caption) > * > *:first-child,
.p-shell .card > .card-body.p-0 > .table-responsive > .table > :not(caption) > * > *:first-child,
.p-shell .card > .card-body.p-0 > .table > :not(caption) > * > *:first-child,
.p-shell .card > .card-body > .table-responsive > .table > :not(caption) > * > *:first-child{
  padding-left:var(--platform-table-inset-x) !important;
}
.p-shell .card > .table-responsive > .table > :not(caption) > * > *:last-child,
.p-shell .card > .card-body.p-0 > .table-responsive > .table > :not(caption) > * > *:last-child,
.p-shell .card > .card-body.p-0 > .table > :not(caption) > * > *:last-child,
.p-shell .card > .card-body > .table-responsive > .table > :not(caption) > * > *:last-child{
  padding-right:var(--platform-table-inset-x) !important;
}
.table{
  color:var(--p-text);
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,.02);
  --bs-table-hover-bg: rgba(255,255,255,.03);
  --bs-table-color: var(--p-text);
}
.table > :not(caption) > * > *{background-color: transparent !important}
.table thead th{
  color:color-mix(in oklab, var(--p-text) 78%, transparent) !important;
  border-bottom:1px solid var(--p-border) !important;
}
.table td, .table th{border-color:var(--p-border) !important}
.table-hover tbody tr:hover{background:rgba(255,255,255,.03)}

/* Table readability per theme */
html:not(.dark) .table thead th{
  background: rgba(255,255,255,.55) !important;
  color: rgba(16,24,40,.82) !important;
}
html:not(.dark) .table td{
  color: rgba(16,24,40,.92) !important;
}
html:not(.dark) .table-hover tbody tr:hover{
  background: rgba(70,95,255,.06) !important;
}

html.dark .table thead th{
  background: rgba(255,255,255,.02) !important;
  color: rgba(255,255,255,.78) !important;
}
html.dark .table td{
  color: rgba(255,255,255,.88) !important;
}
html.dark .table-hover tbody tr:hover{
  background: rgba(255,255,255,.03) !important;
}

.form-control, .form-select{
  border-radius:14px !important;
  border:1px solid var(--p-border) !important;
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent) !important;
  color:var(--p-text) !important;
}
html:not(.dark) .form-control,
html:not(.dark) .form-select{color-scheme:light}
html.dark .form-control,
html.dark .form-select{color-scheme:dark}
.form-control::placeholder{color:color-mix(in oklab, var(--p-muted) 70%, transparent)}
.form-label{color:color-mix(in oklab, var(--p-text) 78%, transparent)}
.text-muted{color:var(--p-muted) !important}

/* File inputs — native button label must contrast in light & dark */
input[type="file"].form-control,
.form-control[type="file"]{
  padding:0.42rem 0.55rem !important;
}
input[type="file"].form-control::file-selector-button,
.form-control[type="file"]::file-selector-button,
input[type="file"].form-control::-webkit-file-upload-button,
.form-control[type="file"]::-webkit-file-upload-button{
  margin-right:0.75rem;
  padding:0.38rem 0.9rem;
  border-radius:10px;
  border:1px solid var(--p-border);
  font-weight:600;
  font-family:inherit;
  font-size:0.88rem;
  cursor:pointer;
  transition:filter .12s ease, background .12s ease, color .12s ease;
}
html:not(.dark) input[type="file"].form-control::file-selector-button,
html:not(.dark) .form-control[type="file"]::file-selector-button,
html:not(.dark) input[type="file"].form-control::-webkit-file-upload-button,
html:not(.dark) .form-control[type="file"]::-webkit-file-upload-button{
  color:rgba(16,24,40,.92) !important;
  background:color-mix(in oklab, var(--p-card-solid) 72%, #fff) !important;
}
html.dark input[type="file"].form-control::file-selector-button,
html.dark .form-control[type="file"]::file-selector-button,
html.dark input[type="file"].form-control::-webkit-file-upload-button,
html.dark .form-control[type="file"]::-webkit-file-upload-button{
  color:rgba(255,255,255,.92) !important;
  background:color-mix(in oklab, var(--p-border) 42%, var(--p-card)) !important;
}
input[type="file"].form-control::file-selector-button:hover,
.form-control[type="file"]::file-selector-button:hover,
input[type="file"].form-control::-webkit-file-upload-button:hover,
.form-control[type="file"]::-webkit-file-upload-button:hover{
  filter:brightness(1.07);
}

/* Lightly disabled / read-only fields */
.form-control:disabled,
.form-select:disabled{
  opacity:.55;
  cursor:not-allowed;
  background:color-mix(in oklab, var(--p-muted) 18%, var(--p-card-solid) 22%) !important;
  border-color:color-mix(in oklab, var(--p-border) 70%, transparent) !important;
  border-style:dashed !important;
  color:color-mix(in oklab, var(--p-text) 55%, var(--p-muted)) !important;
}
.p-field--locked .form-label{
  opacity:.55;
  cursor:not-allowed;
}
.p-field--locked .form-label::after{
  content:' (locked)';
  font-size:.75rem;
  font-weight:500;
  color:var(--p-muted);
}
.p-self-hint{
  padding:10px 12px;
  border-radius:12px;
  border:1px dashed color-mix(in oklab, var(--p-border) 80%, transparent);
  background:color-mix(in oklab, var(--p-muted) 10%, transparent);
  color:var(--p-muted);
}
code{color:color-mix(in oklab, var(--p-accent-2) 88%, #000)}

/* Select dropdown (options) readability */
html.dark select option{
  background-color: rgba(15,26,52,.98);
  color: rgba(255,255,255,.92);
}
html:not(.dark) select option{
  background-color: #ffffff;
  color: rgba(16,24,40,.95);
}

.btn{
  border-radius:14px !important;
  font-weight:600;
}
.btn:focus-visible{
  box-shadow:var(--shadow-focus-ring) !important;
}

/* Light mode: solid, high-contrast buttons (no fade-to-pale gradient) */
html:not(.dark) .btn-primary{
  background:linear-gradient(180deg, #465fff 0%, #3641f5 100%) !important;
  border:1px solid #2a31d8 !important;
  color:#fff !important;
  box-shadow:0 1px 2px rgba(16,24,40,.08), 0 4px 14px rgba(70,95,255,.28) !important;
}
html:not(.dark) .btn-primary:hover,
html:not(.dark) .btn-primary:focus{
  background:linear-gradient(180deg, #3641f5 0%, #2a31d8 100%) !important;
  border-color:#252dae !important;
  color:#fff !important;
}
html:not(.dark) .btn-success{
  background:linear-gradient(180deg, #12b76a 0%, #039855 100%) !important;
  border:1px solid #027a48 !important;
  color:#fff !important;
  box-shadow:0 1px 2px rgba(16,24,40,.08), 0 4px 14px rgba(18,183,106,.25) !important;
}
html:not(.dark) .btn-success:hover,
html:not(.dark) .btn-success:focus{
  background:linear-gradient(180deg, #039855 0%, #027a48 100%) !important;
  color:#fff !important;
}
html:not(.dark) .btn-warning{
  background:linear-gradient(180deg, #f79009 0%, #dc6803 100%) !important;
  border:1px solid #b54708 !important;
  color:#fff !important;
  box-shadow:0 1px 2px rgba(16,24,40,.08), 0 4px 12px rgba(247,144,9,.22) !important;
}
html:not(.dark) .btn-warning:hover,
html:not(.dark) .btn-warning:focus{
  background:linear-gradient(180deg, #dc6803 0%, #b54708 100%) !important;
  color:#fff !important;
}
html:not(.dark) .btn-danger{
  background:linear-gradient(180deg, #f04438 0%, #d92d20 100%) !important;
  border:1px solid #b42318 !important;
  color:#fff !important;
}
html:not(.dark) .btn-info{
  background:linear-gradient(180deg, #0ba5ec 0%, #0086c9 100%) !important;
  border:1px solid #026aa2 !important;
  color:#fff !important;
}
html:not(.dark) .btn-outline-primary{
  background:#fff !important;
  border:1px solid #465fff !important;
  color:#3641f5 !important;
}
html:not(.dark) .btn-outline-primary:hover{
  background:#ecf3ff !important;
  border-color:#3641f5 !important;
  color:#2a31d8 !important;
}
html:not(.dark) .btn-outline-success{
  background:#fff !important;
  border:1px solid #12b76a !important;
  color:#027a48 !important;
}
html:not(.dark) .btn-outline-success:hover{
  background:#ecfdf3 !important;
  color:#05603a !important;
}
html:not(.dark) .btn-outline-warning{
  background:#fff !important;
  border:1px solid #f79009 !important;
  color:#b54708 !important;
}
html:not(.dark) .btn-outline-warning:hover{
  background:#fffaeb !important;
  color:#93370d !important;
}
html:not(.dark) .btn-outline-secondary{
  background:#fff !important;
  border:1px solid #d0d5dd !important;
  color:#344054 !important;
}
html:not(.dark) .btn-outline-secondary:hover{
  background:#f2f4f7 !important;
  color:#1d2939 !important;
}
html:not(.dark) .btn-outline-info{
  background:#fff !important;
  border:1px solid #0ba5ec !important;
  color:#026aa2 !important;
}
html:not(.dark) .btn-outline-info:hover{
  background:#f0f9ff !important;
  color:#065986 !important;
}
html:not(.dark) .btn-primary .fa-solid,
html:not(.dark) .btn-success .fa-solid,
html:not(.dark) .btn-warning .fa-solid,
html:not(.dark) .btn-danger .fa-solid,
html:not(.dark) .btn-info .fa-solid{
  color:inherit !important;
}

/* Dark mode: keep accent gradients, always light text */
html.dark .btn-primary{
  background:linear-gradient(135deg, rgba(70,95,255,.95), rgba(54,65,245,.75)) !important;
  border:1px solid rgba(156,185,255,.35) !important;
  color:#fff !important;
}
html.dark .btn-success{
  background:linear-gradient(135deg, rgba(18,183,106,.95), rgba(3,152,85,.75)) !important;
  border:1px solid rgba(18,183,106,.45) !important;
  color:#fff !important;
}
html.dark .btn-warning{
  background:linear-gradient(135deg, rgba(247,144,9,.95), rgba(220,104,3,.8)) !important;
  border:1px solid rgba(247,144,9,.4) !important;
  color:#fff !important;
}
html.dark .btn-outline-primary,
html.dark .btn-outline-success,
html.dark .btn-outline-warning,
html.dark .btn-outline-secondary,
html.dark .btn-outline-info{
  border-color:var(--p-border) !important;
  color:var(--p-text) !important;
}
html.dark .btn-outline-warning:hover{background:rgba(255,204,102,.12) !important}
html.dark .btn-outline-success:hover{background:rgba(40,209,124,.12) !important}
html.dark .btn-outline-primary:hover{background:color-mix(in oklab, var(--p-accent) 12%, transparent) !important}
html.dark .btn-outline-secondary:hover{background:color-mix(in oklab, var(--p-card-solid) 38%, transparent) !important}
html.dark .btn-outline-info:hover{background:rgba(11,165,236,.12) !important}

.alert{
  border-radius:var(--p-radius) !important;
  border:1px solid var(--p-border) !important;
  background:color-mix(in oklab, var(--p-card-solid) 30%, transparent) !important;
  color:var(--p-text) !important;
}
.alert-success{border-color:rgba(40,209,124,.30) !important}
.alert-danger{border-color:rgba(255,92,124,.30) !important}
.p-alert-static{margin-bottom:1rem}

/* Modal */
/* Backdrop rules live in assets/modal-backdrop.css */
.modal-content{
  border-radius:var(--p-radius) !important;
  border:1px solid var(--p-border) !important;
  background:var(--p-card-solid) !important;
  box-shadow:var(--p-shadow) !important;
  color:var(--p-text) !important;
}
.modal-header{
  border-bottom:1px solid var(--p-border) !important;
  background:var(--p-card-solid) !important;
}
.modal-footer{
  border-top:1px solid var(--p-border) !important;
}
.btn-close{
  filter: invert(1) grayscale(1);
  opacity:.7
}
html:not(.dark) .btn-close{filter:none; opacity:.7}
.btn-close:hover{opacity:1}

/* Toasts */
.p-toaster{
  z-index:1100;
  max-width:min(420px, calc(100vw - 24px));
  pointer-events:none;
}
.p-toaster .toast{pointer-events:auto}
.p-toaster .toast.show{
  display:block;
  opacity:1;
}
.p-toast{
  border-radius:var(--p-radius) !important;
  box-shadow:var(--p-shadow) !important;
  border:1px solid var(--p-border) !important;
  background:var(--p-card-solid) !important;
  color:var(--p-text) !important;
  overflow:hidden;
  min-width:320px;
}
.p-toast__inner{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:14px 16px;
}
.p-toast__icon{
  width:36px; height:36px; border-radius:10px;
  display:grid; place-items:center; flex-shrink:0;
  font-size:1rem;
}
.p-toast--success .p-toast__icon{
  background:color-mix(in oklab, var(--p-success) 18%, transparent);
  color:var(--p-success);
}
.p-toast--danger .p-toast__icon{
  background:color-mix(in oklab, var(--p-danger) 18%, transparent);
  color:var(--p-danger);
}
.p-toast--warning .p-toast__icon{
  background:color-mix(in oklab, var(--p-warning) 18%, transparent);
  color:var(--p-warning);
}
.p-toast__content{flex:1; min-width:0; padding-top:2px}
.p-toast__title{
  font-size:.72rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.05em; margin-bottom:4px;
}
.p-toast--success .p-toast__title{color:var(--p-success)}
.p-toast--danger .p-toast__title{color:var(--p-danger)}
.p-toast--warning .p-toast__title{color:var(--p-warning)}
.p-toast__message{
  font-size:.88rem; line-height:1.45;
  color:var(--p-text); word-break:break-word;
}
.p-toast__close{
  flex-shrink:0; margin:0 !important; opacity:.55;
  filter:none !important;
}
html.dark .p-toast__close{filter:invert(1) grayscale(1) !important}
.p-toast__close:hover{opacity:1}

@media (max-width: 991.98px){
  .p-sidebar{
    position:fixed;
    left:-310px;
    top:0;
    transition:left .18s ease;
    box-shadow: 0 40px 90px rgba(0,0,0,.65);
  }
  .p-sidebar.is-open{left:0}
  .p-content{padding:16px 12px 40px}
}

/* EN / DE language switcher (flags) */
.app-lang-switcher{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 6px;
  border-radius:999px;
  border:1px solid var(--p-border);
  background:var(--p-card-solid);
}
.app-lang-switcher__btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  padding:4px 6px;
  border-radius:8px;
  line-height:1;
  opacity:.55;
  transition:opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}
.app-lang-switcher__btn:hover{
  opacity:.9;
  transform:translateY(-1px);
}
.app-lang-switcher__btn.is-active{
  opacity:1;
  background:color-mix(in oklab, var(--p-accent) 18%, transparent);
  box-shadow:0 0 0 2px color-mix(in oklab, var(--p-accent) 35%, transparent);
}
.app-lang-flag-img{
  display:block;
  width:22px;
  height:16px;
  border-radius:3px;
  object-fit:cover;
  box-shadow:0 0 0 1px rgba(0,0,0,.12);
}
.p-lang-switcher{margin-right:4px}

/* Subscriptions page — professional data table */
.p-subs-page{width:100%; max-width:none}
.p-subs-header{margin-bottom:1.5rem}
.p-subs-header__title{
  font-size:1.35rem; font-weight:700; letter-spacing:-.02em;
  margin:0 0 .25rem; color:var(--p-text);
}
.p-subs-header__sub{margin:0; font-size:.9rem; color:var(--p-muted); max-width:42rem}

.p-subs-kpis{
  display:grid; grid-template-columns:repeat(4, 1fr); gap:12px;
  margin-bottom:1.25rem;
}
@media (max-width: 768px){ .p-subs-kpis{grid-template-columns:repeat(2, 1fr)} }
.p-subs-kpi{
  display:flex; align-items:center; gap:14px;
  padding:16px 18px; border-radius:14px;
  border:1px solid var(--p-border);
  background:var(--p-card-solid);
  box-shadow:0 1px 2px rgba(0,0,0,.04);
}
.p-subs-kpi__icon{
  width:42px; height:42px; border-radius:12px;
  display:grid; place-items:center; font-size:1rem;
  background:color-mix(in oklab, var(--p-accent) 10%, var(--p-card-solid));
  color:var(--p-muted);
}
.p-subs-kpi--success .p-subs-kpi__icon{background:color-mix(in oklab, var(--p-success) 15%, transparent); color:var(--p-success)}
.p-subs-kpi--success .p-subs-kpi__val{color:var(--p-success)}
.p-subs-kpi--danger .p-subs-kpi__icon{background:color-mix(in oklab, var(--p-danger) 12%, transparent); color:var(--p-danger)}
.p-subs-kpi--danger .p-subs-kpi__val{color:var(--p-danger)}
.p-subs-kpi__val{font-size:1.5rem; font-weight:700; line-height:1.1; color:var(--p-text)}
.p-subs-kpi__lbl{font-size:.75rem; color:var(--p-muted); margin-top:2px; font-weight:500}

.p-subs-panel{
  border-radius:16px; border:1px solid var(--p-border);
  background:var(--p-card-solid);
  box-shadow:0 4px 24px rgba(0,0,0,.06);
  overflow:hidden;
}
html.dark .p-subs-panel{box-shadow:0 8px 32px rgba(0,0,0,.25)}

.p-subs-toolbar{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  gap:12px; padding:14px var(--platform-table-inset-x, 1rem);
  border-bottom:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-bg-1) 40%, var(--p-card-solid));
}
.p-subs-toolbar__title{
  font-size:.95rem; font-weight:700; color:var(--p-text);
  display:flex; align-items:center; gap:8px;
}
.p-subs-count{
  font-size:.75rem; font-weight:600; padding:2px 8px; border-radius:999px;
  background:color-mix(in oklab, var(--p-accent) 15%, transparent);
  color:var(--p-accent);
}
.p-subs-search-wrap{
  display:flex; align-items:center; gap:10px;
  padding:0 12px; border-radius:10px;
  border:1px solid var(--p-border);
  background:var(--p-card-solid);
  min-width:220px; max-width:320px;
}
.p-subs-search-wrap i{color:var(--p-muted); font-size:.85rem}
.p-subs-search{
  border:0 !important; background:transparent !important;
  box-shadow:none !important; padding:.45rem 0 !important;
  font-size:.875rem !important; width:100%;
}
.p-subs-search:focus{outline:none}

.p-subs-table-wrap{overflow-x:auto}
.p-subs-table{
  width:100%; border-collapse:collapse;
  font-size:.875rem;
}
.p-subs-table thead th{
  text-align:left; font-size:.7rem; font-weight:600;
  text-transform:uppercase; letter-spacing:.06em;
  color:var(--p-muted);
  padding:12px 16px;
  border-bottom:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-bg-0) 50%, transparent);
  white-space:nowrap;
}
.p-subs-table thead th:first-child{
  padding-left:var(--platform-table-inset-x, 1rem);
}
.p-subs-table thead th:last-child{
  padding-right:var(--platform-table-inset-x, 1rem);
}
.p-subs-table tbody tr{
  border-bottom:1px solid var(--p-border);
  transition:background .12s ease;
}
.p-subs-table tbody tr:last-child{border-bottom:0}
.p-subs-table tbody tr:hover{background:color-mix(in oklab, var(--p-accent) 4%, transparent)}
.p-subs-table tbody tr.is-expired{background:color-mix(in oklab, var(--p-danger) 4%, transparent)}
.p-subs-table tbody tr.is-expired:hover{background:color-mix(in oklab, var(--p-danger) 7%, transparent)}
.p-subs-table td{padding:14px 16px; vertical-align:middle}
.p-subs-table td:first-child{
  padding-left:var(--platform-table-inset-x, 1rem);
}
.p-subs-table td:last-child{
  padding-right:var(--platform-table-inset-x, 1rem);
}

.p-subs-cell{display:flex; align-items:center; gap:12px; min-width:200px}
.p-subs-avatar{
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:grid; place-items:center; font-weight:700; font-size:.8rem;
  background:linear-gradient(135deg, color-mix(in oklab, var(--p-accent) 35%, transparent), color-mix(in oklab, var(--p-accent-2) 25%, transparent));
  color:#fff;
}
.p-subs-cell__title{display:block; font-weight:600; color:var(--p-text); line-height:1.3}
.p-subs-cell__sub{display:block; font-size:.75rem; color:var(--p-muted); margin-top:2px}

.p-subs-package{
  display:inline-flex; align-items:baseline; gap:8px; flex-wrap:wrap;
  font-size:.875rem;
}
.p-subs-package strong{font-weight:600}
.p-subs-package__price{color:var(--p-muted); font-weight:500}
.p-subs-package__per{font-size:.7rem; opacity:.8}
.p-subs-package--none{
  font-size:.8rem; color:var(--p-muted);
  padding:4px 10px; border-radius:6px;
  border:1px dashed var(--p-border);
}

.p-subs-status-wrap{display:flex; flex-direction:column; align-items:flex-start; gap:6px}
.p-subs-status{
  display:inline-flex; align-items:center; gap:6px;
  font-size:.8rem; font-weight:600;
}
.p-subs-status__dot{width:7px; height:7px; border-radius:50%; flex-shrink:0}
.p-subs-status--active .p-subs-status__dot{background:var(--p-success); box-shadow:0 0 0 3px color-mix(in oklab, var(--p-success) 25%, transparent)}
.p-subs-status--active{color:var(--p-success)}
.p-subs-status--trial .p-subs-status__dot{background:var(--p-accent)}
.p-subs-status--trial{color:var(--p-accent-2)}
.p-subs-status--warn .p-subs-status__dot{background:var(--p-warning)}
.p-subs-status--warn{color:var(--p-warning)}
.p-subs-status--muted .p-subs-status__dot{background:var(--p-muted)}
.p-subs-status--muted{color:var(--p-muted)}
.p-subs-status--none .p-subs-status__dot{background:var(--p-muted); opacity:.5}
.p-subs-status--none{color:var(--p-muted)}

.p-subs-chip{
  font-size:.7rem; font-weight:500; padding:2px 8px; border-radius:6px;
  background:color-mix(in oklab, var(--p-muted) 12%, transparent);
  color:var(--p-muted);
}

.p-subs-period-cell{display:flex; flex-direction:column; gap:4px; min-width:120px}
.p-subs-period-cell__date{font-weight:500; color:var(--p-text); font-size:.85rem}
.p-subs-period-cell__lbl{font-size:.7rem; color:var(--p-muted)}

.p-subs-tag{
  display:inline-flex; align-items:center; gap:5px;
  font-size:.72rem; font-weight:600; padding:4px 10px; border-radius:6px;
}
.p-subs-tag--danger{
  background:color-mix(in oklab, var(--p-danger) 18%, transparent);
  color:var(--p-danger); width:fit-content;
}
.p-subs-tag--stripe{
  background:color-mix(in oklab, #635bff 12%, transparent);
  color:#635bff;
}
html.dark .p-subs-tag--stripe{color:#a5b4fc; background:color-mix(in oklab, #635bff 20%, transparent)}

.p-subs-muted{color:var(--p-muted); font-size:.85rem}
.p-subs-actions{
  display:flex; gap:6px; justify-content:flex-end; white-space:nowrap;
}
.p-subs-action{
  width:34px; height:34px; border-radius:8px;
  border:1px solid var(--p-border);
  background:transparent;
  color:var(--p-muted);
  display:inline-grid; place-items:center;
  cursor:pointer; transition:all .15s ease;
}
.p-subs-action:hover{
  border-color:color-mix(in oklab, var(--p-accent) 40%, var(--p-border));
  color:var(--p-text);
  background:color-mix(in oklab, var(--p-accent) 8%, transparent);
}
.p-subs-action--primary:hover{
  background:var(--p-accent);
  border-color:var(--p-accent);
  color:#fff;
}

.p-subs-row.is-open{background:color-mix(in oklab, var(--p-accent) 6%, transparent)}
.p-subs-row.is-open .p-subs-action--toggle i{transform:rotate(180deg)}
.p-subs-action--toggle i{transition:transform .2s ease}

.p-subs-expand-row td{padding:0 16px 14px; border-bottom:1px solid var(--p-border); vertical-align:top}
.p-subs-expand-row:not([hidden]) + tr,
.p-subs-row.is-open{border-bottom-color:transparent}
.p-subs-expand{
  padding:16px 18px; border-radius:10px;
  border:1px solid var(--p-border);
  background:color-mix(in oklab, var(--p-muted) 5%, var(--p-surface));
}
.p-subs-expand__head{margin-bottom:12px}
.p-subs-expand__title{font-size:.85rem; font-weight:700; color:var(--p-muted); text-transform:uppercase; letter-spacing:.04em}

.p-subs-meta-grid{
  display:grid; grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:14px 24px;
}
.p-subs-meta-item{display:flex; flex-direction:column; gap:4px; min-width:0}
.p-subs-meta-item--wide{grid-column:1 / -1}
.p-subs-meta-item__k{font-size:.72rem; font-weight:600; color:var(--p-muted); text-transform:uppercase; letter-spacing:.03em}
.p-subs-meta-item__v{font-size:.88rem; color:var(--p-text); word-break:break-word}
.p-subs-meta-item__v code{font-size:.82rem}

.p-subs-expand-edit{
  margin-top:16px; padding-top:16px;
  border-top:1px solid var(--p-border);
}
.p-subs-expand-edit__title{font-size:.9rem; font-weight:600; color:var(--p-text)}
.p-subs-assign-help{font-size:.82rem; color:var(--p-muted); margin:0 0 12px}
.p-subs-presets{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px}
.p-subs-stripe-advanced{
  margin-top:4px; padding:12px 14px; border-radius:8px;
  border:1px dashed var(--p-border); background:color-mix(in oklab, var(--p-muted) 4%, transparent);
}
.p-subs-stripe-advanced summary{cursor:pointer; font-weight:600; font-size:.85rem; color:var(--p-muted)}
.p-subs-stripe-advanced__help{font-size:.78rem; color:var(--p-muted); margin:10px 0 0}

@media (max-width: 991px){
  .p-subs-meta-grid{grid-template-columns:1fr}
  .p-subs-expand-row{display:block}
  .p-subs-expand-row[hidden]{display:none !important}
  .p-subs-expand-row td{display:block; padding:0 16px 12px; border:0}
  .p-subs-expand-row td::before{display:none}
  .p-subs-table thead{display:none}
  .p-subs-table tbody tr{display:block; padding:12px 16px; margin-bottom:8px}
  .p-subs-table td{
    display:flex; justify-content:space-between; align-items:flex-start;
    padding:8px 0; border:0;
  }
  .p-subs-table td::before{
    content:attr(data-label);
    font-size:.7rem; font-weight:600; text-transform:uppercase;
    color:var(--p-muted); margin-right:12px; flex-shrink:0;
  }
  .p-subs-actions{justify-content:flex-start}
}
