:root {
  --background: #eef7ff;
  --surface: #ffffff;
  --surface-soft: #f3f9ff;
  --text: #0b1f33;
  --muted: #607489;
  --line: rgba(108, 182, 255, 0.24);
  --primary: #2b5d87;
  --primary-dark: #16324f;
  --accent: #6cb6ff;
  --danger: #a53f3f;
  --shadow: 0 22px 58px rgba(11, 31, 51, 0.1);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

/* Final pre-go-live UX/contrast guardrail. Keep existing layout, but make
   template cards collapsed/readable and action buttons consistently visible. */
.template-builder-grid {
  display: grid;
  gap: 14px;
}

.template-collapsible-card {
  padding: 0 !important;
  overflow: hidden;
  background: #ffffff !important;
  color: #0b1f33 !important;
}

.template-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f3f9ff 100%);
  color: #0b1f33;
  text-align: left;
  cursor: pointer;
}

.template-card-toggle span:first-child {
  display: grid;
  gap: 4px;
}

.template-card-toggle strong {
  color: #0b1f33;
  font-size: 18px;
}

.template-card-toggle .eyebrow {
  color: #2b5d87;
}

.template-collapsible-card > .card-header,
.template-collapsible-card > .template-summary-grid,
.template-collapsible-card > .quick-actions,
.template-collapsible-card > .muted,
.template-collapsible-card > .notice,
.template-collapsible-body {
  margin: 0 20px 16px;
}

.template-collapsible-card > .card-header {
  padding-top: 16px;
}

.template-collapsible-card details {
  display: block;
}

.template-collapsible-card summary {
  list-style: none;
}

.template-collapsible-card summary::-webkit-details-marker {
  display: none;
}

.template-collapsible-body {
  padding-bottom: 18px;
}

.finance-workflow-modal,
.product-form-modal,
.modal-card {
  color: #0b1f33 !important;
}

.finance-workflow-modal :where(label, p, span, small),
.product-form-modal :where(label, p, span, small),
.modal-card :where(label, p, span, small) {
  color: #27415c;
}

.finance-workflow-modal :where(h2, h3, strong),
.product-form-modal :where(h2, h3, strong),
.modal-card :where(h2, h3, strong) {
  color: #0b1f33;
}

.button:not(.secondary):not(.danger):not(.muted),
a.button:not(.secondary):not(.danger):not(.muted) {
  background: #0b4f8a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.button.secondary,
a.button.secondary,
.modal-close-button {
  background: #ffffff !important;
  color: #0b1f33 !important;
  -webkit-text-fill-color: #0b1f33 !important;
  border-color: rgba(43, 93, 135, 0.35) !important;
}

.button.danger,
a.button.danger {
  background: #b42318 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.account-balance-card .button.compact,
.account-balance-card a.button.compact,
.dashboard-account-card .button.compact,
.dashboard-account-card a.button.compact {
  background: rgba(255, 255, 255, 0.96) !important;
  color: #0b1f33 !important;
  border-color: rgba(255, 255, 255, 0.72) !important;
}

/* Template editors should expose business content only. The system can keep
   saved PDF calibration values internally without making staff position text. */
.product-form-scroll label:has(input[name="issueDateLabel"]),
.product-form-scroll label:has(input[name="paymentDueDateLabel"]),
.product-form-scroll label:has(input[name="serviceDateLabel"]),
.product-form-scroll label:has(input[name="expiryDateLabel"]),
.product-form-scroll label:has(input[name="accentColor"]),
.product-form-scroll label:has(input[name="headerText"]),
.product-form-scroll label:has(input[name="fontStyle"]),
.product-form-scroll label:has(input[name="blankTemplateLabel"]),
.product-form-scroll label:has(input[name="filledTemplateLabel"]) {
  display: none;
}

@media (max-width: 768px) {
  .template-card-toggle {
    padding: 16px;
  }

  .template-collapsible-card > .card-header,
  .template-collapsible-card > .template-summary-grid,
  .template-collapsible-card > .quick-actions,
  .template-collapsible-card > .muted,
  .template-collapsible-card > .notice,
  .template-collapsible-body {
    margin-left: 14px;
    margin-right: 14px;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    background: #ffffff !important;
    color: #0b1f33 !important;
    -webkit-text-fill-color: #0b1f33 !important;
    border-color: rgba(43, 93, 135, 0.24) !important;
  }

  .mobile-bottom-nav .mobile-nav-icon,
  .contextual-mobile-bottom-nav .mobile-nav-icon {
    background: #0b4f8a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }

  .mobile-bottom-nav > a:hover,
  .mobile-bottom-nav summary:hover,
  .mobile-bottom-nav details[open] summary {
    background: #eaf4ff !important;
    color: #071827 !important;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% -10%, rgba(108, 182, 255, 0.26), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, var(--background) 48%, #f8fcff 100%);
  color: var(--text);
  font-family: "Source Sans 3", "Open Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar-shell {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  padding: 14px;
}

.sidebar-shell[open] {
  z-index: 90;
}

.sidebar-toggle {
  list-style: none;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 252, 255, 0.96);
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.sidebar-toggle::-webkit-details-marker {
  display: none;
}

.sidebar {
  position: absolute;
  top: 74px;
  left: 14px;
  width: 288px;
  height: 100vh;
  max-height: calc(100vh - 88px);
  overflow: auto;
  padding: 24px;
  background: #14251d;
  color: #f5fff8;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.sidebar-shell:not([open]) .sidebar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e9b454;
  color: #14251d;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #bad0c4;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-groups {
  align-content: flex-start;
}

.nav-group {
  border-radius: 14px;
}

.nav-group summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  cursor: pointer;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary > span {
  color: var(--primary-dark);
  font-weight: 800;
  padding-right: 8px;
}

.nav-root {
  min-width: 0;
}

.submenu {
  display: grid;
  gap: 2px;
  margin: 2px 0 6px 12px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.submenu-link {
  border-radius: 10px;
  color: #5d7282;
  font-size: 12px;
  font-weight: 560;
  padding: 7px 9px;
}

.submenu-link:hover {
  background: rgba(131, 199, 242, 0.16);
  color: var(--text);
}

.nav-link {
  color: #dcebe2;
  border-radius: 8px;
  padding: 11px 12px;
  font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
  background: #294437;
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  color: #bbcec2;
  font-size: 13px;
  line-height: 1.45;
}

.logout-button {
  width: 100%;
  margin-top: 10px;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 31px;
}

h1,
h2,
h3,
.page-title,
.metric strong {
  font-family: Raleway, "Source Sans 3", Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(18px, 2vw, 22px);
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-column {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2vw, 22px);
  backdrop-filter: blur(18px);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.card:hover {
  border-color: rgba(108, 182, 255, 0.42);
  box-shadow: 0 26px 70px rgba(11, 31, 51, 0.13);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.05;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  white-space: nowrap;
}

.button:hover:not(:disabled):not(.disabled) {
  transform: translateY(-1px);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--text);
}

.button.danger {
  background: #f5e3e3;
  color: var(--danger);
}

.button[disabled],
.button.disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.2);
  box-shadow: none;
}

.button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.inline-link {
  color: var(--primary);
  font-weight: 900;
}

.language-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.transaction-control {
  display: grid;
  gap: 14px;
}

.transaction-selector {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
}

.transaction-filter-drawer {
  position: relative;
}

.transaction-filter-drawer > summary {
  list-style: none;
  cursor: pointer;
}

.transaction-filter-drawer > summary::-webkit-details-marker {
  display: none;
}

.transaction-filter-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 10px);
  right: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(108, 182, 255, 0.28);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(207, 232, 255, 0.98), rgba(246, 251, 255, 0.98));
  box-shadow: 0 26px 70px rgba(11, 31, 51, 0.24);
}

.transaction-filter-panel label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.transaction-filter-panel .form-actions {
  position: sticky;
  bottom: -18px;
  margin: 4px -18px -18px;
  padding: 14px 18px;
  border-top: 1px solid rgba(43, 93, 135, 0.14);
  background: rgba(207, 232, 255, 0.96);
}

.selected-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.selected-strip strong {
  color: var(--text);
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.detail-panel {
  margin-top: 16px;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.detail-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 31, 51, 0.42);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(860px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: rgba(248, 252, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(11, 31, 51, 0.28);
  padding: clamp(16px, 2vw, 22px);
}

.product-edit-modal {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 900px);
  overflow: hidden;
}

.product-form-modal {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 900px);
  overflow: hidden;
}

.product-edit-form,
.product-form-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.sticky-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 8px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.76), rgba(248, 252, 255, 0.98) 32%);
  border-top: 1px solid rgba(108, 182, 255, 0.24);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form-error {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8e2e2;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-weight: 760;
  box-shadow: 0 12px 28px rgba(52, 92, 121, 0.08);
}

.notice.success {
  border-color: rgba(57, 150, 93, 0.28);
  background: rgba(231, 248, 237, 0.92);
  color: #1d6a3a;
}

.template-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.template-summary-grid .metric {
  min-height: 92px;
}

@media (max-width: 760px) {
  .template-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 15px;
  background: rgba(248, 252, 255, 0.98);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(38, 74, 96, 0.18);
  font-size: 14px;
  font-weight: 760;
}

.toast.success {
  border-color: rgba(57, 150, 93, 0.32);
  background: rgba(232, 249, 239, 0.98);
  color: #195f34;
}

.toast.error {
  border-color: rgba(165, 63, 63, 0.28);
  background: rgba(255, 238, 238, 0.98);
  color: var(--danger);
}

.toast.info {
  border-color: rgba(91, 169, 221, 0.32);
  background: rgba(235, 247, 255, 0.98);
  color: var(--primary-dark);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  outline: 0;
  padding: 10px 11px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: var(--surface-soft);
  color: #36463e;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3f1;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.status.pending {
  background: #fff2d7;
  color: #8a5b12;
}

.status.rejected {
  background: #f8e2e2;
  color: var(--danger);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #14251d, #26624a);
}

.login-card {
  width: min(460px, 100%);
  background: #ffffff;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.login-card .brand {
  color: var(--text);
  margin-bottom: 24px;
}

@media (max-width: 1120px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar {
    gap: 18px;
  }

  .metrics,
  .two-column,
  .queue-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transaction-selector {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
  }

  .transaction-selector .button {
    grid-column: 1 / -1;
  }

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  body {
    overflow-x: hidden;
  }

  .app-layout {
    width: 100%;
  }

  .sidebar {
    padding: 16px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .nav-link {
    min-height: 42px;
    padding: 10px;
    font-size: 14px;
  }

  .content {
    padding: 18px;
  }

  .topbar,
  .card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .two-column,
  .queue-grid,
  .form-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .transaction-selector {
    grid-template-columns: 1fr;
  }

  .transaction-filter-drawer {
    width: 100%;
  }

  .transaction-filter-drawer > summary {
    width: 100%;
    justify-content: center;
  }

  .transaction-filter-panel {
    position: fixed;
    inset: auto 10px 10px;
    width: auto;
    max-height: min(82vh, 720px);
    border-radius: 24px;
  }

  .selected-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-tab {
    justify-content: center;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 17px;
  }

  .card {
    padding: 14px;
  }

  .metric strong {
    font-size: 24px;
  }

  .button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .modal-backdrop {
    align-items: flex-start;
    padding: 12px;
  }

  .modal-card {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 14px;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
  }

  .modal-card .card-header {
    position: sticky;
    top: -14px;
    z-index: 5;
    padding: 2px 0 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.88));
  }

  .modal-card .form-actions {
    position: sticky;
    bottom: -14px;
    z-index: 6;
    margin: 8px -14px -14px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
    background: rgba(248, 252, 255, 0.98);
    box-shadow: 0 -12px 28px rgba(52, 92, 121, 0.08);
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button.compact {
    min-height: 38px;
  }

  .quick-actions {
    gap: 8px;
  }

  .quick-actions .button {
    min-height: 42px;
    flex: 1 1 150px;
  }

  .table-wrap {
    max-width: calc(100vw - 36px);
  }

  table {
    min-width: 720px;
  }
}

@media (max-width: 430px) {
  .content {
    padding: 14px;
  }

  .sidebar {
    padding: 14px;
  }

  .login-card {
    padding: 20px;
  }

  .table-wrap {
    max-width: calc(100vw - 28px);
  }

  .toast-host {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: 86px;
    width: auto;
  }
}

/* Approved YosuBooks staging visual direction: calm baby-blue finance UI. */
:root {
  --background: #eef6fb;
  --surface: #ffffff;
  --surface-soft: #f6fbff;
  --text: #142435;
  --muted: #6f8393;
  --line: rgba(97, 139, 169, 0.2);
  --primary: #2e719d;
  --primary-dark: #234f73;
  --accent: #83c7f2;
  --danger: #a53f3f;
  --shadow: 0 18px 44px rgba(52, 92, 121, 0.12);
}

body {
  background:
    radial-gradient(circle at 12% 4%, rgba(177, 220, 248, 0.72), transparent 28%),
    radial-gradient(circle at 92% 2%, rgba(255, 244, 202, 0.28), transparent 22%),
    linear-gradient(135deg, #eef7fd 0%, #f7fbff 48%, #edf6fb 100%);
  font-weight: 430;
  line-height: 1.45;
}

.sidebar {
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.96), rgba(234, 246, 255, 0.9));
  color: var(--text);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 34px rgba(52, 92, 121, 0.06);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(142, 199, 238, 0.72);
  box-shadow: 0 8px 20px rgba(69, 142, 192, 0.16);
  flex: 0 0 auto;
}

.brand-logo img {
  width: 86%;
  height: 86%;
  object-fit: cover;
  border-radius: 8px;
}

.full-logo {
  width: min(260px, 100%);
  height: 74px;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
}

.brand strong {
  color: var(--text);
  font-weight: 760;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-weight: 470;
}

.sidebar .brand span {
  color: #5c7282;
}

.nav-link {
  color: #2f4352;
  font-weight: 610;
  border-radius: 13px;
  padding: 10px 12px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(131, 199, 242, 0.22);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
  color: #5f7584;
}

.content {
  background: transparent;
}

.card,
.modal-card,
.login-card {
  border-color: var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.button {
  border-radius: 13px;
  background: linear-gradient(135deg, #2e719d, #65b4e6);
  box-shadow: 0 12px 24px rgba(64, 145, 199, 0.18);
  font-weight: 720;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(52, 92, 121, 0.08);
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

h1 {
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  font-weight: 720;
}

label {
  color: color-mix(in srgb, var(--text) 58%, var(--muted));
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 12px;
  background: rgba(251, 253, 255, 0.94);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5ba9dd;
  box-shadow: 0 0 0 3px rgba(91, 169, 221, 0.14);
}

.table-wrap {
  border-color: var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
}

th {
  background: #f6fbff;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.055em;
}

tbody tr:hover {
  background: rgba(220, 239, 251, 0.42);
}

.status {
  background: rgba(131, 199, 242, 0.18);
  color: var(--primary-dark);
}

.line-item-editor {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(246, 251, 255, 0.72);
}

.line-item-row {
  display: grid;
  grid-template-columns: 90px repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.line-item-row:first-of-type {
  border-top: 0;
}

.proof-upload {
  border: 1px dashed rgba(91, 169, 221, 0.44);
  border-radius: 16px;
  padding: 14px;
  background: rgba(246, 251, 255, 0.84);
}

.proof-upload span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.proof-link-list {
  display: grid;
  gap: 6px;
}

.impact-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.impact-row:first-of-type {
  border-top: 0;
}

.impact-row span {
  color: var(--muted);
}

.impact-row strong {
  text-align: right;
}

.mobile-bottom-nav {
  display: none;
}

.desktop-context-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
}

.desktop-context-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(11, 31, 51, 0.12);
  border-radius: 14px;
  background: rgba(207, 232, 255, 0.78);
  color: #0b1f33;
  font-size: 13px;
  font-weight: 720;
  box-shadow: 0 10px 24px rgba(11, 31, 51, 0.08);
}

.desktop-context-actions a:hover {
  background: linear-gradient(135deg, #16324f, #2b5d87);
  color: #ffffff;
}

.desktop-context-actions span,
.contextual-mobile-bottom-nav .mobile-nav-icon {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 9px;
  background: rgba(108, 182, 255, 0.22);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.mobile-bottom-nav details {
  position: static;
}

.mobile-bottom-nav summary {
  list-style: none;
  cursor: pointer;
}

.mobile-bottom-nav summary::-webkit-details-marker {
  display: none;
}

.mobile-quick-menu {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 82px;
  z-index: 80;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(248, 252, 255, 0.96);
  box-shadow: var(--shadow);
}

.mobile-quick-menu a {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(220, 239, 251, 0.64);
  font-weight: 720;
}

@media (max-width: 980px) {
  .line-item-row {
    grid-template-columns: 1fr 1fr;
  }
}

.metric strong {
  font-weight: 760;
}

.login-page {
  grid-template-columns: minmax(0, 1fr) 420px;
  background:
    radial-gradient(circle at 14% 0%, rgba(177, 220, 248, 0.82), transparent 30%),
    linear-gradient(135deg, #eef7fd 0%, #f7fbff 52%, #edf6fb 100%);
}

.login-art {
  min-height: 100vh;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f7fbff;
  background: linear-gradient(155deg, rgba(13, 41, 65, 0.94), rgba(32, 83, 119, 0.88) 58%, rgba(175, 218, 246, 0.72));
  border-radius: 0 36px 36px 0;
  box-shadow: var(--shadow);
}

.login-art h1 {
  color: #ffffff;
  max-width: 650px;
  font-size: clamp(38px, 5vw, 58px);
}

.login-art p {
  color: rgba(247, 251, 255, 0.8);
  max-width: 520px;
}

.login-art .brand strong,
.login-art .brand span {
  color: #ffffff;
}

.login-card {
  width: min(460px, 100%);
  align-self: center;
}

@media (max-width: 1120px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 300px;
    border-radius: 0 0 30px 30px;
  }
}

@media (max-width: 700px) {
  .login-art {
    padding: 28px;
  }

  .button {
    min-height: 44px;
  }
}

@media (max-width: 1024px) {
  .sidebar-shell {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding-bottom: 98px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(207, 232, 255, 0.22);
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(11, 31, 51, 0.96), rgba(22, 50, 79, 0.94));
    box-shadow: 0 18px 48px rgba(4, 14, 26, 0.34);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    min-height: 58px;
    display: grid;
    grid-template-rows: auto auto;
    gap: 4px;
    place-items: center;
    border-radius: 20px;
    color: rgba(238, 248, 255, 0.86);
    font-size: 10px;
    font-weight: 760;
    text-align: center;
    background: rgba(207, 232, 255, 0.08);
  }

  .mobile-bottom-nav > a:hover,
  .mobile-bottom-nav summary:hover {
    background: rgba(108, 182, 255, 0.18);
    color: #ffffff;
  }
}

.mobile-nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(207, 232, 255, 0.12);
  color: #cfe8ff;
  font-size: 10px;
  font-weight: 860;
}

.mobile-bottom-nav details[open] .mobile-nav-icon,
.mobile-bottom-nav > a:hover .mobile-nav-icon,
.mobile-bottom-nav summary:hover .mobile-nav-icon {
  background: linear-gradient(135deg, #6cb6ff, #cfe8ff);
  color: #0b1f33;
}

@media (max-width: 700px) {
  .line-item-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .line-item-row .button {
    width: 100%;
  }

  .proof-upload {
    padding: 12px;
  }

  .mobile-quick-menu {
    bottom: 78px;
    max-height: min(70dvh, 520px);
    overflow: auto;
  }
}

/* Controlled navigation: collapsed rail + one-section drawer. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar-rail {
  position: sticky;
  top: 0;
  z-index: 85;
  height: 100vh;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  border-right: 1px solid rgba(108, 182, 255, 0.22);
  background: linear-gradient(180deg, rgba(11, 31, 51, 0.98), rgba(22, 50, 79, 0.95));
  box-shadow: 12px 0 38px rgba(11, 31, 51, 0.16);
}

.sidebar-toggle-button,
.rail-button,
.mobile-menu-button {
  border: 1px solid rgba(108, 182, 255, 0.26);
  border-radius: 16px;
  background: rgba(207, 232, 255, 0.1);
  color: #eaf7ff;
  font-weight: 780;
  box-shadow: 0 12px 30px rgba(4, 14, 26, 0.18);
}

.sidebar-toggle-button {
  width: 58px;
  min-height: 48px;
  font-size: 11px;
}

.rail-button {
  width: 48px;
  min-height: 48px;
}

.sidebar-toggle-button span[aria-hidden="true"] {
  font-size: 20px;
  line-height: 1;
}

.rail-brand {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(108, 182, 255, 0.72);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.rail-brand img {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
}

.rail-nav {
  display: grid;
  gap: 9px;
}

.rail-button {
  font-size: 12px;
}

.rail-button.active,
.rail-button:hover,
.sidebar-toggle-button:hover,
.mobile-menu-button:hover {
  background: linear-gradient(135deg, rgba(108, 182, 255, 0.95), rgba(207, 232, 255, 0.7));
  border-color: rgba(207, 232, 255, 0.86);
  color: #0b1f33;
}

.sidebar-drawer {
  position: fixed;
  z-index: 100;
  top: 14px;
  left: 88px;
  width: min(326px, calc(100vw - 108px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  display: none;
  padding: 18px;
  border: 1px solid rgba(146, 194, 224, 0.52);
  border-radius: 24px;
  background: rgba(248, 252, 255, 0.97);
  box-shadow: 0 30px 90px rgba(11, 31, 51, 0.24);
  backdrop-filter: blur(20px);
}

.sidebar-drawer.open {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  border: 0;
  background: rgba(18, 36, 53, 0.14);
}

.nav-group.controlled {
  display: grid;
  gap: 6px;
  border-radius: 16px;
}

.nav-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.submenu-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-dark);
  font-weight: 800;
}

.nav-group.controlled.open .nav-root {
  background: rgba(131, 199, 242, 0.22);
  color: var(--text);
}

.mobile-menu-button {
  display: none;
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 90;
  width: 50px;
  min-height: 50px;
  font-size: 19px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(11, 31, 51, 0.98), rgba(22, 50, 79, 0.94));
  box-shadow: 0 18px 42px rgba(11, 31, 51, 0.28);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  padding: 10px;
  background: rgba(11, 31, 51, 0.54);
  backdrop-filter: blur(10px);
}

.mobile-menu-panel {
  height: calc(100dvh - 20px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(108, 182, 255, 0.28);
  border-radius: 30px;
  background:
    radial-gradient(circle at 18% 0%, rgba(108, 182, 255, 0.24), transparent 34%),
    linear-gradient(180deg, rgba(11, 31, 51, 0.98), rgba(22, 50, 79, 0.96) 40%, rgba(248, 252, 255, 0.98) 40%);
  box-shadow: 0 28px 70px rgba(3, 12, 24, 0.36);
  color: #eef8ff;
}

.mobile-drawer-nav {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mobile-drawer-group {
  border: 1px solid rgba(207, 232, 255, 0.42);
  border-radius: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(11, 31, 51, 0.08);
}

.mobile-drawer-group summary {
  cursor: pointer;
  color: var(--yosu-ink);
  font-weight: 760;
  list-style: none;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-group summary::after {
  content: "+";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(207, 232, 255, 0.72);
  color: var(--yosu-navy);
}

.mobile-drawer-group[open] summary::after {
  content: "-";
}

.mobile-drawer-group summary::-webkit-details-marker {
  display: none;
}

.mobile-drawer-group a {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(220, 239, 251, 0.58);
  color: var(--primary-dark);
  font-weight: 650;
}

.mobile-menu-panel .card-header {
  align-items: center;
  margin-bottom: 12px;
}

.mobile-menu-panel .brand strong,
.mobile-menu-panel .brand span {
  color: #ffffff;
}

.mobile-menu-panel .brand-logo {
  background: #ffffff;
  border-color: rgba(207, 232, 255, 0.86);
}

.mobile-account-card {
  display: grid;
  gap: 2px;
  margin: 12px 0;
  padding: 16px;
  border: 1px solid rgba(207, 232, 255, 0.28);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(43, 93, 135, 0.72), rgba(108, 182, 255, 0.22));
  box-shadow: 0 16px 38px rgba(4, 14, 26, 0.18);
}

.mobile-account-card span,
.mobile-account-card small {
  color: rgba(238, 248, 255, 0.76);
}

.mobile-account-card strong {
  color: #ffffff;
  font-size: 20px;
}

.mobile-drawer-footer {
  position: sticky;
  bottom: -16px;
  display: grid;
  gap: 10px;
  margin: 16px -16px -16px;
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(108, 182, 255, 0.24);
  background: rgba(248, 252, 255, 0.98);
  border-radius: 24px 24px 30px 30px;
}

.mobile-language-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.mobile-drawer-footer .logout-button {
  width: 100%;
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-rail,
  .sidebar-drawer,
  .sidebar-scrim {
    display: none !important;
  }

  .mobile-menu-button {
    display: grid;
    place-items: center;
  }
}

/* Login and finance visual polish. This intentionally overrides older
   prototype-era login styles without changing auth behavior. */
.full-logo,
.login-art {
  display: none !important;
}

.login-page {
  min-height: 100dvh;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr !important;
  place-items: center;
  padding: clamp(18px, 4vw, 42px);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(198, 232, 255, 0.86), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(255, 221, 140, 0.26), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(36, 94, 77, 0.12), transparent 30%),
    linear-gradient(135deg, #f7fcff 0%, #edf8ff 48%, #ffffff 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.72;
}

.login-page::before {
  width: 240px;
  height: 240px;
  left: -80px;
  bottom: -80px;
  background: rgba(133, 206, 255, 0.34);
}

.login-page::after {
  width: 180px;
  height: 180px;
  right: -52px;
  top: 12%;
  background: rgba(36, 94, 77, 0.12);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%) !important;
  align-self: center;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid rgba(165, 211, 239, 0.56);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 28px 78px rgba(38, 74, 96, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(22px);
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 24px;
  text-align: center;
}

.login-logo {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px solid rgba(137, 202, 244, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(224, 244, 255, 0.86));
  box-shadow: 0 18px 38px rgba(72, 157, 216, 0.18);
}

.login-logo img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 18px;
}

.login-brand h1 {
  margin: 8px 0 0;
  color: #102131;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.05;
}

.login-brand p {
  margin: 0;
  color: #617487;
  font-size: 14px;
  font-weight: 650;
}

.login-card .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.login-card label {
  gap: 7px;
  color: #1c3144;
  font-size: 13px;
  font-weight: 760;
}

.login-card input,
.login-card select {
  min-height: 52px;
  border-radius: 17px;
  border-color: rgba(153, 197, 225, 0.72);
  background: rgba(248, 252, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.login-card input:focus,
.login-card select:focus {
  border-color: rgba(77, 166, 226, 0.82);
  outline: 3px solid rgba(124, 200, 249, 0.22);
}

.login-card .button {
  min-height: 54px;
  margin-top: 4px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f85b8, #67bff2);
  box-shadow: 0 18px 36px rgba(49, 137, 190, 0.28);
}

.account-balance-card {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  border-radius: 28px;
  border-color: rgba(161, 205, 232, 0.52);
  background:
    radial-gradient(circle at 88% 14%, rgba(112, 190, 242, 0.2), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 249, 255, 0.86));
  box-shadow: 0 22px 58px rgba(38, 74, 96, 0.12);
}

.account-balance-card::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -54px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: rgba(36, 94, 77, 0.08);
}

.account-balance-card > * {
  position: relative;
  z-index: 1;
}

.account-balance-card strong {
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0;
}

.account-balance-card .quick-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-balance-card .button.compact {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 13px;
}

.button:disabled,
.button.disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

@media (max-width: 700px) {
  .login-page {
    align-items: flex-start;
    padding: 18px;
  }

  .login-card {
    margin-top: min(7vh, 42px);
    border-radius: 26px;
  }

  .login-logo {
    width: 66px;
    height: 66px;
    border-radius: 21px;
  }

  .login-logo img {
    width: 50px;
    height: 50px;
  }

  .login-card input,
  .login-card select,
  .login-card .button {
    min-height: 50px;
  }
}

/* Mobile usability pass: keep long forms and modal actions reachable. */
@media (max-width: 768px) {
  .modal-backdrop {
    align-items: stretch;
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow: auto;
    border-radius: 24px;
    padding: 16px;
  }

  .modal-card .card-header {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -16px -16px 12px;
    padding: 14px 16px;
    border-radius: 24px 24px 0 0;
    background: rgba(248, 252, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  .modal-card .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-card .span-2,
  .modal-card .span-3 {
    grid-column: 1;
  }

  .modal-card .form-grid > button[type="submit"],
  .modal-card .form-grid > .button.span-3 {
    position: sticky;
    bottom: 0;
    z-index: 3;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 -10px 28px rgba(38, 74, 96, 0.14);
  }

  .mobile-bottom-nav {
    gap: 6px;
    padding: 8px;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    min-height: 52px;
    font-size: 11px;
  }

  select[multiple] {
    min-height: 132px;
  }
}

@media (min-width: 1025px) {
  .contextual-mobile-bottom-nav {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .desktop-context-actions {
    display: none !important;
  }

  .contextual-mobile-bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  .contextual-mobile-bottom-nav > a {
    min-width: 0;
    padding: 7px 3px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 360px) {
  .contextual-mobile-bottom-nav {
    left: 6px !important;
    right: 6px !important;
    gap: 4px !important;
    padding: 6px !important;
  }

  .contextual-mobile-bottom-nav > a {
    font-size: 9px !important;
  }

  .contextual-mobile-bottom-nav .mobile-nav-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
}

/* Current-workflow polish: apply the approved baby-blue/navy palette without changing app structure. */
:root {
  --yosu-ink: #0b1f33;
  --yosu-navy: #16324f;
  --yosu-blue: #2b5d87;
  --yosu-sky: #6cb6ff;
  --yosu-mist: #cfe8ff;
}

.button {
  border-radius: 16px;
}

.button:not(.secondary):not(.danger):not(.muted) {
  background: linear-gradient(135deg, var(--yosu-blue), var(--yosu-sky));
  box-shadow: 0 16px 34px rgba(43, 93, 135, 0.22);
}

.card,
.modal-card {
  border-color: rgba(108, 182, 255, 0.28);
}

.line-item-row {
  border-radius: 22px;
  border: 1px solid rgba(108, 182, 255, 0.28);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(207, 232, 255, 0.22));
  padding: 14px;
}

.line-meta {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.line-total {
  min-height: 58px;
  border-radius: 16px;
  background: rgba(207, 232, 255, 0.32);
  border: 1px solid rgba(108, 182, 255, 0.24);
  padding: 10px 12px;
}

.line-total span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.line-total strong {
  color: var(--yosu-ink);
}

.document-success-panel {
  display: grid;
  gap: 14px;
}

.document-success-panel .metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.document-success-panel .form-actions {
  justify-content: flex-start;
}

.action-drawer {
  padding: 0;
  overflow: hidden;
}

.action-summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  padding: 18px;
  list-style: none;
}

.action-summary::-webkit-details-marker {
  display: none;
}

.action-summary span {
  color: var(--yosu-ink);
  font-size: 18px;
  font-weight: 850;
}

.action-summary small {
  color: var(--muted);
}

.action-drawer[open] .action-summary {
  border-bottom: 1px solid rgba(108, 182, 255, 0.24);
  background: rgba(207, 232, 255, 0.24);
}

.action-drawer form {
  padding: 18px;
}

@media (max-width: 768px) {
  .line-item-row {
    grid-template-columns: 1fr;
  }

  .line-total,
  .line-meta {
    grid-column: 1;
  }

  .action-drawer form {
    padding: 14px;
  }
}

/* Final UI-only polish pass. Keep these late overrides isolated so they do not
   change routes, data flow, permissions, or accounting behavior. */
.login-page {
  background:
    radial-gradient(circle at 18% 18%, rgba(108, 182, 255, 0.34), transparent 28%),
    radial-gradient(circle at 84% 8%, rgba(207, 232, 255, 0.82), transparent 28%),
    linear-gradient(135deg, #f8fcff 0%, #edf8ff 48%, #ffffff 100%) !important;
}

.login-card {
  border-radius: 34px !important;
  border-color: rgba(108, 182, 255, 0.42) !important;
  box-shadow: 0 34px 92px rgba(11, 31, 51, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

.login-brand h1 {
  color: #0b1f33 !important;
}

.login-card .button {
  background: linear-gradient(135deg, #16324f, #2b5d87 48%, #6cb6ff) !important;
}

.topbar,
.page-header {
  gap: clamp(12px, 2vw, 20px);
}

.content {
  padding: clamp(18px, 3vw, 34px);
}

.dashboard-grid,
.metrics,
.queue-grid,
.two-column {
  gap: clamp(14px, 2vw, 20px);
}

.table-wrap {
  border-radius: 20px;
  border: 1px solid rgba(108, 182, 255, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  color: #16324f;
  font-size: 12px;
  letter-spacing: 0;
}

td {
  font-size: 14px;
}

input,
select,
textarea {
  border-radius: 15px !important;
  border-color: rgba(108, 182, 255, 0.34) !important;
  background: rgba(255, 255, 255, 0.86);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(108, 182, 255, 0.2);
  border-color: rgba(43, 93, 135, 0.56) !important;
}

.status {
  border-radius: 999px;
  padding-inline: 10px;
}

@media (max-width: 1024px) {
  .content {
    padding-top: 74px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  h1 {
    font-size: clamp(26px, 8vw, 34px);
  }

  .card {
    border-radius: 22px;
    padding: 15px;
  }

  .metrics,
  .dashboard-grid,
  .queue-grid,
  .two-column,
  .transaction-selector {
    grid-template-columns: 1fr !important;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-actions .button {
    width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
    max-width: 100%;
  }

  table {
    min-width: 680px;
  }

  .mobile-menu-button {
    border-radius: 18px;
  }

  .modal-card .form-actions {
    position: sticky;
    bottom: -16px;
    z-index: 3;
    margin: 10px -16px -16px;
    padding: 12px 16px;
    background: rgba(248, 252, 255, 0.96);
    border-top: 1px solid rgba(108, 182, 255, 0.22);
    backdrop-filter: blur(14px);
  }
}

/* Mobile web functionality pass: final override layer for all shared dialogs,
   action drawers and data tables. Keeps backend/data behavior untouched. */
@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .modal-backdrop {
    align-items: stretch !important;
    justify-items: stretch !important;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)) !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 22px !important;
    padding: 14px !important;
    overscroll-behavior: contain;
  }

  .modal-card .card-header {
    position: sticky !important;
    top: -14px !important;
    z-index: 10 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: -14px -14px 12px !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid rgba(108, 182, 255, 0.22);
    border-radius: 22px 22px 0 0 !important;
    background: rgba(248, 252, 255, 0.98) !important;
    backdrop-filter: blur(16px);
  }

  .modal-card .card-header h2 {
    font-size: 18px !important;
    line-height: 1.16 !important;
  }

  .modal-card .card-header .button.compact {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    border-radius: 14px;
  }

  .modal-card .card-header .button.compact::after {
    content: "x";
    font-size: 16px;
    line-height: 1;
  }

  .modal-card .form-grid,
  .modal-card form {
    min-width: 0;
  }

  .modal-card input,
  .modal-card select,
  .modal-card textarea {
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }

  .modal-card textarea {
    min-height: 92px;
  }

  .modal-card .form-actions {
    position: sticky !important;
    bottom: -14px !important;
    z-index: 11 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin: 14px -14px -14px !important;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom)) !important;
    border-top: 1px solid rgba(108, 182, 255, 0.24);
    background: rgba(248, 252, 255, 0.98) !important;
    box-shadow: 0 -16px 34px rgba(11, 31, 51, 0.1);
  }

  .modal-card .form-actions .button {
    width: 100%;
    min-height: 48px;
  }

  .modal-card .quick-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .action-drawer form {
    grid-template-columns: 1fr !important;
    max-height: min(72dvh, 680px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0;
  }

  .action-drawer .span-2,
  .action-drawer .span-3 {
    grid-column: 1 !important;
  }

  .action-drawer form > button[type="submit"] {
    position: sticky;
    bottom: 0;
    width: 100%;
    min-height: 50px;
    margin: 10px -14px 0;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 -12px 26px rgba(11, 31, 51, 0.1);
  }

  .mobile-menu-panel {
    max-width: 100%;
    overflow-x: hidden;
  }

  .mobile-drawer-footer {
    position: sticky;
    bottom: -16px;
    z-index: 2;
  }

  .mobile-language-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mobile-language-form select {
    min-width: 0;
  }

  .mobile-bottom-nav {
    left: 8px !important;
    right: 8px !important;
    gap: 5px !important;
    border-radius: 24px !important;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    min-width: 0;
    min-height: 54px !important;
    padding: 6px 4px;
    font-size: 10px !important;
  }

  .mobile-nav-icon {
    width: 25px !important;
    height: 25px !important;
  }

  .table-wrap {
    border: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    min-width: 0 !important;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    margin-bottom: 12px;
    border: 1px solid rgba(108, 182, 255, 0.24);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 28px rgba(11, 31, 51, 0.07);
    overflow: hidden;
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(108, 182, 255, 0.16);
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td .button,
  .table-wrap td a.button {
    width: 100%;
    white-space: normal;
  }
}

@media (max-width: 430px) {
  .modal-card .form-actions {
    grid-template-columns: 1fr !important;
  }

  .table-wrap td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Real calendar views for service bookings and operations schedules. */
.calendar-grid-card {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.calendar-personal-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.calendar-dashboard-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.calendar-dashboard-greeting-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-dashboard-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b1f33, #16324f);
  color: #cfe8ff;
  font-size: 18px;
  font-weight: 800;
}

.calendar-time {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--premium-ink);
}

.calendar-desktop-summary .metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.calendar-desktop-summary .metric {
  min-height: 100px;
}

.calendar-desktop-summary {
  margin-top: 14px;
}

.simple-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text);
}

.simple-list li {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-left: 3px solid rgba(108, 182, 255, 0.85);
  padding-left: 10px;
}

.calendar-quick-actions .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calendar-time,
.calendar-dashboard-greeting-user strong,
.calendar-dashboard-greeting-user small,
.calendar-personal-dashboard p {
  margin: 0;
}

.calendar-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.calendar-weekdays,
.calendar-week,
.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 132px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(108, 182, 255, 0.24);
  border-radius: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.calendar-day.is-outside {
  opacity: 0.52;
  background: rgba(246, 251, 255, 0.56);
}

.calendar-day.is-today {
  border-color: rgba(43, 93, 135, 0.52);
  box-shadow: inset 0 0 0 2px rgba(108, 182, 255, 0.2);
}

.calendar-day-number {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--yosu-ink);
  font-weight: 850;
}

.calendar-day-number small,
.calendar-more {
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
}

.calendar-day-events {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.calendar-event {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid rgba(108, 182, 255, 0.22);
  border-radius: 12px;
  padding: 7px 8px;
  background: linear-gradient(145deg, rgba(207, 232, 255, 0.76), rgba(255, 255, 255, 0.82));
  color: var(--yosu-ink);
}

details.calendar-event summary {
  display: grid;
  gap: 2px;
  cursor: pointer;
  list-style: none;
}

details.calendar-event summary::-webkit-details-marker {
  display: none;
}

details.calendar-event[open] {
  box-shadow: 0 18px 46px rgba(11, 31, 51, 0.14);
}

.calendar-event dl {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(43, 93, 135, 0.14);
}

.calendar-event dl div {
  display: grid;
  gap: 2px;
}

.calendar-event dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-event dd {
  margin: 0;
  color: var(--yosu-ink);
  font-size: 12px;
  font-weight: 750;
}

.calendar-event-accommodation {
  border-color: rgba(108, 182, 255, 0.45);
  background: linear-gradient(145deg, rgba(207, 232, 255, 0.94), rgba(255, 255, 255, 0.88));
}

.calendar-event-activity {
  border-color: rgba(245, 158, 11, 0.42);
  background: linear-gradient(145deg, rgba(255, 237, 213, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-touristic-site {
  border-color: rgba(34, 197, 94, 0.42);
  background: linear-gradient(145deg, rgba(220, 252, 231, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-transport {
  border-color: rgba(168, 85, 247, 0.42);
  background: linear-gradient(145deg, rgba(243, 232, 255, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-package {
  border-color: rgba(234, 179, 8, 0.48);
  background: linear-gradient(145deg, rgba(254, 249, 195, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-meeting {
  border-color: rgba(20, 184, 166, 0.42);
  background: linear-gradient(145deg, rgba(204, 251, 241, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-operation {
  border-color: rgba(239, 68, 68, 0.38);
  background: linear-gradient(145deg, rgba(254, 226, 226, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-event-staff {
  border-color: rgba(100, 116, 139, 0.36);
  background: linear-gradient(145deg, rgba(241, 245, 249, 0.95), rgba(255, 255, 255, 0.86));
}

.calendar-workspace {
  position: relative;
  overflow: visible;
}

.calendar-tab-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.calendar-tabs {
  gap: 8px;
}

.desktop-calendar-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.calendar-tabs label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(43, 93, 135, 0.18);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(248, 252, 255, 0.84);
  color: var(--yosu-ink);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
}

.calendar-tab-panels {
  min-width: 0;
}

.calendar-tab-panel {
  display: none;
  min-width: 0;
}

#calendar-tab-accommodation:checked ~ .desktop-calendar-tabs label[for="calendar-tab-accommodation"],
#calendar-tab-services:checked ~ .desktop-calendar-tabs label[for="calendar-tab-services"],
#calendar-tab-operations:checked ~ .desktop-calendar-tabs label[for="calendar-tab-operations"],
#calendar-tab-staff:checked ~ .desktop-calendar-tabs label[for="calendar-tab-staff"],
#calendar-tab-accommodation:checked ~ .mobile-calendar-tabs label[for="calendar-tab-accommodation"],
#calendar-tab-services:checked ~ .mobile-calendar-tabs label[for="calendar-tab-services"],
#calendar-tab-operations:checked ~ .mobile-calendar-tabs label[for="calendar-tab-operations"],
#calendar-tab-staff:checked ~ .mobile-calendar-tabs label[for="calendar-tab-staff"] {
  background: linear-gradient(135deg, #0b1f33, #16324f);
  border-color: rgba(108, 182, 255, 0.42);
  color: #ffffff;
}

#calendar-tab-accommodation:checked ~ .calendar-tab-panels #calendar-accommodation,
#calendar-tab-services:checked ~ .calendar-tab-panels #calendar-services,
#calendar-tab-operations:checked ~ .calendar-tab-panels #calendar-operations,
#calendar-tab-staff:checked ~ .calendar-tab-panels #calendar-staff {
  display: grid;
  gap: 14px;
}

.mobile-calendar-tabs {
  display: none;
}

.calendar-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.calendar-filter-row span {
  border: 1px solid rgba(43, 93, 135, 0.16);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(248, 252, 255, 0.78);
  color: var(--yosu-ink);
  font-size: 12px;
  font-weight: 800;
}

.legend-orange { box-shadow: inset 4px 0 0 #f59e0b; }
.legend-green { box-shadow: inset 4px 0 0 #22c55e; }
.legend-purple { box-shadow: inset 4px 0 0 #a855f7; }
.legend-yellow { box-shadow: inset 4px 0 0 #eab308; }

.calendar-event strong,
.calendar-event small,
.calendar-event em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event strong {
  font-size: 12px;
  font-weight: 850;
}

.calendar-event small,
.calendar-event em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.calendar-empty {
  border: 1px dashed rgba(108, 182, 255, 0.36);
  border-radius: 18px;
  padding: 18px;
  background: rgba(246, 251, 255, 0.72);
}

.calendar-empty p {
  margin-bottom: 0;
  color: var(--muted);
}

.calendar-view-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto)) 1fr;
  gap: 8px;
  align-items: flex-start;
}

.calendar-view-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.calendar-view-toggle > label {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(43, 93, 135, 0.18);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(248, 252, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.calendar-view-radio:checked + label {
  background: linear-gradient(135deg, #0b1f33, #16324f);
  border-color: rgba(108, 182, 255, 0.42);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(11, 31, 51, 0.18);
}

.calendar-panel {
  grid-column: 1 / -1;
  display: none;
  min-width: 0;
}

.calendar-view-today:checked ~ .calendar-today-panel,
.calendar-view-week:checked ~ .calendar-week-panel,
.calendar-view-month:checked ~ .calendar-month-panel,
.calendar-view-list:checked ~ .calendar-list-panel {
  display: grid;
  gap: 10px;
}

.calendar-panel {
  display: none;
}

.calendar-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(43, 93, 135, 0.14);
}

.calendar-event-actions .button {
  min-height: 32px;
  border-radius: 999px;
  padding-inline: 10px;
  font-size: 11px;
  white-space: normal;
}

.calendar-event-action-note {
  flex: 1 1 180px;
  align-self: center;
  color: #41566b;
  font-size: 11px;
  line-height: 1.35;
}

.calendar-agenda-day {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(108, 182, 255, 0.22);
  border-radius: 18px;
  padding: 12px;
  background: rgba(248, 252, 255, 0.72);
}

.calendar-agenda-date {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.calendar-agenda-date strong {
  color: var(--yosu-ink);
  font-size: 13px;
}

.calendar-agenda-date span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-agenda-events {
  display: grid;
  gap: 8px;
}

@media (max-width: 900px) {
  .desktop-calendar-tabs {
    display: none;
  }

  .mobile-calendar-tabs {
    position: sticky;
    bottom: 74px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0 -4px 12px;
    padding: 8px;
    border: 1px solid rgba(43, 93, 135, 0.16);
    border-radius: 18px;
    background: rgba(207, 232, 255, 0.94);
    box-shadow: 0 14px 35px rgba(11, 31, 51, 0.16);
  }

  .mobile-calendar-tabs label {
    min-height: 48px;
    display: grid;
    gap: 2px;
    padding: 5px 4px;
    font-size: 12px;
  }

  .mobile-calendar-tabs label span {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 800;
  }

  .calendar-view-toggle {
    grid-template-columns: 1fr 1fr;
  }

  .calendar-view-toggle > label {
    width: 100%;
    min-height: 42px;
  }

  .calendar-day {
    min-height: 76px;
    border-radius: 12px;
    padding: 7px;
  }

  .calendar-weekdays,
  .calendar-week,
  .calendar-month {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
  }

  .calendar-weekdays span {
    font-size: 9px;
  }

  .calendar-day-events {
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 5px;
  }

  .calendar-event strong,
  .calendar-event small,
  .calendar-event em {
    white-space: nowrap;
  }

  .calendar-month-panel .calendar-event {
    border-radius: 8px;
    padding: 4px 5px;
  }

  .calendar-month-panel .calendar-event strong {
    font-size: 9px;
  }

  .calendar-month-panel .calendar-event small,
  .calendar-month-panel .calendar-event em {
    display: none;
  }

  .calendar-week {
    grid-template-columns: 1fr;
  }

  .calendar-week .calendar-day {
    min-height: auto;
  }

  .calendar-today-panel,
  .calendar-list-panel {
    gap: 8px;
  }

  .calendar-event-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-event-actions .button {
    width: 100%;
  }

  details.calendar-event[open] {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 86px;
    z-index: 45;
    max-height: min(72dvh, 580px);
    overflow: auto;
    padding: 14px;
    border-radius: 22px;
    background: rgba(248, 252, 255, 0.98);
    box-shadow: 0 24px 80px rgba(11, 31, 51, 0.28);
    -webkit-overflow-scrolling: touch;
  }

  .calendar-day-number {
    font-size: 11px;
  }

  .calendar-day-number small {
    display: none;
  }

  .calendar-more {
    font-size: 9px;
  }
}

/* Premium mobile-first visual pass: compact app drawer, calmer type, softer cards. */
:root {
  --premium-ink: #0B1F33;
  --premium-navy: #16324F;
  --premium-blue: #2B5D87;
  --premium-sky: #6CB6FF;
  --premium-mist: #CFE8FF;
}

body {
  color: var(--premium-ink);
  font-weight: 400;
}

h1,
h2,
h3,
.metric strong {
  font-weight: 650;
}

.card {
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(11, 31, 51, 0.09);
}

.metric span,
label,
th {
  font-weight: 620;
}

.metric strong {
  font-size: clamp(22px, 3.5vw, 32px);
}

.button {
  font-weight: 650;
  letter-spacing: 0;
}

@media (max-width: 768px) {
  .content {
    padding: 76px 14px 108px;
  }

  .card {
    padding: 14px;
    border-radius: 24px;
  }

  .metrics {
    gap: 12px;
  }

  .metric {
    min-height: 110px;
  }

  .metric strong {
    font-size: clamp(21px, 8vw, 30px);
  }

  .mobile-menu-button {
    width: 46px;
    min-height: 46px;
    border-radius: 17px;
    font-size: 0;
  }

  .mobile-menu-button::before {
    content: "";
    width: 20px;
    height: 14px;
    display: block;
    border-top: 2px solid #fff;
    border-bottom: 2px solid #fff;
    box-shadow: inset 0 6px 0 0 #fff;
  }

  .mobile-menu-overlay {
    padding: 8px;
  }

  .mobile-menu-panel {
    height: calc(100dvh - 16px);
    padding: 14px;
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
      radial-gradient(circle at 18% 0%, rgba(108, 182, 255, 0.24), transparent 34%),
      linear-gradient(180deg, rgba(11, 31, 51, 0.98), rgba(22, 50, 79, 0.96) 0 178px, rgba(246, 251, 255, 0.98) 178px);
  }

  .mobile-menu-panel .card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  .mobile-menu-panel .card-header .button.compact {
    min-width: 42px;
    min-height: 42px;
    width: 42px;
    padding: 0;
    font-size: 0;
    border-radius: 15px;
  }

  .mobile-menu-panel .card-header .button.compact::after {
    content: "x";
    color: var(--premium-ink);
    font-size: 16px;
  }

  .mobile-account-card {
    margin: 10px 0 14px;
    padding: 14px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(43, 93, 135, 0.92), rgba(108, 182, 255, 0.38));
  }

  .mobile-account-card strong {
    font-size: 18px;
    font-weight: 650;
  }

  .mobile-drawer-nav {
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }

  .mobile-drawer-group {
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(108, 182, 255, 0.24);
    box-shadow: 0 10px 28px rgba(11, 31, 51, 0.08);
  }

  .mobile-drawer-summary {
    width: 100%;
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--premium-ink);
    padding: 11px 13px;
    text-align: left;
  }

  .mobile-drawer-summary span {
    min-width: 0;
    font-size: 15px;
    font-weight: 650;
  }

  .mobile-drawer-summary small {
    color: #6f8393;
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-drawer-summary::after {
    content: "+";
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(207, 232, 255, 0.72);
    color: var(--premium-navy);
    font-weight: 700;
  }

  .mobile-drawer-group.open .mobile-drawer-summary {
    background: rgba(207, 232, 255, 0.34);
  }

  .mobile-drawer-group.open .mobile-drawer-summary::after {
    content: "-";
  }

  .mobile-drawer-submenu {
    display: grid;
    gap: 6px;
    padding: 8px 10px 12px;
    border-top: 1px solid rgba(108, 182, 255, 0.16);
  }

  .mobile-drawer-submenu a {
    display: block;
    margin: 0;
    padding: 10px 11px;
    border-radius: 13px;
    background: rgba(246, 251, 255, 0.9);
    color: var(--premium-navy);
    font-size: 13px;
    font-weight: 560;
  }

  .mobile-drawer-footer {
    margin: 10px -14px -14px;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 30px 30px;
    flex: 0 0 auto;
  }

  .mobile-settings {
    border: 1px solid rgba(108, 182, 255, 0.24);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
  }

  .mobile-settings summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    padding: 0 13px;
    color: var(--premium-ink);
    font-size: 13px;
    font-weight: 650;
  }

  .mobile-settings summary::-webkit-details-marker {
    display: none;
  }

  .mobile-settings summary::after {
    content: "+";
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(207, 232, 255, 0.7);
  }

  .mobile-settings[open] summary::after {
    content: "-";
  }

  .mobile-settings-body {
    display: grid;
    gap: 10px;
    padding: 0 10px 10px;
  }

  .mobile-settings-body .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-settings-body .button.compact {
    min-height: 38px;
    font-size: 12px;
    border-radius: 12px;
  }

  .mobile-language-form {
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 0;
  }

  .mobile-language-form label {
    gap: 5px;
    font-size: 11px;
  }

  .mobile-language-form select {
    min-height: 40px;
    border-radius: 12px !important;
  }

  .mobile-drawer-footer .logout-button {
    min-height: 40px;
    border-radius: 12px;
    background: rgba(255, 238, 238, 0.92);
    color: #9c3838;
    box-shadow: none;
  }

  .mobile-bottom-nav {
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border: 1px solid rgba(108, 182, 255, 0.24);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 42px rgba(11, 31, 51, 0.14);
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    border-radius: 18px;
    color: var(--premium-navy);
    font-weight: 600;
  }

  .mobile-nav-icon {
    border-radius: 12px;
    background: rgba(207, 232, 255, 0.7);
    color: var(--premium-navy);
    font-size: 10px;
    font-weight: 700;
  }

  .action-summary span {
    font-size: 16px;
    font-weight: 650;
  }

  .modal-card .card-header h2 {
    font-weight: 650;
  }

  input,
  select,
  textarea {
    font-size: 15px;
  }
}

/* Advanced product-quality hierarchy pass: app-like rhythm without changing workflows. */
:root {
  --hierarchy-page: #eef7ff;
  --hierarchy-panel: rgba(255, 255, 255, 0.78);
  --hierarchy-panel-strong: rgba(255, 255, 255, 0.94);
  --hierarchy-dark: #0b1f33;
  --hierarchy-dark-2: #16324f;
  --hierarchy-mid: #2b5d87;
  --hierarchy-sky: #6cb6ff;
  --hierarchy-mist: #cfe8ff;
}

body {
  background:
    radial-gradient(circle at 9% 0%, rgba(108, 182, 255, 0.3), transparent 28%),
    radial-gradient(circle at 88% 6%, rgba(207, 232, 255, 0.72), transparent 32%),
    linear-gradient(180deg, #f8fcff 0%, var(--hierarchy-page) 52%, #f7fbff 100%);
}

.content {
  display: grid;
  align-content: flex-start;
  gap: 18px;
  max-width: 1480px;
  width: 100%;
}

.topbar {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  margin-bottom: 2px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(108, 182, 255, 0.18);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(11, 31, 51, 0.98), rgba(22, 50, 79, 0.94) 58%, rgba(43, 93, 135, 0.88)),
    radial-gradient(circle at 88% 18%, rgba(108, 182, 255, 0.34), transparent 26%);
  color: #f7fbff;
  box-shadow: 0 28px 80px rgba(11, 31, 51, 0.18);
}

.topbar::after {
  content: "";
  position: absolute;
  right: -76px;
  top: -94px;
  width: 250px;
  height: 250px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(207, 232, 255, 0.26), transparent 68%);
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar .eyebrow {
  color: rgba(207, 232, 255, 0.82);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0.08em;
}

.topbar h1 {
  max-width: 760px;
  color: #ffffff;
  font-size: clamp(27px, 4vw, 44px);
  font-weight: 640;
}

.topbar .button,
.topbar a.button {
  border: 1px solid rgba(207, 232, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: none;
}

.card {
  position: relative;
  overflow: hidden;
  border-color: rgba(108, 182, 255, 0.2);
  background:
    linear-gradient(180deg, var(--hierarchy-panel-strong), var(--hierarchy-panel)),
    radial-gradient(circle at 100% 0%, rgba(207, 232, 255, 0.28), transparent 34%);
  box-shadow: 0 18px 54px rgba(11, 31, 51, 0.08);
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 70px rgba(11, 31, 51, 0.12);
}

.card-header {
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(108, 182, 255, 0.12);
}

.card-header h2,
.card-header h3 {
  font-weight: 640;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.metric {
  min-height: 128px;
}

.metric span {
  color: #647a8e;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.metric strong {
  margin-top: 8px;
  font-weight: 630;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: #6d8295;
  line-height: 1.35;
}

.account-balance-card {
  isolation: isolate;
  min-height: 242px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 0;
  background:
    radial-gradient(circle at 88% 6%, rgba(108, 182, 255, 0.28), transparent 34%),
    linear-gradient(145deg, #0b1f33 0%, #16324f 56%, #2b5d87 100%);
  color: #f8fcff;
  box-shadow: 0 26px 82px rgba(11, 31, 51, 0.24);
}

.account-balance-card::before {
  content: "";
  position: absolute;
  inset: auto -28px -66px auto;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: rgba(207, 232, 255, 0.12);
  z-index: -1;
}

.account-balance-card span,
.account-balance-card small {
  color: rgba(248, 252, 255, 0.78);
}

.account-balance-card strong {
  color: #ffffff;
  font-size: clamp(28px, 4vw, 42px);
}

.account-balance-card .quick-actions {
  margin-top: 16px;
  gap: 8px;
}

.account-balance-card .button.compact,
.account-balance-card a.button.compact {
  min-height: 34px;
  border: 1px solid rgba(207, 232, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  backdrop-filter: blur(10px);
}

.dashboard-account-link {
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.dashboard-account-link:hover,
.dashboard-account-link:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 34px 96px rgba(11, 31, 51, 0.34);
  filter: saturate(1.04);
}

.dashboard-account-link:focus-visible {
  outline: 3px solid rgba(108, 182, 255, 0.72);
  outline-offset: 4px;
}

.dashboard-account-link__hint {
  font-weight: 700;
  color: #cfe8ff !important;
}

.account-section-card {
  min-height: 178px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.filter-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-row input,
.filter-row select {
  width: 100%;
  min-height: 42px;
}

.inline-empty {
  margin-top: 12px;
  border: 1px dashed rgba(43, 93, 135, 0.24);
  background: rgba(207, 232, 255, 0.28);
}

.report-export-card {
  margin-bottom: 16px;
}

.report-export-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) repeat(3, auto);
}

.report-export-form .button {
  min-height: 42px;
}

.dashboard-total-balance-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 0;
  background:
    radial-gradient(circle at 86% 14%, rgba(207, 232, 255, 0.34), transparent 30%),
    linear-gradient(135deg, #0b1f33 0%, #16324f 48%, #2b5d87 100%);
  color: #ffffff;
  box-shadow: 0 30px 90px rgba(11, 31, 51, 0.24);
}

.dashboard-total-balance-card span,
.dashboard-total-balance-card small {
  color: rgba(248, 252, 255, 0.78);
}

.dashboard-total-balance-card strong {
  color: #ffffff;
  font-size: clamp(42px, 7vw, 72px);
  letter-spacing: 0;
}

.dashboard-account-card {
  min-height: 170px;
}

.exchange-rate-panel {
  display: none;
  margin: 14px 0 18px;
  padding: 0;
  overflow: hidden;
  border-color: rgba(108, 182, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(207, 232, 255, 0.42)),
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.28), transparent 30%);
}

.exchange-rate-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--hierarchy-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.exchange-rate-toggle strong,
.exchange-rate-toggle small {
  display: block;
}

.exchange-rate-toggle small,
.exchange-rate-body small,
.exchange-rate-footer p,
.exchange-rate-source {
  color: var(--muted);
}

.exchange-rate-body {
  padding: 0 20px 18px;
}

.exchange-rate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.exchange-rate-grid article {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(108, 182, 255, 0.14);
}

.exchange-rate-grid span,
.exchange-rate-grid strong,
.exchange-rate-grid small {
  display: block;
}

.exchange-rate-grid strong {
  margin: 5px 0;
  color: #0b1f33;
  font-size: 20px;
}

.exchange-rate-grid .rate-stale {
  background: rgba(255, 248, 222, 0.78);
}

.exchange-rate-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.exchange-rate-footer p,
.exchange-rate-source {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.quick-actions {
  gap: 9px;
}

.quick-actions .button {
  border-radius: 999px;
}

.status {
  font-weight: 650;
}

.table-wrap {
  border-radius: 22px;
  border-color: rgba(108, 182, 255, 0.18);
  background: rgba(255, 255, 255, 0.58);
}

th {
  background: rgba(207, 232, 255, 0.36);
  color: #435c72;
  font-weight: 680;
  letter-spacing: 0.05em;
}

td {
  color: #21384c;
}

.detail-tabs {
  border-bottom: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(207, 232, 255, 0.34);
}

.detail-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 650;
}

.detail-tab.active {
  background: #ffffff;
  color: var(--hierarchy-dark);
  box-shadow: 0 10px 24px rgba(11, 31, 51, 0.08);
}

.modal-card {
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(238, 247, 255, 0.96)),
    radial-gradient(circle at 100% 0%, rgba(108, 182, 255, 0.18), transparent 28%);
}

.modal-close-button {
  min-width: 42px;
}

.workspace-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.workspace-intro p:not(.eyebrow) {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

input,
select,
textarea {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
}

@media (min-width: 901px) {
  .exchange-rate-panel {
    display: block;
  }

  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .sidebar {
    border-radius: 28px;
    box-shadow: 0 24px 80px rgba(11, 31, 51, 0.22);
  }
}

@media (max-width: 900px) {
  .content {
    gap: 14px;
  }

  .topbar {
    min-height: 112px;
    padding: 18px;
    border-radius: 28px;
  }

  .topbar h1 {
    font-size: clamp(25px, 8vw, 34px);
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar .button,
  .topbar a.button {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 12px;
  }

  .metric {
    min-height: 116px;
  }

  .account-balance-card {
    min-height: 228px;
    border-radius: 30px;
  }

  .account-balance-card strong {
    font-size: clamp(28px, 10vw, 38px);
  }

  .card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .workspace-intro {
    grid-template-columns: 1fr;
  }

  .record-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-actions .button {
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  .dashboard-account-link {
    min-height: 220px;
  }

  .filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .report-export-form {
    grid-template-columns: 1fr;
  }

  .filter-row .button,
  .filter-row a.button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  body {
    background:
      linear-gradient(180deg, rgba(11, 31, 51, 0.98) 0 180px, #f5fbff 180px),
      radial-gradient(circle at 88% 4%, rgba(108, 182, 255, 0.3), transparent 34%);
  }

  .topbar {
    margin-top: 0;
    box-shadow: 0 20px 60px rgba(11, 31, 51, 0.2);
  }

  .card {
    border-radius: 26px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .table-wrap tr {
    border-radius: 22px;
  }

  .table-wrap td {
    padding: 10px 12px;
  }

  .mobile-bottom-nav {
    width: calc(100vw - 22px);
    left: 11px;
    right: 11px;
    bottom: 10px;
    border-radius: 26px;
  }
}

/* Fix67: final visual consistency layer. Keeps workflows untouched while
   preventing lower page sections from reverting to plain admin-white panels. */
:root {
  --surface: #cfe8ff;
  --surface-soft: #e7f5ff;
  --panel: rgba(207, 232, 255, 0.72);
  --panel-strong: rgba(248, 252, 255, 0.76);
  --navy-glass: rgba(11, 31, 51, 0.92);
  --navy-card: #16324f;
}

body {
  background:
    radial-gradient(circle at 14% -6%, rgba(108, 182, 255, 0.36), transparent 28%),
    radial-gradient(circle at 86% 0%, rgba(43, 93, 135, 0.22), transparent 34%),
    linear-gradient(180deg, #eaf7ff 0%, #cfe8ff 54%, #e7f5ff 100%);
}

.content {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 260px),
    radial-gradient(circle at 92% 8%, rgba(108, 182, 255, 0.18), transparent 28%);
}

.card,
.notice,
.workspace-intro,
.empty-state,
.calendar-shell,
.report-export-card,
.account-filter-card {
  background:
    linear-gradient(145deg, rgba(248, 252, 255, 0.78), rgba(207, 232, 255, 0.66)),
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.18), transparent 30%);
  border: 1px solid rgba(43, 93, 135, 0.18);
  box-shadow: 0 24px 70px rgba(11, 31, 51, 0.12);
  backdrop-filter: blur(18px);
}

.card:hover {
  border-color: rgba(108, 182, 255, 0.36);
}

.card-header {
  border-bottom: 1px solid rgba(43, 93, 135, 0.12);
  padding-bottom: 12px;
}

.card-header h2,
.card-header h3,
.topbar h1,
.page-header h1 {
  color: #0b1f33;
  font-weight: 660;
  letter-spacing: 0;
}

.metric:not(.account-balance-card):not(.dashboard-total-balance-card) {
  background:
    radial-gradient(circle at 92% 8%, rgba(108, 182, 255, 0.22), transparent 34%),
    linear-gradient(145deg, rgba(248, 252, 255, 0.74), rgba(207, 232, 255, 0.68));
}

.dashboard-grid .card:not(.account-balance-card),
.grid.metrics .card:not(.account-balance-card):not(.dashboard-total-balance-card) {
  border-color: rgba(43, 93, 135, 0.2);
}

.table-wrap {
  background:
    linear-gradient(145deg, rgba(248, 252, 255, 0.72), rgba(207, 232, 255, 0.62));
  border: 1px solid rgba(43, 93, 135, 0.14);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

thead th {
  color: #2b5d87;
  font-size: 11px;
  letter-spacing: 0;
  background: transparent;
}

tbody tr {
  background: rgba(248, 252, 255, 0.68);
  box-shadow: 0 12px 34px rgba(11, 31, 51, 0.08);
}

tbody tr:hover {
  background: rgba(207, 232, 255, 0.82);
}

tbody td {
  border-top: 1px solid rgba(43, 93, 135, 0.1);
  border-bottom: 1px solid rgba(43, 93, 135, 0.1);
}

tbody td:first-child {
  border-left: 1px solid rgba(43, 93, 135, 0.1);
  border-radius: 18px 0 0 18px;
}

tbody td:last-child {
  border-right: 1px solid rgba(43, 93, 135, 0.1);
  border-radius: 0 18px 18px 0;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid rgba(43, 93, 135, 0.14);
  background: rgba(96, 116, 137, 0.14);
  color: #41566b;
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  text-transform: capitalize;
}

.status.pending {
  background: rgba(255, 178, 74, 0.2);
  border-color: rgba(255, 178, 74, 0.38);
  color: #8a5200;
}

.status.rejected,
.status.danger,
.status.cancelled,
.status.unpaid {
  background: rgba(214, 82, 82, 0.16);
  border-color: rgba(214, 82, 82, 0.32);
  color: #9c3030;
}

.status.approved,
.status.completed,
.status.paid,
.status.confirmed {
  background: rgba(48, 164, 108, 0.16);
  border-color: rgba(48, 164, 108, 0.32);
  color: #1d724a;
}

.status.refunded,
.status.info {
  background: rgba(108, 182, 255, 0.22);
  border-color: rgba(108, 182, 255, 0.42);
  color: #1f5f98;
}

.status.draft,
.status.archived {
  background: rgba(96, 116, 137, 0.14);
  border-color: rgba(96, 116, 137, 0.22);
  color: #4d6072;
}

.rail-button,
.mobile-nav-icon {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  letter-spacing: 0;
}

.rail-button {
  color: rgba(207, 232, 255, 0.82);
  background: rgba(207, 232, 255, 0.08);
  border: 1px solid rgba(207, 232, 255, 0.12);
}

.rail-button:hover,
.rail-button.active {
  color: #ffffff;
  background:
    radial-gradient(circle at 70% 0%, rgba(108, 182, 255, 0.45), transparent 42%),
    rgba(43, 93, 135, 0.72);
  border-color: rgba(108, 182, 255, 0.36);
}

.sidebar-drawer,
.mobile-menu-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(108, 182, 255, 0.28), transparent 34%),
    linear-gradient(180deg, #0b1f33, #16324f 58%, #102a44);
}

.submenu-link,
.mobile-drawer-submenu a {
  background: rgba(207, 232, 255, 0.08);
  border: 1px solid rgba(207, 232, 255, 0.08);
}

.submenu-link:hover,
.mobile-drawer-submenu a:hover {
  background: rgba(108, 182, 255, 0.18);
  border-color: rgba(108, 182, 255, 0.24);
}

.button.secondary {
  background: rgba(207, 232, 255, 0.58);
  border-color: rgba(43, 93, 135, 0.22);
  color: #16324f;
}

.button.secondary:hover {
  background: rgba(108, 182, 255, 0.28);
}

input,
select,
textarea {
  background: rgba(248, 252, 255, 0.86);
  border-color: rgba(43, 93, 135, 0.18);
}

.wide-modal {
  width: min(1120px, calc(100vw - 28px));
}

.package-builder-modal {
  width: min(1180px, calc(100vw - 28px));
  height: min(92dvh, 900px);
  max-height: calc(100dvh - 28px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.package-builder-modal > .card-header {
  flex-shrink: 0;
}

.package-builder-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 2px;
  padding-bottom: 0;
}

.package-builder-form .sticky-modal-actions {
  bottom: 0;
}

.package-workspace {
  background:
    radial-gradient(circle at 85% 0%, rgba(108, 182, 255, 0.42), transparent 32%),
    linear-gradient(135deg, rgba(11, 31, 51, 0.95), rgba(22, 50, 79, 0.92));
  color: #eef8ff;
}

.package-workspace p,
.package-workspace .eyebrow {
  color: rgba(238, 248, 255, 0.78);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card,
.package-builder-section {
  border: 1px solid rgba(43, 93, 135, 0.18);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(207, 232, 255, 0.72), rgba(248, 252, 255, 0.74));
  padding: 14px;
}

.package-workspace .metric-card {
  background: rgba(207, 232, 255, 0.12);
  border-color: rgba(207, 232, 255, 0.18);
}

.metric-card span {
  display: block;
  color: inherit;
  opacity: 0.72;
  font-size: 12px;
  margin-bottom: 6px;
}

.metric-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.package-component-row,
.package-reseller-row,
.package-staff-row,
.package-service-row {
  display: grid;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.package-component-row {
  grid-template-columns: minmax(110px, 1fr) minmax(190px, 1.45fr) minmax(140px, 1.1fr) repeat(5, minmax(84px, 0.72fr)) minmax(120px, 1fr) auto;
}

.package-reseller-row {
  grid-template-columns: minmax(160px, 1.3fr) minmax(120px, 1fr) minmax(90px, 0.7fr) minmax(78px, 0.5fr) minmax(88px, 0.55fr) minmax(120px, 1fr) auto;
}

.package-staff-row {
  grid-template-columns: minmax(160px, 1.25fr) minmax(120px, 1fr) minmax(110px, 0.85fr) minmax(88px, 0.6fr) minmax(78px, 0.5fr) minmax(88px, 0.55fr) minmax(120px, 1fr) auto;
}

.package-service-row {
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.1fr) minmax(88px, 0.65fr) minmax(78px, 0.5fr) minmax(88px, 0.55fr) minmax(120px, 0.95fr) minmax(120px, 1fr) auto;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.inline-check input {
  width: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-blue {
  background: rgba(108, 182, 255, 0.22);
  border-color: rgba(108, 182, 255, 0.38);
  color: #cfe8ff;
}

.status-grey {
  background: rgba(96, 116, 137, 0.16);
  border-color: rgba(96, 116, 137, 0.28);
  color: #4d6072;
}

.responsive-table {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .content {
    background:
      linear-gradient(180deg, rgba(11, 31, 51, 0.9) 0 170px, #cfe8ff 170px),
      radial-gradient(circle at 88% 0%, rgba(108, 182, 255, 0.32), transparent 30%);
  }

  .table-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .table-wrap tr {
    background:
      linear-gradient(145deg, rgba(248, 252, 255, 0.78), rgba(207, 232, 255, 0.72));
    border: 1px solid rgba(43, 93, 135, 0.14);
    box-shadow: 0 18px 42px rgba(11, 31, 51, 0.1);
  }

  .table-wrap td,
  .table-wrap td:first-child,
  .table-wrap td:last-child {
    border: 0;
    border-radius: 0;
  }

  .metric-grid,
  .package-component-row,
  .package-reseller-row,
  .package-staff-row,
  .package-service-row {
    grid-template-columns: 1fr;
  }

  .package-builder-modal,
  .modal-card.package-builder-modal {
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    overflow: hidden !important;
  }

  .package-builder-form {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 0 !important;
  }
}

/* Fix74: restore account-card contrast after the global visual consistency layer.
   Keep the existing sizing/layout; only make finance cards readable again. */
.card.metric.dashboard-total-balance-card,
.card.metric.account-balance-card,
.card.metric.dashboard-account-card {
  background:
    radial-gradient(circle at 86% 8%, rgba(108, 182, 255, 0.36), transparent 32%),
    radial-gradient(circle at 12% 96%, rgba(207, 232, 255, 0.14), transparent 38%),
    linear-gradient(145deg, #0b1f33 0%, #16324f 54%, #2b5d87 100%) !important;
  border: 1px solid rgba(108, 182, 255, 0.28);
  color: #f8fcff;
  box-shadow: 0 28px 84px rgba(11, 31, 51, 0.28);
}

.card.metric.dashboard-total-balance-card:hover,
.card.metric.account-balance-card:hover,
.card.metric.dashboard-account-card:hover {
  border-color: rgba(108, 182, 255, 0.46);
}

.card.metric.dashboard-total-balance-card span,
.card.metric.dashboard-total-balance-card small,
.card.metric.account-balance-card span,
.card.metric.account-balance-card small,
.card.metric.dashboard-account-card span,
.card.metric.dashboard-account-card small {
  color: rgba(248, 252, 255, 0.78);
}

.card.metric.dashboard-total-balance-card strong,
.card.metric.account-balance-card strong,
.card.metric.dashboard-account-card strong {
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(11, 31, 51, 0.28);
}

.card.metric.dashboard-total-balance-card .dashboard-account-link__hint,
.card.metric.account-balance-card .dashboard-account-link__hint,
.card.metric.dashboard-account-card .dashboard-account-link__hint {
  color: #cfe8ff !important;
}

.card.metric.account-balance-card .button.compact,
.card.metric.account-balance-card a.button.compact,
.card.metric.dashboard-account-card .button.compact,
.card.metric.dashboard-account-card a.button.compact {
  background: rgba(248, 252, 255, 0.12);
  border-color: rgba(207, 232, 255, 0.28);
  color: #ffffff;
}

/* Fix75: mobile modal safety net. This preserves existing forms while keeping
   long create/edit dialogs inside the viewport with reachable actions. */
@media (max-width: 768px) {
  .modal-backdrop {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    padding:
      max(8px, env(safe-area-inset-top))
      8px
      max(8px, env(safe-area-inset-bottom)) !important;
  }

  .modal-card,
  .modal-card.wide-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100vh - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-card .card-header {
    flex-shrink: 0;
    top: -14px !important;
  }

  .modal-card form,
  .modal-card .form-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-content: flex-start;
    min-width: 0 !important;
    width: 100% !important;
  }

  .modal-card label,
  .modal-card .span-2,
  .modal-card .span-3,
  .modal-card .notice,
  .modal-card .form-error {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .modal-card input,
  .modal-card select,
  .modal-card textarea,
  .modal-card button {
    max-width: 100% !important;
  }

  .modal-card .form-actions {
    position: sticky !important;
    bottom: -14px !important;
    grid-column: 1 / -1 !important;
    flex-shrink: 0;
  }

  .modal-card .form-actions .button,
  .modal-card .form-actions button {
    min-width: 0 !important;
    white-space: normal;
  }

  .package-component-row,
  .package-reseller-row,
  .package-staff-row,
  .package-service-row {
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .action-drawer[open] {
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .action-drawer form {
    grid-template-columns: 1fr !important;
    overflow-x: hidden !important;
  }

  .action-drawer .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px -12px -12px;
    padding: 12px max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
    background: rgba(248, 252, 255, 0.98);
    border-top: 1px solid rgba(108, 182, 255, 0.24);
  }
}

/* Fix78: mobile autosizing layer for narrow phones through tablets.
   Fluid spacing and type reduce clipping without changing desktop layouts. */
@media (max-width: 768px) {
  :root {
    --mobile-pad: clamp(10px, 3.6vw, 18px);
    --mobile-gap: clamp(8px, 2.8vw, 14px);
    --mobile-radius: clamp(14px, 4vw, 22px);
    --mobile-body: clamp(13px, 3.7vw, 15px);
    --mobile-small: clamp(11px, 3.1vw, 13px);
    --mobile-title: clamp(18px, 5.4vw, 24px);
    --mobile-value: clamp(26px, 9vw, 42px);
  }

  body {
    font-size: var(--mobile-body);
  }

  .content,
  .page-shell,
  .dashboard-grid,
  .grid,
  .metrics,
  .package-workspace {
    min-width: 0;
    max-width: 100%;
  }

  .content {
    padding-left: var(--mobile-pad) !important;
    padding-right: var(--mobile-pad) !important;
    gap: var(--mobile-gap) !important;
  }

  .card,
  .notice,
  .empty-state,
  .calendar-grid-card,
  .package-builder-section {
    min-width: 0;
    max-width: 100%;
    border-radius: var(--mobile-radius);
    padding: var(--mobile-pad);
  }

  .card-header,
  .page-header,
  .calendar-grid-header {
    min-width: 0;
    gap: var(--mobile-gap);
  }

  .page-header h1,
  .topbar h1,
  .card-header h2,
  .calendar-grid-header h2 {
    font-size: var(--mobile-title) !important;
    line-height: 1.12 !important;
    overflow-wrap: anywhere;
  }

  p,
  small,
  span,
  label,
  .status,
  .button,
  .calendar-event,
  .table-wrap td {
    overflow-wrap: anywhere;
  }

  .metric strong,
  .account-balance-card strong,
  .dashboard-account-card strong {
    font-size: var(--mobile-value) !important;
    line-height: 1.04 !important;
    overflow-wrap: anywhere;
  }

  .dashboard-total-balance-card strong {
    font-size: clamp(34px, 12vw, 56px) !important;
  }

  .quick-actions,
  .account-balance-card .quick-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)) !important;
    gap: var(--mobile-gap) !important;
  }

  .button,
  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .button,
  a.button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }

  .mobile-bottom-nav {
    width: min(calc(100vw - 16px), 480px) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
  }
}

@media (max-width: 430px) {
  .grid.metrics,
  .dashboard-grid,
  .filter-row,
  .report-export-form {
    grid-template-columns: 1fr !important;
  }

  .account-balance-card,
  .dashboard-total-balance-card {
    min-height: auto !important;
  }

  .calendar-day {
    padding: 5px;
  }

  .calendar-month-panel .calendar-event {
    padding: 3px 4px;
  }
}

@media (max-width: 340px) {
  :root {
    --mobile-pad: 9px;
    --mobile-gap: 7px;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    font-size: 10px !important;
  }

  .mobile-nav-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .calendar-weekdays,
  .calendar-month {
    gap: 3px;
  }
}

/* Fix79: contrast and readability guardrail.
   Dark cards/surfaces get light text; light surfaces keep navy text. */
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card),
.notice,
.empty-state,
.table-wrap,
.calendar-day,
.calendar-agenda-day,
.modal-card,
.mobile-drawer-group,
.mobile-drawer-footer,
.mobile-settings-body {
  color: #0b1f33;
}

.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) h1,
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) h2,
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) h3,
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) strong,
.notice h2,
.notice strong,
.empty-state h2,
.empty-state h3,
.modal-card h2,
.modal-card h3,
.calendar-day-number,
.calendar-agenda-date strong,
.table-wrap td {
  color: #0b1f33;
}

.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) small,
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) p,
.calendar-event small,
.calendar-event em,
.calendar-agenda-date span,
.table-wrap td::before {
  color: #41566b;
}

.package-workspace,
.package-workspace .card,
.package-workspace .metric-card,
.sidebar,
.sidebar-drawer,
.mobile-menu-panel,
.card.metric.dashboard-total-balance-card,
.card.metric.account-balance-card,
.card.metric.dashboard-account-card {
  color: #f8fcff;
}

.package-workspace h1,
.package-workspace h2,
.package-workspace h3,
.package-workspace strong,
.package-workspace .metric-card strong,
.sidebar strong,
.sidebar-drawer strong,
.mobile-menu-panel .brand strong,
.card.metric.dashboard-total-balance-card strong,
.card.metric.account-balance-card strong,
.card.metric.dashboard-account-card strong {
  color: #ffffff !important;
}

.package-workspace p,
.package-workspace small,
.package-workspace span,
.package-workspace .eyebrow,
.package-workspace .metric-card span,
.sidebar span,
.sidebar small,
.sidebar-drawer span,
.sidebar-drawer small,
.card.metric.dashboard-total-balance-card span,
.card.metric.dashboard-total-balance-card small,
.card.metric.account-balance-card span,
.card.metric.account-balance-card small,
.card.metric.dashboard-account-card span,
.card.metric.dashboard-account-card small {
  color: rgba(248, 252, 255, 0.82) !important;
}

.mobile-drawer-summary,
.mobile-drawer-submenu a,
.mobile-settings summary {
  color: #0b1f33;
}

.mobile-menu-panel .card-header,
.mobile-menu-panel .card-header h2,
.mobile-menu-panel .card-header h3,
.mobile-menu-panel .card-header span {
  color: #ffffff !important;
}

.button:not(.secondary):not(.danger):not(.muted),
a.button:not(.secondary):not(.danger):not(.muted) {
  color: #ffffff;
}

.button.secondary,
a.button.secondary,
.calendar-view-toggle > label {
  color: #0b1f33;
}

.button.danger,
a.button.danger {
  color: #8a2424;
}

.status,
.status-pill {
  color: #0b1f33;
}

.status.pending {
  color: #7a4700;
}

.status.rejected,
.status.danger,
.status.cancelled,
.status.unpaid {
  color: #8a2424;
}

.status.approved,
.status.completed,
.status.paid,
.status.confirmed {
  color: #145c39;
}

.status.refunded,
.status.info,
.status-blue {
  color: #0b4f83;
}

.calendar-view-radio:checked + label,
.rail-button:hover,
.rail-button.active {
  color: #ffffff !important;
}

.calendar-event {
  color: #0b1f33;
}

.calendar-event strong {
  color: #0b1f33;
}

.table-wrap th {
  color: #16324f;
}

tbody tr,
.table-wrap tr {
  color: #0b1f33;
}

@media (max-width: 768px) {
  .mobile-bottom-nav,
  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    color: #0b1f33 !important;
  }

  .mobile-bottom-nav > a:hover,
  .mobile-bottom-nav summary:hover,
  .mobile-bottom-nav details[open] summary {
    color: #0b1f33 !important;
  }

  .table-wrap tr,
  .table-wrap td {
    color: #0b1f33;
  }

  .modal-card .card-header,
  .modal-card .form-actions {
    color: #0b1f33;
  }
}

/* Fix82: sidebar/menu readability. Keep dark navigation premium but readable. */
.sidebar-rail,
.sidebar-drawer,
.mobile-menu-panel {
  color: #f8fcff !important;
}

.sidebar-toggle-button,
.rail-button,
.mobile-menu-button {
  color: #ffffff !important;
  border-color: rgba(207, 232, 255, 0.34);
  background: rgba(207, 232, 255, 0.12);
}

.rail-button {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
}

.sidebar-drawer .brand strong,
.sidebar-drawer .brand span,
.sidebar-drawer .nav-root,
.sidebar-drawer .submenu-toggle,
.mobile-menu-panel .brand strong,
.mobile-menu-panel .brand span,
.mobile-drawer-summary,
.mobile-drawer-summary span,
.mobile-drawer-summary small,
.mobile-drawer-submenu a {
  color: #f8fcff !important;
}

.sidebar-drawer .nav-group.controlled,
.mobile-drawer-group {
  border-color: rgba(207, 232, 255, 0.22);
  background: rgba(207, 232, 255, 0.08);
}

.sidebar-drawer .nav-root,
.sidebar-drawer .submenu-toggle,
.mobile-drawer-summary {
  background: rgba(207, 232, 255, 0.08) !important;
}

.sidebar-drawer .submenu-link,
.mobile-drawer-submenu a {
  background: rgba(207, 232, 255, 0.12) !important;
  border-color: rgba(207, 232, 255, 0.18);
}

.sidebar-drawer .nav-group.controlled.open,
.mobile-drawer-group.open {
  background:
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.32), transparent 40%),
    rgba(43, 93, 135, 0.42);
  border-color: rgba(207, 232, 255, 0.46);
  box-shadow: 0 18px 40px rgba(3, 12, 24, 0.26);
}

.sidebar-drawer .nav-group.controlled.open .nav-root,
.mobile-drawer-group.open .mobile-drawer-summary {
  background: rgba(108, 182, 255, 0.24) !important;
  color: #ffffff !important;
}

.sidebar-drawer .submenu-toggle,
.mobile-drawer-summary::after {
  color: #0b1f33 !important;
  background: #cfe8ff !important;
  border-color: rgba(207, 232, 255, 0.76);
}

.sidebar-drawer .submenu-link:hover,
.mobile-drawer-submenu a:hover,
.rail-button.active,
.rail-button:hover,
.sidebar-toggle-button:hover,
.mobile-menu-button:hover {
  color: #ffffff !important;
  background:
    radial-gradient(circle at 76% 0%, rgba(207, 232, 255, 0.3), transparent 44%),
    rgba(108, 182, 255, 0.34) !important;
  border-color: rgba(207, 232, 255, 0.58);
}

.sidebar-footer,
.mobile-drawer-footer,
.mobile-settings,
.mobile-settings summary {
  color: #f8fcff !important;
}

.sidebar-footer .button.secondary,
.mobile-drawer-footer .button.secondary {
  background: rgba(207, 232, 255, 0.16);
  border-color: rgba(207, 232, 255, 0.26);
  color: #ffffff !important;
}

/* Fix89: topbar readability guardrail.
   Dark page hero headers must keep light text even when generic h1/card
   contrast rules appear later in the cascade. */
.topbar {
  color: #f8fcff !important;
}

.topbar h1,
.topbar .eyebrow,
.topbar p,
.topbar span,
.page-header-on-dark h1,
.page-header-on-dark .eyebrow {
  color: #f8fcff !important;
}

.topbar .eyebrow {
  color: #cfe8ff !important;
}

.topbar .button,
.topbar a.button {
  color: #ffffff !important;
  border-color: rgba(207, 232, 255, 0.38) !important;
}

/* Fix90: final contrast safety net.
   Light cards, tables, modals, drawers, and empty states must never inherit
   light text from dark parent sections. Explicit dark surfaces are handled
   again below this block. */
.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card),
.notice,
.empty-state,
.table-wrap,
.modal-card,
.calendar-day,
.calendar-agenda-day,
.mobile-drawer-footer,
.mobile-settings-body,
.mobile-drawer-group,
.mobile-drawer-submenu a {
  color: #0b1f33 !important;
}

.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) :where(h1, h2, h3, h4, strong, label, td, th, input, select, textarea),
.notice :where(h1, h2, h3, h4, strong),
.empty-state :where(h1, h2, h3, h4, strong),
.table-wrap :where(th, td, strong),
.modal-card :where(h1, h2, h3, h4, strong, label, span),
.calendar-day :where(strong, span),
.calendar-agenda-day :where(strong, span),
.mobile-drawer-footer :where(strong, span, small),
.mobile-settings-body :where(strong, span, small) {
  color: #0b1f33 !important;
}

.card:not(.account-balance-card):not(.dashboard-total-balance-card):not(.dashboard-account-card) :where(p, small),
.notice :where(p, small),
.empty-state :where(p, small),
.table-wrap td::before,
.modal-card :where(p, small),
.calendar-event :where(small, em),
.calendar-agenda-date span {
  color: #41566b !important;
}

.topbar,
.package-workspace,
.package-workspace .card,
.package-workspace .metric-card,
.sidebar-rail,
.sidebar-drawer,
.mobile-menu-panel,
.card.metric.dashboard-total-balance-card,
.card.metric.account-balance-card,
.card.metric.dashboard-account-card {
  color: #f8fcff !important;
}

.topbar :where(h1, h2, h3, p, span, strong, .eyebrow),
.package-workspace :where(h1, h2, h3, h4, p, span, small, strong, .eyebrow, td, th, label),
.package-workspace .card :where(h1, h2, h3, h4, p, span, small, strong, .eyebrow, td, th, label),
.package-workspace .metric-card :where(h1, h2, h3, h4, p, span, small, strong, .eyebrow),
.sidebar-rail :where(span, small, strong, a, button),
.sidebar-drawer :where(span, small, strong, a, button),
.mobile-menu-panel :where(span, small, strong, a, button, h2, h3),
.card.metric.dashboard-total-balance-card :where(span, small, strong, a),
.card.metric.account-balance-card :where(span, small, strong, a),
.card.metric.dashboard-account-card :where(span, small, strong, a) {
  color: #f8fcff !important;
}

.topbar .eyebrow,
.package-workspace :where(.eyebrow, p, small, span),
.card.metric.dashboard-total-balance-card :where(span, small),
.card.metric.account-balance-card :where(span, small),
.card.metric.dashboard-account-card :where(span, small) {
  color: #cfe8ff !important;
}

/* Fix101: mobile drawer light-surface contrast.
   The app drawer is dark, but the settings/utility tray is intentionally
   light. Keep all text and controls inside that tray dark/readable. */
.mobile-menu-panel .mobile-drawer-footer,
.mobile-menu-panel .mobile-settings,
.mobile-menu-panel .mobile-settings summary,
.mobile-menu-panel .mobile-settings-body {
  color: #0b1f33 !important;
}

.mobile-menu-panel .mobile-drawer-footer :where(h1, h2, h3, h4, p, span, small, strong, label, a, button),
.mobile-menu-panel .mobile-settings :where(h1, h2, h3, h4, p, span, small, strong, label, a, button),
.mobile-menu-panel .mobile-settings-body :where(h1, h2, h3, h4, p, span, small, strong, label, a, button) {
  color: #0b1f33 !important;
}

.mobile-menu-panel .mobile-settings-body .button.secondary,
.mobile-menu-panel .mobile-settings-body a.button.secondary,
.mobile-menu-panel .mobile-settings-body button.button.secondary {
  background: rgba(207, 232, 255, 0.72) !important;
  border-color: rgba(108, 182, 255, 0.42) !important;
  color: #0b1f33 !important;
  box-shadow: 0 10px 22px rgba(11, 31, 51, 0.08) !important;
}

.mobile-menu-panel .mobile-settings-body .button.secondary:hover,
.mobile-menu-panel .mobile-settings-body a.button.secondary:hover,
.mobile-menu-panel .mobile-settings-body button.button.secondary:hover {
  background: #cfe8ff !important;
  color: #0b1f33 !important;
}

.mobile-menu-panel .mobile-settings-body .logout-button {
  background: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

.mobile-menu-panel .mobile-language-form select,
.mobile-menu-panel .mobile-language-form option {
  background: #f8fcff !important;
  color: #0b1f33 !important;
  border-color: rgba(108, 182, 255, 0.45) !important;
}

.package-workspace .button.secondary,
.package-workspace a.button.secondary {
  color: #ffffff !important;
  border-color: rgba(207, 232, 255, 0.3) !important;
  background: rgba(207, 232, 255, 0.14) !important;
}

.button:not(.secondary):not(.danger):not(.muted),
a.button:not(.secondary):not(.danger):not(.muted) {
  color: #ffffff !important;
}

.button.secondary,
a.button.secondary {
  color: #0b1f33 !important;
}

.product-edit-modal,
.product-form-modal {
  display: flex !important;
  flex-direction: column !important;
  max-height: min(92dvh, 900px) !important;
  overflow: hidden !important;
}

.product-edit-modal .card-header,
.product-form-modal .card-header {
  flex-shrink: 0 !important;
}

.product-edit-form,
.product-form-scroll {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

.product-edit-modal .sticky-modal-actions,
.product-form-modal .sticky-modal-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 8 !important;
}

.user-access-modal {
  width: min(920px, calc(100vw - 32px)) !important;
  max-height: min(92dvh, 900px) !important;
  overflow: hidden !important;
}

.user-access-form {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.user-access-modal .card-header {
  flex-shrink: 0;
}

.user-access-modal .sticky-modal-actions {
  background: rgba(238, 247, 255, 0.98);
  border-top: 1px solid rgba(108, 182, 255, 0.28);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.partner-logo-preview,
.partner-logo-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(108, 182, 255, 0.28);
  border-radius: 18px;
  background: rgba(207, 232, 255, 0.42);
}

.partner-logo-preview img,
.partner-logo-profile img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(11, 31, 51, 0.08);
}

.partner-logo-profile {
  margin-bottom: 12px;
}

.staff-avatar-image,
.staff-avatar-fallback {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  background: linear-gradient(135deg, #0B1F33, #2B5D87);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 800;
  border: 2px solid rgba(108, 182, 255, 0.45);
}

.legal-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.legal-summary span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.legal-summary strong {
  color: var(--text);
}

.legal-field-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.calendar-dashboard-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

.mobile-loading-shell {
  display: grid;
  gap: 14px;
}

.mobile-loading-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 118px;
  background: linear-gradient(135deg, #0B1F33, #16324F);
}

.loading-avatar,
.loading-line,
.loading-card,
.loading-list {
  position: relative;
  overflow: hidden;
}

.loading-avatar {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: rgba(207, 232, 255, 0.32);
}

.loading-line {
  display: block;
  height: 12px;
  margin: 8px 0;
  border-radius: 999px;
  background: rgba(207, 232, 255, 0.36);
}

.loading-line.short {
  width: 36%;
}

.loading-line.medium {
  width: 64%;
}

.loading-card {
  min-height: 98px;
  background: rgba(207, 232, 255, 0.62);
}

.loading-list {
  min-height: 220px;
  background: rgba(246, 251, 255, 0.74);
}

.loading-avatar::after,
.loading-line::after,
.loading-card::after,
.loading-list::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: loading-shimmer 1.25s infinite;
}

@keyframes loading-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 768px) {
  .user-access-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    border-radius: 24px !important;
  }

  .user-access-modal .card-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 12 !important;
  }

  .user-access-form {
    grid-template-columns: 1fr !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding-bottom: 96px;
  }

  .user-access-modal .sticky-modal-actions {
    bottom: 0 !important;
    grid-template-columns: 1fr !important;
    margin-inline: -14px;
  }
}

/* Fix157: final UI color and visual consistency audit.
   Keep the approved YosuBooks palette, but make contrast, cards, buttons,
   statuses, and empty states consistent across recently refined pages. */
:root {
  --visual-ink: #0b1f33;
  --visual-navy: #16324f;
  --visual-blue: #2b5d87;
  --visual-sky: #6cb6ff;
  --visual-mist: #cfe8ff;
  --visual-page: #eef7ff;
  --visual-surface: rgba(255, 255, 255, 0.94);
  --visual-surface-strong: #ffffff;
  --visual-surface-soft: #f6fbff;
  --visual-muted: #41566b;
  --visual-border: rgba(43, 93, 135, 0.18);
  --visual-border-strong: rgba(43, 93, 135, 0.3);
  --visual-shadow: 0 18px 44px rgba(11, 31, 51, 0.11);
  --visual-shadow-soft: 0 10px 28px rgba(11, 31, 51, 0.08);
  --visual-radius: 18px;
}

.content {
  color: var(--visual-ink);
}

.card,
.metric-card,
.notice,
.empty-state,
.table-wrap,
.modal-card,
.calendar-grid-card,
.account-filter-card,
.report-export-card,
.exchange-rate-panel,
.compact-card,
.document-success-panel,
.partner-profile-modal {
  border: 1px solid var(--visual-border-strong) !important;
  border-radius: var(--visual-radius) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 255, 0.94)) !important;
  color: var(--visual-ink) !important;
  box-shadow: var(--visual-shadow-soft) !important;
}

.card:hover,
.metric-card:hover,
.calendar-grid-card:hover {
  border-color: rgba(43, 93, 135, 0.42) !important;
  box-shadow: var(--visual-shadow) !important;
}

.card-header {
  border-bottom: 1px solid rgba(43, 93, 135, 0.1);
  padding-bottom: 10px;
}

.card-header:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.card :where(h1, h2, h3, h4, strong, label),
.metric-card :where(h1, h2, h3, h4, strong),
.notice :where(h1, h2, h3, h4, strong),
.empty-state :where(h1, h2, h3, h4, strong),
.table-wrap :where(th, td, strong),
.modal-card :where(h1, h2, h3, h4, strong, label),
.document-success-panel :where(h1, h2, h3, h4, strong),
.legal-summary strong {
  color: var(--visual-ink) !important;
}

.card :where(p, small),
.metric-card :where(span, small, p),
.notice :where(p, small),
.empty-state :where(p, small),
.modal-card :where(p, small),
.legal-summary span,
.muted,
.line-meta {
  color: var(--visual-muted) !important;
}

.grid.metrics {
  align-items: stretch;
}

.grid.metrics > .card.metric,
.metric-card {
  display: grid;
  align-content: flex-start;
  gap: 8px;
  min-height: 118px;
  padding: clamp(16px, 2vw, 22px) !important;
  background:
    radial-gradient(circle at 94% 0%, rgba(108, 182, 255, 0.18), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f6fbff 100%) !important;
}

.grid.metrics > .card.metric span,
.metric-card span {
  color: var(--visual-blue) !important;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grid.metrics > .card.metric strong,
.metric-card strong {
  color: var(--visual-ink) !important;
  font-weight: 840;
}

.grid.metrics > .card.metric small,
.metric-card small {
  color: var(--visual-muted) !important;
}

.topbar,
.page-header-on-dark,
.mobile-loading-hero {
  border: 1px solid rgba(207, 232, 255, 0.22);
  border-radius: 22px;
  padding: clamp(16px, 2.2vw, 24px);
  background:
    radial-gradient(circle at 94% 0%, rgba(108, 182, 255, 0.28), transparent 42%),
    linear-gradient(135deg, #0b1f33 0%, #16324f 56%, #2b5d87 100%) !important;
  color: #f8fcff !important;
  box-shadow: 0 20px 46px rgba(11, 31, 51, 0.18);
}

.topbar :where(h1, h2, h3, p, span, strong),
.page-header-on-dark :where(h1, h2, h3, p, span, strong),
.mobile-loading-hero :where(h1, h2, h3, p, span, strong) {
  color: #f8fcff !important;
}

.topbar :where(.eyebrow, small),
.page-header-on-dark :where(.eyebrow, small),
.mobile-loading-hero :where(.eyebrow, small) {
  color: var(--visual-mist) !important;
}

.topbar .button.secondary,
.page-header-on-dark .button.secondary {
  background: rgba(207, 232, 255, 0.14) !important;
  border-color: rgba(207, 232, 255, 0.34) !important;
  color: #ffffff !important;
}

.button,
a.button,
button.button {
  border-radius: 12px !important;
  border: 1px solid transparent;
  font-weight: 800;
  letter-spacing: 0;
}

.button:not(.secondary):not(.danger):not(.muted),
a.button:not(.secondary):not(.danger):not(.muted),
button.button:not(.secondary):not(.danger):not(.muted) {
  background: linear-gradient(135deg, #16324f, #2b5d87 52%, #3f9ad9) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(43, 93, 135, 0.22) !important;
}

.button.secondary,
a.button.secondary,
button.button.secondary {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: var(--visual-border-strong) !important;
  color: var(--visual-ink) !important;
  box-shadow: var(--visual-shadow-soft) !important;
}

.button.danger,
a.button.danger,
button.button.danger {
  background: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

.button:hover:not(:disabled):not(.disabled),
a.button:hover:not(.disabled),
button.button:hover:not(:disabled) {
  filter: saturate(1.05);
}

.status,
.status-pill {
  border: 1px solid rgba(43, 93, 135, 0.16);
  background: #e7f5ff !important;
  color: #0b4f83 !important;
  font-weight: 860 !important;
}

.status.pending,
.status-pill.status-orange,
.status.warning,
.status.awaiting {
  border-color: #fed7aa !important;
  background: #fff7ed !important;
  color: #8a5200 !important;
}

.status.approved,
.status.completed,
.status.paid,
.status.confirmed,
.status.active,
.status-pill.status-green {
  border-color: #bbf7d0 !important;
  background: #ecfdf5 !important;
  color: #145c39 !important;
}

.status.rejected,
.status.danger,
.status.cancelled,
.status.unpaid,
.status.error,
.status-pill.status-red {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}

.status-pill.status-grey,
.status.muted,
.status.archived {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  color: #334155 !important;
}

.status.refunded,
.status.info,
.status-blue,
.status-pill.status-blue {
  border-color: #bfdbfe !important;
  background: #eff6ff !important;
  color: #0b4f83 !important;
}

.table-wrap {
  overflow: auto;
}

th {
  background: #eaf7ff !important;
  color: var(--visual-navy) !important;
  border-bottom-color: rgba(43, 93, 135, 0.22) !important;
}

td {
  color: var(--visual-ink) !important;
}

tbody tr:hover {
  background: rgba(207, 232, 255, 0.24) !important;
}

.empty-state,
.notice {
  display: grid;
  gap: 10px;
  border-style: solid !important;
}

.notice.success,
.document-success-panel {
  border-color: rgba(20, 92, 57, 0.22) !important;
  background:
    radial-gradient(circle at 94% 0%, rgba(34, 197, 94, 0.12), transparent 42%),
    linear-gradient(180deg, #ffffff, #f0fdf4) !important;
}

.form-error {
  border: 1px solid #fecaca;
  background: #fef2f2 !important;
  color: #991b1b !important;
}

.calendar-event,
.calendar-day,
.calendar-agenda-day {
  border-color: var(--visual-border) !important;
  background-color: rgba(255, 255, 255, 0.86) !important;
  color: var(--visual-ink) !important;
}

.calendar-event :where(strong, span),
.calendar-day :where(strong, span),
.calendar-agenda-day :where(strong, span) {
  color: var(--visual-ink) !important;
}

.calendar-event :where(small, em),
.calendar-agenda-date span {
  color: var(--visual-muted) !important;
}

.package-workspace,
.package-workspace .card,
.package-workspace .metric-card,
.card.metric.dashboard-total-balance-card,
.card.metric.account-balance-card,
.card.metric.dashboard-account-card {
  background:
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.28), transparent 42%),
    linear-gradient(145deg, #0b1f33 0%, #16324f 56%, #2b5d87 100%) !important;
  border-color: rgba(207, 232, 255, 0.26) !important;
  color: #f8fcff !important;
}

.package-workspace :where(h1, h2, h3, h4, strong, label),
.package-workspace .card :where(h1, h2, h3, h4, strong, label),
.package-workspace .metric-card :where(h1, h2, h3, h4, strong),
.card.metric.dashboard-total-balance-card :where(strong, h1, h2, h3),
.card.metric.account-balance-card :where(strong, h1, h2, h3),
.card.metric.dashboard-account-card :where(strong, h1, h2, h3) {
  color: #ffffff !important;
}

.package-workspace :where(p, small, span, .eyebrow),
.package-workspace .card :where(p, small, span, .eyebrow),
.package-workspace .metric-card :where(p, small, span, .eyebrow),
.card.metric.dashboard-total-balance-card :where(span, small, p),
.card.metric.account-balance-card :where(span, small, p),
.card.metric.dashboard-account-card :where(span, small, p) {
  color: var(--visual-mist) !important;
}

.package-workspace .table-wrap,
.package-workspace .modal-card,
.package-workspace .notice,
.package-workspace .empty-state {
  background: var(--visual-surface-strong) !important;
  color: var(--visual-ink) !important;
}

.package-workspace .table-wrap :where(th, td, strong),
.package-workspace .modal-card :where(h1, h2, h3, h4, p, span, small, strong, label),
.package-workspace .notice :where(h1, h2, h3, h4, p, span, small, strong),
.package-workspace .empty-state :where(h1, h2, h3, h4, p, span, small, strong) {
  color: var(--visual-ink) !important;
}

.mobile-menu-panel,
.sidebar-drawer,
.sidebar-rail {
  background:
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.24), transparent 42%),
    linear-gradient(180deg, #0b1f33, #16324f 58%, #102a44) !important;
  color: #f8fcff !important;
}

.mobile-menu-panel :where(.brand strong, .brand span, .mobile-drawer-summary, .mobile-drawer-summary span, .mobile-drawer-summary small, .mobile-drawer-submenu a),
.sidebar-drawer :where(.brand strong, .brand span, .nav-root, .submenu-link, .submenu-toggle, .sidebar-footer),
.sidebar-rail :where(button, span) {
  color: #f8fcff !important;
}

.mobile-menu-panel .mobile-account-card,
.mobile-drawer-group,
.sidebar-drawer .nav-group.controlled,
.sidebar-drawer .submenu-link,
.mobile-drawer-submenu a {
  border-color: rgba(207, 232, 255, 0.22) !important;
  background: rgba(207, 232, 255, 0.1) !important;
}

.mobile-menu-panel .mobile-settings,
.mobile-menu-panel .mobile-settings-body,
.mobile-menu-panel .mobile-drawer-footer {
  background: rgba(248, 252, 255, 0.96) !important;
  border-color: rgba(43, 93, 135, 0.18) !important;
  color: var(--visual-ink) !important;
}

.mobile-menu-panel .mobile-settings :where(summary, label, span, small, strong, a, button),
.mobile-menu-panel .mobile-settings-body :where(label, span, small, strong, a, button) {
  color: var(--visual-ink) !important;
}

@media (max-width: 768px) {
  .card,
  .metric-card,
  .notice,
  .empty-state,
  .table-wrap,
  .calendar-grid-card,
  .modal-card {
    border-radius: clamp(14px, 4vw, 20px) !important;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .grid.metrics > .card.metric,
  .metric-card {
    min-height: auto;
  }

  .card-header {
    padding-bottom: 8px;
  }
}

/* Fix158: top mobile drawer navigation only.
   Main mobile navigation must stay separate from the page-specific bottom
   quick actions. Main rows expand; submenu links navigate. */
.mobile-menu-overlay {
  display: grid;
  align-items: stretch;
}

.mobile-menu-panel {
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
  min-height: 0;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
}

.mobile-menu-panel > .card-header {
  flex: 0 0 auto;
}

.mobile-account-card {
  flex: 0 0 auto;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px !important;
}

.mobile-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 70% 0%, rgba(207, 232, 255, 0.34), transparent 40%),
    linear-gradient(135deg, #0b1f33, #2b5d87);
  border: 2px solid rgba(207, 232, 255, 0.46);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.mobile-account-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.mobile-account-details {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mobile-account-details :where(span, strong, small) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mobile-drawer-nav {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 2px 2px max(18px, env(safe-area-inset-bottom)) !important;
}

.mobile-drawer-group {
  padding: 0 !important;
  overflow: hidden !important;
}

.mobile-drawer-summary-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.mobile-drawer-main-link {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 3px;
  margin: 0 !important;
  padding: 11px 13px !important;
  border-radius: 18px !important;
  background: transparent !important;
  color: #f8fcff !important;
  text-decoration: none;
  border: 0 !important;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.mobile-drawer-main-link span {
  display: block;
  min-width: 0;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.mobile-drawer-main-link small {
  display: block;
  min-width: 0;
  color: #cfe8ff !important;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
}

.mobile-drawer-toggle {
  width: 44px;
  min-height: 44px;
  align-self: center;
  display: grid;
  place-items: center;
  margin-right: 8px;
  border: 1px solid rgba(207, 232, 255, 0.32);
  border-radius: 999px;
  background: rgba(207, 232, 255, 0.16);
  color: #ffffff !important;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.mobile-drawer-group.active {
  border-color: rgba(207, 232, 255, 0.54) !important;
  background:
    radial-gradient(circle at 92% 0%, rgba(108, 182, 255, 0.34), transparent 42%),
    rgba(108, 182, 255, 0.18) !important;
}

.mobile-drawer-group.open .mobile-drawer-main-link {
  background: rgba(207, 232, 255, 0.1) !important;
}

.mobile-drawer-submenu {
  max-height: min(42dvh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 12px !important;
}

.mobile-drawer-submenu a {
  min-height: 42px;
  display: flex !important;
  align-items: center;
  margin: 0 !important;
  color: #f8fcff !important;
  overflow-wrap: anywhere;
}

.mobile-drawer-footer {
  position: static !important;
  flex: 0 0 auto;
  margin: 10px 0 0 !important;
  padding: 0 !important;
  border-top: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.mobile-settings {
  max-height: 36dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 430px) {
  .mobile-menu-overlay {
    padding: 8px !important;
  }

  .mobile-menu-panel {
    max-height: calc(100dvh - 16px) !important;
    border-radius: 24px !important;
  }

  .mobile-account-avatar {
    width: 42px;
    height: 42px;
  }

  .mobile-drawer-main-link {
    min-height: 52px;
    padding: 10px 11px !important;
  }

  .mobile-drawer-toggle {
    width: 40px;
    min-height: 40px;
  }
}

/* Fix162: modal/drawer close safety.
   Keep existing forms intact while making close and cancel controls visible. */
.modal-card > .card-header {
  position: sticky;
  top: 0;
  z-index: 24;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.99), rgba(238, 247, 255, 0.96));
  border-bottom: 1px solid rgba(43, 93, 135, 0.18);
  padding-bottom: 12px;
}

.modal-card .modal-close-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0 !important;
  border: 1px solid rgba(43, 93, 135, 0.24) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #0b1f33 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 24px rgba(11, 31, 51, 0.1);
}

.modal-card .sticky-modal-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 22 !important;
  margin-top: 12px;
  padding-top: 12px;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.84), rgba(248, 252, 255, 0.99) 34%);
  border-top: 1px solid rgba(43, 93, 135, 0.18);
  backdrop-filter: blur(12px);
}

@media (max-width: 768px) {
  .modal-card .card-header .modal-close-button {
    font-size: 0 !important;
  }

  .modal-card .card-header .modal-close-button::after {
    content: "x";
    font-size: 16px;
    line-height: 1;
  }
}

/* Fix163: mobile landing dashboard correction.
   Mobile login lands on the Calendar workspace, styled as the personal
   Operations check-in dashboard while keeping the top drawer as main nav. */
.calendar-dashboard-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-notification-button {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(43, 93, 135, 0.22);
  border-radius: 14px;
  background: #ffffff;
  color: #0b1f33;
  box-shadow: 0 12px 26px rgba(11, 31, 51, 0.1);
}

.calendar-notification-button span {
  font-weight: 900;
}

.calendar-notification-button strong {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #a53f3f;
  color: #ffffff;
  font-size: 11px;
}

.calendar-progress-card {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(207, 232, 255, 0.5);
  color: #0b1f33;
}

.calendar-progress-card span,
.calendar-progress-card small {
  color: #16324f;
  font-weight: 800;
}

.calendar-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 50, 79, 0.14);
}

.calendar-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2b5d87, #6cb6ff);
}

.mobile-schedule-list {
  display: none;
}

@media (max-width: 768px) {
  .calendar-personal-dashboard {
    gap: 12px;
    padding-bottom: 8px;
  }

  .calendar-personal-dashboard > .grid.two-column {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .calendar-dashboard-greeting {
    min-height: 86px;
    padding: 14px !important;
    border-radius: 24px !important;
  }

  .calendar-dashboard-greeting-user {
    min-width: 0;
  }

  .calendar-dashboard-greeting-user > div:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .calendar-dashboard-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    color: #ffffff;
  }

  .calendar-dashboard-greeting-user p,
  .calendar-dashboard-greeting-user strong,
  .calendar-dashboard-greeting-user small {
    overflow-wrap: anywhere;
  }

  .calendar-dashboard-greeting-user strong {
    font-size: 17px;
  }

  .calendar-dashboard-top-actions {
    flex: 0 0 auto;
    align-items: end;
    flex-direction: column;
    gap: 6px;
  }

  .calendar-time {
    font-size: 15px !important;
    color: #16324f !important;
    white-space: nowrap;
  }

  .operations-presence-card:first-child {
    background: linear-gradient(135deg, #0b1f33, #2b5d87) !important;
    color: #ffffff !important;
    border-color: rgba(207, 232, 255, 0.36) !important;
  }

  .operations-presence-card:first-child :where(h2, p, strong, span) {
    color: #ffffff !important;
  }

  .operations-presence-card:first-child .status {
    background: rgba(207, 232, 255, 0.18) !important;
    border-color: rgba(207, 232, 255, 0.36) !important;
    color: #ffffff !important;
  }

  .calendar-personal-dashboard .card:has(.mobile-schedule-list) .table-wrap,
  .calendar-personal-dashboard .card:has(.mobile-schedule-list) table {
    display: none !important;
  }

  .mobile-schedule-list {
    display: grid;
    gap: 10px;
  }

  .mobile-schedule-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 2px 12px;
    align-items: center;
    min-height: 62px;
    padding: 10px 12px;
    border: 1px solid rgba(43, 93, 135, 0.16);
    border-radius: 16px;
    background: #ffffff;
    color: #0b1f33;
  }

  .mobile-schedule-item span {
    grid-row: span 2;
    color: #2b5d87;
    font-weight: 900;
  }

  .mobile-schedule-item strong,
  .mobile-schedule-item small {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .mobile-schedule-item small {
    color: #607489;
    font-weight: 700;
  }

  #team-check-in {
    scroll-margin-top: 74px;
  }
}

/* Fix165: package action and modal consistency polish.
   Keep package accounting untouched while making the package workspace
   readable and the package builder open as one full, scrollable form. */
.card.package-workspace {
  background:
    radial-gradient(circle at 88% 0%, rgba(108, 182, 255, 0.34), transparent 38%),
    linear-gradient(145deg, #0b1f33 0%, #16324f 58%, #24557e 100%) !important;
  border-color: rgba(207, 232, 255, 0.28) !important;
  color: #f8fcff !important;
}

.card.package-workspace :where(h1, h2, h3, h4, strong, label) {
  color: #ffffff !important;
}

.card.package-workspace :where(p, small, span, .eyebrow) {
  color: #cfe8ff !important;
}

.card.package-workspace .metric-grid {
  align-items: stretch;
}

.card.package-workspace .metric-card {
  min-height: 96px !important;
  border: 1px solid rgba(207, 232, 255, 0.32) !important;
  background: rgba(248, 252, 255, 0.13) !important;
  box-shadow: 0 18px 42px rgba(5, 17, 31, 0.2) !important;
  color: #f8fcff !important;
}

.card.package-workspace .metric-card span {
  color: #cfe8ff !important;
  opacity: 1 !important;
}

.card.package-workspace .metric-card strong {
  color: #ffffff !important;
}

.modal-card.package-builder-modal {
  width: min(1180px, calc(100vw - 28px)) !important;
  max-height: calc(100dvh - 28px) !important;
  overflow: hidden !important;
}

.modal-card.package-builder-modal .product-form-scroll,
.modal-card.package-builder-modal .package-builder-form {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .modal-card.package-builder-modal {
    width: min(100%, calc(100vw - 16px)) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .card.package-workspace .metric-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Fix166: Create Package modal readability and import/save workflow polish. */
.modal-card.package-builder-modal {
  background: linear-gradient(180deg, #f8fcff 0%, #eef7ff 100%) !important;
  border: 1px solid rgba(43, 93, 135, 0.28) !important;
  color: #0b1f33 !important;
  box-shadow: 0 28px 70px rgba(5, 17, 31, 0.28) !important;
}

.modal-card.package-builder-modal > .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #eef7ff 100%) !important;
  border-bottom: 1px solid rgba(43, 93, 135, 0.2) !important;
}

.modal-card.package-builder-modal > .card-header :where(h2, h3, strong),
.modal-card.package-builder-modal .package-builder-section :where(h3, strong),
.modal-card.package-builder-modal label {
  color: #0b1f33 !important;
}

.modal-card.package-builder-modal > .card-header :where(.eyebrow, p, span),
.modal-card.package-builder-modal .package-builder-section :where(p, small),
.modal-card.package-builder-modal label span,
.modal-card.package-builder-modal .line-meta {
  color: #41566b !important;
}

.modal-card.package-builder-modal .package-builder-section {
  background: #ffffff !important;
  border: 1px solid rgba(43, 93, 135, 0.18) !important;
  box-shadow: 0 14px 32px rgba(11, 31, 51, 0.08) !important;
}

.modal-card.package-builder-modal .package-builder-section .card-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(43, 93, 135, 0.1) !important;
}

.modal-card.package-builder-modal input,
.modal-card.package-builder-modal select,
.modal-card.package-builder-modal textarea {
  background: #ffffff !important;
  border: 1px solid rgba(43, 93, 135, 0.32) !important;
  color: #0b1f33 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

.modal-card.package-builder-modal input::placeholder,
.modal-card.package-builder-modal textarea::placeholder {
  color: #607489 !important;
  opacity: 1 !important;
}

.modal-card.package-builder-modal input[readonly],
.modal-card.package-builder-modal input[aria-readonly="true"] {
  background: #eef7ff !important;
  color: #16324f !important;
}

.modal-card.package-builder-modal .package-component-row,
.modal-card.package-builder-modal .package-reseller-row,
.modal-card.package-builder-modal .package-staff-row,
.modal-card.package-builder-modal .package-service-row {
  padding: 10px;
  border: 1px solid rgba(43, 93, 135, 0.12);
  border-radius: 12px;
  background: #f8fcff;
}

.modal-card.package-builder-modal .impact-row {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0b1f33, #16324f) !important;
  color: #f8fcff !important;
}

.modal-card.package-builder-modal .impact-row span,
.modal-card.package-builder-modal .impact-row strong {
  color: #ffffff !important;
}

.modal-card.package-builder-modal .sticky-modal-actions {
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.86), #ffffff 38%) !important;
}

/* Fix167: final finance, calendar, profile and contrast polish. */
.modal-card.finance-workflow-modal,
.modal-card.user-access-modal {
  width: min(980px, calc(100vw - 28px)) !important;
  max-height: calc(100dvh - 28px) !important;
  overflow: hidden !important;
  background: linear-gradient(180deg, #f8fcff 0%, #eef7ff 100%) !important;
  border: 1px solid rgba(43, 93, 135, 0.28) !important;
  color: #0b1f33 !important;
  box-shadow: 0 28px 70px rgba(5, 17, 31, 0.28) !important;
}

.modal-card.finance-workflow-modal.wide-modal {
  width: min(1180px, calc(100vw - 28px)) !important;
}

.modal-card.finance-workflow-modal > .card-header,
.modal-card.user-access-modal > .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #eef7ff 100%) !important;
  border-bottom: 1px solid rgba(43, 93, 135, 0.2) !important;
  color: #0b1f33 !important;
}

.modal-card.finance-workflow-modal :where(h2, h3, h4, strong, label, legend, th, td),
.modal-card.user-access-modal :where(h2, h3, h4, strong, label, legend, th, td) {
  color: #0b1f33 !important;
}

.modal-card.finance-workflow-modal :where(.eyebrow, p, small, span),
.modal-card.user-access-modal :where(.eyebrow, p, small, span) {
  color: #41566b !important;
}

.modal-card.finance-workflow-modal input,
.modal-card.finance-workflow-modal select,
.modal-card.finance-workflow-modal textarea,
.modal-card.user-access-modal input,
.modal-card.user-access-modal select,
.modal-card.user-access-modal textarea {
  background: #ffffff !important;
  border: 1px solid rgba(43, 93, 135, 0.32) !important;
  color: #0b1f33 !important;
}

.modal-card.finance-workflow-modal .product-form-scroll,
.modal-card.finance-workflow-modal .statement-preview-panel,
.modal-card.user-access-modal .product-form-scroll {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

.modal-card.finance-workflow-modal .statement-preview-panel {
  margin-top: 14px;
  background: #ffffff !important;
  border: 1px solid rgba(43, 93, 135, 0.18) !important;
  border-radius: 16px;
  padding: 14px;
}

.timezone-capture-status {
  margin: -4px 0 0;
  padding: 9px 12px;
  border: 1px solid rgba(43, 93, 135, 0.18);
  border-radius: 12px;
  background: #eef7ff;
  color: #16324f !important;
  font-weight: 800;
}

.user-edit-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-edit-avatar {
  width: 56px !important;
  height: 56px !important;
  flex: 0 0 auto;
  border: 2px solid rgba(43, 93, 135, 0.28);
  background: linear-gradient(135deg, #0b1f33, #2b5d87) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(11, 31, 51, 0.2);
}

.user-edit-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.calendar-view-toggle > label {
  background: #ffffff !important;
  border: 1px solid rgba(43, 93, 135, 0.24) !important;
  color: #0b1f33 !important;
  box-shadow: 0 8px 20px rgba(11, 31, 51, 0.08) !important;
}

.calendar-view-toggle > label:hover {
  border-color: rgba(43, 93, 135, 0.48) !important;
  color: #0b1f33 !important;
}

.calendar-view-radio:checked + label {
  background: linear-gradient(135deg, #0b1f33, #2b5d87) !important;
  border-color: rgba(207, 232, 255, 0.44) !important;
  color: #ffffff !important;
}

.calendar-grid-card .status,
.calendar-day-number small,
.calendar-more {
  background: #0b1f33 !important;
  border: 1px solid rgba(207, 232, 255, 0.28) !important;
  color: #ffffff !important;
}

.calendar-event {
  background: #ffffff !important;
  border-color: rgba(43, 93, 135, 0.2) !important;
  color: #0b1f33 !important;
}

.calendar-event :where(strong, span) {
  color: #0b1f33 !important;
}

.calendar-event :where(small, em) {
  color: #41566b !important;
}

.calendar-dashboard-greeting {
  background:
    radial-gradient(circle at 92% 12%, rgba(207, 232, 255, 0.2), transparent 32%),
    linear-gradient(135deg, #0b1f33 0%, #16324f 58%, #2b5d87 100%) !important;
  border-color: rgba(207, 232, 255, 0.3) !important;
  color: #ffffff !important;
}

.calendar-dashboard-greeting :where(p, strong, small, span) {
  color: #ffffff !important;
}

.calendar-dashboard-greeting-user strong {
  display: block;
  font-size: clamp(28px, 7vw, 46px) !important;
  line-height: 1.02;
  letter-spacing: 0;
}

.calendar-dashboard-greeting-user p {
  font-size: 15px !important;
  font-weight: 900;
  opacity: 0.92;
}

.calendar-dashboard-avatar {
  width: 72px !important;
  height: 72px !important;
  border: 3px solid rgba(207, 232, 255, 0.62) !important;
  background: linear-gradient(135deg, #f8fcff, #cfe8ff) !important;
  color: #0b1f33 !important;
  box-shadow: 0 18px 42px rgba(5, 17, 31, 0.28) !important;
}

.calendar-dashboard-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.calendar-notification-button {
  background: #ffffff !important;
  color: #0b1f33 !important;
  border-color: rgba(207, 232, 255, 0.58) !important;
}

.calendar-notification-button :where(span, strong) {
  color: #0b1f33 !important;
}

.card :where(.status.pending, .status.warning) {
  background: #fff2cc !important;
  color: #5b3b00 !important;
  border-color: rgba(146, 96, 0, 0.28) !important;
}

.card :where(.status.success, .notice.success) {
  background: #dcfce7 !important;
  color: #064e3b !important;
  border-color: rgba(6, 78, 59, 0.24) !important;
}

.mobile-menu-panel,
.mobile-drawer-group,
.mobile-account-card,
.mobile-settings {
  color: #0b1f33 !important;
}

.mobile-menu-panel :where(strong, span, small, summary),
.mobile-drawer-main-link :where(span, small),
.mobile-drawer-submenu a,
.mobile-account-details :where(span, strong, small) {
  color: #0b1f33 !important;
}

.mobile-drawer-group.active,
.mobile-drawer-group.open {
  background: linear-gradient(135deg, #0b1f33, #16324f) !important;
  border-color: rgba(207, 232, 255, 0.36) !important;
}

.mobile-drawer-group.active :where(span, small),
.mobile-drawer-group.open > .mobile-drawer-summary-row :where(span, small),
.mobile-drawer-group.open > .mobile-drawer-summary-row .mobile-drawer-main-link :where(span, small) {
  color: #ffffff !important;
}

.mobile-drawer-group.open .mobile-drawer-submenu a {
  background: #ffffff !important;
  color: #0b1f33 !important;
  border-color: rgba(207, 232, 255, 0.34) !important;
}

.mobile-drawer-toggle {
  background: #ffffff !important;
  color: #0b1f33 !important;
  border-color: rgba(43, 93, 135, 0.28) !important;
}

@media (max-width: 768px) {
  .modal-card.finance-workflow-modal,
  .modal-card.user-access-modal {
    width: min(100%, calc(100vw - 16px)) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .calendar-dashboard-greeting {
    border-radius: 24px !important;
    padding: 18px !important;
  }

  .calendar-dashboard-greeting-user {
    align-items: center !important;
  }

  .calendar-dashboard-avatar {
    width: 66px !important;
    height: 66px !important;
  }

  .calendar-dashboard-greeting-user strong {
    font-size: 34px !important;
  }
}

/* Fix168: contrast pass for dashboard/mobile drawer readability.
   Keep all behavior unchanged; only restore accessible text contrast. */
.calendar-dashboard-avatar {
  color: #f8fcff !important;
}

.calendar-dashboard-greeting :where(p, strong, small, span) {
  color: #f8fcff !important;
}

.calendar-dashboard-greeting .calendar-time,
.calendar-dashboard-greeting .calendar-time,
.calendar-time {
  color: #eaf7ff !important;
}

.calendar-dashboard-greeting-user strong {
  text-shadow: 0 1px 6px rgba(11, 31, 51, 0.36) !important;
}

.calendar-personal-dashboard .calendar-notification-button,
.calendar-notification-button {
  color: #16324f !important;
}

.calendar-notification-button :where(span, strong) {
  color: #16324f !important;
}

.mobile-menu-panel,
.mobile-drawer-group,
.mobile-account-card,
.mobile-settings {
  color: #f8fcff !important;
}

.mobile-menu-panel .mobile-settings,
.mobile-menu-panel .mobile-drawer-group {
  border-color: rgba(207, 232, 255, 0.32) !important;
}

.mobile-menu-panel :where(.brand strong, .brand span),
.mobile-menu-panel :where(.mobile-drawer-main-link, .mobile-drawer-main-link span, .mobile-drawer-main-link small),
.mobile-menu-panel :where(.mobile-drawer-submenu a),
.mobile-menu-panel :where(.mobile-account-details span, .mobile-account-details strong, .mobile-account-details small),
.mobile-menu-panel :where(summary, label, strong, small) {
  color: #f8fcff !important;
}

.mobile-menu-panel :where(.mobile-drawer-main-link small, .mobile-drawer-submenu a) {
  color: #cfe8ff !important;
}

.mobile-drawer-group.active,
.mobile-drawer-group.open {
  background: linear-gradient(135deg, #0b1f33, #16324f) !important;
  border-color: rgba(207, 232, 255, 0.36) !important;
}

.mobile-drawer-group.active :where(span, small),
.mobile-drawer-group.open > .mobile-drawer-summary-row :where(span, small),
.mobile-drawer-group.open > .mobile-drawer-summary-row .mobile-drawer-main-link :where(span, small),
.mobile-drawer-group.open .mobile-drawer-main-link,
.mobile-drawer-group.open .mobile-drawer-main-link:hover,
.mobile-drawer-group.open .mobile-drawer-main-link:focus-visible {
  color: #ffffff !important;
}

.mobile-drawer-submenu a {
  background: rgba(11, 31, 51, 0.22) !important;
  border-color: rgba(207, 232, 255, 0.24) !important;
  color: #f8fcff !important;
}

.mobile-drawer-toggle,
.mobile-menu-panel .mobile-drawer-toggle {
  background: rgba(11, 31, 51, 0.22) !important;
  border-color: rgba(207, 232, 255, 0.28) !important;
  color: #f8fcff !important;
}

.mobile-menu-panel .mobile-settings :where(summary, label, span, small, strong, a, button),
.mobile-menu-panel .mobile-settings-body :where(label, span, small, strong, a, button) {
  color: var(--visual-ink) !important;
}

.mobile-menu-panel .mobile-settings-body .button.secondary,
.mobile-menu-panel .mobile-settings-body a.button.secondary,
.mobile-menu-panel .mobile-settings-body button.button.secondary {
  color: var(--visual-ink) !important;
}

@media (max-width: 768px) {
  .calendar-dashboard-greeting {
    color: #f8fcff !important;
  }

  .calendar-dashboard-greeting-user p {
    color: #dff0ff !important;
  }

  .calendar-dashboard-greeting-user strong {
    font-size: 42px !important;
    letter-spacing: -0.015em;
  }

  .calendar-time {
    color: #eaf7ff !important;
  }

  .mobile-drawer-main-link small {
    color: #cfe8ff !important;
  }

  .mobile-drawer-main-link span {
    color: #ffffff !important;
  }

  .mobile-drawer-toggle {
    background: rgba(11, 31, 51, 0.22) !important;
    color: #f8fcff !important;
  }
}

/* Final pre-go-live contrast guardrails: targeted readability only. */
.calendar-dashboard-greeting {
  background:
    radial-gradient(circle at 92% 10%, rgba(207, 232, 255, 0.22), transparent 34%),
    linear-gradient(135deg, #071827 0%, #0b1f33 48%, #16324f 100%) !important;
  color: #f8fcff !important;
}

.calendar-dashboard-greeting :where(p, strong, small, span),
.calendar-dashboard-greeting .calendar-time {
  color: #f8fcff !important;
}

.calendar-dashboard-greeting-user p,
.calendar-dashboard-greeting-user small {
  color: #dff0ff !important;
}

/* Fix177: urgent mobile UI regression guardrails.
   Mobile only: keep main navigation tappable/readable, prevent clipped toggle
   controls, and protect calendar/check-in text contrast above quick actions. */
@media (max-width: 768px) {
  .content {
    padding-bottom: calc(136px + env(safe-area-inset-bottom)) !important;
  }

  .calendar-personal-dashboard {
    padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
  }

  .mobile-menu-overlay {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  .mobile-menu-panel {
    width: min(100%, 390px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
    overflow: hidden !important;
  }

  .mobile-drawer-nav {
    padding: 2px 0 max(28px, env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
  }

  .mobile-drawer-group {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .mobile-drawer-summary-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 44px !important;
    gap: 8px !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .mobile-drawer-main-link {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 54px !important;
    padding: 11px 12px !important;
    border-radius: 18px !important;
    touch-action: manipulation;
  }

  .mobile-drawer-main-link span {
    color: #ffffff !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .mobile-drawer-main-link small {
    color: #dff0ff !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  .mobile-drawer-toggle {
    width: 44px !important;
    min-width: 44px !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 5px 0 !important;
    align-self: stretch !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid rgba(207, 232, 255, 0.56) !important;
    color: #0b1f33 !important;
    box-shadow: 0 10px 22px rgba(4, 14, 26, 0.18) !important;
    touch-action: manipulation;
  }

  .mobile-drawer-submenu {
    padding: 8px 0 12px 0 !important;
  }

  .mobile-drawer-submenu a {
    min-height: 44px !important;
    width: 100% !important;
    color: #0b1f33 !important;
    background: #ffffff !important;
    border: 1px solid rgba(43, 93, 135, 0.16) !important;
  }

  .mobile-bottom-nav,
  .contextual-mobile-bottom-nav {
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    color: #f8fcff !important;
  }

  .calendar-dashboard-greeting {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 18px !important;
    background:
      radial-gradient(circle at 90% 8%, rgba(207, 232, 255, 0.24), transparent 38%),
      linear-gradient(135deg, #071827 0%, #0b1f33 54%, #16324f 100%) !important;
    color: #f8fcff !important;
  }

  .calendar-dashboard-greeting :where(p, strong, small, span),
  .calendar-dashboard-greeting .calendar-time {
    color: #f8fcff !important;
  }

  .calendar-dashboard-greeting-user {
    display: grid !important;
    grid-template-columns: 66px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
  }

  .calendar-dashboard-avatar {
    width: 66px !important;
    height: 66px !important;
    background: linear-gradient(135deg, #f8fcff, #cfe8ff) !important;
    color: #0b1f33 !important;
    border: 3px solid rgba(207, 232, 255, 0.7) !important;
  }

  .calendar-dashboard-greeting-user > div:last-child {
    min-width: 0 !important;
    display: grid !important;
    gap: 2px !important;
  }

  .calendar-dashboard-greeting-user p {
    color: #dff0ff !important;
    font-size: 14px !important;
    font-weight: 900 !important;
  }

  .calendar-dashboard-greeting-user strong {
    color: #ffffff !important;
    font-size: clamp(25px, 7vw, 32px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere !important;
    text-shadow: 0 2px 10px rgba(4, 14, 26, 0.42) !important;
  }

  .calendar-dashboard-greeting-user small {
    color: #dff0ff !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
  }

  .calendar-dashboard-top-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    min-width: 0 !important;
  }

  .calendar-time {
    color: #eaf7ff !important;
    font-size: 20px !important;
  }

  .calendar-personal-dashboard .operations-presence-card {
    background: #ffffff !important;
    border-color: rgba(43, 93, 135, 0.18) !important;
    color: #0b1f33 !important;
  }

  .calendar-personal-dashboard .operations-presence-card :where(h2, h3, p, strong, span, label) {
    color: #0b1f33 !important;
  }

  .calendar-personal-dashboard .operations-presence-card .status {
    background: #dcfce7 !important;
    color: #064e3b !important;
    border-color: rgba(6, 78, 59, 0.24) !important;
  }
}

.operations-presence-card,
.calendar-grid-card,
.calendar-agenda-day {
  color: #0b1f33;
}

.operations-presence-card :where(h2, p, strong, span),
.calendar-grid-card :where(h2, h3, p, strong, span, label),
.calendar-agenda-day :where(strong, span) {
  color: #0b1f33;
}

.calendar-tabs label,
.calendar-view-toggle > label {
  background: #ffffff !important;
  border-color: rgba(43, 93, 135, 0.28) !important;
  color: #0b1f33 !important;
}

#calendar-tab-accommodation:checked ~ .desktop-calendar-tabs label[for="calendar-tab-accommodation"],
#calendar-tab-services:checked ~ .desktop-calendar-tabs label[for="calendar-tab-services"],
#calendar-tab-operations:checked ~ .desktop-calendar-tabs label[for="calendar-tab-operations"],
#calendar-tab-staff:checked ~ .desktop-calendar-tabs label[for="calendar-tab-staff"],
#calendar-tab-accommodation:checked ~ .mobile-calendar-tabs label[for="calendar-tab-accommodation"],
#calendar-tab-services:checked ~ .mobile-calendar-tabs label[for="calendar-tab-services"],
#calendar-tab-operations:checked ~ .mobile-calendar-tabs label[for="calendar-tab-operations"],
#calendar-tab-staff:checked ~ .mobile-calendar-tabs label[for="calendar-tab-staff"],
.calendar-view-radio:checked + label {
  background: linear-gradient(135deg, #071827, #16324f) !important;
  border-color: rgba(207, 232, 255, 0.45) !important;
  color: #ffffff !important;
}

.calendar-event-action-note,
.calendar-event :where(small, em),
.modal-card.finance-workflow-modal :where(.eyebrow, p, small, span),
.modal-card.package-builder-modal :where(.eyebrow, p, small, span) {
  color: #334a5f !important;
}

.modal-card.finance-workflow-modal .impact-row,
.modal-card.package-builder-modal .impact-row {
  background: linear-gradient(135deg, #071827, #16324f) !important;
  color: #ffffff !important;
}

.modal-card.finance-workflow-modal .impact-row :where(span, strong),
.modal-card.package-builder-modal .impact-row :where(span, strong) {
  color: #ffffff !important;
}

.sidebar-drawer .button.secondary,
.mobile-menu-panel .button.secondary,
.modal-card.finance-workflow-modal .button.secondary,
.modal-card.package-builder-modal .button.secondary {
  background: #ffffff !important;
  border-color: rgba(43, 93, 135, 0.34) !important;
  color: #0b1f33 !important;
}

.sidebar-drawer .button.secondary:hover,
.mobile-menu-panel .button.secondary:hover,
.modal-card.finance-workflow-modal .button.secondary:hover,
.modal-card.package-builder-modal .button.secondary:hover {
  background: #eaf7ff !important;
  color: #0b1f33 !important;
}

.mobile-menu-panel .mobile-drawer-main-link :where(span, small),
.mobile-menu-panel .mobile-drawer-submenu a,
.mobile-menu-panel .mobile-account-details :where(span, strong, small) {
  color: #f8fcff !important;
}

.mobile-drawer-group.active,
.mobile-drawer-group.open {
  background: linear-gradient(135deg, #071827, #16324f) !important;
  border-color: rgba(207, 232, 255, 0.38) !important;
}

.mobile-drawer-group.open .mobile-drawer-submenu a {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #f8fcff !important;
  border-color: rgba(207, 232, 255, 0.28) !important;
}

.mobile-drawer-toggle,
.mobile-menu-panel .mobile-drawer-toggle {
  background: #ffffff !important;
  color: #0b1f33 !important;
  border-color: rgba(207, 232, 255, 0.42) !important;
}

/* Fix178: final mobile contrast override after all broad card/menu rules. */
@media (max-width: 768px) {
  .calendar-personal-dashboard .calendar-dashboard-greeting,
  .calendar-dashboard-greeting.card {
    background:
      radial-gradient(circle at 90% 8%, rgba(207, 232, 255, 0.24), transparent 38%),
      linear-gradient(135deg, #071827 0%, #0b1f33 54%, #16324f 100%) !important;
    color: #f8fcff !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting :where(p, strong, small, span),
  .calendar-personal-dashboard .calendar-dashboard-greeting .calendar-time,
  .calendar-dashboard-greeting.card :where(p, strong, small, span),
  .calendar-dashboard-greeting.card .calendar-time {
    color: #f8fcff !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting.card p,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card span,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card small,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card .calendar-time {
    color: #f8fcff !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting-user p,
  .calendar-personal-dashboard .calendar-dashboard-greeting-user small,
  .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user p,
  .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user small,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user p,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user small {
    color: #dff0ff !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting-user strong,
  .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user strong,
  .calendar-personal-dashboard .calendar-dashboard-greeting.card .calendar-dashboard-greeting-user strong {
    color: #ffffff !important;
    text-shadow: 0 2px 10px rgba(4, 14, 26, 0.42) !important;
  }
}

/* Fix180: final mobile quick-action overlap guardrails.
   Mobile only: keep the page content and long create/edit forms clear of the
   fixed bottom quick actions and iPhone Safari safe area. */
@media (max-width: 1024px) {
  body,
  html {
    scroll-padding-bottom: max(210px, calc(184px + env(safe-area-inset-bottom))) !important;
  }

  .content {
    padding-bottom: max(220px, calc(190px + env(safe-area-inset-bottom))) !important;
  }

  .contextual-mobile-bottom-nav,
  .mobile-bottom-nav {
    z-index: 70 !important;
  }

  .modal-backdrop {
    z-index: 260 !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }

  .modal-card,
  .modal-card.wide-modal,
  .modal-card.package-builder-modal,
  .modal-card.product-form-modal,
  .modal-card.product-edit-modal {
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))) !important;
  }

  .modal-card form,
  .modal-card .form-grid,
  .modal-card .product-form-scroll,
  .modal-card.package-builder-modal .product-form-scroll,
  .modal-card.package-builder-modal .package-builder-form,
  .modal-card.product-form-modal .product-form-scroll {
    padding-bottom: max(104px, calc(84px + env(safe-area-inset-bottom))) !important;
    scroll-padding-bottom: max(128px, calc(104px + env(safe-area-inset-bottom))) !important;
  }

  .modal-card .sticky-modal-actions,
  .modal-card .form-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 42 !important;
    padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.9), #ffffff 38%) !important;
  }

  .package-workspace {
    margin-bottom: max(34px, env(safe-area-inset-bottom)) !important;
  }

  .package-workspace .card,
  .package-workspace .metric-card,
  .card.package-workspace,
  .card.package-workspace .metric-card {
    color: #f8fcff !important;
  }

  .package-workspace .card :where(h1, h2, h3, h4, strong, label),
  .package-workspace .metric-card :where(h1, h2, h3, h4, strong, label),
  .card.package-workspace :where(h1, h2, h3, h4, strong, label),
  .card.package-workspace .metric-card :where(h1, h2, h3, h4, strong, label) {
    color: #ffffff !important;
  }

  .card.package-workspace h1,
  .card.package-workspace h2,
  .card.package-workspace h3,
  .card.package-workspace h4,
  .card.package-workspace strong,
  .card.package-workspace label,
  .package-workspace .card h1,
  .package-workspace .card h2,
  .package-workspace .card h3,
  .package-workspace .card h4,
  .package-workspace .card strong,
  .package-workspace .card label,
  .package-workspace .metric-card strong {
    color: #ffffff !important;
  }

  .package-workspace .card :where(p, small, span, .eyebrow),
  .package-workspace .metric-card :where(p, small, span, .eyebrow),
  .card.package-workspace :where(p, small, span, .eyebrow),
  .card.package-workspace .metric-card :where(p, small, span, .eyebrow) {
    color: #dff0ff !important;
    opacity: 1 !important;
  }

  .card.package-workspace p,
  .card.package-workspace small,
  .card.package-workspace .eyebrow,
  .card.package-workspace .metric-card span,
  .package-workspace .card p,
  .package-workspace .card small,
  .package-workspace .card .eyebrow,
  .package-workspace .metric-card span {
    color: #dff0ff !important;
    opacity: 1 !important;
  }

  .card.package-workspace .status-pill,
  .package-workspace .card .status-pill {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.42) !important;
    color: #ffffff !important;
  }

  .package-workspace .table-wrap,
  .package-workspace .notice,
  .package-workspace .empty-state,
  .package-workspace .modal-card,
  .modal-card.package-builder-modal .package-builder-section {
    background: #ffffff !important;
    color: #0b1f33 !important;
  }

  .package-workspace .table-wrap :where(th, td, h1, h2, h3, h4, p, span, small, strong, label),
  .package-workspace .notice :where(h1, h2, h3, h4, p, span, small, strong, label),
  .package-workspace .empty-state :where(h1, h2, h3, h4, p, span, small, strong, label),
  .package-workspace .modal-card :where(h1, h2, h3, h4, p, span, small, strong, label),
  .modal-card.package-builder-modal .package-builder-section :where(h1, h2, h3, h4, p, span, small, strong, label) {
    color: #0b1f33 !important;
  }

  .modal-card.package-builder-modal .impact-row,
  .modal-card.package-builder-modal .impact-row :where(span, strong) {
    color: #ffffff !important;
  }

  .modal-card.package-builder-modal .impact-row {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px 10px !important;
    box-sizing: border-box !important;
    padding-inline: 12px 16px !important;
    margin-bottom: 12px !important;
    overflow: visible !important;
  }

  .modal-card.package-builder-modal .package-builder-form,
  .modal-card.product-form-modal .product-form-scroll {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .modal-card.package-builder-modal :where(.span-2, .span-3),
  .modal-card.product-form-modal :where(.span-2, .span-3) {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }

  .modal-card.package-builder-modal .impact-row strong {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    text-align: left !important;
  }
}

/* Fix180 contrast floor: package workspace cards are dark globally, so their
   text must stay light even if later dashboard/card rules are adjusted. */
.card.package-workspace h1,
.card.package-workspace h2,
.card.package-workspace h3,
.card.package-workspace h4,
.card.package-workspace strong,
.card.package-workspace label,
.card.package-workspace .metric-card strong {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.card.package-workspace p,
.card.package-workspace small,
.card.package-workspace .eyebrow,
.card.package-workspace .metric-card span {
  color: #dff0ff !important;
  -webkit-text-fill-color: #dff0ff !important;
  opacity: 1 !important;
}

.card.package-workspace .status-pill {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.42) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

html body main.content section.card.package-workspace h1,
html body main.content section.card.package-workspace h2,
html body main.content section.card.package-workspace h3,
html body main.content section.card.package-workspace h4,
html body main.content section.card.package-workspace strong,
html body main.content section.card.package-workspace label {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

html body main.content section.card.package-workspace p,
html body main.content section.card.package-workspace small,
html body main.content section.card.package-workspace .eyebrow,
html body main.content section.card.package-workspace .metric-card span {
  color: #dff0ff !important;
  -webkit-text-fill-color: #dff0ff !important;
  opacity: 1 !important;
}

/* Fix182: global modal/drawer scroll containment.
   When overlays are open, the shared hook locks the page; these rules keep the
   active popup itself scrollable on desktop and mobile. */
.modal-backdrop {
  overflow: hidden !important;
  overscroll-behavior: contain !important;
}

.modal-backdrop .modal-card {
  max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: max(112px, calc(88px + env(safe-area-inset-bottom))) !important;
}

.modal-card > .card-header {
  flex: 0 0 auto;
}

.modal-card.product-form-modal,
.modal-card.product-edit-modal,
.modal-card.package-builder-modal,
.modal-card.finance-workflow-modal,
.modal-card.user-access-modal {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  min-height: 0 !important;
}

.modal-card.product-form-modal > form,
.modal-card.product-edit-modal > form,
.modal-card.package-builder-modal > form,
.modal-card.finance-workflow-modal > form,
.modal-card.user-access-modal > form,
.modal-card.product-form-modal > .product-form-scroll,
.modal-card.product-edit-modal > .product-form-scroll,
.modal-card.package-builder-modal > .product-form-scroll,
.modal-card.package-builder-modal > .package-builder-form,
.modal-card.finance-workflow-modal > .product-form-scroll,
.modal-card.user-access-modal > .product-form-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(118px, calc(92px + env(safe-area-inset-bottom))) !important;
  scroll-padding-bottom: max(136px, calc(112px + env(safe-area-inset-bottom))) !important;
}

.modal-card .sticky-modal-actions,
.modal-card .form-actions {
  scroll-margin-bottom: max(126px, calc(96px + env(safe-area-inset-bottom))) !important;
}

@media (max-width: 768px) {
  .modal-backdrop {
    align-items: stretch !important;
    justify-items: stretch !important;
    padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)) !important;
  }

  .modal-backdrop .modal-card {
    width: 100% !important;
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom))) !important;
  }

  .modal-card .sticky-modal-actions,
  .modal-card .form-actions {
    bottom: 0 !important;
    padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
  }
}

/* Fix187: real-user upload/accessibility polish. */
.role-selector-grid {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(43, 93, 135, 0.2);
  border-radius: 16px;
  padding: 14px;
  background: #f8fcff;
}

.role-selector-grid legend {
  padding: 0 8px;
  color: #0b1f33;
  font-weight: 800;
}

.role-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(43, 93, 135, 0.24);
  border-radius: 14px;
  background: #ffffff;
  color: #0b1f33;
  box-shadow: 0 10px 24px rgba(11, 31, 51, 0.06);
}

.role-option-card input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #2b5d87;
}

.role-option-card strong,
.role-option-card small {
  display: block;
}

.role-option-card strong {
  color: #0b1f33;
  font-size: 14px;
}

.role-option-card small {
  color: #42576d;
  line-height: 1.35;
}

.role-option-card:has(input:checked) {
  border-color: rgba(30, 116, 180, 0.72);
  background: linear-gradient(135deg, #eaf7ff, #ffffff);
  box-shadow: 0 14px 30px rgba(43, 93, 135, 0.18);
}

.role-option-card:has(input:checked)::after {
  content: "Selected";
  justify-self: end;
  grid-column: 2;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #166534;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 768px) {
  .contextual-mobile-bottom-nav,
  .mobile-bottom-nav {
    background: rgba(7, 24, 39, 0.98) !important;
    border: 1px solid rgba(207, 232, 255, 0.28) !important;
    box-shadow: 0 -18px 42px rgba(4, 14, 26, 0.34) !important;
  }

  .contextual-mobile-bottom-nav a,
  .mobile-bottom-nav a {
    background: rgba(255, 255, 255, 0.11) !important;
    border: 1px solid rgba(207, 232, 255, 0.28) !important;
    color: #f8fcff !important;
    opacity: 1 !important;
    text-shadow: 0 1px 2px rgba(4, 14, 26, 0.45) !important;
  }

  .contextual-mobile-bottom-nav a :where(span, small),
  .mobile-bottom-nav a :where(span, small),
  .contextual-mobile-bottom-nav .mobile-nav-icon,
  .mobile-bottom-nav .mobile-nav-icon {
    color: #ffffff !important;
    opacity: 1 !important;
  }

  .contextual-mobile-bottom-nav .mobile-nav-icon,
  .mobile-bottom-nav .mobile-nav-icon {
    display: grid !important;
    place-items: center !important;
    min-width: 30px !important;
    min-height: 30px !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #0b1f33 !important;
    font-weight: 900 !important;
    box-shadow: 0 8px 18px rgba(4, 14, 26, 0.22) !important;
  }

  .contextual-mobile-bottom-nav a[aria-current="page"],
  .mobile-bottom-nav a[aria-current="page"],
  .contextual-mobile-bottom-nav a:hover,
  .mobile-bottom-nav a:hover {
    background: linear-gradient(135deg, #2b5d87, #1e74b4) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.52) !important;
  }

  .role-selector-grid {
    padding: 12px;
  }

  .role-option-card {
    min-height: 72px;
  }
}

/* Fix192: global notification center in the app header, not inside Calendar. */
.global-header-actions {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 82;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(620px, calc(100vw - 360px));
  pointer-events: auto;
}

.global-profile-pill,
.global-settings-link,
.global-notification-center > summary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(43, 93, 135, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #0b1f33;
  box-shadow: 0 14px 34px rgba(11, 31, 51, 0.12);
  font-weight: 850;
}

.global-profile-pill {
  max-width: 230px;
  padding: 5px 12px 5px 5px;
}

.global-profile-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(135deg, #071827, #2b5d87);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.global-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.global-profile-name {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 901px) {
  .content {
    padding-top: 96px;
  }

  .global-header-actions {
    min-height: 48px;
  }

  .desktop-context-actions {
    flex-wrap: wrap;
    padding-right: min(20px, 2vw);
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .global-header-actions {
    max-width: 410px;
  }

  .global-profile-name {
    max-width: 110px;
  }

  .global-settings-link,
  .global-notification-center > summary {
    min-height: 38px;
  }
}

.global-settings-link {
  padding: 0 14px;
}

.global-notification-center {
  position: relative;
}

.global-notification-center > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px 4px 6px;
}

.global-notification-center > summary::-webkit-details-marker {
  display: none;
}

.notification-bell {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #071827, #2b5d87);
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
}

.global-notification-center summary strong {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #a53f3f;
  color: #ffffff;
  font-size: 12px;
}

.global-notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 30px));
  max-height: min(72vh, 620px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(43, 93, 135, 0.24);
  border-radius: 22px;
  background: rgba(248, 252, 255, 0.98);
  box-shadow: 0 28px 76px rgba(4, 14, 26, 0.26);
  color: #0b1f33;
  overscroll-behavior: contain;
}

.global-notification-heading {
  display: grid;
  gap: 2px;
}

.global-notification-heading strong {
  color: #0b1f33;
  font-size: 16px;
}

.global-notification-heading span,
.global-notification-empty {
  color: #42576d;
  font-size: 13px;
  font-weight: 760;
}

.global-notification-list {
  display: grid;
  gap: 9px;
}

.global-notification-item {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid rgba(43, 93, 135, 0.18);
  border-radius: 16px;
  background: #ffffff;
  color: #0b1f33;
}

.global-notification-item span {
  color: #2b5d87;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.global-notification-item strong {
  color: #0b1f33;
  font-size: 14px;
}

.global-notification-item small {
  color: #42576d;
  font-size: 12px;
  line-height: 1.25;
}

.global-notification-item.warning {
  border-color: rgba(146, 96, 0, 0.28);
  background: #fff8e6;
}

.global-notification-item.danger {
  border-color: rgba(165, 63, 63, 0.28);
  background: #fff0f0;
}

.mobile-app-header {
  display: none;
}

@media (max-width: 768px) {
  .global-header-actions {
    display: none;
  }

  .mobile-app-header {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    z-index: 83;
    min-height: 54px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border: 1px solid rgba(207, 232, 255, 0.32);
    border-radius: 22px;
    background: rgba(7, 24, 39, 0.96);
    color: #ffffff;
    box-shadow: 0 18px 44px rgba(4, 14, 26, 0.24);
    backdrop-filter: blur(18px);
  }

  .mobile-app-header > strong {
    min-width: 0;
    overflow: hidden;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-app-header .mobile-menu-button {
    position: static !important;
    inset: auto !important;
    width: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    border-color: rgba(207, 232, 255, 0.42) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    box-shadow: none !important;
  }

  .mobile-app-header .global-notification-center > summary {
    min-height: 42px;
    padding: 4px 7px 4px 4px;
    border-color: rgba(207, 232, 255, 0.36);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: none;
  }

  .mobile-app-header .notification-label {
    display: none;
  }

  .mobile-app-header .notification-bell {
    width: 30px;
    height: 30px;
    background: #ffffff;
    color: #071827;
  }

  .mobile-app-header .global-notification-panel {
    position: fixed;
    top: calc(max(10px, env(safe-area-inset-top)) + 64px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: min(68dvh, 560px);
  }

  .content {
    padding-top: max(86px, calc(76px + env(safe-area-inset-top))) !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting,
  .calendar-dashboard-greeting.card {
    background:
      radial-gradient(circle at 90% 10%, rgba(207, 232, 255, 0.24), transparent 38%),
      linear-gradient(135deg, #071827 0%, #0b1f33 56%, #16324f 100%) !important;
    color: #f8fcff !important;
  }

  .calendar-personal-dashboard .calendar-dashboard-greeting :where(p, strong, small, span),
  .calendar-dashboard-greeting.card :where(p, strong, small, span),
  .calendar-dashboard-greeting .calendar-time {
    color: #f8fcff !important;
    -webkit-text-fill-color: #f8fcff !important;
    opacity: 1 !important;
  }

  .calendar-dashboard-greeting-user strong {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-size: clamp(30px, 8vw, 44px) !important;
    line-height: 1.02 !important;
    text-shadow: 0 2px 12px rgba(4, 14, 26, 0.46) !important;
  }

  .calendar-dashboard-greeting-user p,
  .calendar-dashboard-greeting-user small {
    color: #e6f4ff !important;
    -webkit-text-fill-color: #e6f4ff !important;
  }
}

/* Final pre-go-live UX/contrast guardrail. Duplicated at the end of the
   cascade intentionally so it wins over older staging visual layers. */
.template-builder-grid {
  display: grid;
  gap: 14px;
}

.template-collapsible-card {
  padding: 0 !important;
  overflow: hidden;
  background: #ffffff !important;
  color: #0b1f33 !important;
}

.template-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f3f9ff 100%);
  color: #0b1f33;
  text-align: left;
  cursor: pointer;
}

.template-card-toggle span:first-child {
  display: grid;
  gap: 4px;
}

.template-card-toggle strong {
  color: #0b1f33;
  font-size: 18px;
}

.template-card-toggle .eyebrow {
  color: #2b5d87;
}

.template-collapsible-card > .card-header,
.template-collapsible-card > .template-summary-grid,
.template-collapsible-card > .quick-actions,
.template-collapsible-card > .muted,
.template-collapsible-card > .notice,
.template-collapsible-body {
  margin: 0 20px 16px;
}

.template-collapsible-card > .card-header {
  padding-top: 16px;
}

.template-collapsible-card details {
  display: block;
}

.template-collapsible-card summary {
  list-style: none;
}

.template-collapsible-card summary::-webkit-details-marker {
  display: none;
}

.template-collapsible-body {
  padding-bottom: 18px;
}

.finance-workflow-modal,
.product-form-modal,
.modal-card {
  color: #0b1f33 !important;
}

.finance-workflow-modal :where(label, p, span, small),
.product-form-modal :where(label, p, span, small),
.modal-card :where(label, p, span, small) {
  color: #27415c;
}

.finance-workflow-modal :where(h2, h3, strong),
.product-form-modal :where(h2, h3, strong),
.modal-card :where(h2, h3, strong) {
  color: #0b1f33;
}

.button:not(.secondary):not(.danger):not(.muted),
a.button:not(.secondary):not(.danger):not(.muted) {
  background: #0b4f8a !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.button.secondary,
a.button.secondary,
.modal-close-button {
  background: #ffffff !important;
  color: #0b1f33 !important;
  -webkit-text-fill-color: #0b1f33 !important;
  border-color: rgba(43, 93, 135, 0.35) !important;
}

.button.danger,
a.button.danger {
  background: #b42318 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.account-balance-card .button.compact,
.account-balance-card a.button.compact,
.dashboard-account-card .button.compact,
.dashboard-account-card a.button.compact {
  background: rgba(255, 255, 255, 0.96) !important;
  color: #0b1f33 !important;
  border-color: rgba(255, 255, 255, 0.72) !important;
}

.mobile-work-hero,
.operations-mobile-hero,
.package-builder-hero,
.card.hero-card,
.card.gradient-card,
.card[style*="linear-gradient"],
.card[style*="background: #0b"],
.card[style*="background:#0b"],
.card[style*="background: var(--primary"],
.card[style*="background:var(--primary"] {
  color: #ffffff !important;
}

.mobile-work-hero :where(h1, h2, h3, p, span, small, strong),
.operations-mobile-hero :where(h1, h2, h3, p, span, small, strong),
.package-builder-hero :where(h1, h2, h3, p, span, small, strong),
.card.hero-card :where(h1, h2, h3, p, span, small, strong),
.card.gradient-card :where(h1, h2, h3, p, span, small, strong),
.card[style*="linear-gradient"] :where(h1, h2, h3, p, span, small, strong),
.card[style*="background: #0b"] :where(h1, h2, h3, p, span, small, strong),
.card[style*="background:#0b"] :where(h1, h2, h3, p, span, small, strong),
.card[style*="background: var(--primary"] :where(h1, h2, h3, p, span, small, strong),
.card[style*="background:var(--primary"] :where(h1, h2, h3, p, span, small, strong) {
  color: #f8fbff !important;
  -webkit-text-fill-color: #f8fbff !important;
}

@media (max-width: 768px) {
  .template-card-toggle {
    padding: 16px;
  }

  .template-collapsible-card > .card-header,
  .template-collapsible-card > .template-summary-grid,
  .template-collapsible-card > .quick-actions,
  .template-collapsible-card > .muted,
  .template-collapsible-card > .notice,
  .template-collapsible-body {
    margin-left: 14px;
    margin-right: 14px;
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav summary {
    background: #ffffff !important;
    color: #0b1f33 !important;
    -webkit-text-fill-color: #0b1f33 !important;
    border-color: rgba(43, 93, 135, 0.24) !important;
  }

  .mobile-bottom-nav .mobile-nav-icon,
  .contextual-mobile-bottom-nav .mobile-nav-icon {
    background: #0b4f8a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }

  .mobile-bottom-nav > a:hover,
  .mobile-bottom-nav summary:hover,
  .mobile-bottom-nav details[open] summary {
    background: #eaf4ff !important;
    color: #071827 !important;
  }
}
