/*
 * Trio Primêr application design system
 * Clean personnel-portal-aligned foundation for first-party application pages.
 * Mobirise pages do not load this stylesheet.
 */
:root {
  color-scheme: light;
  --ui-font: "Inter", "Segoe UI", Arial, sans-serif;
  --ui-text: #192b4d;
  --ui-muted: #526583;
  --ui-primary: #477cf0;
  --ui-primary-deep: #2947b8;
  --ui-purple: #8b5cf6;
  --ui-cyan: #06b6d4;
  --ui-green: #22c55e;
  --ui-amber: #f59e0b;
  --ui-red: #ef4444;
  --ui-line: rgba(255, 255, 255, 0.94);
  --ui-control-line: rgba(173, 197, 238, 0.9);
  --ui-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(235, 243, 255, 0.78));
  --ui-glass-strong: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 255, 0.9));
  --ui-shadow:
    0 16px 42px rgba(41, 55, 112, 0.19),
    0 4px 14px rgba(30, 41, 90, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(189, 205, 247, 0.24);
  --ui-shadow-raised:
    0 24px 58px rgba(41, 55, 112, 0.25),
    0 7px 20px rgba(30, 41, 90, 0.11),
    inset 0 1px 0 #fff;
  --ui-radius: 22px;
  --ui-radius-small: 14px;
  --ui-focus: 0 0 0 4px rgba(71, 124, 240, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  max-width: 100%;
  margin: 0;
  padding: 18px;
  overflow-x: hidden;
  color: var(--ui-text);
  background:
    radial-gradient(circle at 8% 5%, rgba(99, 102, 241, 0.2), transparent 30rem),
    radial-gradient(circle at 93% 12%, rgba(14, 165, 233, 0.16), transparent 28rem),
    linear-gradient(135deg, #e3e9ff 0%, #f1f6ff 44%, #dce8ff 100%);
  background-attachment: fixed;
  font: 15px/1.5 var(--ui-font);
}

body.iframe-mode {
  padding: 0;
  background: transparent;
}

body.teacherportal-dashboard {
  padding: 0;
}

.mobile-bottom-bar {
  display: none;
}

@media (max-width: 760px) {
  body:not(.iframe-mode) {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-bar {
    position: fixed;
    z-index: 680;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(4px, 1.5vw, 8px);
    width: auto;
    max-width: 620px;
    margin-inline: auto;
    padding: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.96);
    border-radius: 25px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(238, 245, 255, 0.86));
    box-shadow:
      0 18px 42px rgba(38, 51, 111, 0.25),
      inset 0 1px 0 #fff;
-webkit-backdrop-filter: blur(18px) saturate(150%);
backdrop-filter: blur(18px) saturate(150%);
  }

  .mobile-quicklink {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 58px;
    margin: 0;
    padding: 5px 2px;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    color: #fff;
    text-decoration: none;
    box-shadow:
      0 8px 18px rgba(38, 51, 111, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.82),
      inset 0 -3px 6px rgba(25, 42, 102, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .mobile-quicklink:hover,
  .mobile-quicklink:focus-visible {
    color: #fff;
    transform: translateY(-2px);
    box-shadow:
      0 11px 23px rgba(38, 51, 111, 0.25),
      inset 0 1px 0 #fff;
  }

  .mobile-quicklink:focus-visible {
    outline: 3px solid rgba(71, 124, 240, 0.25);
    outline-offset: 2px;
  }

  .mobile-quicklink i {
    font-size: clamp(1.05rem, 5vw, 1.35rem);
  }

  .mobile-quicklink span {
    display: block;
    width: 100%;
    overflow: hidden;
    color: inherit;
    font-size: clamp(0.54rem, 2.1vw, 0.68rem);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-quicklink.blue { background: linear-gradient(145deg, #64a8ff, #3568dd); }
  .mobile-quicklink.purple { background: linear-gradient(145deg, #a575ff, #7645df); }
  .mobile-quicklink.cyan { background: linear-gradient(145deg, #45c4ea, #188ab7); }
  .mobile-quicklink.red { background: linear-gradient(145deg, #ff6672, #df2435); }
  .mobile-quicklink.amber { background: linear-gradient(145deg, #ffbb38, #e38300); }
  .mobile-quicklink.pink { background: linear-gradient(145deg, #f985c1, #dd3c91); }

  body:has(dialog[open]) .mobile-bottom-bar,
  body:has(.modal.show) .mobile-bottom-bar,
  body:has(.modal.open) .mobile-bottom-bar {
    opacity: 0;
    pointer-events: none;
  }
}

body.iframe-mode .mobile-bottom-bar {
  display: none !important;
}

.tp-return-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

a {
  color: #3157d5;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #1e40af;
}

img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button,
[role="button"],
[type="button"],
[type="submit"] {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  color: var(--ui-text);
  line-height: 1.18;
  overflow-wrap: break-word;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.18rem;
}

p {
  overflow-wrap: break-word;
}

.page,
.app-shell,
.dashboard-shell,
.container,
.main,
.content,
body > main {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin-inline: auto;
}

.page,
.app-shell,
.dashboard-shell {
  min-height: calc(100vh - 36px);
}

.main,
.content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.glass,
.card,
.panel,
.widget,
.form-card,
.content-card,
.admin-card,
.report-card,
.dashboard-card,
.stat-card,
.metric-card,
.calendar-card,
.tool-card,
.fault-card,
.info-box,
.status-banner,
.topbar,
.sidebar,
.modal-content,
.signature-modal,
.toast,
.list-item,
.input-row,
.table-wrap,
.kanban-column,
.task-card {
  position: relative;
  min-width: 0;
  color: var(--ui-text);
  border: 1.5px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-glass);
  box-shadow: var(--ui-shadow);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
}

.card,
.panel,
.widget,
.form-card,
.content-card,
.admin-card,
.report-card,
.dashboard-card,
.stat-card,
.metric-card,
.calendar-card,
.tool-card,
.fault-card,
.info-box {
  padding: 1.25rem;
}

.card:hover,
.widget:hover,
.tool-card:hover {
  box-shadow: var(--ui-shadow-raised);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.95rem 1.15rem;
}

.brand,
.topbar-main,
.topbar-left,
.topbar-right,
.top-actions,
.actions,
.form-actions,
.hero-buttons,
.icon-shortcuts,
.row,
.block,
.flex {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.75rem;
}

.brand h1,
.topbar-title {
  margin: 0;
  background: linear-gradient(135deg, #1e40af, #7c3aed, #0891b2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: 1.45rem;
  font-weight: 850;
}

.brand p,
.subtitle,
.help-note,
.muted,
.muted-text,
.text-muted {
  color: var(--ui-muted);
}

.brand p {
  margin: 0.15rem 0 0;
}

.brand-logo,
.quick-icon,
.kpi-icon,
.topbar-quick-icon,
.profile-avatar {
  display: inline-grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #67a7ff, #477cf0 50%, #3157d5);
  box-shadow: 0 6px 14px rgba(49, 87, 213, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.profile-pill,
.chip,
.badge,
.pill,
.status,
.module-health {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
  padding: 0.38rem 0.72rem;
  border: 1px solid rgba(162, 187, 235, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #334b72;
  box-shadow: 0 4px 12px rgba(41, 55, 112, 0.09), inset 0 1px 0 #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.ok,
.success,
.status-success,
.status-ok {
  color: #13713a;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(220, 252, 231, 0.84);
}

.warn,
.warning,
.status-warn {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(254, 243, 199, 0.86);
}

.danger,
.error,
.status-error,
.flash-error {
  color: #9f1239;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(255, 228, 230, 0.88);
}

.btn,
.auth-button,
.auth-btn,
.button-primary,
.btn-primary,
[type="submit"]:not(.btn-secondary):not(.btn-ghost):not(.btn-cancel) {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  overflow: hidden;
  padding: 0.6rem 1.08rem;
  border: 1px solid rgba(55, 93, 225, 0.92);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(145deg, #67a7ff 0%, #477cf0 48%, #3157d5 100%);
  box-shadow:
    0 5px 0 #2947b8,
    0 10px 22px rgba(49, 87, 213, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(15, 35, 78, 0.34);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.btn::before,
.auth-button::before,
.auth-btn::before,
.button-primary::before,
.btn-primary::before,
[type="submit"]:not(.btn-secondary):not(.btn-ghost):not(.btn-cancel)::before {
  position: absolute;
  z-index: -1;
  top: 5%;
  right: 10%;
  left: 10%;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.08));
  content: "";
  pointer-events: none;
}

.btn:hover,
.auth-button:hover,
.auth-btn:hover,
.button-primary:hover,
.btn-primary:hover {
  color: #fff;
  filter: saturate(1.08);
  transform: translateY(-2px);
  box-shadow:
    0 7px 0 #2947b8,
    0 14px 27px rgba(49, 87, 213, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.btn:active,
.auth-button:active,
.auth-btn:active,
.button-primary:active,
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2947b8, 0 4px 9px rgba(49, 87, 213, 0.24);
}

.btn-secondary,
.button-secondary,
.btn-ghost,
.btn.ghost,
.auth-btn--neutral,
.btn-cancel,
.topbar-menu,
.qty-btn {
  color: #1e40af !important;
  background: linear-gradient(145deg, #ffffff, #e0edff) !important;
  border: 1px solid rgba(147, 197, 253, 0.9) !important;
  box-shadow: 0 4px 12px rgba(30, 41, 89, 0.08) !important;
  text-shadow: none !important;
}

.btn-secondary::before,
.button-secondary::before,
.btn-ghost::before,
.btn.ghost::before,
.auth-btn--neutral::before,
.btn-cancel::before {
  display: none !important;
}

.btn-secondary:hover,
.button-secondary:hover,
.btn-ghost:hover,
.btn.ghost:hover,
.auth-btn--neutral:hover,
.btn-cancel:hover,
.topbar-menu:hover,
.qty-btn:hover {
  color: #1d4ed8 !important;
  background: linear-gradient(145deg, #ffffff, #c7d2fe) !important;
  text-shadow: none !important;
}

.tp-return-link-header {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tp-return-link-header:hover {
  transform: translateY(-1px);
  color: #fff !important;
  text-decoration: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
textarea,
select,
.form-input,
.form-control {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.88rem;
  border: 1.5px solid var(--ui-control-line);
  border-radius: var(--ui-radius-small);
  outline: 0;
  color: var(--ui-text);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 #fff, 0 5px 14px rgba(42, 61, 124, 0.08);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23477cf0' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.05rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
  -webkit-text-fill-color: #192b4d !important;
  transition: background-color 5000s ease-in-out 0s;
  border-radius: var(--ui-radius-small) !important;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.15rem !important;
  height: 1.15rem !important;
  min-height: 1.15rem !important;
  max-width: 1.15rem !important;
  margin: 0 0.35rem 0 0 !important;
  padding: 0 !important;
  accent-color: var(--ui-primary, #477cf0);
  cursor: pointer;
  vertical-align: middle;
  display: inline-block !important;
  box-shadow: none !important;
  border-radius: 4px;
}

input[type="radio"] {
  border-radius: 50%;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8799b6;
}

input:focus,
textarea:focus,
select:focus,
.form-input:focus,
.form-control:focus {
  border-color: var(--ui-primary);
  /* Keep select background images (including the dropdown chevron) intact. */
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: var(--ui-focus), 0 9px 22px rgba(42, 61, 124, 0.13);
}

label,
.form-label,
.field-label {
  color: #263b60;
  font-weight: 750;
}

.auth-field,
.field,
.field-group {
  display: grid;
  min-width: 0;
  gap: 0.38rem;
}

.auth-form,
.stack-form,
.modal-form {
  display: grid;
  gap: 0.9rem;
}

.grid,
.card-grid,
.kpi-grid,
.task-grid,
.pending-grid,
.contacts-grid,
.kb-grid,
.grid-cols-280,
.dm-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.two,
.form-row,
.form-row-end,
.two-col {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ui-text);
  background: transparent;
}

th,
td {
  padding: 0.72rem 0.78rem;
  border-bottom: 1px solid rgba(179, 197, 226, 0.42);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: #334b72;
  background: rgba(235, 243, 255, 0.96);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.sidebar {
  width: 240px;
  max-width: 100%;
  padding: 0.85rem;
}

.nav,
.nav-item,
.portal-nav,
.sidebar__link,
.topbar-link,
.topbar-quick-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.72rem;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #526583;
  background: transparent;
  font-weight: 750;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav:hover,
.nav.active,
.nav-item:hover,
.portal-nav:hover,
.portal-nav.active,
.sidebar__link:hover,
.sidebar__link.active,
.topbar-link:hover,
.topbar-quick-link:hover {
  color: #1e40af;
  border-color: rgba(147, 197, 253, 0.65);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.13));
  transform: translateX(2px);
}

.modal-backdrop,
.signature-modal-backdrop,
.scan-overlay,
.popup {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(25, 35, 74, 0.58);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}

.modal-content,
.signature-modal,
.popup-content {
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.25rem;
  border-radius: 24px;
  background: var(--ui-glass-strong);
  box-shadow: 0 30px 80px rgba(20, 31, 76, 0.35), inset 0 1px 0 #fff;
}

.modal-header,
.dialog-head,
.panel-header,
.card-header,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.close,
.close-btn,
.modal-close {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #fb7185, #e11d48 52%, #be123c);
  box-shadow: 0 5px 0 #9f1239, 0 10px 20px rgba(225, 29, 72, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hidden,
[hidden],
.is-hidden {
  display: none;
}

.visually-hidden,
.visually-hidden-file,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(71, 124, 240, 0.3);
  outline-offset: 2px;
}

.w-full {
  width: 100%;
}

.flex-1 {
  flex: 1 1 0;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 800;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.86rem;
}

.text-xl {
  font-size: 1.2rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-3xl {
  font-size: 1.85rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.portal-quicklinks-label {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.portal-global-search {
  display: flex;
  min-width: min(20rem, 100%);
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
}

.portal-global-search-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 1000px) {
  .grid,
  .card-grid,
  .kpi-grid,
  .task-grid,
  .pending-grid,
  .contacts-grid,
  .kb-grid,
  .grid-cols-280,
  .dm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  body {
    padding: 8px;
    font-size: 14px;
  }

  .page,
  .app-shell,
  .dashboard-shell {
    min-height: calc(100vh - 16px);
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.28rem;
  }

  .topbar,
  .card,
  .panel,
  .widget,
  .form-card,
  .content-card,
  .admin-card,
  .report-card {
    padding: 0.9rem;
    border-radius: 18px;
  }

  .brand,
  .topbar-main,
  .topbar-right,
  .top-actions,
  .actions,
  .form-actions,
  .hero-buttons,
  .section-head {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .card-grid,
  .kpi-grid,
  .task-grid,
  .pending-grid,
  .contacts-grid,
  .kb-grid,
  .grid-cols-280,
  .dm-grid,
  .two,
  .form-row,
  .form-row-end,
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .actions > :is(.btn, button, a),
  .form-actions > :is(.btn, button, a) {
    width: 100%;
  }

  .round,
  .square,
  .close,
  .close-btn,
  .modal-close {
    width: 44px;
  }

  .table-wrap {
    border-radius: 16px;
  }

  th,
  td {
    padding: 0.6rem;
  }

  .modal-backdrop,
  .signature-modal-backdrop,
  .scan-overlay,
  .popup {
    padding: 0.4rem;
  }

  .modal-content,
  .signature-modal,
  .popup-content {
    max-height: calc(100dvh - 0.8rem);
    padding: 0.9rem;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}

/* =============================================================
   TRIO TOPBAR HEADER & USER PROFILE BADGE
   ============================================================= */
.trio-header,
.topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  padding: 0.75rem 1.25rem !important;
  margin-bottom: 1.25rem !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border: 2px solid rgba(255, 255, 255, 0.95) !important;
  border-radius: 24px !important;
  box-shadow: 0 10px 30px rgba(60, 80, 160, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

.trio-header__brand h1 {
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  margin: 0 !important;
}

.trio-header__profile {
  display: flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  background: rgba(255, 255, 255, 0.92) !important;
  border: 2px solid rgba(255, 255, 255, 0.95) !important;
  border-radius: 999px !important;
  padding: 0.35rem 0.95rem 0.35rem 0.35rem !important;
  box-shadow: 0 4px 20px rgba(60, 80, 160, 0.12), 0 0 0 1px rgba(139, 92, 246, 0.15) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  flex-shrink: 0 !important;
  max-width: none !important;
}

.trio-header__avatar {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
  color: #ffffff !important;
  font-size: 0.88rem !important;
  font-weight: 900 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.trio-header__identity {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  line-height: 1.25 !important;
  gap: 0.15rem !important;
}

.trio-header__identity strong {
  font-size: 0.86rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  letter-spacing: -0.01em !important;
  display: block !important;
}

.trio-header__identity small {
  font-size: 0.68rem !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
  border-radius: 999px !important;
  padding: 0.18rem 0.65rem !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45), 0 1px 0 rgba(0, 0, 0, 0.1) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  width: fit-content !important;
  display: inline-block !important;
}

/* =============================================================
   FIRST-PARTY MODULE RESPONSIVE CASCADE FINALISER
   Kept after legacy !important header rules so the mobile contract wins.
   Mobirise pages do not carry data-trio-module and are intentionally excluded.
   ============================================================= */
html[data-trio-module] :is(.page, .app-shell, .dashboard-shell, main, section, article, header, nav, form, fieldset, .card, .panel, .widget, .table-wrap) {
  min-width: 0;
}

html[data-trio-module] :is(img, svg, canvas, video, iframe) {
  max-width: 100%;
}

html[data-trio-module] :is(input, select, textarea, button, .btn) {
  max-width: 100%;
}

html[data-trio-module] :is(h1, h2, h3, h4, p, label, .title, .subtitle, .description) {
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  html[data-trio-module] .trio-header {
    width: 100% !important;
    min-width: 0 !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.55rem !important;
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: 18px !important;
  }

  html[data-trio-module] .trio-header__brand {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 12rem !important;
  }

  html[data-trio-module] .trio-header__brand h1 {
    min-width: 0 !important;
    font-size: clamp(1.05rem, 5.5vw, 1.35rem) !important;
    line-height: 1.15 !important;
  }

  html[data-trio-module] .trio-header__profile {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: wrap !important;
  }

  html[data-trio-module] .trio-header__identity {
    min-width: 0 !important;
    max-width: min(12rem, 42vw) !important;
  }

  html[data-trio-module] .trio-header__identity strong {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html[data-trio-module] :is(.modal-content, .signature-modal, .popup-content, dialog) {
    width: min(100%, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    overflow: auto;
  }
}
