/* Shared visual language, with dedicated touch layouts. */
@font-face {
  font-family: Tajawal;
  src: url("/fonts/tajawal-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("/fonts/tajawal-500.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("/fonts/tajawal-700.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("/fonts/tajawal-800.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}
.metric-card strong,
.metric-icon,
.card strong,
.fund-health-row b,
.engineer-balance-card strong,
.number-preview strong,
.eyebrow {
  font-family: Tajawal, Arial, sans-serif;
}
.eyebrow {
  letter-spacing: 0.2px;
}
.quick-action {
  grid-template-columns: 38px minmax(0, 1fr) auto !important;
}
:root {
  --paper: #f2f5fa;
  --muted: #5f6f88;
  --line: #e0e7f1;
}
input[type="number"],
input[type="date"],
input[dir="ltr"] {
  direction: ltr;
  font-family: Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
[hidden] {
  display: none !important;
}
.shell {
  grid-template-columns: 244px minmax(0, 1fr);
}
.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  background:
    radial-gradient(ellipse at 0 0, #4274a433, transparent 65%),
    linear-gradient(165deg, #142947, #111d34);
  padding: 28px 16px;
}
.brand {
  font-family: inherit;
  font-size: 1.12rem;
  margin-bottom: 30px;
  padding: 12px;
  border: 0;
}
.brand:before {
  content: "M";
  display: inline-grid;
  place-items: center;
  background: #48dcc8;
  color: #112b40;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  margin-left: 10px;
  font-family: Arial;
  font-weight: 800;
}
.brand small {
  margin-top: 12px;
  line-height: 1.8;
}
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent !important;
  border-radius: 12px;
  padding: 12px;
  margin: 5px 0;
  font-weight: 700;
  color: #bccce0;
}
.nav svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.nav.active {
  background: #ffffff18;
  border-color: #ffffff20 !important;
  color: #fff;
  box-shadow: inset -3px 0 #48dcc8;
}
.content {
  margin: 0 auto;
  padding: 28px 32px 48px;
  min-width: 0;
  max-width: 1660px;
  align-self: start;
}
.top {
  margin-bottom: 24px;
}
.top h1 {
  font-size: 1.65rem;
  letter-spacing: -0.6px;
}
.top .muted {
  display: block;
  margin-top: 7px;
}
.appearance-toggle {
  min-width: 42px;
  font-size: 1.2rem;
  padding: 8px;
}
button {
  min-height: 42px;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
button:active {
  transform: translateY(1px);
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.panel {
  box-shadow: 0 5px 22px #17255406;
  border-radius: 20px;
}
.dashboard-hero {
  min-height: 180px;
  padding: 28px 32px;
}
.metric-card {
  min-height: 115px;
}
.metric-icon {
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}
.metric-card strong {
  font-size: clamp(1.05rem, 1.5vw, 1.6rem);
  font-variant-numeric: tabular-nums;
}
.metric-card i {
  width: 3px;
}
.badge {
  white-space: nowrap;
  line-height: 1.5;
}
.toolbar {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  align-items: center;
}
.toolbar input {
  flex: 1;
  min-width: 180px;
}
.toolbar select {
  width: auto;
  min-width: 140px;
}
td {
  padding: 16px 12px;
}
tbody tr {
  transition: background 0.18s;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--card));
}
th {
  font-size: 0.78rem;
  letter-spacing: 0.2px;
}
.danger {
  background: #fff0f2;
  border: 1px solid #f4cbd3;
  color: #b72d48;
  box-shadow: none;
}
.scroll {
  scrollbar-width: thin;
  scrollbar-color: #bcc8da transparent;
}
.picker-heading {
  margin: 24px 0 12px;
  font-size: 1rem;
}
.operation-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.operation-tile {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-content: start;
  gap: 5px 10px;
  min-height: 94px;
  padding: 15px;
  text-align: right;
  background: var(--card);
  color: var(--ink);
  box-shadow: none;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.operation-tile svg {
  width: 25px;
  height: 25px;
  grid-row: span 2;
  color: var(--accent);
  margin-top: 3px;
}
.operation-tile strong {
  font-size: 0.83rem;
  line-height: 1.5;
}
.operation-tile small {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.65;
}
.operation-tile.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  box-shadow: 0 0 0 1px var(--accent);
}
.entry-workspace {
  grid-template-columns: minmax(0, 1fr) 280px;
}
.entry-panel .form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.entry-panel .form .wide {
  grid-column: 1/-1;
}
.entry-panel {
  padding: 24px;
}
.entry-summary {
  border: 1px solid #ffffff25;
  border-radius: 20px;
  padding: 24px;
}
.entry-hero {
  background: var(--card);
  border: 1px solid var(--line);
}
.number-preview {
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
}
.module-directory {
  margin: 0 0 20px;
}
.module-directory h2 {
  margin: 4px 0;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.module-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 15px;
  font-size: 0.84rem;
}
.module-link svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex: none;
}
.report-output {
  min-width: 0;
  overflow: hidden;
}
.report-output .scroll {
  max-width: 100%;
  overflow: auto;
}
.report-actions {
  flex-wrap: wrap;
}
html[data-theme="dark"] {
  --paper: #0e1727;
  --card: #182338;
  --ink: #edf2fa;
  --muted: #aebcd0;
  --line: #30405a;
}
html[data-theme="dark"] .operation-tile,
html[data-theme="dark"] .module-link {
  color: var(--ink);
}
html[data-theme="dark"] .metric-icon {
  background: #263750;
  color: #7ebaff;
}
html[data-theme="dark"] .badge {
  background: #143c38;
  color: #80e4c8;
}
html[data-theme="dark"] .badge.cancelled,
html[data-theme="dark"] .danger {
  background: #422436;
  color: #ffa4b6;
  border-color: #6c3b4f;
}
html[data-theme="dark"] .quick-action {
  background: #22324b;
  color: var(--ink);
}
html[data-theme="dark"] .number-preview {
  background: #22324b;
}
html[data-theme="dark"] .report-controls input,
html[data-theme="dark"] .report-controls select,
html[data-theme="dark"] .login-screen,
html[data-theme="dark"] .login-card input {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
@media (min-width: 801px) and (max-width: 1180px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .content {
    padding: 24px 20px;
  }
  .operation-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .entry-workspace {
    grid-template-columns: 1fr;
  }
  .entry-summary {
    position: static;
  }
  .module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .shell {
    display: block;
  }
  .content {
    padding: 20px 14px calc(100px + env(safe-area-inset-bottom));
    margin: 0;
  }
  .top {
    gap: 12px;
  }
  .top h1 {
    font-size: 1.4rem;
  }
  .top .row {
    justify-content: flex-start;
    gap: 8px;
  }
  .top #logout {
    margin-right: auto;
  }
  .top .badge {
    font-size: 0.67rem;
  }
  .dashboard-hero {
    min-height: 0;
    padding: 22px 18px;
  }
  .metric-card {
    min-height: 100px;
  }
  .metric-card strong {
    font-size: 1.03rem;
  }
  .metric-card span:not(.metric-icon) {
    font-size: 0.69rem;
  }
  .mobile-nav {
    height: calc(70px + env(safe-area-inset-bottom));
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }
  .mobile-nav button {
    min-height: 46px;
  }
  .operation-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .operation-tile {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 4px 7px;
    padding: 12px 10px;
    min-height: 96px;
  }
  .operation-tile svg {
    width: 21px;
    height: 21px;
  }
  .operation-tile strong {
    font-size: 0.76rem;
  }
  .operation-tile small {
    font-size: 0.65rem;
  }
  .entry-workspace {
    display: flex;
    flex-direction: column;
  }
  .entry-panel {
    padding: 16px;
  }
  .entry-panel .form {
    grid-template-columns: 1fr;
  }
  .entry-summary {
    position: static;
  }
  .entry-actions {
    position: static;
    background: transparent;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .module-link {
    padding: 12px 10px;
    font-size: 0.76rem;
  }
  .toolbar {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    gap: 8px;
  }
  .toolbar input {
    grid-column: 1/-1;
  }
  .toolbar select {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }
  .toolbar button {
    grid-column: 2;
    grid-row: auto;
    min-height: 46px;
    padding: 10px;
  }
  .panel.scroll {
    margin: 12px 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
  }
  .update-toast {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .form .wide {
    grid-column: 1/-1;
  }
}

/* Account administration and the restored interactive mobile dock. */
.account-form {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--primary) 4%, var(--card));
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.table-actions button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.72rem;
  box-shadow: none;
}
.password-pending {
  display: block;
  margin-top: 5px;
  color: #b45309;
  font-size: 0.66rem;
}
@media (max-width: 800px) {
  .shell > .mobile-nav {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 1200 !important;
    height: calc(76px + env(safe-area-inset-bottom)) !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    border-radius: 22px 22px 0 0 !important;
    background: color-mix(in srgb, var(--card) 96%, transparent) !important;
    box-shadow: 0 -14px 38px color-mix(in srgb, var(--primary) 18%, transparent) !important;
    backdrop-filter: blur(18px);
  }
  .shell > .mobile-nav button {
    transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease !important;
  }
  .shell > .mobile-nav button:active {
    transform: scale(0.92);
  }
  .shell > .mobile-nav button.active:not(.mobile-create) {
    border-radius: 14px;
    background: color-mix(in srgb, var(--accent) 11%, transparent) !important;
  }
  .user-management .scroll {
    overflow: visible;
  }
  .user-management table,
  .user-management tbody,
  .user-management tr,
  .user-management td {
    display: block;
    width: 100%;
  }
  .user-management thead {
    display: none;
  }
  .user-management tr {
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
  }
  .user-management td {
    padding: 7px 0;
    border: 0;
  }
  .table-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  html:not([data-page="reports"]) .content table,
  html:not([data-page="reports"]) .content tbody {
    display: block;
  }
  html:not([data-page="reports"]) .content thead {
    display: none;
  }
  html:not([data-page="reports"]) .content tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--card);
  }
  html:not([data-page="reports"]) .content td {
    display: flex;
    flex-direction: column;
    white-space: normal;
    overflow-wrap: anywhere;
    border: 0;
    padding: 8px 0;
    min-width: 0;
    font-size: 0.82rem;
  }
  html:not([data-page="reports"]) .content td:before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 5px;
  }
  html:not([data-page="reports"]) .content td[colspan] {
    grid-column: 1/-1;
  }
  html[data-page="operations"] td:nth-child(3),
  html[data-page="operations"] td:nth-child(4) {
    grid-column: 1/-1;
  }
  html[data-page="operations"] td:first-child {
    color: var(--accent);
    font-weight: 800;
  }
  html[data-page="operations"] td:last-child {
    justify-content: end;
  }
  html[data-page="operations"] td:last-child:before {
    display: none;
  }
  .metric-card {
    gap: 7px;
    padding: 11px;
  }
  .metric-icon {
    width: 28px;
    height: 32px;
    font-size: 0.9rem;
    flex: none;
  }
  .metric-card strong {
    font-size: 0.95rem;
  }
  .fund-health-row strong {
    white-space: normal;
  }
  .login-visual {
    min-height: 220px;
  }
  .login-copy {
    margin-top: 30px;
  }
  .login-form-wrap {
    padding: 16px;
  }
  .login-card {
    padding: 18px 8px;
  }
  .theme-card {
    min-height: 95px;
  }
}

@media (max-width: 800px) {
  .mobile-module-sheet section {
    right: 10px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: 10px;
    max-height: min(68dvh, 590px);
    padding: 15px;
    border-radius: 24px;
  }
  .mobile-sheet-head > div {
    display: grid;
    gap: 2px;
  }
  .mobile-sheet-head small {
    color: var(--accent);
    font-size: 0.67rem;
    font-weight: 700;
  }
  .mobile-sheet-head strong {
    font-size: 1.05rem;
  }
  .mobile-sheet-head [data-close] {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 13px;
    font-size: 1.35rem;
  }
  .mobile-sheet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-sheet-grid button {
    place-items: center;
    align-content: center;
    min-height: 76px;
    padding: 9px 5px;
    border-radius: 15px;
    text-align: center;
  }
  .mobile-sheet-grid button:active {
    transform: scale(0.95);
  }
  .mobile-sheet-grid i {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    font-style: normal;
    font-size: 0.9rem;
  }
  .mobile-sheet-grid strong {
    font-size: 0.68rem;
    line-height: 1.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 800px) {
  .mobile-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 2px;
    height: 76px !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    background: #fffffff7 !important;
    border-top: 1px solid var(--line) !important;
    box-shadow: 0 -12px 35px #17255418 !important;
  }
  .mobile-nav button {
    display: grid !important;
    place-items: center;
    gap: 3px;
    min-width: 0;
    height: 56px !important;
    padding: 4px 2px !important;
    background: transparent !important;
    color: #60708a !important;
    box-shadow: none !important;
    font-size: 0.67rem !important;
  }
  .mobile-nav button span {
    font-size: 1.3rem;
    line-height: 1;
  }
  .mobile-nav button small {
    font-size: 0.65rem;
    line-height: 1.2;
    font-weight: 700;
    white-space: nowrap;
  }
  .mobile-nav button.active {
    color: var(--primary) !important;
  }
  .mobile-nav .mobile-create {
    width: 54px !important;
    height: 54px !important;
    margin: -29px auto 0 !important;
    border-radius: 18px !important;
    background: linear-gradient(
      135deg,
      var(--primary),
      var(--accent)
    ) !important;
    color: #fff !important;
    box-shadow: 0 12px 25px color-mix(in srgb, var(--primary) 38%, transparent) !important;
  }
  .mobile-nav .mobile-create span {
    font-size: 1.85rem;
  }
  .mobile-menu-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    align-items: end;
    background: #0b142a80;
    backdrop-filter: blur(4px);
    padding: 12px;
  }
  .mobile-menu-overlay[hidden] {
    display: none !important;
  }
  .mobile-menu-sheet {
    width: min(100%, 620px);
    max-height: min(78dvh, 720px);
    margin: auto;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--card);
    box-shadow: 0 28px 70px #060b1b66;
    padding: 18px;
  }
  .mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }
  .mobile-menu-head h2 {
    margin: 4px 0 0;
    font-size: 1.25rem;
  }
  .mobile-menu-close {
    display: grid !important;
    place-items: center;
    width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 14px !important;
    background: var(--paper) !important;
    color: var(--ink) !important;
    font-size: 1.8rem !important;
    box-shadow: none !important;
  }
  .mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }
  .mobile-menu-grid button {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 6px;
    min-height: 82px;
    padding: 10px 5px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: none;
    font-size: 0.72rem;
  }
  .mobile-menu-grid button.selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--paper));
    color: var(--primary);
  }
  .mobile-menu-grid svg {
    width: 23px;
    height: 23px;
    color: var(--accent);
  }
  body.mobile-menu-open {
    overflow: hidden;
  }
  html[data-theme="dark"] .mobile-nav {
    background: #172136f7 !important;
  }
  html[data-theme="dark"] .mobile-menu-sheet {
    background: var(--card);
  }
  html[data-theme="dark"] .mobile-menu-grid button,
  html[data-theme="dark"] .mobile-menu-close {
    background: #24334c !important;
    color: var(--ink) !important;
  }
}
@media (max-width: 390px) {
  .mobile-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mobile-nav button small {
    font-size: 0.6rem;
  }
}

/* 1.0.35: richer operation flow and real-data analytics. */
.entry-steps {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}
.entry-steps span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.entry-steps span b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--muted);
}
.entry-steps span.done {
  color: var(--primary);
}
.entry-steps span.done b {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}
.entry-steps i {
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--line),
    color-mix(in srgb, var(--accent) 45%, var(--line))
  );
}
.analytics-suite {
  display: grid;
  gap: 18px;
}
.analytics-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary) 8%, var(--card)),
    var(--card)
  );
}
.analytics-hero h2,
.chart-card h2 {
  margin: 5px 0;
}
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}
.chart-card {
  min-width: 0;
}
.visual-bars {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, minmax(30px, 1fr));
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 30px;
  border-bottom: 1px solid var(--line);
}
.visual-bar {
  height: 100%;
  display: grid;
  grid-template-rows: 26px 1fr 28px;
  align-items: end;
  gap: 5px;
  text-align: center;
}
.visual-bar > div {
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  background: linear-gradient(
    180deg,
    transparent,
    color-mix(in srgb, var(--accent) 4%, transparent)
  );
  border-radius: 10px 10px 0 0;
}
.visual-bar i {
  display: block;
  width: min(34px, 68%);
  min-height: 7px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 20%, transparent);
  transition: height 0.4s ease;
}
.visual-bar strong {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
}
.visual-bar span {
  font-size: 0.72rem;
  font-weight: 700;
}
.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 22px;
  margin-top: 20px;
}
.donut {
  --fill: 0;
  display: grid;
  place-items: center;
  align-content: center;
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--card) 0 53%, transparent 54%),
    conic-gradient(
      var(--accent) calc(var(--fill) * 1%),
      color-mix(in srgb, var(--accent) 10%, var(--line)) 0
    );
  box-shadow: inset 0 0 0 1px var(--line);
}
.donut strong {
  font-size: 1.65rem;
}
.donut span {
  font-size: 0.72rem;
  color: var(--muted);
}
.legend {
  display: grid;
  gap: 10px;
}
.legend > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.legend .dot-1 {
  opacity: 0.8;
}
.legend .dot-2 {
  opacity: 0.6;
}
.legend .dot-3 {
  opacity: 0.4;
}
.chart-row span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-row .fund-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
@media (max-width: 800px) {
  .entry-steps {
    padding: 10px;
    gap: 5px;
    overflow: auto;
  }
  .entry-steps span {
    font-size: 0.68rem;
  }
  .entry-steps span b {
    width: 24px;
    height: 24px;
  }
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-hero {
    align-items: flex-start;
  }
  .visual-bars {
    height: 220px;
    gap: 5px;
  }
  .visual-bar strong {
    font-size: 0.52rem;
  }
  .donut-wrap {
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 14px;
  }
  .donut {
    width: 128px;
  }
  .donut strong {
    font-size: 1.3rem;
  }
}
@media (max-width: 430px) {
  .entry-steps span {
    font-size: 0;
  }
  .entry-steps span b {
    font-size: 0.7rem;
  }
  .visual-bars {
    height: 190px;
  }
  .donut-wrap {
    grid-template-columns: 1fr;
  }
  .donut {
    margin: auto;
  }
}
.dashboard-chart {
  margin-top: 18px;
}
.dashboard-chart .section-title {
  margin-bottom: 12px;
}
.spark-bars {
  height: 145px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  padding: 12px 8px 0;
  border-bottom: 1px solid var(--line);
}
.spark-bars > div {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 24px;
  align-items: end;
  justify-items: center;
}
.spark-bars i {
  display: block;
  width: min(38px, 68%);
  min-height: 8px;
  border-radius: 12px 12px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 18%, transparent);
}
.spark-bars span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}
@media print {
  .side,
  .mobile-nav,
  .top,
  .report-controls,
  .report-hero,
  .report-actions,
  button {
    display: none !important;
  }
  .shell,
  .content {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .report-output {
    border: 0 !important;
    box-shadow: none !important;
  }
  .report-output .scroll {
    overflow: visible !important;
  }
  .report-output table {
    width: 100%;
    font-size: 10pt;
  }
  .report-output th {
    background: #172554 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .report-output tr {
    break-inside: avoid;
  }
  .report-summary {
    border-bottom: 2px solid #172554;
    padding-bottom: 12px;
  }
}
/* Corporate identity */
.shell {
  position: relative;
  isolation: isolate;
}
.shell::before {
  content: "";
  position: fixed;
  inset: 18% 12% 8%;
  background: url("/brothers-logo-transparent.png") center/52vmin auto no-repeat;
  opacity: 0.035;
  pointer-events: none;
  z-index: 2;
  filter: grayscale(1);
}
.shell > .side,
.shell > .content,
.shell > .mobile-nav {
  position: relative;
  z-index: 1;
}
.top-page-logo {
  display: block;
  width: 154px;
  height: 62px;
  flex: none;
  object-fit: cover;
  object-position: center 49%;
  background: transparent;
}
.login-mmd-logo {
  width: 178px;
  height: 70px;
  object-fit: cover;
  object-position: center 49%;
  background: transparent;
}
.login-visual::before,
.login-form-wrap::before {
  content: "";
  position: absolute;
  inset: 12% 10%;
  background: url("/brothers-logo-transparent.png") center/72% auto no-repeat;
  pointer-events: none;
}
.login-visual::before {
  opacity: 0.12;
  filter: grayscale(1) brightness(0) invert(1);
}
.login-form-wrap {
  position: relative;
  isolation: isolate;
}
.login-form-wrap::before {
  opacity: 0.09;
  z-index: 0;
  filter: grayscale(1);
}
.login-form-wrap > *,
.login-visual > .login-brand,
.login-visual > .login-copy {
  position: relative;
  z-index: 1;
}
@media (max-width: 720px) {
  .top-page-logo {
    width: 108px;
    height: 46px;
  }
  .login-mmd-logo {
    width: 150px;
    height: 60px;
  }
  .shell::before {
    background-size: 72vmin;
  }
  .login-form-wrap::before {
    background-size: 86% auto;
  }
}

.login-card-logo {
  display: block;
  width: 190px;
  height: 74px;
  margin: 0 auto 18px;
  object-fit: cover;
  object-position: center 49%;
}
html[data-brand-mode="generic"] .top-page-logo,
html[data-brand-mode="generic"] .login-mmd-logo,
html[data-brand-mode="generic"] .login-card-logo {
  display: none !important;
}
html[data-brand-mode="generic"] .shell::before,
html[data-brand-mode="generic"] .login-visual::before,
html[data-brand-mode="generic"] .login-form-wrap::before {
  background-image: none !important;
}

/* 1.0.81: compact data entry, stable desktop navigation and predictable back flow. */
@media (min-width: 801px) {
  .shell {
    display: block;
    min-height: 100dvh;
  }
  .shell > .side {
    position: fixed;
    inset: 0 0 0 auto;
    width: 244px;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    z-index: 30;
  }
  .shell > .content {
    width: calc(100% - 244px);
    max-width: 1660px;
    margin: 0 244px 0 0;
  }
}
.top > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
}
.top > div:first-child h1,
.top > div:first-child .muted {
  grid-column: 2;
}
.page-back {
  grid-row: 1 / span 2;
  align-self: center;
  min-height: 38px;
  padding: 8px 11px;
  white-space: nowrap;
  box-shadow: none;
}
.entry-hero {
  margin-bottom: 12px;
  padding: 16px 20px;
}
.entry-hero h2 {
  margin: 2px 0 4px;
  font-size: 1.25rem;
}
.entry-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 0;
}
.entry-workspace .entry-panel {
  order: 2;
  padding: 20px;
}
.entry-workspace .entry-summary {
  order: 1;
  position: static;
  display: grid;
  grid-template-columns: auto repeat(3, minmax(140px, 1fr));
  align-items: center;
  gap: 0 18px;
  padding: 14px 18px;
  border-radius: 16px;
}
.entry-summary h3 {
  margin: 2px 0;
  font-size: 1rem;
}
.entry-summary > .eyebrow,
.entry-summary > h3 {
  grid-column: 1;
}
.entry-summary > .eyebrow {
  grid-row: 1;
}
.entry-summary > h3 {
  grid-row: 2;
}
.entry-summary > div {
  grid-row: 1 / span 2;
  display: grid;
  gap: 4px;
  padding: 2px 18px;
  border-top: 0;
  border-right: 1px solid #ffffff28;
}
.entry-summary > p {
  display: none;
}
.entry-panel .entry-form-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.entry-type-field {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
}
.entry-type-field select {
  min-height: 48px;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line)) !important;
  font-weight: 800;
}
.entry-type-helper {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
}
.entry-notes-field {
  grid-column: span 2 !important;
}
.entry-notes-field textarea {
  min-height: 76px;
  resize: vertical;
}
.entry-actions {
  position: static;
  grid-column: 3 !important;
  align-self: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--primary) 16%, transparent);
  backdrop-filter: blur(12px);
}
.entry-quick-save {
  width: 100%;
  min-height: 36px;
  margin-top: 9px;
  padding: 7px 12px;
  font-size: .78rem;
}
.entry-actions button {
  width: 100%;
  min-height: 48px;
}
.inline-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.inline-form-head h3 {
  margin: 0;
}
.appearance-settings .settings-wide {
  padding: 22px;
}
.appearance-settings .theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.appearance-settings .theme-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 12px;
  text-align: right;
}
.appearance-settings .theme-dot {
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px #ffffff55;
}
.appearance-settings .theme-copy {
  min-width: 0;
}
.appearance-settings .theme-copy strong,
.appearance-settings .theme-copy small {
  display: block;
}
.appearance-settings .theme-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .66rem;
}
.appearance-settings .theme-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: transparent;
  background: transparent;
  font-size: .72rem;
}
.appearance-settings .theme-card.selected .theme-check {
  color: #fff;
  background: var(--preview-primary);
}
.appearance-settings .segmented {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 3%, var(--paper));
}
.appearance-settings .segmented button {
  flex: 1 1 110px;
}
@media (max-width: 600px) {
  .appearance-settings .settings-wide { padding: 14px; }
  .appearance-settings .theme-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .appearance-settings .theme-card {
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    min-height: 60px;
    padding: 8px;
  }
  .appearance-settings .theme-dot { width: 28px; height: 28px; }
}
@media (max-width: 1100px) and (min-width: 801px) {
  .shell > .side { width: 210px; }
  .shell > .content { width: calc(100% - 210px); margin-right: 210px; }
  .entry-panel .entry-form-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-notes-field { grid-column: 1 / -1 !important; }
  .entry-actions { grid-column: 1 / -1 !important; }
}
@media (max-width: 800px) {
  .top > div:first-child {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .page-back span { display: none; }
  .page-back { min-width: 40px; padding: 7px; }
  .entry-hero {
    padding: 14px;
  }
  .entry-hero p { display: none; }
  .number-preview { padding: 10px 12px; }
  .entry-workspace .entry-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
  }
  .entry-summary > .eyebrow,
  .entry-summary > h3,
  .entry-summary > p { display: none; }
  .entry-summary > div {
    display: grid;
    gap: 3px;
    padding: 0;
    border: 0;
    text-align: center;
    font-size: .68rem;
  }
  .entry-summary strong { font-size: .72rem; }
  .entry-workspace .entry-panel { padding: 12px; }
  .entry-panel .entry-form-compact { grid-template-columns: 1fr; gap: 11px; }
  .entry-notes-field { grid-column: auto !important; }
  .entry-actions {
    position: static;
    grid-column: auto !important;
    padding: 7px;
  }
  .inline-form-head { align-items: flex-start; flex-direction: column; }
}
.mobile-module-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #0f172a99;
  backdrop-filter: blur(4px);
}
.mobile-module-sheet section {
  position: absolute;
  right: 10px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 10px;
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 24px 70px #0f172a4d;
}
.mobile-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.mobile-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.mobile-sheet-grid button {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  text-align: right;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 6%, var(--paper));
  border: 1px solid var(--line);
  box-shadow: none;
}
.mobile-sheet-grid span {
  color: var(--accent);
  font-size: 0.72rem;
}
@media (max-width: 800px) {
  .shell > .mobile-nav {
    position: fixed !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 1200 !important;
    height: calc(76px + env(safe-area-inset-bottom)) !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    border-radius: 22px 22px 0 0 !important;
    background: color-mix(in srgb, var(--card) 96%, transparent) !important;
    box-shadow: 0 -14px 38px color-mix(in srgb, var(--primary) 18%, transparent) !important;
    backdrop-filter: blur(18px);
  }
  .top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 16px;
  }
  .top > div:first-child {
    min-width: 0;
  }
  .top-page-logo {
    width: 92px;
    height: 42px;
  }
  .top .row {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }
  html[data-brand-mode="generic"] .top {
    grid-template-columns: 1fr;
  }
  .mobile-module-sheet {
    display: block;
  }
  .login-screen {
    min-height: 100dvh;
  }
  .login-visual {
    min-height: 210px;
    padding: 20px;
  }
  .login-copy {
    margin-top: 20px;
  }
  .login-copy h1 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 7vw, 2.1rem);
  }
  .login-form-wrap {
    padding: 12px 16px 28px;
  }
  .login-card {
    width: min(100%, 440px);
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 45px #17255412;
  }
}

/* Final mobile navigation layer: compact dock and compact three-column directory. */
@media (max-width: 800px) {
  .shell > .mobile-nav {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 1200 !important;
    height: calc(76px + env(safe-area-inset-bottom)) !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    border-radius: 22px 22px 0 0 !important;
    background: color-mix(in srgb, var(--card) 96%, transparent) !important;
    box-shadow: 0 -14px 38px color-mix(in srgb, var(--primary) 18%, transparent) !important;
    backdrop-filter: blur(18px);
  }
  .mobile-module-sheet section {
    right: 10px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: 10px;
    max-height: min(68dvh, 590px);
    padding: 15px;
    border-radius: 24px;
  }
  .mobile-sheet-head > div {
    display: grid;
    gap: 2px;
  }
  .mobile-sheet-head small {
    color: var(--accent);
    font-size: 0.67rem;
    font-weight: 700;
  }
  .mobile-sheet-head strong {
    font-size: 1.05rem;
  }
  .mobile-sheet-head [data-close] {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 13px;
    font-size: 1.35rem;
  }
  .mobile-sheet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-sheet-grid button {
    place-items: center;
    align-content: center;
    min-height: 76px;
    padding: 9px 5px;
    border-radius: 15px;
    text-align: center;
  }
  .mobile-sheet-grid i {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    font-style: normal;
    font-size: 0.9rem;
  }
  .mobile-sheet-grid strong {
    font-size: 0.68rem;
    line-height: 1.35;
  }
}
