/* THRS Ultra Premium — Phase 1: systemwide surface, contrast and controls
   CSS-only progressive enhancement.  Layout Locked: no positional, sizing,
   grid, flex, width, height or structural overrides to the app shell.
   Applied only to authenticated THRS shell; third-party widgets excluded.
   Maintain separate dark/light, Arabic/English and reduced-motion support.
*/
.thrs-shell {
  --premium-paper: #ffffff;
  --premium-heading: #102b4f;
  --premium-ink: #162f50;
  --premium-muted: #506581;
  --premium-outline: #cbd6e4;
  --premium-inset: #f7f9fc;
  --premium-gold: #9d751b;
  --premium-gold-wash: rgba(200,168,78,.09);
  --premium-ring: 0 0 0 3px rgba(177,130,25,.20);
  --premium-elevation: 0 2px 3px rgba(12,35,67,.028), 0 13px 38px rgba(12,35,67,.065);
  --premium-elevation-hover: 0 3px 5px rgba(12,35,67,.042), 0 20px 45px rgba(12,35,67,.105);
}
[data-theme="dark"] .thrs-shell {
  --premium-paper: #142b49;
  --premium-heading: #f0f6ff;
  --premium-ink: #e6f0fe;
  --premium-muted: #b6c8df;
  --premium-outline: #426080;
  --premium-inset: #0d2139;
  --premium-gold: #e0ba62;
  --premium-gold-wash: rgba(224,186,98,.12);
  --premium-ring: 0 0 0 3px rgba(224,186,98,.27);
  --premium-elevation: 0 3px 8px rgba(0,0,0,.18), 0 15px 36px rgba(0,0,0,.20);
  --premium-elevation-hover: 0 3px 9px rgba(0,0,0,.26), 0 22px 50px rgba(0,0,0,.32);
}
/* Override unreadable light-on-light / dark-on-dark token drift, scoped to content. */
.thrs-shell .thrs-main-shell {
  --text-primary: var(--premium-ink);
  --text-secondary: var(--premium-muted);
  --border-strong: var(--premium-outline);
  --bg-input: var(--premium-paper);
}
.thrs-shell .thrs-main-shell :is(h1,h2,h3,h4,h5,h6) {
  text-wrap: pretty;
}
/* Crisp premium surfaces; preserve exact element placement, dimensions and grids. */
.thrs-shell .thrs-main-shell :is(
  .thrs-card,.card,.emp-stat-card,.thrs-stat-card,
  .stat-card,.kpi-card,.dashboard-card
) {
  border-color: var(--premium-outline);
  box-shadow: var(--premium-elevation);
  transition: border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}
.thrs-shell .thrs-main-shell :is(
  .thrs-card,.card,.emp-stat-card,.thrs-stat-card,
  .stat-card,.kpi-card,.dashboard-card
):hover {
  box-shadow: var(--premium-elevation-hover);
}
/* Readability: do not force a text color on dark gradient hero blocks. */
.thrs-shell .thrs-main-shell :is(.page-header,.thrs-card-header) :is(h1,h2,h3,h4) {
  color: var(--premium-heading);
}
/* Inputs: theme-correct background, visible values, hints and borders. */
.thrs-shell .thrs-main-shell :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  textarea, select,
  .form-input,.emp-search-input
):not(:disabled):not([readonly]) {
  /* The legacy component CSS uses !important for form fields. Scope the
     override to visible enabled fields so the colors actually take effect. */
  color: var(--premium-ink) !important;
  background-color: var(--premium-paper) !important;
  border-color: var(--premium-outline) !important;
  caret-color: var(--premium-gold);
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.thrs-shell .thrs-main-shell :is(input,textarea)::placeholder {
  color: var(--premium-muted);
  opacity: 1;
}
.thrs-shell .thrs-main-shell :is(input,textarea,select):focus-visible {
  outline: 2px solid var(--premium-gold);
  outline-offset: 2px;
  box-shadow: var(--premium-ring);
}
.thrs-shell .thrs-main-shell :is(input,textarea,select):disabled {
  opacity: .72;
  cursor: not-allowed;
}
.thrs-shell .thrs-main-shell :is(input,textarea,select)[aria-invalid="true"] {
  border-color: #c44747;
  box-shadow: 0 0 0 2px rgba(196,71,71,.15);
}
/* Accessible field labels and help text. */
.thrs-shell .thrs-main-shell :is(label,.form-label,.field-label) {
  color: var(--premium-ink);
}
.thrs-shell .thrs-main-shell :is(.form-hint,.field-hint,.helper-text) {
  color: var(--premium-muted);
}
/* Buttons: visual polish only, no spatial or action changes. */
.thrs-shell .thrs-main-shell :is(.thrs-btn,button):not(:disabled) {
  transition: background-color .19s ease, color .19s ease,
              border-color .19s ease, box-shadow .19s ease, filter .19s ease;
}
.thrs-shell .thrs-main-shell :is(.thrs-btn,button):focus-visible {
  outline: 2px solid var(--premium-gold);
  outline-offset: 3px;
  box-shadow: var(--premium-ring);
}
.thrs-shell .thrs-main-shell :is(.thrs-btn-primary,.btn-primary) {
  color: #fff;
  box-shadow: 0 3px 12px rgba(15,41,77,.17);
}
.thrs-shell .thrs-main-shell :is(.thrs-btn-primary,.btn-primary):hover:not(:disabled) {
  box-shadow: 0 5px 16px rgba(15,41,77,.24);
  filter: brightness(1.08);
}
.thrs-shell .thrs-main-shell :is(.thrs-btn-secondary,.btn-secondary) {
  border-color: var(--premium-outline) !important;
  color: var(--premium-ink) !important;
  background-color: var(--premium-paper) !important;
}
/* Non-color affordances: visible row separators and active states. */
.thrs-shell .thrs-main-shell :is(table,.thrs-table) {
  border-color: var(--premium-outline);
}
.thrs-shell .thrs-main-shell :is(table,.thrs-table) thead th {
  color: var(--premium-ink);
  border-bottom-color: var(--premium-outline);
}
.thrs-shell .thrs-main-shell :is(table,.thrs-table) tbody td {
  border-bottom-color: var(--border-color);
}
.thrs-shell .thrs-main-shell :is(table,.thrs-table) tbody tr:hover {
  background-color: var(--premium-gold-wash);
}
.thrs-shell .thrs-main-shell :is(.table-empty,.empty-state,.no-data) {
  color: var(--premium-muted);
}
/* Menus and overlays: keep inherited placement, improve legibility. */
.thrs-shell .thrs-main-shell :is(
 .dropdown-menu,.popover-content,.menu-panel,.thrs-modal,.modal-content
) {
  border-color: var(--premium-outline);
  box-shadow: var(--premium-elevation-hover);
}
.thrs-shell .thrs-main-shell :is(
 .dropdown-menu,.popover-content,.menu-panel
):not([style*="background"]) {
  background-color: var(--premium-paper);
  color: var(--premium-ink);
}
/* Icon treatment: coherent strokes, not new icon packs or layout shifts. */
.thrs-shell .thrs-main-shell :is(button,a,[role="button"]) svg:not([fill]):not([stroke]) {
  stroke-linecap: round;
  stroke-linejoin: round;
}
.thrs-shell .thrs-main-shell :is(button,a,[role="button"]) svg {
  transition: color .18s ease, opacity .18s ease, filter .18s ease;
}
/* Media, interaction and language safe states. */
@media (prefers-reduced-motion: reduce) {
  .thrs-shell .thrs-main-shell :is(.thrs-card,.card,.emp-stat-card,.thrs-stat-card,.stat-card,.kpi-card,.dashboard-card,button,input,select,textarea) {
    transition: none !important;
    animation: none !important;
  }
}
@media (forced-colors: active) {
  .thrs-shell .thrs-main-shell :is(input,select,textarea,button) {
    border: 1px solid ButtonText;
  }
}
