:root {
  --theme-modal-backdrop: rgba(15, 23, 42, 0.55);
  --app-modal-radius: calc(12px * var(--app-component-scale, 1));
}

.profile-role-popover{position:fixed;z-index:1200;display:grid;gap:calc(10px * var(--app-component-scale,1));width:calc(260px * var(--app-component-scale,1));min-width:200px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;padding:calc(12px * var(--app-component-scale,1));border:1px solid var(--theme-border);border-radius:calc(10px * var(--app-component-scale,1));background:var(--theme-card);color:var(--theme-text);box-shadow:0 4px 16px var(--theme-modal-backdrop)}
.profile-role-popover .profile-role-link{display:block;padding:calc(6px * var(--app-component-scale,1));color:var(--theme-text);text-decoration:none;border-radius:4px}
.profile-role-popover .profile-role-link:hover{background:var(--theme-table-hover)}
.profile-role-popover :is(a,select):focus-visible{outline:2px solid var(--theme-focus);outline-offset:2px}
.profile-role-popover select{width:100%;color:var(--theme-input-text);background-color:var(--theme-input);border-color:var(--theme-border)}
.profile-role-popover select:disabled{opacity:.65}
.profile-role-feedback{position:fixed;top:-10000px;left:0;max-width:1px;overflow:hidden}
:root {
  --top-banner-height: calc(56px * var(--app-component-scale, 1));
  --bg: #f5f5f6;
  --card: #ffffff;
  --text: #1f1f23;
  --muted: #72757e;
  --primary: #09b3a0;
  --border: #e3e5e8;
  --font-size-body: calc(15px * var(--app-font-scale, 1));
  --font-size-label: calc(14px * var(--app-font-scale, 1));
  --font-size-brand: calc(17px * var(--app-font-scale, 1));
  --font-size-menu-item: calc(15px * var(--app-font-scale, 1));
  --font-size-submenu-item: calc(13px * var(--app-font-scale, 1));
  --font-size-header-title: clamp(calc(24px * var(--app-font-scale, 1)), 2.6vw, calc(34px * var(--app-font-scale, 1)));
  --font-size-header-subtitle: calc(15px * var(--app-font-scale, 1));
  --font-size-panel-title: calc(24px * var(--app-font-scale, 1));
  --font-size-metric-head: calc(15px * var(--app-font-scale, 1));
  --font-size-metric-value: calc(34px * var(--app-font-scale, 1));
  --font-size-list-row: calc(16px * var(--app-font-scale, 1));
  --font-size-breakdown-table: calc(15px * var(--app-font-scale, 1));
  --font-size-form-section-heading: calc(16px * var(--app-font-scale, 1));
  --font-size-simple-table: calc(14px * var(--app-font-scale, 1));
  --table-cell-padding-y: calc(9px * var(--app-component-scale, 1));
  --table-cell-padding-x: calc(7px * var(--app-component-scale, 1));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  padding-top: var(--top-banner-height);
  font-family: "Inter Tight", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: var(--font-size-body);
}
body.app-interaction-locked {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}
.eyebrow { font-size: calc(12px * var(--app-font-scale, 1)); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 calc(8px * var(--app-component-scale, 1)); }
.muted { color: var(--muted); margin-top: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(16px * var(--app-component-scale, 1));
  box-shadow: 0 8px 25px rgba(17, 24, 39, .05);
}
body.auth-page { padding-top: 0; }
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: calc(24px * var(--app-component-scale, 1));
  padding: calc(48px * var(--app-component-scale, 1));
}
.brand-panel { align-self: center; }
.auth-logo { width: min(calc(240px * var(--app-component-scale, 1)), 55%); display: block; margin: 0 0 calc(18px * var(--app-component-scale, 1)); }
.brand-panel h1 { margin: 0 0 calc(12px * var(--app-component-scale, 1)); font-size: clamp(calc(36px * var(--app-font-scale, 1)), calc(4vw * var(--app-font-scale, 1)), calc(60px * var(--app-font-scale, 1))); line-height: 1.05; }
.auth-card { align-self: center; max-width: calc(460px * var(--app-component-scale, 1)); padding: calc(28px * var(--app-component-scale, 1)); }
@media (min-width: 901px) and (max-height: 760px) {
  .auth-shell { padding-block: calc(16px * var(--app-component-scale, 1)); }
  .auth-card { padding-block: calc(20px * var(--app-component-scale, 1)); }
  .auth-card .form-stack { gap: calc(10px * var(--app-component-scale, 1)); }
}
.auth-card h2 { margin: 0 0 calc(8px * var(--app-component-scale, 1)); }
.form-stack { display: grid; gap: calc(14px * var(--app-component-scale, 1)); margin-top: calc(16px * var(--app-component-scale, 1)); }
.auth-card #passkeyLoginBtn { width: 100%; min-width: 0; height: calc(44px * var(--app-component-scale, 1)); margin: 0; padding: 0 calc(12px * var(--app-component-scale, 1)); justify-self: stretch; white-space: nowrap; }
label { font-weight: 600; display: grid; gap: calc(7px * var(--app-component-scale, 1)); font-size: var(--font-size-label); }
input, select, textarea {
  height: calc(44px * var(--app-component-scale, 1));
  border: 1px solid var(--border);
  border-radius: calc(10px * var(--app-component-scale, 1));
  padding: 0 calc(12px * var(--app-component-scale, 1));
  font: inherit;
  background: #fff;
  color: var(--text);
}
input:disabled,
select:disabled,
textarea:disabled,
input[readonly]:not([type="hidden"]),
textarea[readonly] {
  background: #ebedf0;
  border-color: #c9ced6;
  color: #4b5563;
}
input:disabled::placeholder,
textarea:disabled::placeholder,
input[readonly]:not([type="hidden"])::placeholder,
textarea[readonly]::placeholder {
  color: #6b7280;
}
/* select:disabled {
  background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%);
} */
textarea {
  min-height: calc(88px * var(--app-component-scale, 1));
  height: auto;
  resize: vertical;
  padding: calc(10px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1.05em), calc(100% - 12px) calc(1.05em);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: calc(36px * var(--app-component-scale, 1));
}
button {
  height: calc(44px * var(--app-component-scale, 1));
  border: none;
  border-radius: calc(10px * var(--app-component-scale, 1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #111827;
  cursor: pointer;
}
button:disabled { opacity: .7; cursor: not-allowed; }
.error-text { min-height: calc(20px * var(--app-component-scale, 1)); color: #c62828; font-size: calc(14px * var(--app-font-scale, 1)); }

.app-top-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-banner-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
  padding: 0 calc(16px * var(--app-component-scale, 1));
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  z-index: 35;
}

.app-top-banner-profile,
.app-top-banner-brand,
.app-top-banner-actions {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
}

.app-top-banner-brand {
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: default;
}

.app-top-banner-profile {
  grid-column: 1;
  justify-self: start;
}

.app-top-banner-brand {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
}

.app-top-banner-actions {
  grid-column: 3;
  justify-self: end;
}

.top-banner-logout-btn {
  width: auto;
  min-width: calc(110px * var(--app-component-scale, 1));
  order: 1;
}

.top-banner-profile-btn {
  order: 2;
}

.app-top-banner-logo { width: calc(28px * var(--app-component-scale, 1)); height: calc(28px * var(--app-component-scale, 1)); object-fit: contain; }
.app-top-banner-title { font-weight: 700; font-size: calc(16px * var(--app-font-scale, 1)); }
@media (max-width: 700px) {
  .app-top-banner {
    padding-inline: calc(60px * var(--app-component-scale, 1));
  }

  .app-top-banner-brand {
    justify-self: center;
    text-align: center;
  }

  .app-top-banner-title {
    text-align: center;
  }
}
.top-banner-profile-btn {
  width: auto;
  min-width: 0;
  height: calc(40px * var(--app-component-scale, 1));
  padding: 0 calc(12px * var(--app-component-scale, 1));
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
}
.top-banner-profile-copy {
  display: grid;
  text-align: left;
  line-height: 1.05;
}
.top-banner-profile-label {
  font-size: calc(11px * var(--app-font-scale, 1));
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.top-banner-profile-name {
  font-size: calc(14px * var(--app-font-scale, 1));
  font-weight: 700;
  color: var(--text);
}
.top-banner-profile-avatar,
.menu-profile-avatar,
.profile-avatar-circle {
  width: calc(28px * var(--app-component-scale, 1));
  height: calc(28px * var(--app-component-scale, 1));
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
}
.top-banner-profile-avatar--placeholder,
.menu-profile-avatar--placeholder,
.profile-avatar-circle--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: calc(11px * var(--app-font-scale, 1));
  font-weight: 700;
}

/* Dashboard */
.dash-body { min-height: 100vh; }
.mobile-menu-btn {
  --mobile-menu-size: max(42px, calc(42px * var(--app-component-scale, 1)));
  display: none;
  position: fixed;
  top: calc(8px * var(--app-component-scale, 1));
  left: calc(12px * var(--app-component-scale, 1));
  z-index: 25;
  width: var(--mobile-menu-size);
  height: var(--mobile-menu-size);
  border-radius: calc(12px * var(--app-component-scale, 1));
  border: 1px solid var(--border);
  background: #fff;
  color: #111;
  padding: calc(8px * var(--app-component-scale, 1));
}
.mobile-menu-btn svg { width: calc(24px * var(--app-component-scale, 1)); height: calc(24px * var(--app-component-scale, 1)); flex: 0 0 auto; }
.sidebar-nav {
  position: fixed;
  left: 0;
  top: var(--top-banner-height);
  bottom: 0;
  width: calc(78px * var(--app-component-scale, 1));
  background: #fff;
  border-right: 1px solid var(--border);
  padding: calc(16px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1));
  overflow-y: auto;
  z-index: 30;
  transition: width .14s ease-out, box-shadow .14s ease-out;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 41, 55, 0.35) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: calc(8px * var(--app-component-scale, 1));
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(31, 41, 55, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(31, 41, 55, 0.5);
  background-clip: content-box;
}
.brand {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
  padding: calc(10px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1)) calc(18px * var(--app-component-scale, 1));
  font-weight: 700;
  font-size: var(--font-size-brand)
}
.brand-logo { width: calc(34px * var(--app-component-scale, 1)); height: calc(34px * var(--app-component-scale, 1)); object-fit: contain; flex: 0 0 auto; }

.brand { cursor: pointer; }

body.menu-collapsed .sidebar-nav {
  width: calc(78px * var(--app-component-scale, 1));
}
body.menu-hover-expanded .sidebar-nav {
  width: calc(270px * var(--app-component-scale, 1));
  box-shadow: 8px 0 18px rgba(15, 23, 42, 0.12);
}
body.menu-collapsed .dashboard-main {
  margin-left: calc(78px * var(--app-component-scale, 1));
}
body.menu-collapsed:not(.menu-hover-expanded) .submenu-list {
  display: none !important;
}
body.menu-collapsed:not(.menu-hover-expanded) .brand,
body.menu-collapsed:not(.menu-hover-expanded) .menu-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.menu-collapsed:not(.menu-hover-expanded) .brand-logo {
  width: calc(28px * var(--app-component-scale, 1));
  height: calc(28px * var(--app-component-scale, 1));
}

.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(6px * var(--app-component-scale, 1)); }
.menu-item {
  display: flex;
  cursor: pointer;
  align-items: center;
  gap: calc(12px * var(--app-component-scale, 1));
  padding: calc(11px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
  border-radius: calc(12px * var(--app-component-scale, 1));
  color: #23252d;
  font-size: var(--font-size-menu-item);
  overflow: hidden;
  position: relative;
}
.brand span,
.menu-item span {
  white-space: nowrap;
  max-width: calc(180px * var(--app-component-scale, 1));
  opacity: 1;
  transform: translateX(0);
  transition: max-width .12s ease-out, opacity .1s ease-out, transform .14s ease-out;
}
body.menu-collapsed .brand span,
body.menu-collapsed .menu-item span {
  max-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  overflow: hidden;
}
body.menu-collapsed.menu-hover-expanded .brand span,
body.menu-collapsed.menu-hover-expanded .menu-item span {
  max-width: calc(180px * var(--app-component-scale, 1));
  opacity: 1;
  transform: translateX(0);
  transition-delay: .05s;
}
.menu-item svg { width: calc(20px * var(--app-component-scale, 1)); height: calc(20px * var(--app-component-scale, 1)); color: #262932; flex: 0 0 auto; }
.menu-caret-pair{margin-left:auto;display:inline-flex;align-items:center;gap:calc(2px * var(--app-component-scale, 1));color:#6b7280;font-size:calc(11px * var(--app-font-scale, 1));line-height:1;}
.menu-caret-up{display:none;}
.menu-item.open .menu-caret-down{display:none;}
.menu-item.open .menu-caret-up{display:inline;}
.menu-item.active {
  background: #f1f2f4;
  color: #111;
  font-weight: 600;
}

.menu-profile-item,
.menu-profile-separator,
.menu-logout-separator,
.menu-logout-item {
  display: none;
}

.menu-logout-separator {
  margin: calc(8px * var(--app-component-scale, 1)) calc(4px * var(--app-component-scale, 1)) 0;
  border-top: 1px solid var(--border);
  height: 0;
}

.menu-logout-item {
  display: none;
  align-items: center;
  gap: calc(12px * var(--app-component-scale, 1));
  color: #b91c1c;
  font-weight: 600;
}

.menu-logout-item svg {
  width: calc(20px * var(--app-component-scale, 1));
  height: calc(20px * var(--app-component-scale, 1));
}


.menu-pin-item {
  margin-top: calc(8px * var(--app-component-scale, 1));
  padding: calc(8px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
}

.menu-pin-toggle {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
  color: #4b5563;
  font-size: calc(13px * var(--app-font-scale, 1));
  font-weight: 600;
  cursor: pointer;
}

.menu-pin-toggle input[type="checkbox"] {
  width: calc(16px * var(--app-component-scale, 1));
  height: calc(16px * var(--app-component-scale, 1));
  cursor: pointer;
}

body.menu-pinned .sidebar-nav {
  width: calc(270px * var(--app-component-scale, 1));
  box-shadow: none;
}

body.menu-pinned .dashboard-main {
  margin-left: calc(270px * var(--app-component-scale, 1));
}

body.menu-pinned .brand span,
body.menu-pinned .menu-item span {
  max-width: calc(180px * var(--app-component-scale, 1));
  opacity: 1;
  transform: translateX(0);
}

body.menu-pinned .brand,
body.menu-pinned .menu-item {
  justify-content: flex-start;
  padding-left: calc(12px * var(--app-component-scale, 1));
  padding-right: calc(12px * var(--app-component-scale, 1));
}

body.menu-collapsed:not(.menu-hover-expanded) .menu-item {
  gap: 0;
}

body.menu-collapsed:not(.menu-hover-expanded) .menu-caret-pair {
  position: absolute;
  right: calc(8px * var(--app-component-scale, 1));
  margin-left: 0;
}

.submenu-list { list-style: none; margin: calc(-2px * var(--app-component-scale, 1)) 0 calc(8px * var(--app-component-scale, 1)) calc(38px * var(--app-component-scale, 1)); padding: 0; display: none; gap: calc(4px * var(--app-component-scale, 1)); }
.submenu-list.open { display: grid; }
.submenu-item {
  color: #6b7280;
  font-size: var(--font-size-submenu-item);
  padding: calc(4px * var(--app-component-scale, 1)) calc(8px * var(--app-component-scale, 1));
  border-radius: calc(8px * var(--app-component-scale, 1));
  cursor: pointer;
}
.submenu-item:hover { background: #f7f8fa; color: #1f2937; }
.submenu-item.active {
  background: #f1f2f4;
  color: #111;
  font-weight: 600;
}
.dashboard-main {
  margin-left: calc(78px * var(--app-component-scale, 1));
  padding: calc(22px * var(--app-component-scale, 1)) calc(28px * var(--app-component-scale, 1)) calc(24px * var(--app-component-scale, 1));
}
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(16px * var(--app-component-scale, 1));
  margin-bottom: calc(16px * var(--app-component-scale, 1));
}
.dashboard-header h1 { margin: 0 0 calc(8px * var(--app-component-scale, 1)); font-size: var(--font-size-header-title); }
.dashboard-header p { margin: 0; color: var(--muted); font-size: var(--font-size-header-subtitle); }
.role-badge {
  border: 1px solid #d8dbe0;
  border-radius: 999px;
  padding: calc(2px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1));
  color: #31353e;
  background: #fafbfc;
  font-weight: 600;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.ghost-btn {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  width: calc(110px * var(--app-component-scale, 1));
}

.record-modal-header .popup-close-btn,
.attachment-modal-header .popup-close-btn {
  width: calc(38px * var(--app-component-scale, 1));
  min-width: calc(38px * var(--app-component-scale, 1));
  padding: 0;
  font-size: calc(24px * var(--app-font-scale, 1));
  line-height: 1;
}

.ghost-btn.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--app-component-scale, 1));
  color: #b91c1c;
  border-color: #b91c1c;
}

.ghost-btn.logout-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.ghost-btn.logout-btn svg {
  width: calc(18px * var(--app-component-scale, 1));
  height: calc(18px * var(--app-component-scale, 1));
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(calc(190px * var(--app-component-scale, 1)), 1fr));
  gap: calc(14px * var(--app-component-scale, 1));
}

.metric-grid.metric-grid--three-up {
  grid-template-columns: repeat(3, minmax(calc(220px * var(--app-component-scale, 1)), 1fr));
}
.metric-card {
  background: #fff;
  border: 1px solid #dddfe3;
  border-radius: calc(16px * var(--app-component-scale, 1));
  padding: calc(18px * var(--app-component-scale, 1)) calc(20px * var(--app-component-scale, 1));
  min-height: calc(150px * var(--app-component-scale, 1));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
}
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #636770;
}
.metric-head h3 { margin: 0; font-size: var(--font-size-metric-head); font-weight: 600; }
.icon { font-size: calc(18px * var(--app-font-scale, 1)); }
.metric-value {
  margin: calc(26px * var(--app-component-scale, 1)) 0 0;
  font-size: var(--font-size-metric-value);
  font-weight: 700;
}
.success { color: #06966f; }
.danger { color: #d60019; }
.warn { color: #d88500; }
.neutral { color: #232323; }

.metric-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 700;
}

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(16px * var(--app-component-scale, 1));
  margin-top: calc(14px * var(--app-component-scale, 1));
}
.panel-card {
  background: #fff;
  border: 1px solid #dddfe3;
  border-radius: calc(16px * var(--app-component-scale, 1));
  padding: calc(18px * var(--app-component-scale, 1)) calc(20px * var(--app-component-scale, 1));
  /* min-height: 250px; */
}
.panel-card h2 { margin: 0 0 calc(12px * var(--app-component-scale, 1)); font-size: var(--font-size-panel-title); }
.panel-empty {
  text-align: center;
  color: #7f838d;
  margin-top: calc(24px * var(--app-component-scale, 1));
  font-size: calc(18px * var(--app-font-scale, 1));
}
.compact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: calc(9px * var(--app-component-scale, 1));
}
.compact-list li {
  display: flex;
  justify-content: space-between;
  gap: calc(10px * var(--app-component-scale, 1));
  border-bottom: 1px dashed #e4e6eb;
  padding: calc(8px * var(--app-component-scale, 1)) 0;
  font-size: var(--font-size-list-row);
}
.attachment-inline-link {
  color: #0f172a;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}
.attachment-inline-link:hover {
  color: #1d4ed8;
}

.breakdown-table-wrap { overflow-x: auto; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-breakdown-table); }
.breakdown-table th,
.breakdown-table td {
  text-align: left;
  border-bottom: 1px solid #d9dde5;
  padding: calc(10px * var(--app-component-scale, 1)) calc(8px * var(--app-component-scale, 1));
}
.breakdown-table th { font-weight: 700; color: #111827; }
.breakdown-table td { color: #111827; }
.breakdown-table th.amount-cell,
.breakdown-table td.amount-cell { text-align: right; }


@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(calc(180px * var(--app-component-scale, 1)), 1fr)); }
  .metric-grid.metric-grid--three-up { grid-template-columns: 1fr; }
  .panels-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; padding: calc(24px * var(--app-component-scale, 1)); }
  .auth-logo { margin: 0 auto calc(18px * var(--app-component-scale, 1)); }

  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-menu-btn {
    left: calc(12px * var(--app-component-scale, 1));
    top: calc((var(--top-banner-height) - var(--mobile-menu-size)) / 2);
    z-index: 58;
  }
  body.menu-collapsed .sidebar-nav,
  body.menu-pinned .sidebar-nav {
    width: calc(270px * var(--app-component-scale, 1));
  }
  body.menu-collapsed .dashboard-main,
  body.menu-pinned .dashboard-main {
    margin-left: 0;
  }
  body.menu-collapsed .brand span,
  body.menu-collapsed .menu-item span,
  body.menu-collapsed .submenu-list,
  body.menu-pinned .brand span,
  body.menu-pinned .menu-item span,
  body.menu-pinned .submenu-list {
    display: initial !important;
  }
  body.menu-collapsed .brand,
  body.menu-collapsed .menu-item,
  body.menu-pinned .brand,
  body.menu-pinned .menu-item {
    justify-content: flex-start;
    padding-left: calc(12px * var(--app-component-scale, 1));
    padding-right: calc(12px * var(--app-component-scale, 1));
  }
  .sidebar-nav {
    top: var(--top-banner-height);
    width: calc(270px * var(--app-component-scale, 1));
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 20;
    box-shadow: none;
  }
  .sidebar-nav.open { transform: translateX(0); }

  .dashboard-main {
    margin-left: 0;
    padding: calc(16px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1)) calc(16px * var(--app-component-scale, 1));
  }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .dashboard-header .ghost-btn { display: none; }
  .top-banner-profile-btn,
  .top-banner-logout-btn { display: none !important; }
  .menu-pin-item { display: none; }
  .menu-profile-item,
  .menu-logout-separator,
  .menu-logout-item { display: flex; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: calc(132px * var(--app-component-scale, 1)); }
  .metric-value { font-size: clamp(calc(30px * var(--app-font-scale, 1)), calc(8vw * var(--app-font-scale, 1)), calc(36px * var(--app-font-scale, 1))); }
  .panel-empty { margin-top: calc(24px * var(--app-component-scale, 1)); }
}

/* Goal-based application navigation */
.app-top-banner {
  grid-template-columns: auto minmax(0, 1fr) auto;
  background: var(--theme-card);
  border-color: var(--theme-border);
  color: var(--theme-text);
}
.app-top-banner-brand { grid-column: 1; justify-self: start; }
.app-top-banner .sidebar-nav {
  grid-column: 2;
  position: static;
  width: auto;
  /* Fit the banner's content box, excluding its bottom border. */
  height: 100%;
  padding: 0 calc(6px * var(--app-component-scale, 1));
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  z-index: 1;
}
.app-top-banner-user {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: calc(8px * var(--app-component-scale, 1));
  min-width: 0;
}
.app-top-banner-profile,
.app-top-banner-actions { display: flex; align-items: center; gap: calc(8px * var(--app-component-scale, 1)); }
.menu-list,
.menu-tree { list-style: none; margin: 0; padding: 0; }
.app-top-banner .menu-list {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: calc(2px * var(--app-component-scale, 1));
  height: 100%;
}
.menu-entry { position: relative; list-style: none; }
.app-top-banner .menu-depth-0 { display: flex; align-items: center; }
.menu-item,
.submenu-item {
  appearance: none;
  border: 0;
  text-decoration: none;
  color: var(--theme-text);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.app-top-banner .menu-item {
  width: auto;
  height: calc(40px * var(--app-component-scale, 1));
  min-height: calc(40px * var(--app-component-scale, 1));
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--app-component-scale, 1));
  padding: 0 calc(9px * var(--app-component-scale, 1));
  border-radius: calc(9px * var(--app-component-scale, 1));
  font-size: calc(13px * var(--app-font-scale, 1));
  font-weight: 650;
  white-space: nowrap;
  overflow: visible;
}
.menu-item:hover,
.menu-item:focus-visible,
.submenu-item:hover,
.submenu-item:focus-visible,
.menu-entry.active-ancestor > .menu-item,
.menu-entry.active-ancestor > .submenu-item {
  color: var(--theme-text);
  background: color-mix(in srgb, var(--theme-primary) 11%, var(--theme-card));
}
.menu-item:focus-visible,
.submenu-item:focus-visible {
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}
.menu-item .menu-icon {
  display: block;
  width: calc(18px * var(--app-component-scale, 1));
  height: calc(18px * var(--app-component-scale, 1));
  flex: 0 0 auto;
  color: var(--theme-muted);
}
.menu-entry.active > .menu-item .menu-icon,
.menu-entry.active-ancestor > .menu-item .menu-icon { color: currentColor; }
.menu-caret { margin-left: calc(2px * var(--app-component-scale, 1)); color: var(--theme-muted); transition: transform .15s ease; }
.menu-entry.open > .menu-item .menu-caret,
.menu-entry.open > .submenu-item .menu-caret { transform: rotate(180deg); }
.submenu-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: calc(8px * var(--app-component-scale, 1));
  min-width: calc(220px * var(--app-component-scale, 1));
  border: 1px solid var(--theme-border);
  border-radius: calc(12px * var(--app-component-scale, 1));
  background: var(--theme-overlay);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--theme-shadow) 18%, transparent);
}
.menu-entry.open > .submenu-list { display: grid; gap: calc(3px * var(--app-component-scale, 1)); }
.app-top-banner .menu-depth-0 > .submenu-list {
  position: absolute;
  top: calc(100% - calc(3px * var(--app-component-scale, 1)));
  left: 0;
  max-height: calc(100dvh - var(--top-banner-height) - calc(16px * var(--app-component-scale, 1)));
  overflow: auto;
}
.app-top-banner .menu-depth-0:nth-last-child(-n+2) > .submenu-list { left: auto; right: 0; }
.app-top-banner .submenu-list .submenu-list {
  margin: calc(3px * var(--app-component-scale, 1)) 0 calc(5px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1));
  padding: calc(3px * var(--app-component-scale, 1)) 0 calc(3px * var(--app-component-scale, 1)) calc(9px * var(--app-component-scale, 1));
  min-width: 0;
  border: 0;
  border-left: 1px solid var(--theme-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.submenu-item {
  width: 100%;
  min-height: calc(36px * var(--app-component-scale, 1));
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: calc(9px * var(--app-component-scale, 1));
  padding: calc(7px * var(--app-component-scale, 1)) calc(9px * var(--app-component-scale, 1));
  border-radius: calc(8px * var(--app-component-scale, 1));
  font-size: var(--font-size-submenu-item);
  text-align: left;
}
.submenu-item .menu-icon { width: calc(17px * var(--app-component-scale, 1)); height: calc(17px * var(--app-component-scale, 1)); flex: 0 0 auto; color: var(--theme-muted); }
.submenu-item .menu-caret { margin-left: auto; }
.menu-entry.active > .submenu-item,
.menu-entry.active > .menu-item {
  color: var(--theme-menu-text);
  background: var(--theme-menu-hover);
  font-weight: 700;
}
.app-top-banner .menu-depth-0.active > .menu-item::after,
.app-top-banner .menu-depth-0.active-ancestor > .menu-item::after {
  content: '';
  position: absolute;
  left: calc(10px * var(--app-component-scale, 1));
  right: calc(10px * var(--app-component-scale, 1));
  bottom: calc(3px * var(--app-component-scale, 1));
  height: calc(2px * var(--app-component-scale, 1));
  border-radius: 999px;
  background: var(--theme-primary);
}
.menu-entry.active > .submenu-item .menu-icon { color: currentColor; }
.menu-profile-item,
.menu-profile-separator,
.menu-logout-separator,
.menu-logout-item { display: none; }
.dashboard-main,
body.menu-collapsed .dashboard-main,
body.menu-pinned .dashboard-main { margin-left: 0; }
.menu-drawer-backdrop { display: none; }

@media (min-width: 1281px) {
  .app-top-banner .menu-depth-0 > .submenu-list {
    width: min(calc(320px * var(--app-component-scale, 1)), calc(100vw - calc(24px * var(--app-component-scale, 1))));
  }
  .app-top-banner .menu-depth-0[data-menu-id="administration"] > .submenu-list {
    width: min(calc(360px * var(--app-component-scale, 1)), calc(100vw - calc(24px * var(--app-component-scale, 1))));
  }
}

@media (min-width: 1281px) and (max-width: 1400px) {
  .top-banner-profile-btn { padding-inline: calc(6px * var(--app-component-scale, 1)); }
  .top-banner-profile-copy { display: none; }
  .app-top-banner .menu-item { gap: calc(5px * var(--app-component-scale, 1)); padding-inline: calc(6px * var(--app-component-scale, 1)); }
  .app-top-banner .menu-item .menu-icon { width: calc(16px * var(--app-component-scale, 1)); height: calc(16px * var(--app-component-scale, 1)); }
}

@media (max-width: 900px) {
  html,
  body { overscroll-behavior-x: none; }
  body.app-shell {
    --top-banner-height: max(50px, calc(56px * var(--app-component-scale, 1)));
    overscroll-behavior-x: none;
    touch-action: pan-x pan-y pinch-zoom;
  }
  .app-top-banner {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    padding-inline: calc(60px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
  }
  .app-top-banner-brand { grid-column: 2; justify-self: center; }
  .app-top-banner-profile,
  .app-top-banner-actions,
  .app-top-banner-user { display: none; }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: calc((var(--top-banner-height) - var(--mobile-menu-size)) / 2);
    left: calc(12px * var(--app-component-scale, 1));
    z-index: 61;
    border-color: var(--theme-border);
    background: var(--theme-card);
    color: var(--theme-text);
  }
  .app-top-banner .sidebar-nav {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    width: min(calc(340px * var(--app-component-scale, 1)), 88vw);
    height: 100vh;
    height: 100dvh;
    padding: calc(env(safe-area-inset-top, 0px) + calc(8px * var(--app-component-scale, 1))) calc(6px * var(--app-component-scale, 1)) calc(env(safe-area-inset-bottom, 0px) + calc(14px * var(--app-component-scale, 1)));
    overflow: auto;
    transform: translateX(-102%);
    transition: transform .2s ease;
    border-right: 1px solid var(--theme-border);
    background: var(--theme-overlay);
    box-shadow: 12px 0 28px color-mix(in srgb, var(--theme-shadow) 20%, transparent);
    z-index: 60;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
  }
  .app-top-banner .sidebar-nav.open { transform: translateX(0); }
  body.menu-drawer-open .mobile-menu-btn { visibility: hidden; }
  .app-top-banner .menu-list { display: grid; align-content: start; justify-content: stretch; width: 100%; height: auto; gap: calc(4px * var(--app-component-scale, 1)); }
  .app-top-banner .menu-depth-0 { display: block; }
  .app-top-banner .menu-item,
  .app-top-banner .submenu-item { min-height: calc(44px * var(--app-component-scale, 1)); height: auto; }
  .app-top-banner .menu-item {
    width: 100%;
    justify-content: flex-start;
    padding: calc(9px * var(--app-component-scale, 1)) calc(11px * var(--app-component-scale, 1));
    font-size: var(--font-size-menu-item);
  }
  .menu-item .menu-icon { display: block; width: calc(20px * var(--app-component-scale, 1)); height: calc(20px * var(--app-component-scale, 1)); flex: 0 0 auto; }
  .menu-item .menu-caret { margin-left: auto; }
  .app-top-banner .menu-depth-0.active > .menu-item::after,
  .app-top-banner .menu-depth-0.active-ancestor > .menu-item::after { display: none; }
  .app-top-banner .menu-depth-0 > .submenu-list {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .app-top-banner .submenu-list {
    margin: calc(2px * var(--app-component-scale, 1)) 0 calc(4px * var(--app-component-scale, 1)) calc(5px * var(--app-component-scale, 1));
    padding: calc(2px * var(--app-component-scale, 1)) 0 calc(2px * var(--app-component-scale, 1)) calc(6px * var(--app-component-scale, 1));
    min-width: 0;
    border: 0;
    border-left: 1px solid var(--theme-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .menu-profile-item,
  .menu-logout-item { display: flex; }
  .app-top-banner .menu-profile-item > .submenu-item.menu-profile-link,
  .profile-role-popover > .profile-role-link {
    display: flex;
    align-items: center;
    gap: calc(12px * var(--app-component-scale, 1));
    padding: calc(10px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1));
    border: 1px solid var(--theme-border);
    border-radius: calc(10px * var(--app-component-scale, 1));
    background: var(--theme-card);
    color: var(--theme-text);
    text-decoration: none;
  }
  .app-top-banner .menu-profile-item > .submenu-item.menu-profile-link {
    min-height: max(64px, calc(70px * var(--app-component-scale, 1)));
  }
  .profile-role-popover > .profile-role-link {
    min-height: max(48px, calc(52px * var(--app-component-scale, 1)));
    font-weight: 700;
  }
  .app-top-banner .menu-profile-item > .submenu-item.menu-profile-link:is(:hover,:focus-visible),
  .app-top-banner .menu-profile-item.active > .submenu-item.menu-profile-link,
  .profile-role-popover > .profile-role-link:is(:hover,:focus-visible) {
    background: var(--theme-menu-hover);
    color: var(--theme-menu-text);
    border-color: var(--theme-primary);
  }
  .menu-profile-link:focus-visible,
  .profile-role-popover > .profile-role-link:focus-visible {
    outline: 2px solid var(--theme-focus);
    outline-offset: 2px;
  }
  .menu-profile-link::after,
  .profile-role-popover > .profile-role-link::after {
    content: '';
    width: .5em;
    height: .5em;
    margin-inline-start: auto;
    border-block-start: 2px solid currentColor;
    border-inline-end: 2px solid currentColor;
    transform: rotate(45deg);
    flex: 0 0 auto;
  }
  .menu-profile-link .menu-profile-avatar {
    width: max(36px, calc(42px * var(--app-component-scale, 1)));
    height: max(36px, calc(42px * var(--app-component-scale, 1)));
  }
  .menu-profile-link .menu-profile-avatar--placeholder {
    background: var(--theme-raised);
    color: var(--theme-text);
    font-size: max(13px, calc(15px * var(--app-font-scale, 1)));
  }
  .menu-profile-copy {
    display: grid;
    gap: .15em;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .menu-profile-copy strong { font-size: max(14px, calc(17px * var(--app-font-scale, 1))); }
  .menu-profile-name { color: var(--theme-muted); }
  .menu-profile-separator { display: block; margin: calc(4px * var(--app-component-scale, 1)) calc(4px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1)); border-top: 1px solid var(--theme-border); }
  .menu-logout-separator { display: block; margin: calc(10px * var(--app-component-scale, 1)) calc(4px * var(--app-component-scale, 1)) calc(4px * var(--app-component-scale, 1)); border-top: 1px solid var(--theme-border); }
  .menu-logout-item {
    min-height: calc(44px * var(--app-component-scale, 1));
    align-items: center;
    gap: calc(10px * var(--app-component-scale, 1));
    padding: calc(9px * var(--app-component-scale, 1)) calc(11px * var(--app-component-scale, 1));
    border-radius: calc(8px * var(--app-component-scale, 1));
    color: var(--theme-danger);
    cursor: pointer;
  }
  .menu-logout-item svg { width: calc(20px * var(--app-component-scale, 1)); height: calc(20px * var(--app-component-scale, 1)); }
  .menu-drawer-backdrop {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--theme-shadow) 55%, transparent);
    z-index: 34;
  }
  body.menu-drawer-open .menu-drawer-backdrop { display: block; }
}


.form-grid { display: grid; gap: calc(12px * var(--app-component-scale, 1)); }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(calc(180px * var(--app-component-scale, 1)), 1fr)); }
.form-grid.three-col { grid-template-columns: repeat(3, minmax(calc(220px * var(--app-component-scale, 1)), 1fr)); }
.form-section-divider { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: calc(2px * var(--app-component-scale, 1)) 0; }
.form-section-heading { grid-column: 1 / -1; font-size: var(--font-size-form-section-heading); font-weight: 700; margin-top: calc(6px * var(--app-component-scale, 1)); }
.form-actions { grid-column: 1 / -1; display: flex; gap: calc(10px * var(--app-component-scale, 1)); align-items: center; }
.profile-picture-field { align-content: start;  position: relative; }
.profile-picture-label { display: block; margin-bottom: calc(8px * var(--app-component-scale, 1)); font-weight: 600; }
.profile-picture-native-input, .file-upload-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; overflow: hidden; }
.profile-photo-editor { position: relative; width: var(--profile-photo-size); padding-bottom: calc(18px * var(--app-component-scale, 1)); }
.profile-photo-preview { width: var(--profile-photo-size); height: var(--profile-photo-size); border-radius: 50%; border: 1px solid var(--theme-border); background: color-mix(in srgb, var(--theme-primary) 12%, var(--theme-card)); color: var(--theme-primary); overflow: hidden; display: grid; place-items: center; }
.profile-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-placeholder { width: calc(64px * var(--app-component-scale, 1)); height: calc(64px * var(--app-component-scale, 1)); }
.profile-photo-placeholder svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
.profile-photo-edit { position: absolute; left: calc(8px * var(--app-component-scale, 1)); bottom: 0; min-width: calc(68px * var(--app-component-scale, 1)); height: calc(38px * var(--app-component-scale, 1)); padding: 0 calc(12px * var(--app-component-scale, 1)); display: inline-flex; align-items: center; gap: calc(7px * var(--app-component-scale, 1)); box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-shadow) 18%, transparent); }
.profile-photo-edit svg { width: calc(15px * var(--app-component-scale, 1)); height: calc(15px * var(--app-component-scale, 1)); }
.profile-photo-menu { position: absolute; z-index: 20; left: calc(8px * var(--app-component-scale, 1)); top: calc(100% + calc(3px * var(--app-component-scale, 1))); width: calc(180px * var(--app-component-scale, 1)); padding: calc(6px * var(--app-component-scale, 1)); border: 1px solid var(--theme-border); border-radius: calc(9px * var(--app-component-scale, 1)); background: var(--theme-overlay); box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-shadow) 18%, transparent); }
.profile-photo-menu button { width: 100%; min-height: calc(36px * var(--app-component-scale, 1)); justify-content: flex-start; border: 0; box-shadow: none; }
.profile-crop-dialog { width: min(calc(520px * var(--app-component-scale, 1)), calc(100vw - calc(24px * var(--app-component-scale, 1)))); max-height: calc(100dvh - calc(24px * var(--app-component-scale, 1))); padding: 0; border: 1px solid var(--theme-border); border-radius: calc(12px * var(--app-component-scale, 1)); background: var(--theme-overlay); color: var(--theme-text); overflow: hidden auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; scrollbar-color: var(--theme-muted) transparent; }
.profile-crop-dialog::backdrop { background: color-mix(in srgb, var(--theme-shadow) 65%, transparent); }
.profile-crop-dialog header, .profile-crop-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: calc(10px * var(--app-component-scale, 1)); padding: calc(14px * var(--app-component-scale, 1)) calc(16px * var(--app-component-scale, 1)); border-bottom: 1px solid var(--theme-border); }
.profile-crop-dialog header { position: sticky; top: 0; z-index: 2; background: var(--theme-overlay); }
.profile-crop-dialog header h2 { margin: 0; font-size: calc(16px * var(--app-font-scale, 1)); }
.profile-crop-dialog footer { justify-content: flex-end; border-top: 1px solid var(--theme-border); border-bottom: 0; }
.profile-crop-close { min-width: calc(36px * var(--app-component-scale, 1)); width: calc(36px * var(--app-component-scale, 1)); padding: 0; font-size: calc(22px * var(--app-font-scale, 1)); }
.profile-crop-stage { position: relative; width: calc(100% - calc(32px * var(--app-component-scale, 1))); aspect-ratio: 1; margin: calc(16px * var(--app-component-scale, 1)); background: var(--theme-muted); overflow: hidden; border-radius: 50%; touch-action: none; cursor: grab; }
.profile-crop-stage:active { cursor: grabbing; }
.profile-crop-stage img { position: absolute; width: auto; height: auto; max-width: none; left: 50%; top: 50%; transform-origin: center; user-select: none; }
.profile-crop-zoom { display: flex; align-items: center; gap: calc(12px * var(--app-component-scale, 1)); padding: 0 calc(16px * var(--app-component-scale, 1)); }
.profile-crop-zoom input { flex: 1; accent-color: var(--theme-primary); }
.profile-crop-help { text-align: center; margin: calc(10px * var(--app-component-scale, 1)) calc(16px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1)); }
.file-upload-placeholder { border: 1px dashed var(--theme-border); border-radius: calc(10px * var(--app-component-scale, 1)); background: var(--theme-raised); color: var(--theme-text); display: flex; align-items: center; justify-content: center; gap: calc(10px * var(--app-component-scale, 1)); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.file-upload-placeholder--compact { width: 100%; height: calc(42px * var(--app-component-scale, 1)); padding: calc(5px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1)); justify-content: flex-start; }
.file-upload-placeholder:hover, .file-upload-placeholder:focus-within, .file-upload-placeholder.dragover { border-color: var(--theme-focus); background: var(--theme-menu-hover); }
.file-upload-placeholder svg { width: calc(24px * var(--app-component-scale, 1)); height: calc(24px * var(--app-component-scale, 1)); flex: 0 0 auto; color: var(--theme-muted); }
.file-upload-copy { display: grid; min-width: 0; line-height: 1.1; }
.file-upload-copy strong, .file-upload-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-upload-copy strong { font-size: calc(13px * var(--app-font-scale, 1)); }
.file-upload-copy small { color: var(--theme-muted); font-size: calc(11px * var(--app-font-scale, 1)); }
.file-upload-placeholder.has-file { border-style: solid; }

.profile-picture-field--wide,
.profile-picture-field--full-row { grid-column: 1 / -1; }
.profile-picture-preview-card { display: flex; align-items: end; }
.profile-picture-preview { width: calc(140px * var(--app-component-scale, 1)); height: calc(140px * var(--app-component-scale, 1)); border-radius: calc(16px * var(--app-component-scale, 1)); border: 1px dashed var(--border); background: #f8fafc; display: flex; align-items: center; justify-content: center; padding: calc(10px * var(--app-component-scale, 1)); text-align: center; overflow: hidden; }
.profile-picture-preview.profile-picture-preview--image { border-style: solid; background: #fff; padding: 0; }
.profile-picture-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.table-wrap { overflow-x: auto; touch-action: pan-x pan-y pinch-zoom; }
.simple-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-simple-table); }
.simple-table th, .simple-table td { text-align: left; border-bottom: 1px solid var(--border); padding: var(--table-cell-padding-y) var(--table-cell-padding-x); }
.simple-table th.amount-cell, .simple-table td.amount-cell { text-align: right; }
.simple-table :is(th,td).attachment-indicator-cell {
  width: calc(36px * var(--app-component-scale, 1));
  text-align: center;
  color: var(--theme-icon);
}
.attachment-indicator-cell svg {
  width: 1rem;
  height: 1rem;
  vertical-align: middle;
}
@media (max-width: 900px) {
  .simple-table td.attachment-indicator-cell:empty { display: none; }
  .simple-table td.attachment-indicator-cell:not(:empty) { width: auto; justify-content: flex-end; }
  .simple-table td.attachment-indicator-cell::before { display: none; }
}
.table-btn { height: calc(24px * var(--app-component-scale, 1)); border-radius: calc(7px * var(--app-component-scale, 1)); padding: 0 calc(6px * var(--app-component-scale, 1)); margin-right: calc(6px * var(--app-component-scale, 1)); background: #111827; color: #fff; border: 0; font-size: calc(12px * var(--app-font-scale, 1)); min-width: calc(58px * var(--app-component-scale, 1)); }
.forgot-btn { margin-top: calc(10px * var(--app-component-scale, 1)); width: auto; height: calc(36px * var(--app-component-scale, 1)); padding: 0 calc(12px * var(--app-component-scale, 1)); font-size: calc(14px * var(--app-font-scale, 1)); }
.auth-social-divider {
  margin-top: calc(16px * var(--app-component-scale, 1));
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: calc(13px * var(--app-font-scale, 1));
}
.auth-social-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--border);
  transform: translateY(-50%);
}
.auth-social-divider span {
  position: relative;
  background: var(--card);
  padding: 0 calc(10px * var(--app-component-scale, 1));
}
.social-login-btn {
  width: 100%;
  height: calc(44px * var(--app-component-scale, 1));
  margin-top: calc(12px * var(--app-component-scale, 1));
  gap: calc(10px * var(--app-component-scale, 1));
}
.social-login-icon {
  width: calc(20px * var(--app-component-scale, 1));
  height: calc(20px * var(--app-component-scale, 1));
  flex: 0 0 20px;
}
.danger-btn { background: #b91c1c; min-width: calc(88px * var(--app-component-scale, 1)); padding: 0 calc(10px * var(--app-component-scale, 1)); }
.table-btn.table-delete-btn { height: calc(24px * var(--app-component-scale, 1)); padding: 0 calc(6px * var(--app-component-scale, 1)); min-width: calc(58px * var(--app-component-scale, 1)); font-size: calc(12px * var(--app-font-scale, 1)); }
@media (max-width: 900px) {
  .form-grid.two-col { grid-template-columns: 1fr; }
  .form-grid.three-col { grid-template-columns: 1fr; }
  .profile-picture-field--wide,
  .profile-picture-field--full-row { grid-column: auto; justify-self: center; text-align: center; }
  .profile-picture-preview-card { justify-content: flex-start; }
  .feature-grid { grid-template-columns: 1fr; }
}


.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(calc(220px * var(--app-component-scale, 1)), 1fr)); gap: calc(10px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1)); }
.feature-row { display: grid; gap: calc(7px * var(--app-component-scale, 1)); align-content: start; }
.check-inline { display:flex; align-items:center; gap:calc(10px * var(--app-component-scale, 1)); font-weight:600; }
.check-inline input[type="checkbox"] { width:calc(18px * var(--app-component-scale, 1)); height:calc(18px * var(--app-component-scale, 1)); }

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: 1fr; }
}

.attachment-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: calc(16px * var(--app-component-scale, 1)); z-index: 75; }
.attachment-modal[hidden] { display: none; }
.attachment-modal-card { --modal-card-padding: calc(16px * var(--app-component-scale, 1)); width: min(calc(760px * var(--app-component-scale, 1)), 100%); max-height: 88vh; overflow: hidden auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; scrollbar-color: var(--theme-muted) transparent; background: var(--theme-overlay); border-radius: calc(12px * var(--app-component-scale, 1)); border: 1px solid var(--theme-border); padding: var(--modal-card-padding); }
.attachment-modal-header { display: flex; align-items: center; justify-content: space-between; margin: calc(-1 * var(--modal-card-padding)) calc(-1 * var(--modal-card-padding)) calc(12px * var(--app-component-scale, 1)); padding: var(--modal-card-padding); }
.attachment-upload-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: calc(10px * var(--app-component-scale, 1)); align-items: end; margin-bottom: calc(10px * var(--app-component-scale, 1)); }
.attachment-list { display: grid; gap: calc(10px * var(--app-component-scale, 1)); }
.attachment-item { display: flex; align-items: center; justify-content: space-between; gap: calc(10px * var(--app-component-scale, 1)); border: 1px solid var(--border); border-radius: calc(9px * var(--app-component-scale, 1)); padding: calc(10px * var(--app-component-scale, 1)); }
.attachment-open-btn { border: 0; background: transparent; text-align: left; display: grid; gap: calc(2px * var(--app-component-scale, 1)); cursor: pointer; }
.attachment-type { font-size: calc(12px * var(--app-font-scale, 1)); color: #334155; font-weight: 600; }

@media (max-width: 900px) {
  .attachment-upload-row { grid-template-columns: 1fr; }
}


.record-modal { position: fixed; inset: 0; background: var(--theme-modal-backdrop); display: flex; align-items: center; justify-content: center; padding: calc(16px * var(--app-component-scale, 1)); z-index: 65; overflow-y: auto; }
.user-child-modal { z-index: 85; }
.record-modal[hidden] { display: none; }
.record-modal-card { --modal-card-padding: calc(16px * var(--app-component-scale, 1)); width: min(calc(980px * var(--app-component-scale, 1)), 100%); max-height: calc(100dvh - calc(32px * var(--app-component-scale, 1))); overflow: hidden auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; scrollbar-color: var(--theme-muted) transparent; background: var(--theme-overlay); border-radius: calc(12px * var(--app-component-scale, 1)); border: 1px solid var(--theme-border); padding: var(--modal-card-padding); margin: auto 0; }
.record-modal-header { display:flex; align-items:center; justify-content:space-between; margin: calc(-1 * var(--modal-card-padding)) calc(-1 * var(--modal-card-padding)) calc(12px * var(--app-component-scale, 1)); padding: var(--modal-card-padding); }
.record-modal-header,
.attachment-modal-header {
  position: sticky;
  top: calc(-1 * var(--modal-card-padding));
  z-index: 10;
  background: var(--theme-overlay);
  border-bottom: 1px solid var(--theme-border);
}
.record-modal-card::-webkit-scrollbar,
.attachment-modal-card::-webkit-scrollbar,
.profile-crop-dialog::-webkit-scrollbar { width: calc(10px * var(--app-component-scale, 1)); }
.record-modal-card::-webkit-scrollbar-track,
.attachment-modal-card::-webkit-scrollbar-track,
.profile-crop-dialog::-webkit-scrollbar-track,
.record-modal-card::-webkit-scrollbar-corner,
.attachment-modal-card::-webkit-scrollbar-corner,
.profile-crop-dialog::-webkit-scrollbar-corner { background: transparent; }
.record-modal-card::-webkit-scrollbar-thumb,
.attachment-modal-card::-webkit-scrollbar-thumb,
.profile-crop-dialog::-webkit-scrollbar-thumb { background: var(--theme-muted); border: 3px solid transparent; border-radius: 999px; background-clip: content-box; }
.record-modal-actions { display:flex; gap: calc(8px * var(--app-component-scale, 1)); margin-top: calc(12px * var(--app-component-scale, 1)); }
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover td { background: #f3f4f6; }
.member-contrib-toolbar { display:flex; align-items:center; justify-content:space-between; gap:calc(12px * var(--app-component-scale, 1)); margin-bottom:calc(12px * var(--app-component-scale, 1)); flex-wrap:wrap; }
.member-contrib-toolbar-pager { display:flex; align-items:center; gap:calc(8px * var(--app-component-scale, 1)); margin-left:auto; flex-wrap:wrap; justify-content:flex-end; }

.email-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: calc(2px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1));
  font-size: calc(12px * var(--app-font-scale, 1));
  font-weight: 700;
  text-transform: capitalize;
}
.email-status--sent { background: #dcfce7; color: #166534; }
.email-status--failed { background: #fee2e2; color: #991b1b; }
.email-status--outgoing { background: #e0e7ff; color: #3730a3; }
.app-tabs {
  min-inline-size: 0;
  max-inline-size: 100%;
  border-block-end: 1px solid var(--theme-border);
  background: var(--theme-page);
  display: flex;
  gap: calc(4px * var(--app-component-scale, 1));
  overflow-x: auto;
  scrollbar-width: thin;
}
.app-tabs > .app-tab {
  display: inline-flex;
  box-sizing: border-box;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: calc(38px * var(--app-component-scale, 1));
  height: auto;
  margin: 0;
  padding: calc(10px * var(--app-component-scale, 1)) calc(18px * var(--app-component-scale, 1));
  border: 0;
  border-block-end: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--theme-muted);
  box-shadow: none;
  font: inherit;
  font-size: var(--font-size-label);
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}
.app-tabs > .app-tab:is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"]) {
  border-block-end-color: var(--theme-primary);
  background: var(--theme-card);
  color: var(--theme-text);
  font-weight: 700;
}
.app-tabs > .app-tab:not(:is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"], :disabled)):hover {
  background: var(--theme-secondary-hover);
  color: var(--theme-text);
}
.app-tabs > .app-tab:focus-visible {
  outline: 2px solid var(--theme-focus);
  outline-offset: -3px;
}
.app-tabs > .app-tab:disabled {
  opacity: .7;
  cursor: not-allowed;
}
@media (max-width: 900px), (pointer: coarse) {
  .app-tabs > .app-tab {
    min-height: max(44px, calc(38px * var(--app-component-scale, 1)));
  }
}
#emailLogTabs {
  margin-block: calc(14px * var(--app-component-scale, 1));
}
.app-tabs:not([hidden]) ~ .app-tab-panel {
  min-width: 0;
  margin-block-start: calc(14px * var(--app-component-scale, 1));
  padding: calc(18px * var(--app-component-scale, 1)) calc(20px * var(--app-component-scale, 1));
  border: 1px solid var(--theme-border);
  border-radius: calc(16px * var(--app-component-scale, 1));
  background: var(--theme-card);
}

.email-body-preview {
  border: 1px solid var(--border);
  border-radius: calc(10px * var(--app-component-scale, 1));
  min-height: calc(120px * var(--app-component-scale, 1));
  padding: calc(12px * var(--app-component-scale, 1));
  background: #fff;
}

.global-loading-layer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-loading-layer.global-loading-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.global-loading-layer.global-loading-hidden {
  opacity: 0;
  visibility: hidden;
}

.global-loading-content {
  min-width: calc(210px * var(--app-component-scale, 1));
  padding: calc(14px * var(--app-component-scale, 1)) calc(18px * var(--app-component-scale, 1));
  border-radius: calc(12px * var(--app-component-scale, 1));
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: calc(10px * var(--app-component-scale, 1));
  font-weight: 600;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.18);
}

.global-loading-spinner {
  width: calc(18px * var(--app-component-scale, 1));
  height: calc(18px * var(--app-component-scale, 1));
  border-radius: 999px;
  border: 2px solid rgba(30, 41, 59, 0.18);
  border-top-color: #1e40af;
  animation: global-loading-spin 0.9s linear infinite;
}

@keyframes global-loading-spin {
  to { transform: rotate(360deg); }
}


@media (max-width: 900px) {
  .table-wrap { overflow: visible; }
  .simple-table thead { display: none; }
  .simple-table,
  .simple-table tbody,
  .simple-table tr,
  .simple-table td {
    display: block;
    width: 100%;
  }
  .simple-table tr {
    border: 1px solid var(--border);
    border-radius: calc(12px * var(--app-component-scale, 1));
    background: #fff;
    padding: calc(10px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
    margin-bottom: calc(10px * var(--app-component-scale, 1));
    box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
  }
  .simple-table td {
    border-bottom: 0;
    padding: calc(6px * var(--app-component-scale, 1)) 0;
    min-height: calc(30px * var(--app-component-scale, 1));
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: calc(10px * var(--app-component-scale, 1));
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }
  .simple-table td::before {
    content: attr(data-label);
    min-width: calc(110px * var(--app-component-scale, 1));
    max-width: 44%;
    font-weight: 700;
    color: #334155;
    flex: 0 0 auto;
  }
  .simple-table td > * {
    max-width: 100%;
    text-align: left;
  }
  .simple-table td.amount-cell {
    justify-content: space-between;
    text-align: right;
  }
  .simple-table td.amount-cell::before {
    text-align: left;
  }
  .simple-table td.amount-cell > * {
    margin-left: auto;
    text-align: right;
  }
  .simple-table td:last-child {
    padding-top: calc(10px * var(--app-component-scale, 1));
    margin-top: calc(6px * var(--app-component-scale, 1));
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: calc(6px * var(--app-component-scale, 1));
    align-items: center;
  }
  .simple-table td:last-child::before {
    width: 100%;
    max-width: 100%;
    margin-bottom: calc(4px * var(--app-component-scale, 1));
  }
  .transparency-table td:last-child {
    padding-top: calc(6px * var(--app-component-scale, 1));
    margin-top: 0;
    border-top: 0;
    flex-wrap: nowrap;
    gap: calc(10px * var(--app-component-scale, 1));
    align-items: flex-start;
  }
  .transparency-table td:last-child::before {
    width: auto;
    max-width: 44%;
    margin-bottom: 0;
  }
  .table-btn { margin-right: 0; }
  .record-modal,
  .attachment-modal {
    align-items: flex-start;
    padding: calc(var(--top-banner-height) + calc(8px * var(--app-component-scale, 1))) calc(10px * var(--app-component-scale, 1)) calc(10px * var(--app-component-scale, 1));
  }
  .record-modal-card,
  .attachment-modal-card {
    --modal-card-padding: calc(16px * var(--app-component-scale, 1));
    width: 100%;
    max-height: calc(100vh - var(--top-banner-height) - calc(20px * var(--app-component-scale, 1)));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: calc(12px * var(--app-component-scale, 1));
  }
  .record-modal .form-grid.two-col,
  .attachment-modal .form-grid.two-col {
    grid-template-columns: 1fr;
  }
  .record-modal label,
  .attachment-modal label {
    min-width: 0;
  }
  .record-modal input,
  .record-modal select,
  .record-modal textarea,
  .attachment-modal input,
  .attachment-modal select,
  .attachment-modal textarea {
    width: 100%;
    max-width: 100%;
  }
  .record-modal input[type="date"],
  .record-modal input[type="month"],
  .attachment-modal input[type="date"],
  .attachment-modal input[type="month"] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    height: calc(44px * var(--app-component-scale, 1));
    line-height: 1.2;
  }
  .record-modal .form-actions,
  .attachment-modal .form-actions {
    flex-wrap: wrap;
  }
  .form-actions button[type="submit"],
  .form-actions button[id*="save" i] {
    min-width: calc(75px * var(--app-component-scale, 1));
  }
}


.back-to-top-btn {
  position: fixed;
  right: calc(20px * var(--app-component-scale, 1));
  bottom: calc(20px * var(--app-component-scale, 1));
  z-index: 120;
  min-width: calc(42px * var(--app-component-scale, 1)) !important;
  width: calc(42px * var(--app-component-scale, 1));
  height: calc(42px * var(--app-component-scale, 1));
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--theme-border);
  background: transparent;
  color: var(--theme-primary);
  font-size: calc(20px * var(--app-font-scale, 1));
  line-height: 1;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.back-to-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  border-color: var(--theme-primary);
  background: var(--theme-menu-hover);
  color: var(--theme-primary);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-shadow) 22%, transparent);
}

.back-to-top-btn:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 2px; }

.vendor-statement-controls {
  margin-top: calc(12px * var(--app-component-scale, 1));
  display: grid;
  grid-template-columns: minmax(calc(220px * var(--app-component-scale, 1)), 1.5fr) repeat(2, minmax(calc(140px * var(--app-component-scale, 1)), 1fr)) auto;
  gap: calc(8px * var(--app-component-scale, 1));
  align-items: center;
}

.vendor-statement-controls select,
.vendor-statement-controls input {
  width: 100%;
}

@media (max-width: 900px) {
  .vendor-statement-controls {
    grid-template-columns: 1fr;
  }

  .vendor-statement-controls .ghost-btn {
    width: 100%;
  }
}


@media (min-width: 1024px) {
  button,
  .ghost-btn {
    height: calc(38px * var(--app-component-scale, 1));
    min-width: calc(110px * var(--app-component-scale, 1));
  }

  select[id$="RowsPerPage"] {
    height: calc(38px * var(--app-component-scale, 1));
  }

  button[id$="PrevBtn"],
  button[id$="NextBtn"] {
    width: calc(38px * var(--app-component-scale, 1)) !important;
    min-width: calc(38px * var(--app-component-scale, 1)) !important;
    padding: 0 calc(6px * var(--app-component-scale, 1)) !important;
    line-height: 1;
  }
}

@media (min-width: 901px) {
  body.menu-pinned {
    --font-size-body: calc(14px * var(--app-font-scale, 1));
    --font-size-label: calc(13px * var(--app-font-scale, 1));
    --font-size-brand: calc(16px * var(--app-font-scale, 1));
    --font-size-menu-item: calc(14px * var(--app-font-scale, 1));
    --font-size-submenu-item: calc(12px * var(--app-font-scale, 1));
    --font-size-header-title: clamp(calc(22px * var(--app-font-scale, 1)), 2.2vw, calc(30px * var(--app-font-scale, 1)));
    --font-size-header-subtitle: calc(14px * var(--app-font-scale, 1));
    --font-size-panel-title: calc(21px * var(--app-font-scale, 1));
    --font-size-metric-head: calc(14px * var(--app-font-scale, 1));
    --font-size-metric-value: calc(30px * var(--app-font-scale, 1));
    --font-size-list-row: calc(15px * var(--app-font-scale, 1));
    --font-size-breakdown-table: calc(14px * var(--app-font-scale, 1));
    --font-size-form-section-heading: calc(15px * var(--app-font-scale, 1));
    --font-size-simple-table: calc(13px * var(--app-font-scale, 1));
    --table-cell-padding-y: calc(8px * var(--app-component-scale, 1));
    --table-cell-padding-x: calc(6px * var(--app-component-scale, 1));
  }
}

.entity-history-panel {
  margin-top: calc(14px * var(--app-component-scale, 1));
  margin-bottom: max(16px,calc(16px * var(--app-component-scale, 1)));
  border: 1px solid var(--theme-border);
  border-radius: calc(12px * var(--app-component-scale, 1));
  padding: calc(10px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
  background: var(--theme-card);
}

.entity-history-panel > summary {
  cursor: pointer;
  font-weight: 600;
}
.entity-history-panel > summary:focus-visible{outline:2px solid var(--theme-focus);outline-offset:2px}
@media(pointer:coarse){
  .entity-history-panel > summary{min-height:44px;align-content:center}
}

.entity-history-list {
  margin-top: calc(12px * var(--app-component-scale, 1));
  display: grid;
  gap: calc(10px * var(--app-component-scale, 1));
}

.entity-history-item {
  border: 1px solid var(--border, #d8dee8);
  border-radius: calc(10px * var(--app-component-scale, 1));
  padding: calc(10px * var(--app-component-scale, 1)) calc(12px * var(--app-component-scale, 1));
  background: rgba(15, 23, 42, 0.015);
}

.entity-history-item-head {
  display: flex;
  justify-content: space-between;
  gap: calc(10px * var(--app-component-scale, 1));
  align-items: baseline;
  margin-bottom: calc(8px * var(--app-component-scale, 1));
}

.entity-history-item-title {
  font-weight: 600;
}

.entity-history-item ul {
  margin: calc(6px * var(--app-component-scale, 1)) 0 0;
  padding-left: calc(18px * var(--app-component-scale, 1));
}

.entity-history-empty {
  margin-top: calc(12px * var(--app-component-scale, 1));
}

.pwa-install-btn {
  position: fixed;
  right: calc(16px * var(--app-component-scale, 1));
  bottom: calc(16px * var(--app-component-scale, 1));
  z-index: 90;
  width: auto;
  min-width: calc(122px * var(--app-component-scale, 1));
  padding: 0 calc(14px * var(--app-component-scale, 1));
  border: 1px solid #0f766e;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.3);
}

.pwa-install-btn:hover {
  background: #0b625b;
  border-color: #0b625b;
}

.mobile-pull-refresh-indicator {
  --pull-refresh-distance: 0px;
  --pull-refresh-progress: 0;
  display: none;
}

@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  body.mobile-pull-refresh-active > main {
    transform: translateY(var(--mobile-pull-refresh-content-offset, 0));
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }
  .mobile-pull-refresh-indicator {
    display: flex;
    position: fixed;
    top: max(calc(10px * var(--app-component-scale, 1)), env(safe-area-inset-top));
    left: 50%;
    z-index: 10000;
    width: calc(48px * var(--app-component-scale, 1));
    height: calc(48px * var(--app-component-scale, 1));
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-56px + (var(--pull-refresh-distance) * 0.85))) scale(calc(0.72 + (var(--pull-refresh-progress) * 0.28)));
    transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mobile-pull-refresh-indicator.visible { opacity: 1; }
  .mobile-pull-refresh-orb {
    width: calc(38px * var(--app-component-scale, 1));
    height: calc(38px * var(--app-component-scale, 1));
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    color: var(--theme-primary, var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-pull-refresh-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: calc(1 - var(--pull-refresh-progress));
    transform: rotate(calc(var(--pull-refresh-progress) * 180deg));
    transition: opacity 0.12s ease, transform 0.12s ease;
  }
  .mobile-pull-refresh-arrow svg {
    width: calc(22px * var(--app-component-scale, 1));
    height: calc(22px * var(--app-component-scale, 1));
    font-size: calc(22px * var(--app-font-scale, 1));
    color: currentColor;
    fill: currentColor;
  }
  .mobile-pull-refresh-spinner {
    position: absolute;
    width: calc(22px * var(--app-component-scale, 1));
    height: calc(22px * var(--app-component-scale, 1));
    border: 2px solid rgba(31, 78, 121, 0.18);
    border-top-color: var(--theme-primary, var(--primary));
    border-radius: 50%;
    opacity: var(--pull-refresh-progress);
    transform: rotate(calc(var(--pull-refresh-progress) * 240deg));
  }
  .mobile-pull-refresh-indicator.ready .mobile-pull-refresh-spinner,
  body.mobile-pull-refresh-refreshing .mobile-pull-refresh-spinner {
    animation: mobile-pull-refresh-spin 0.75s linear infinite;
    opacity: 1;
  }
  .mobile-pull-refresh-indicator.ready .mobile-pull-refresh-arrow,
  body.mobile-pull-refresh-refreshing .mobile-pull-refresh-arrow { opacity: 0; }
}

@keyframes mobile-pull-refresh-spin { to { transform: rotate(360deg); } }

/* Alternate save actions share the same menu treatment across financial forms. */
html body :is(.save-split-menu,.split-save-menu,.transfer-save-menu)[role=menu] {
  background: var(--theme-card);
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
  box-shadow: 0 .4rem 1rem var(--theme-modal-backdrop);
  max-width: min(24rem, calc(100vw - 3rem));
}
html body :is(.save-split-menu,.split-save-menu,.transfer-save-menu)[role=menu] > [role=menuitem] {
  background: transparent;
  color: var(--theme-text);
  border: 0;
  box-shadow: none;
  text-align: start;
  justify-content: flex-start;
  font-weight: 500;
  min-width: 0;
}
html body :is(.save-split-menu,.split-save-menu,.transfer-save-menu)[role=menu] > [role=menuitem]:is(:hover,:focus-visible) {
  background: var(--theme-menu-hover);
  color: var(--theme-text);
}
html body :is(.save-split-menu,.split-save-menu,.transfer-save-menu)[role=menu] > [role=menuitem]:focus-visible {
  outline: 2px solid var(--theme-focus);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  body.mobile-pull-refresh-active > main,
  .mobile-pull-refresh-indicator,
  .mobile-pull-refresh-arrow { transition: none; }
  .mobile-pull-refresh-indicator.ready .mobile-pull-refresh-spinner,
  body.mobile-pull-refresh-refreshing .mobile-pull-refresh-spinner { animation-duration: 1.5s; }
}
.save-split-toggle {
  min-width: calc(34px * var(--app-component-scale, 1)) !important;
}

/* Compact, consistent window-style close control for popup form headers. */
.popup-close-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 calc(30px * var(--app-component-scale, 1));
  box-sizing: border-box;
  aspect-ratio: 1;
  width: calc(30px * var(--app-component-scale, 1)) !important;
  min-width: calc(30px * var(--app-component-scale, 1)) !important;
  height: calc(30px * var(--app-component-scale, 1)) !important;
  min-height: calc(30px * var(--app-component-scale, 1)) !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 1px solid var(--theme-border) !important;
  background: var(--theme-raised) !important;
  color: var(--theme-text) !important;
  font-size: calc(20px * var(--app-font-scale, 1)) !important;
  line-height: 1 !important;
}
.popup-close-btn:hover {
  border-color: var(--theme-danger) !important;
  background: var(--theme-danger) !important;
  color: var(--theme-card) !important;
}
.popup-close-btn:focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 2px; }

/* The rounded frame clips the title bar, scrolling body and sticky footer. */
.app-modal-frame{padding:0!important;overflow:hidden!important;border-radius:var(--app-modal-radius);max-height:calc(100dvh - 32px);box-sizing:border-box;gap:0!important}
dialog.app-modal-frame:not([open]){display:none}
dialog.app-modal-frame[open],.app-modal-frame:not(dialog){display:flex!important;flex-direction:column!important}
.app-modal-frame[hidden]{display:none!important}
.app-modal-frame>.app-modal-titlebar{position:relative!important;top:auto!important;flex:0 0 auto!important;display:flex!important;align-items:center!important;justify-content:space-between!important;flex-wrap:nowrap!important;gap:calc(8px * var(--app-component-scale,1))!important;margin:0!important;padding:0 0 0 calc(12px * var(--app-component-scale,1))!important;min-height:calc(32px * var(--app-component-scale,1));background:var(--theme-primary)!important;color:var(--theme-primary-text)!important;border:0!important;border-bottom:1px solid var(--theme-border)!important;z-index:10}
.app-modal-titlebar :is(h1,h2,h3,h4){margin:0!important;padding:calc(4px * var(--app-component-scale,1)) 0!important;color:var(--theme-primary-text)!important;font-size:calc(14px * var(--app-font-scale,1))!important;line-height:1.3!important;font-weight:600;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.app-modal-frame>.app-modal-body{--app-modal-body-padding:calc(16px * var(--app-component-scale,1));flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;scrollbar-color:var(--theme-muted) transparent;padding:var(--app-modal-body-padding);box-sizing:border-box;touch-action:pan-y pinch-zoom}
.app-modal-body .app-modal-footer{position:sticky;bottom:0;z-index:6;box-sizing:border-box;flex-shrink:0;grid-column:1/-1;background:var(--theme-overlay);border-top:1px solid var(--theme-border);padding-top:calc(12px * var(--app-component-scale,1));padding-bottom:calc(12px * var(--app-component-scale,1));margin-top:calc(12px * var(--app-component-scale,1));margin-bottom:0;isolation:isolate}
.app-modal-frame > .app-modal-body.app-modal-body-with-footer {
  padding-block-end: 0;
}
/* Extend the opaque footer across the body inset without moving controls
   out of their original form. The scroll body and frame clip the paint. */
.app-modal-body .app-modal-footer::before {
  content: "";
  position: absolute;
  inset: -1px 0 0;
  z-index: -1;
  pointer-events: none;
  background: var(--theme-overlay);
  box-shadow: 0 0 0 100vmax var(--theme-overlay);
  clip-path: inset(0 -100vmax);
  border-block-start: 1px solid var(--theme-border);
}
.app-modal-body > .app-modal-footer:is([data-modal-footer="true"], .reusable-filter__modal-actions) {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: calc(10px * var(--app-component-scale, 1));
  margin-inline: calc(-1 * var(--app-modal-body-padding));
  margin-block-end: 0;
  padding: calc(12px * var(--app-component-scale, 1)) var(--app-modal-body-padding);
}
@media (max-width: 600px) {
  .app-modal-body > .app-modal-footer:is([data-modal-footer="true"], .reusable-filter__modal-actions) > button:not([hidden]) {
    flex: 1 1 min(9rem, 100%);
  }
}
.app-modal-body .app-modal-footer-generated{display:flex;flex-wrap:wrap;align-items:center;gap:calc(8px * var(--app-component-scale,1))}
.profile-review-prompt {
  width: min(calc(480px * var(--app-component-scale, 1)), calc(100% - 24px));
  color: var(--theme-text);
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
}
.profile-review-prompt::backdrop { background: var(--theme-modal-backdrop); }
.profile-review-prompt #profileReviewMessage { margin-top: 0; }
html .form-actions[data-modal-footer="true"] > button.secondary-btn {
  background: var(--theme-secondary);
  color: var(--theme-secondary-text);
  border: 1px solid var(--theme-secondary-border);
}
html .form-actions[data-modal-footer="true"] > button.secondary-btn:not(:disabled):hover {
  background: var(--theme-secondary-hover);
  border-color: var(--theme-secondary-border);
}
@media (max-width: 600px) {
  .profile-review-prompt .app-modal-body > .app-modal-footer[data-modal-footer="true"] > button:not([hidden]) {
    flex: 1 1 0;
    min-width: 0;
  }
}
.app-modal-titlebar .app-modal-close{display:inline-flex!important;align-items:center!important;justify-content:center!important;align-self:stretch!important;flex:0 0 calc(46px * var(--app-component-scale,1))!important;aspect-ratio:auto!important;width:calc(46px * var(--app-component-scale,1))!important;min-width:calc(46px * var(--app-component-scale,1))!important;height:auto!important;min-height:calc(32px * var(--app-component-scale,1))!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--theme-primary-text)!important;box-shadow:none!important}
.app-modal-titlebar .app-modal-close svg{width:calc(12px * var(--app-component-scale,1));height:calc(12px * var(--app-component-scale,1));fill:none;stroke:currentColor;stroke-width:1.2;pointer-events:none}
.app-modal-titlebar .app-modal-close:hover{background:var(--theme-danger)!important;color:var(--theme-card)!important}.app-modal-titlebar .app-modal-close:focus-visible{outline:2px solid var(--theme-focus)!important;outline-offset:-3px}.app-modal-titlebar .app-modal-close:disabled{opacity:.5;cursor:not-allowed}
.app-modal-titlebar :is(h1,h2,h3,h4){font-family:"Segoe UI",system-ui,sans-serif!important}
@media(pointer:coarse){.app-modal-frame>.app-modal-titlebar,.app-modal-titlebar .app-modal-close{min-height:max(44px,calc(32px * var(--app-component-scale,1)))!important}}

.app-top-banner-brand-copy { display: grid; justify-items: center; line-height: 1.05; }
.app-environment-label {
  margin-top: calc(2px * var(--app-component-scale, 1));
  padding: calc(2px * var(--app-component-scale, 1)) calc(7px * var(--app-component-scale, 1));
  border-radius: 999px;
  color: var(--theme-primary-text);
  font-size: calc(9px * var(--app-font-scale, 1));
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}
.app-environment-label--staging { background: var(--theme-warning); color: var(--theme-text); }
.app-environment-label--local { background: var(--theme-info); }

.pwa-install-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(18px * var(--app-component-scale, 1));
  z-index: 119;
  display: flex;
  align-items: center;
  gap: calc(14px * var(--app-component-scale, 1));
  width: min(92vw, calc(520px * var(--app-component-scale, 1)));
  padding: calc(12px * var(--app-component-scale, 1)) calc(14px * var(--app-component-scale, 1));
  border: 1px solid var(--theme-border);
  border-radius: calc(12px * var(--app-component-scale, 1));
  background: var(--theme-overlay);
  color: var(--theme-text);
  box-shadow: 0 10px 30px var(--theme-shadow);
  transform: translateX(-50%);
}
.pwa-install-prompt > span { flex: 1; }
.pwa-install-copy { flex: 1; display: grid; gap: calc(4px * var(--app-component-scale, 1)); }
.pwa-install-copy strong { color: var(--theme-text); font-size: calc(16px * var(--app-font-scale, 1)); }
.pwa-install-copy span { color: var(--theme-muted); font-size: calc(13px * var(--app-font-scale, 1)); }

.pa-member-avatar { width: calc(42px * var(--app-component-scale, 1)); height: calc(42px * var(--app-component-scale, 1)); display: grid; place-items: center; overflow: hidden; border-radius: 50%; border: 1px solid var(--theme-border); background: var(--theme-raised); color: var(--theme-primary); font-weight: 700; }
.pa-member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pa-member-modal-card { width: min(calc(820px * var(--app-component-scale, 1)), 100%); }
.pa-member-portrait { grid-column: 1 / -1; min-height: calc(250px * var(--app-component-scale, 1)); display: flex; align-items: flex-start; }
.pa-member-portrait .profile-photo-preview { width: calc(180px * var(--app-component-scale, 1)); height: calc(240px * var(--app-component-scale, 1)); border-radius: calc(12px * var(--app-component-scale, 1)); }
.pa-member-portrait .profile-photo-editor { width: calc(180px * var(--app-component-scale, 1)); }
.pa-member-bio { grid-column: 1 / -1; }
.pa-member-drag-handle { width: calc(40px * var(--app-component-scale, 1)); min-width: calc(40px * var(--app-component-scale, 1)); padding: 0; cursor: grab; color: var(--theme-muted); touch-action: none; }
.pa-member-drag-handle:active { cursor: grabbing; }
.pa-member-row.is-dragging { opacity: .55; background: var(--theme-menu-hover); }
.pa-member-main-listing { width: calc(18px * var(--app-component-scale, 1)); height: calc(18px * var(--app-component-scale, 1)); accent-color: var(--theme-primary); }
/* Keep the popup checkbox beside its label and aligned with the adjacent field. */
#memberForm .checkbox-label { display: flex; align-items: center; align-self: end; gap: calc(8px * var(--app-component-scale, 1)); min-height: max(44px, calc(44px * var(--app-component-scale, 1))); cursor: pointer; }
#memberMainListing { flex: 0 0 auto; width: max(18px, calc(18px * var(--app-component-scale, 1))); height: max(18px, calc(18px * var(--app-component-scale, 1))); min-width: 0; min-height: 0; margin: 0; padding: 0; accent-color: var(--theme-primary); cursor: pointer; }
#memberMainListing:focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 3px; }
.pa-members-table th:first-child, .pa-members-table td:first-child { width: calc(52px * var(--app-component-scale, 1)); text-align: center; }
.pa-members-table th:last-child, .pa-members-table td:last-child { text-align: center; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: calc(6px * var(--app-component-scale, 1)); padding: calc(8px * var(--app-component-scale, 1)); border: 1px solid var(--theme-border); border-bottom: 0; border-radius: calc(8px * var(--app-component-scale, 1)) calc(8px * var(--app-component-scale, 1)) 0 0; background: var(--theme-raised); }
.rte-toolbar button { min-width: calc(38px * var(--app-component-scale, 1)); height: calc(34px * var(--app-component-scale, 1)); padding: 0 calc(9px * var(--app-component-scale, 1)); }
.rte-toolbar select { width: auto; min-height: calc(34px * var(--app-component-scale, 1)); background: var(--theme-card); color: var(--theme-text); border-color: var(--theme-border); }
.rte-editor { min-height: calc(180px * var(--app-component-scale, 1)); padding: calc(12px * var(--app-component-scale, 1)); border: 1px solid var(--theme-border); border-radius: 0 0 calc(8px * var(--app-component-scale, 1)) calc(8px * var(--app-component-scale, 1)); background: var(--theme-card); color: var(--theme-text); overflow: auto; }
.rte-editor:focus { outline: 3px solid color-mix(in srgb, var(--theme-focus) 35%, transparent); border-color: var(--theme-focus); }
@media (max-width: 900px) { .pa-member-portrait { justify-content: center; } .pa-members-table th:nth-child(4), .pa-members-table td:nth-child(4) { display: none; } }
.pwa-install-actions { display: flex; gap: calc(8px * var(--app-component-scale, 1)); }
.profile-passkey-header { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(12px * var(--app-component-scale, 1)); flex-wrap: wrap; }
.profile-passkey-header > div { flex: 1 1 calc(280px * var(--app-component-scale, 1)); min-width: 0; }
.profile-passkey-header #enablePasskeyBtn { flex: 0 0 auto; width: auto; min-height: calc(40px * var(--app-component-scale, 1)); margin: 0; white-space: nowrap; align-self: flex-start; }
.pwa-install-actions button { width: auto; white-space: nowrap; }
@media (max-width: 520px) {
  .pwa-install-prompt { align-items: stretch; flex-direction: column; bottom: calc(10px * var(--app-component-scale, 1)); }
  .pwa-install-actions button { flex: 1; }
}
/* Shared semantic icon and action-control contract. */
.action-btn{align-items:center;background:var(--theme-button-bg,var(--theme-primary,#1f5f78));border:1px solid var(--theme-button-border,var(--theme-primary,#1f5f78));border-radius:calc(7px * var(--app-component-scale, 1));color:var(--theme-button-text,#fff);cursor:pointer;display:inline-flex;gap:.4rem;justify-content:center;min-height:max(40px,calc(40px * var(--app-component-scale,1)));min-width:max(40px,calc(40px * var(--app-component-scale,1)));padding:.45rem .7rem}
.action-btn--compact{padding:.35rem}.action-btn--danger{background:var(--theme-danger,#b42318);border-color:var(--theme-danger,#b42318);color:var(--theme-danger-text,#fff)}
.action-btn:hover:not(:disabled){filter:brightness(.94)}.action-btn:focus-visible{outline:3px solid var(--theme-focus-ring,currentColor);outline-offset:2px}.action-btn:disabled,.action-btn[aria-disabled="true"]{cursor:not-allowed;opacity:.55;pointer-events:none}.action-btn.is-loading .action-icon{animation:portal-icon-spin .8s linear infinite}
.action-icon,.menu-icon{display:inline-block;flex:0 0 auto;height:1.15em;width:1.15em}.submenu-item .menu-icon{margin-right:.55rem}svg[data-missing-icon]{color:var(--theme-danger,#b42318)}
@keyframes portal-icon-spin{to{transform:rotate(360deg)}}

@media (max-width: 600px) { .profile-crop-dialog footer button { flex: 1; } }

/* Large theme sizes keep the goal menu clear of brand/profile controls. */
@media (min-width: 1281px) and (max-width: 1700px) {
  html:is([data-size-active="huge"],[data-size-active="extra-huge"]) body.app-shell { --top-banner-height:calc(104px * var(--app-component-scale,1)); }
  html:is([data-size-active="huge"],[data-size-active="extra-huge"]) .app-top-banner { grid-template-columns:minmax(0,1fr) auto;grid-template-rows:repeat(2,minmax(0,1fr)); }
  html:is([data-size-active="huge"],[data-size-active="extra-huge"]) .app-top-banner-brand { grid-column:1;grid-row:1; }
  html:is([data-size-active="huge"],[data-size-active="extra-huge"]) .app-top-banner-user { grid-column:2;grid-row:1; }
  html:is([data-size-active="huge"],[data-size-active="extra-huge"]) .app-top-banner .sidebar-nav { grid-column:1/-1;grid-row:2;min-width:0; }
}
.complaints-email-fields,
.complaints-email-help {
  grid-column: 1 / -1;
}
.complaints-email-fields {
  align-items: start;
  padding: calc(14px * var(--app-component-scale, 1));
  border: 1px solid var(--theme-border);
  border-radius: calc(10px * var(--app-component-scale, 1));
  background: var(--theme-card);
  color: var(--theme-text);
}
.complaints-email-fields :disabled {
  background: var(--theme-raised);
  border-color: var(--theme-border);
  color: var(--theme-muted);
  cursor: not-allowed;
}
.complaints-email-fields input:disabled::placeholder {
  color: var(--theme-placeholder);
}
#complaintsEmailSection input[type="checkbox"] {
  accent-color: var(--theme-primary);
}
#complaintsEmailSection button {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: var(--theme-primary-text);
}
#complaintsEmailSection button:hover {
  background: var(--theme-primary-hover);
  border-color: var(--theme-primary-hover);
}
#complaintsEmailSection :is(input, select, button):focus-visible {
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}

.archive-pagination {flex-wrap:wrap;margin-top:1rem;}

.top-banner-card-link{display:inline-flex;align-items:center;justify-content:center;gap:5px;text-decoration:none;color:var(--theme-text);white-space:nowrap;padding:calc(6px * var(--app-component-scale,1)) calc(10px * var(--app-component-scale,1))}.top-banner-card-link svg{width:18px;height:18px}.app-top-banner-profile{gap:calc(6px * var(--app-component-scale,1))}@media(max-width:600px){.top-banner-card-link .top-banner-card-label{display:none}.top-banner-card-link{min-width:34px;min-height:34px;padding:5px}}

@media(max-width:900px){.app-top-banner>.top-banner-card-link{position:absolute;right:calc(12px * var(--app-component-scale,1));top:50%;transform:translateY(-50%);z-index:1;min-height:34px}}

@media(pointer:coarse){.top-banner-card-link{min-width:44px;min-height:44px}}

.app-top-banner .top-banner-card-link{width:auto;min-width:0;height:auto;border-radius:calc(10px * var(--app-component-scale,1))}.app-top-banner .top-banner-card-link>.menu-icon{display:inline-flex}@media(max-width:600px){.app-top-banner .top-banner-card-link{width:34px;min-width:34px;height:34px;padding:5px}}@media(pointer:coarse){.app-top-banner .top-banner-card-link{min-width:44px;min-height:44px}}

/* Shared geometry for navigation links presented as secondary list actions. */
.list-action-link{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;box-sizing:border-box;width:auto;min-width:0;max-width:100%;height:calc(44px * var(--app-component-scale,1));padding:0 calc(14px * var(--app-component-scale,1));border:1px solid var(--theme-secondary-border);border-radius:calc(10px * var(--app-component-scale,1));background:var(--theme-secondary);color:var(--theme-secondary-text);font:inherit;font-weight:600;line-height:1.2;text-decoration:none;white-space:nowrap;flex:0 0 auto}
.list-action-link:hover{background:var(--theme-secondary-hover);color:var(--theme-secondary-text);border-color:var(--theme-focus)}
.list-action-link:focus-visible{outline:2px solid var(--theme-focus);outline-offset:2px}
.list-action-link[aria-disabled=true]{opacity:.7;pointer-events:none}
@media(min-width:1024px){.list-action-link{height:calc(38px * var(--app-component-scale,1))}}
@media(max-width:600px){.list-action-link{min-height:44px}}

/* Anchor hidden native uploads to their visible control, never the modal frame. */
.file-upload-placeholder { position: relative; box-sizing: border-box; }
.file-upload-placeholder .file-upload-native { top: 0; left: 0; margin: 0; }
.file-upload-placeholder:focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 2px; }
.file-upload-placeholder:has(input:disabled) { opacity: .6; cursor: not-allowed; }

/* Only the top-bar My Card preview is a card without modal chrome. */
dialog.my-card-quick-dialog{width:min(760px,calc(100vw - 24px),calc((100dvh - 24px) * 85.6 / 53.98));max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:0;border:0;border-radius:.5rem;background:transparent;color:var(--theme-text);box-shadow:none;overflow:visible}
.my-card-quick-dialog::backdrop{background:var(--theme-modal-backdrop)}
.my-card-quick-message:empty{display:none}.my-card-quick-message{margin:0;padding:1rem;background:var(--theme-card);border-radius:.5rem;overflow-wrap:anywhere}
.my-card-quick-artwork:empty{display:none}.my-card-quick-artwork img{display:block;width:100%;height:auto;max-width:100%;border-radius:.5rem}

/* Two protected artwork faces share one request and one revocable object URL. */
.my-card-quick-artwork{position:relative;overflow:hidden}
.my-card-flip-stage{position:relative;aspect-ratio:85.6/53.98;isolation:isolate;overflow:hidden;border-radius:.5rem}

.my-card-flip-face{position:absolute;inset:0;overflow:hidden;opacity:1;transition:opacity .16s ease;pointer-events:none;border-radius:.5rem}
.my-card-flip-back{opacity:0}
.my-card-flip-stage.is-flipped>.my-card-flip-face{opacity:0}
.my-card-flip-stage.is-flipped>.my-card-flip-back{opacity:1}
.my-card-flip-face img{width:100%;height:auto;border-radius:0}
.my-card-flip-back img{transform:translateY(-50%)}
.my-card-quick-artwork :is(.my-card-flip-button,.my-card-edit-button){position:absolute;right:8px;bottom:8px;display:inline-flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;padding:8px;opacity:.75;background:var(--theme-card);color:var(--theme-text);border:1px solid var(--theme-border)}
.my-card-quick-artwork :is(.my-card-flip-button,.my-card-edit-button):is(:hover,:focus-visible){opacity:1;background:var(--theme-primary);color:var(--theme-primary-text)}
:is(.my-card-flip-button,.my-card-edit-button):focus-visible{outline:2px solid var(--theme-primary);outline-offset:3px}
.my-card-quick-artwork .my-card-edit-button{right:60px}
.my-card-quick-artwork .my-card-edit-button[hidden]{display:none}
@media(prefers-reduced-motion:reduce){.my-card-flip-face{transition:none}}

/* A stale request cannot make a superseded private view or popup visible again. */
body.role-context-invalidated main > :not(.role-context-notice),
body.role-context-invalidated :is(dialog,.record-modal,.attachment-modal,.reusable-filter__modal,[role="dialog"][aria-modal="true"]){display:none!important}

/* Sectioned menu panels: headings do not introduce another navigation level. */
.app-top-banner .app-menu-panel{z-index:90;width:max-content;max-width:calc(100vw - 16px);min-width:min(240px,calc(100vw - 16px));overflow:auto;overscroll-behavior:contain;background:var(--theme-overlay);border:1px solid var(--theme-border);padding:calc(12px * var(--app-component-scale,1));}
.app-top-banner .menu-entry.open>.app-menu-panel{display:grid;grid-template-columns:minmax(0,1fr);gap:calc(12px * var(--app-component-scale,1));}
.app-menu-section,.app-menu-section>ul{list-style:none;padding:0;margin:0;min-width:0;}
.app-menu-section-title{display:block;color:var(--theme-muted);font-weight:650;padding:calc(7px * var(--app-component-scale,1));border-bottom:1px solid var(--theme-border);margin-bottom:calc(5px * var(--app-component-scale,1));}
.app-top-banner .app-menu-panel .submenu-item{white-space:normal;overflow-wrap:anywhere;}
.app-top-banner .app-menu-panel .menu-icon{width:1.2em;height:1.2em;flex:0 0 auto;}
.app-top-banner .app-menu-more[hidden]{display:none;}
.app-top-banner .app-menu-overflow-list>.menu-depth-0{display:block;}
.app-top-banner .app-menu-overflow-list>.menu-entry>.menu-item{width:100%;justify-content:flex-start;}
.app-top-banner .app-menu-overflow-list .app-menu-panel{margin:0;padding:calc(12px * var(--app-component-scale,1));border:1px solid var(--theme-border);background:var(--theme-overlay);box-shadow:0 10px 25px var(--theme-shadow);}
.app-top-banner .app-menu-settings>.menu-item{font-size:calc(12px * var(--app-font-scale,1));}
@media(max-width:900px){
 .app-top-banner .menu-entry.open>.app-menu-panel{display:block;width:auto;max-width:100%;min-width:0;}
 .app-menu-section+.app-menu-section{margin-top:calc(12px * var(--app-component-scale,1));}
 .app-top-banner .app-menu-settings>.menu-item{font-size:var(--font-size-menu-item);}
}

.app-menu-user-links{display:flex;list-style:none;padding:0;margin:0;}
.app-menu-user-links:empty{display:none;}

/* Submenu groups remain collapsed until explicitly expanded. */
.app-menu-section-links[hidden]{display:none!important;}
.app-top-banner .app-menu-section-toggle{width:100%;justify-content:flex-start;}
.menu-entry > button.menu-item[aria-controls],
.app-menu-section > button.app-menu-section-toggle[aria-controls]{font-weight:700;}
.app-menu-section-toggle .menu-caret{margin-left:auto;}
.app-menu-section-toggle[aria-expanded="true"] .menu-caret{transform:rotate(180deg);}
.app-top-banner .app-menu-section.active-section>.app-menu-section-toggle{background:var(--theme-menu-hover);color:var(--theme-menu-text);}
.app-menu-section-links:not([hidden]){padding-inline-start:calc(10px * var(--app-component-scale,1));border-inline-start:1px solid var(--theme-border);}

@media(max-width:900px){
  #backToTopBtn.back-to-top-btn{
    width:max(48px,calc(52px * var(--app-component-scale,1)));
    min-width:max(48px,calc(52px * var(--app-component-scale,1)))!important;
    height:max(48px,calc(52px * var(--app-component-scale,1)));
    right:calc(max(16px,20px * var(--app-component-scale,1)) + env(safe-area-inset-right,0px));
    bottom:calc(max(32px,32px * var(--app-component-scale,1)) + env(safe-area-inset-bottom,0px));
    font-size:max(24px,calc(24px * var(--app-font-scale,1)));
    display:inline-flex;align-items:center;justify-content:center;
  }
}
.app-top-banner-mobile-actions {display:none;}
@media(max-width:900px) {
  /* Reserve real banner width for both shortcuts; neither overlays the other. */
  html body .app-top-banner {grid-template-columns:minmax(0,1fr) auto;}
  html body .app-top-banner .app-top-banner-brand {
    grid-column:1;grid-row:1;min-width:0;max-width:100%;justify-self:stretch;justify-content:center;
  }
  html body .app-top-banner .app-top-banner-brand-copy {min-width:0;}
  html body .app-top-banner .app-top-banner-title {display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  html body .app-top-banner .app-top-banner-logo {flex:0 0 auto;}
  html body .app-top-banner-mobile-actions {
    display:flex;grid-column:2;grid-row:1;justify-self:end;align-items:center;
    gap:calc(8px * var(--app-component-scale,1));flex-wrap:nowrap;
  }
  html body .app-top-banner-mobile-actions > :is(button,a) {flex:0 0 auto;}
  html body .app-top-banner-mobile-actions > .top-banner-card-link {position:static;transform:none;}
}
