:root {
  color-scheme: light;
  --brand-primary: #186CD7;
  --brand-black: #03091E;
  --brand-white: #FFFFFF;
  --brand-bg: #F5F8FC;
  --brand-border: #D8E3F0;
  --brand-text: #0D1B33;
  --brand-muted: #617087;
  --bg: var(--brand-bg);
  --surface: var(--brand-white);
  --surface-soft: #F8FAFC;
  --ink: var(--brand-text);
  --muted: var(--brand-muted);
  --line: var(--brand-border);
  --accent: var(--brand-primary);
  --accent-dark: #05388E;
  --accent-soft: #E7F1FF;
  --gold: #9A6700;
  --red: #DC2626;
  --green: #067647;
  --blue: #186CD7;
  --shadow: 0 18px 40px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

label[id*="RateLabel"]:not(#saleRateLabel):not(#purchaseRateLabel):not(#expenseRateLabel),
label[id*="FundingRateLabel"],
label:has(select[name="fundingCurrency"]),
label:has(input[name="fundingRate"]),
label:has(input[name="usdPreview"]),
label:has(input[name="afnPreview"]),
label:has(input[name="baseAmount"]) {
  display: none !important;
}

body.locked .sidebar,
body.locked .mobile-menu-toggle,
body.locked .mobile-sidebar,
body.locked .mobile-sidebar-overlay,
body.locked .app-shell {
  display: none;
}

body:not(.locked) .login-screen {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  overflow: auto;
  background:
    radial-gradient(circle at 13% 16%, rgba(24, 108, 215, .38), transparent 28%),
    radial-gradient(circle at 88% 80%, rgba(47, 93, 116, .26), transparent 30%),
    linear-gradient(138deg, #020612 0%, #03091E 50%, #061534 100%);
}

.login-screen::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -28%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.032) 0 1px, transparent 1px 58px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 58px);
  transform: rotate(-7deg);
  mask-image: radial-gradient(circle at center, #000 12%, transparent 73%);
}

.login-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 7%;
  top: 50%;
  width: min(650px, 68vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgba(255,255,255,.016),
    0 0 0 112px rgba(24,108,215,.024),
    0 0 160px rgba(24,108,215,.2);
}

.login-layout {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(350px, 400px);
  align-items: stretch;
  gap: clamp(20px, 3vw, 34px);
}

.daily-hadith-card,
.login-card {
  min-height: 560px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 28px;
  box-shadow: 0 34px 90px rgba(0,0,0,.42);
}

.daily-hadith-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(34px, 5vw, 62px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(3,9,30,.9), rgba(5,27,81,.84)),
    radial-gradient(circle at 12% 10%, rgba(24,108,215,.4), transparent 38%);
  backdrop-filter: blur(18px);
}

.daily-hadith-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255,255,255,.08), transparent 24%),
    radial-gradient(circle at 88% 90%, rgba(24,108,215,.22), transparent 32%);
}

.daily-hadith-card::after {
  content: "";
  position: absolute;
  right: -78px;
  bottom: -78px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255,255,255,.018), 0 0 0 70px rgba(24,108,215,.025);
}

.hadith-card-topline,
.daily-hadith-arabic,
.hadith-divider,
.hadith-meaning-label,
.daily-hadith-pashto,
.hadith-source {
  position: relative;
  z-index: 1;
}

.hadith-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(30px, 6vh, 52px);
}

.hadith-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.82);
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.hadith-day-mark {
  color: #41A4FF;
  font-size: 32px;
  line-height: 1;
}

.hadith-quote-mark {
  position: absolute;
  z-index: 0;
  left: clamp(24px, 4vw, 46px);
  top: clamp(104px, 17vh, 142px);
  color: rgba(24,108,215,.3);
  font-family: Georgia, serif;
  font-size: 150px;
  line-height: .7;
  user-select: none;
}

.daily-hadith-arabic {
  max-width: 680px;
  margin: 0;
  color: #fff;
  font-family: "Noto Naskh Arabic", "Traditional Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.55;
  text-align: right;
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0,0,0,.32);
}

.hadith-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(24px, 4vh, 38px) 0 20px;
}

.hadith-divider::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: #186CD7;
  box-shadow: 0 0 18px rgba(24,108,215,.72);
}

.hadith-divider span {
  width: min(150px, 34%);
  height: 1px;
  background: linear-gradient(90deg, rgba(24,108,215,.9), transparent);
}

.hadith-meaning-label {
  margin: 0 0 8px;
  color: #79BCFF;
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  text-align: right;
}

.daily-hadith-pashto {
  max-width: 690px;
  margin: 0;
  color: rgba(255,255,255,.92);
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: clamp(23px, 3vw, 31px);
  font-weight: 650;
  line-height: 1.65;
  text-align: right;
  text-wrap: balance;
}

.hadith-source {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  margin-top: auto;
  padding-top: 26px;
  color: rgba(255,255,255,.5);
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 13px;
}

.hadith-source strong {
  color: rgba(255,255,255,.82);
  font-weight: 700;
}

.login-card {
  position: relative;
  display: grid;
  align-content: center;
  gap: 15px;
  width: 100%;
  padding: clamp(28px, 4vw, 38px);
  overflow: hidden;
  border-color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.965);
  box-shadow:
    0 34px 90px rgba(0,0,0,.46),
    0 0 0 1px rgba(255,255,255,.12);
  backdrop-filter: blur(18px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #186CD7, #41A4FF 58%, #2563eb);
}

.login-card .brand-mark {
  margin-bottom: 2px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.login-logo {
  width: 118px;
  height: 118px;
  justify-self: center;
  border-radius: 19px;
  box-shadow:
    0 0 0 1px rgba(15,23,42,.1),
    0 16px 36px rgba(15,23,42,.16);
}

.login-card h1 {
  margin: 0;
  color: #101820;
  font-size: 25px;
  line-height: 1.18;
  text-align: center;
  letter-spacing: -.02em;
}

.login-card p {
  margin: 0;
  color: #64748b;
  line-height: 1.55;
  text-align: center;
}

.login-card > label {
  display: grid;
  gap: 7px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 800;
}

.login-card > label input {
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #fff;
  color: #0f172a;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.login-card > label input:focus {
  border-color: #186CD7;
  box-shadow: 0 0 0 4px rgba(24,108,215,.1);
}

.login-card > .primary-button {
  min-height: 49px;
  justify-content: center;
  margin-top: 2px;
  border-radius: 11px;
  background: linear-gradient(135deg, #186CD7, #05388E) !important;
  box-shadow: 0 13px 25px rgba(5,56,142,.24);
}

.login-card > .primary-button:hover,
.login-card > .primary-button:focus-visible {
  background: linear-gradient(135deg, #268CF1, #0B4AA6) !important;
  box-shadow: 0 16px 30px rgba(5,56,142,.3);
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}

.login-developer-footer {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 17px 12px;
  border: 1px solid #dbe6f3;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7faff, #eef5ff);
  color: #617087;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.login-developer-footer strong {
  color: #0D1B33;
  font-size: 17px;
}

.developer-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.6px; color: #617087; }
.developer-phones { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.developer-phones a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 8px; background: white; border: 1px solid #dbe6f3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.login-developer-footer svg { width: 14px; height: 14px; flex: 0 0 14px; }
.developer-email { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.developer-email span { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

.login-developer-footer a {
  color: #1150AD;
  font-weight: 750;
  text-decoration: none;
}

.login-developer-footer a:hover,
.login-developer-footer a:focus-visible {
  color: #186CD7;
  text-decoration: underline;
}

.login-connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 24px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.connection-dot,
.sync-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148,163,184,.14);
}

.login-connection-status[data-mode="online"] .connection-dot,
.sync-status[data-mode="online"] .sync-status-dot {
  background: #12a66a;
  box-shadow: 0 0 0 4px rgba(18,166,106,.14);
}

.login-connection-status[data-mode="offline"] .connection-dot,
.sync-status[data-mode="offline"] .sync-status-dot {
  background: #e08b14;
  box-shadow: 0 0 0 4px rgba(224,139,20,.16);
}

.login-connection-status[data-mode="syncing"] .connection-dot,
.sync-status[data-mode="syncing"] .sync-status-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.15);
  animation: connectivityPulse 1.15s ease-in-out infinite;
}

.login-connection-status[data-mode="conflict"] .connection-dot,
.sync-status[data-mode="conflict"] .sync-status-dot {
  background: #DC2626;
  box-shadow: 0 0 0 4px rgba(220,38,38,.14);
}

.sync-status {
  position: relative;
  z-index: auto;
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: none;
  padding: 9px 10px;
  border: 1px solid rgba(15,23,42,.11);
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: none;
}

body.locked .sync-status {
  display: none;
}

.sync-status-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.sync-status-copy strong {
  font-size: 12px;
  line-height: 1.2;
}

.sync-status-copy small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.sync-status[data-mode="online"] .sync-status-copy small {
  display: none;
}

.sync-status button {
  display: none;
  grid-column: 1 / -1;
  width: 100%;
  margin: 1px 0 0;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.sync-status[data-mode="offline"] button,
.sync-status[data-mode="conflict"] button {
  display: inline-flex;
}

.noscript-warning {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0f172a;
  color: #fff;
  font-size: 18px;
  text-align: center;
}

@keyframes connectivityPulse {
  0%, 100% { opacity: .55; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 780px) {
  body.locked {
    overflow: hidden;
  }

  .login-screen {
    place-items: start center;
    padding: 14px;
  }

  .login-screen::after {
    left: 50%;
    top: 12%;
    width: 92vw;
    transform: translateX(-50%);
  }

  .login-layout {
    width: min(470px, 100%);
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .daily-hadith-card,
  .login-card {
    min-height: 0;
    border-radius: 21px;
  }

  .daily-hadith-card {
    padding: 20px 22px;
  }

  .hadith-card-topline {
    margin-bottom: 14px;
  }

  .hadith-kicker {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 13px;
  }

  .hadith-day-mark {
    font-size: 25px;
  }

  .hadith-quote-mark {
    left: 15px;
    top: 70px;
    font-size: 88px;
  }

  .daily-hadith-arabic {
    font-size: clamp(22px, 7vw, 29px);
    line-height: 1.45;
  }

  .hadith-divider {
    margin: 12px 0 9px;
  }

  .hadith-meaning-label {
    margin-bottom: 3px;
    font-size: 12px;
  }

  .daily-hadith-pashto {
    font-size: clamp(17px, 5.3vw, 21px);
    line-height: 1.52;
  }

  .hadith-source {
    padding-top: 11px;
    font-size: 11px;
  }

  .login-card {
    gap: 10px;
    padding: 20px 22px;
  }

  .login-logo {
    width: 76px;
    height: 76px;
    border-radius: 14px;
  }

  .login-card h1 {
    font-size: 21px;
  }

  .login-card p {
    font-size: 13px;
  }

  .login-card > label input {
    min-height: 44px;
  }

  .login-card > .primary-button {
    min-height: 45px;
  }

  .mobile-sync-status {
    margin-top: 12px;
  }
}

@media (max-width: 390px) {
  .login-screen {
    padding: 9px;
  }

  .daily-hadith-card {
    padding: 16px 17px;
  }

  .login-card {
    padding: 17px;
  }

  .daily-hadith-arabic {
    font-size: 21px;
  }

  .daily-hadith-pashto {
    font-size: 17px;
  }
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  min-width: 220px;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--brand-black), #051B51);
  color: #f8fafc;
}

.mobile-menu-toggle,
.mobile-sidebar,
.mobile-sidebar-overlay {
  display: none;
}

.mobile-menu-toggle {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 950;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand-black);
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.12);
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 980;
  background: rgba(17, 17, 17, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.mobile-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 990;
  width: min(292px, 86vw);
  height: 100vh;
  padding: 16px;
  overflow-y: auto;
  background: var(--brand-white);
  color: var(--brand-black);
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 44px rgba(17, 17, 17, 0.18);
  transform: translateX(-104%);
  transition: transform 220ms ease;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar-head,
.mobile-brand {
  display: flex;
  align-items: center;
}

.mobile-sidebar-head {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.mobile-brand {
  gap: 10px;
}

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

.mobile-brand strong {
  font-size: 14px;
}

.mobile-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-menu-close {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--brand-black);
}

.mobile-menu-nav {
  display: grid;
  gap: 6px;
  padding: 14px 0 4px;
}

.mobile-menu-link {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 12px;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-black);
  font-weight: 700;
  text-align: left;
}

.mobile-menu-link svg,
.mobile-menu-close svg,
.mobile-menu-toggle svg {
  width: 20px;
  height: 20px;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
  border-color: var(--line);
  border-left-color: var(--brand-primary);
  background: var(--accent-soft);
  color: var(--brand-primary);
}

.mobile-logout-link {
  margin-top: 8px;
  color: var(--brand-primary);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-primary);
  color: var(--brand-white);
  font-weight: 800;
}

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

.brand span {
  margin-top: 2px;
  color: #cbd5dc;
  font-size: 12px;
}

.nav {
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar .sync-status {
  flex: 0 0 auto;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
  color: #ffffff;
}

.sidebar .sync-status-copy small {
  color: #bac9d1;
}

.sidebar .sync-status button {
  background: #186CD7;
}

.mobile-sidebar .sync-status {
  flex: 0 0 auto;
  background: #f8fafc;
}

.nav-button,
.icon-button,
.link-button,
.mini-button,
.secondary-button,
.primary-button,
.segment {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
}

.nav-button {
  justify-content: flex-start;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-left: 3px solid transparent;
  background: transparent;
  color: #d9e3e7;
}

.nav-button span {
  display: grid;
  gap: 2px;
  font-size: 14px;
  line-height: 1.2;
}

.dari-label,
.inline-dari,
th span,
.segment span {
  direction: rtl;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.dari-label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.inline-dari {
  color: var(--muted);
}

.nav-button small {
  color: #a9bbc3;
  font-size: 11px;
  line-height: 1.1;
}

.link-button > span,
.primary-button > span,
.secondary-button > span {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.link-button .dari-label,
.primary-button .dari-label,
.secondary-button .dari-label {
  color: inherit;
  font-size: 11px;
  opacity: 0.86;
  margin-top: 0;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(24, 108, 215, 0.14);
  border-left-color: var(--brand-primary);
  color: #ffffff;
}

.nav-button svg,
.icon-button svg,
.link-button svg,
.mini-button svg,
.secondary-button svg,
.primary-button svg,
.status-pill svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.side-actions {
  margin-top: 4px;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  background: #242424;
  color: #ffffff;
}

.icon-button:hover {
  background: var(--brand-primary);
}

.app-shell {
  min-height: 100vh;
  margin-left: 220px;
  padding: 20px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(29px, 2.4vw, 34px);
  line-height: 1.1;
}

.topbar h1::after,
.report-toolbar h2::after,
.panel-head h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--brand-primary);
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill,
.link-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

body[data-active-view="customer-sheet"] .topbar,
body[data-active-view="customer-detail"] .topbar,
body[data-active-view="people"] .topbar,
body[data-active-view="purchases"] .topbar,
body[data-active-view="sales"] .topbar,
body[data-active-view="supplier-detail"] .topbar {
  display: none;
}

body[data-active-view="customer-sheet"] .app-shell,
body[data-active-view="customer-detail"] .app-shell,
body[data-active-view="people"] .app-shell,
body[data-active-view="purchases"] .app-shell,
body[data-active-view="sales"] .app-shell,
body[data-active-view="supplier-detail"] .app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px;
}

body[data-active-view="customer-sheet"] #view-customer-sheet,
body[data-active-view="customer-detail"] #view-customer-detail,
body[data-active-view="people"] #view-people,
body[data-active-view="purchases"] #view-purchases,
body[data-active-view="sales"] #view-sales,
body[data-active-view="supplier-detail"] #view-supplier-detail {
  height: calc(100vh - 24px);
  overflow: hidden;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.compact-kpis {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.business-value-panel {
  margin-top: 16px;
}

.business-admin-panel h3 {
  margin: 0;
  color: var(--brand-black);
  font-size: 1rem;
}

.business-admin-panel .split-grid > section {
  min-width: 0;
}

.kpi {
  min-height: 108px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.kpi svg {
  color: var(--brand-primary);
}

.kpi span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 1.25vw, 24px);
  line-height: 1.15;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  letter-spacing: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dashboard-number,
.dashboard-number .tag,
.dashboard-number span {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: normal;
}

.dashboard-number .tag {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 14px;
}

.panel-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(20px, 1.5vw, 24px);
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.panel-actions,
.report-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.partner-account-actions {
  width: 100%;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.investment-actions {
  justify-content: flex-end;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.app-modal.hidden {
  display: none !important;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.58);
}

.app-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  box-shadow: 0 24px 70px rgba(17, 17, 17, 0.32);
}

.confirm-modal-card {
  position: relative;
  z-index: 1;
  width: min(360px, calc(100vw - 28px));
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(17, 17, 17, 0.32);
}

.confirm-modal-card .panel-head {
  min-height: 44px;
  padding: 8px 10px;
}

.confirm-modal-card h2 {
  font-size: 14px;
}

.compact-confirm-form {
  gap: 8px;
  padding: 10px;
}

.compact-confirm-form input {
  min-height: 34px;
  padding: 6px 9px;
}

.filter-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
}

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

.sale-mode-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px;
}

.sale-mode-control legend {
  color: var(--brand-black);
  font-size: 12px;
  font-weight: 900;
  padding: 0 6px;
}

.sale-mode-control label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-black);
  font-weight: 800;
  min-height: 34px;
  padding: 5px 11px 5px 7px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sale-mode-control input {
  appearance: none;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 2px solid var(--brand-black);
  border-radius: 50%;
  background: #ffffff;
  accent-color: var(--brand-primary);
  box-shadow: inset 0 0 0 4px #ffffff;
}

.sale-mode-control label:has(input:checked) {
  border-color: rgba(24, 108, 215, 0.72);
  background: var(--accent-soft);
  color: var(--brand-primary);
  box-shadow: 0 5px 14px rgba(24, 108, 215, 0.1);
}

.sale-mode-control input:checked {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
}

.multi-sale-fields {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
  overflow: hidden;
}

.compact-head {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.compact-head h3 {
  margin: 0;
  font-size: 15px;
}

.multi-sale-rows {
  display: grid;
  gap: 10px;
}

.multi-sale-header,
.multi-sale-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.55fr) minmax(58px, 0.48fr) minmax(82px, 0.72fr) minmax(88px, 0.78fr) minmax(40px, 44px);
  gap: 8px;
  min-width: 0;
}

.multi-sale-header {
  align-items: center;
  margin-bottom: 8px;
  padding: 0 10px;
  color: var(--brand-black);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.multi-sale-row {
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
}

.multi-sale-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.multi-sale-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 40px;
}

.row-add-button {
  border-color: rgba(24, 108, 215, 0.32);
  color: var(--brand-primary);
}

.multi-sale-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--brand-black);
}

.multi-sale-total strong {
  color: var(--brand-primary);
  font-size: 18px;
}

.mini-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--brand-black);
}

.mini-button.text-mini {
  width: auto;
  min-width: 0;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mini-button:hover {
  background: var(--accent-soft);
  color: var(--brand-primary);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.dashboard-position-grid,
.dashboard-filter-panel,
.dashboard-report-grid,
.pending-panel {
  margin-bottom: 14px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 14px;
}

#view-sales .section-grid {
  grid-template-columns: minmax(470px, 0.95fr) minmax(0, 1.05fr);
}

.two-forms {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  margin-bottom: 14px;
}

.three-forms {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.form-panel {
  align-self: start;
}

.wide-panel {
  min-width: 0;
}

.stacked-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.form-hint {
  margin: -4px 0 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--brand-black);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.expense-clear-options {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.expense-clear-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-black);
  font-weight: 700;
}

.expense-clear-toggle input {
  margin: 0;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.inline-search {
  width: min(320px, 100%);
  min-height: 44px;
  border-color: var(--brand-border);
  background: var(--brand-white);
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.05);
}

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

.primary-button {
  min-height: 44px;
  padding: 9px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--brand-black);
  background: var(--brand-white);
  color: var(--brand-black);
  font-weight: 700;
  font-size: 15px;
}

.secondary-button:hover {
  background: #fff5f5;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

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

.form-actions .primary-button,
.form-actions .secondary-button {
  flex: 1 1 130px;
}

.hidden {
  display: none !important;
}

input[readonly] {
  background: #F8FAFC;
  color: var(--brand-black);
  font-weight: 800;
}

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

.compact-table table {
  min-width: 360px;
}

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

#view-dashboard table {
  min-width: 520px;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-top: 3px solid var(--brand-primary);
  background: #F3F4F6;
  color: var(--brand-black);
  font-size: 12px;
  text-transform: uppercase;
}

th span {
  display: block;
  margin-top: 3px;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: none;
}

tbody tr:hover {
  background: #fff5f5;
}

.search-match-row td {
  background: #fff1f1;
  box-shadow: inset 4px 0 0 var(--brand-primary);
}

.filter-match-row td {
  background: #fff1f1;
}

.search-match-row .link-cell {
  color: var(--brand-black);
}

#view-customer-sheet,
#view-customer-detail {
  display: none;
}

#view-customer-sheet.active,
#view-customer-detail.active {
  display: block;
}

.customer-sheet-panel,
.customer-ledger-panel,
.supplier-sheet-panel,
.supplier-ledger-panel {
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.04);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customer-sheet-panel .panel-head,
.customer-ledger-panel .panel-head,
.supplier-sheet-panel .panel-head,
.supplier-ledger-panel .panel-head {
  min-height: 34px;
  padding: 4px 8px;
}

.customer-sheet-toolbar,
.customer-ledger-toolbar,
.supplier-sheet-toolbar,
.supplier-ledger-toolbar {
  border-top: 3px solid var(--brand-primary);
}

.customer-sheet-toolbar h2,
.customer-ledger-toolbar h2,
.supplier-sheet-toolbar h2,
.supplier-ledger-toolbar h2 {
  min-width: max-content;
  font-size: 14px;
  color: var(--brand-black);
}

.customer-ledger-toolbar .mini-button,
.supplier-ledger-toolbar .mini-button {
  width: 28px;
  height: 28px;
}

.customer-ledger-toolbar .mini-button.text-mini,
.supplier-ledger-toolbar .mini-button.text-mini {
  min-height: 28px;
  padding: 0 7px;
}

.customer-sheet-toolbar .panel-actions,
.customer-ledger-toolbar .panel-actions,
.supplier-sheet-toolbar .panel-actions,
.supplier-ledger-toolbar .panel-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.customer-sheet-toolbar .inline-search,
.supplier-sheet-toolbar .inline-search {
  width: min(360px, 44vw);
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 5px;
  box-shadow: none;
}

.customer-sheet-toolbar .primary-button,
.customer-sheet-toolbar .secondary-button,
.supplier-sheet-toolbar .primary-button,
.supplier-sheet-toolbar .secondary-button,
.ledger-entry-form .primary-button,
.ledger-entry-form .secondary-button,
.compact-filter-row .secondary-button {
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 12px;
}

.compact-action {
  min-height: 30px;
}

.currency-modal-card {
  max-width: 380px;
}

.cash-currency-list {
  display: grid;
  gap: 5px;
  font-size: 13px;
  line-height: 1.35;
}

.dashboard-cash-line {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.dashboard-cash-box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.stock-table-panel {
  min-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
}

.stock-toolbar {
  border-top: 3px solid var(--brand-primary);
  gap: 10px;
}

.stock-toolbar h2 {
  min-width: max-content;
  font-size: 16px;
}

.stock-toolbar .panel-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 8px;
}

.stock-toolbar .inline-search,
.stock-toolbar select,
.stock-toolbar label input {
  min-height: 34px;
  border-radius: 6px;
  box-shadow: none;
}

.stock-toolbar .inline-search {
  width: min(300px, 32vw);
}

.stock-toolbar select,
.stock-toolbar label {
  width: min(190px, 22vw);
}

.stock-toolbar label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.stock-toolbar label input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 6px 10px;
}

.expense-sheet-panel,
.roz-namcha-panel {
  gap: 12px;
}

.expense-table-panel,
.roz-namcha-table-panel {
  box-shadow: none;
}

.roz-namcha-panel .kpi-grid {
  margin-top: 4px;
}

.stock-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.stock-table {
  min-width: 1060px;
}

.product-modal-card {
  width: min(520px, 100%);
}

.purchase-invoice-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.5fr);
  gap: 16px;
}

.purchase-invoice-panel,
.purchase-transactions-panel {
  min-width: 0;
}

.purchase-transactions-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 150px);
}

.purchase-transactions-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.selector-field {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand-black);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-weight: 800;
}

.selector-field span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-invoice-summary {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-primary);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.purchase-invoice-summary strong {
  display: block;
  margin-bottom: 8px;
}

.purchase-invoice-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.purchase-invoice-summary div {
  min-width: 0;
}

.purchase-invoice-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.purchase-invoice-summary dd {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.purchase-expense-inline-list {
  display: grid;
  gap: 6px;
}

.purchase-expense-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--brand-black);
  font-size: 12px;
  font-weight: 800;
}

.purchase-expense-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

.picker-modal-card {
  width: min(760px, 100%);
}

.picker-search {
  width: 100%;
  margin: 0 0 10px;
}

.select-with-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.picker-select-row {
  cursor: pointer;
}

.picker-select-row:hover {
  background: #fff4f4;
}

.text-row-action {
  width: auto;
  min-width: 68px;
  padding: 0 10px;
  border-radius: 5px;
}

.purchase-transactions-table {
  min-width: 1120px;
}

.purchase-sheet-panel {
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.04);
  min-height: calc(100vh - 145px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.purchase-sheet-toolbar {
  border-top: 3px solid var(--brand-primary);
  min-height: 34px;
  padding: 4px 8px;
}

.purchase-sheet-toolbar h2 {
  min-width: max-content;
  font-size: 14px;
  color: var(--brand-black);
}

.sheet-toolbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.sheet-toolbar-actions .primary-button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
}

.purchase-sheet-controls {
  display: grid;
  grid-template-columns: repeat(8, minmax(92px, 1fr));
  gap: 7px;
  align-items: end;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.purchase-page-controls {
  grid-template-columns: minmax(180px, 1.5fr) repeat(2, minmax(120px, .8fr)) repeat(4, minmax(92px, auto));
  align-items: end;
}

.entry-modal-card {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

.entry-modal-card .panel-head {
  min-height: 40px;
  padding: 8px 10px;
}

.entry-modal-card h2 {
  font-size: 15px;
}

.popup-entry-form {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
}

.popup-entry-form .purchase-line-items {
  grid-column: 1 / -1;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.popup-entry-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.popup-entry-actions .primary-button,
.popup-entry-actions .secondary-button {
  min-height: 30px;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
}

.purchase-sheet-controls label {
  min-width: 0;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
}

.purchase-sheet-controls input,
.purchase-sheet-controls select,
.purchase-sheet-controls .selector-field {
  min-height: 30px;
  border-radius: 5px;
  font-size: 12px;
}

.purchase-sheet-controls input,
.purchase-sheet-controls select {
  padding: 4px 8px;
}

.purchase-sheet-controls .selector-field {
  padding: 4px 8px;
  font-weight: 800;
}

.purchase-sheet-controls .primary-button,
.purchase-sheet-controls .secondary-button,
.purchase-sheet-controls .mini-button {
  min-height: 30px;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
  justify-content: center;
  white-space: nowrap;
}

.purchase-inline-total {
  min-height: 30px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-primary);
  border-radius: 5px;
  padding: 4px 8px;
  color: var(--brand-black);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.purchase-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.sales-sheet-panel {
  min-height: calc(100vh - 145px);
}

.sales-sheet-controls {
  grid-template-columns: repeat(8, minmax(92px, 1fr));
}

#saleForm.sales-sheet-controls.popup-entry-form {
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(140px, 0.7fr);
  gap: 12px;
  align-items: end;
  width: 100%;
}

#saleForm.sales-sheet-controls.popup-entry-form label {
  min-width: 0;
}

#saleForm.sales-sheet-controls.popup-entry-form select,
#saleForm.sales-sheet-controls.popup-entry-form input,
#saleForm.sales-sheet-controls.popup-entry-form .selector-field {
  width: 100%;
  min-width: 0;
}

.purchase-line-items,
.multi-sale-fields {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.purchase-line-head,
.multi-sale-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.purchase-line-head-expense {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(76px, .55fr) minmax(94px, .7fr) minmax(108px, .8fr) auto;
}

.purchase-line-head strong,
.multi-sale-head strong {
  color: var(--brand-black);
  font-size: 13px;
}

.purchase-line-rows,
.multi-sale-rows {
  display: grid;
  gap: 6px;
}

.multi-sale-row,
.purchase-line-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(76px, .55fr) minmax(94px, .7fr) minmax(108px, .8fr) auto;
  gap: 6px;
  align-items: end;
}

.purchase-line-row-expense {
  grid-template-columns: minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(76px, .55fr) minmax(94px, .7fr) minmax(108px, .8fr) auto;
}

.multi-sale-row label,
.purchase-line-row label {
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
}

.multi-sale-row input,
.multi-sale-row select,
.purchase-line-row input,
.purchase-line-row select {
  min-height: 28px;
  width: 100%;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
}

.multi-sale-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  min-height: 28px;
}

.multi-sale-actions .mini-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 5px;
}

.purchase-line-total,
.multi-sale-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-primary);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.purchase-line-total strong,
.multi-sale-total strong {
  color: var(--brand-black);
  font-size: 14px;
  font-weight: 900;
}

.sales-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.sales-transactions-table {
  min-width: 1120px;
}

.purchase-expense-modal-card {
  width: min(460px, calc(100vw - 24px));
}

.compact-modal-form {
  gap: 10px;
}

.compact-modal-form input,
.compact-modal-form select {
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
}

.kpi-currency-lines {
  display: block;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 800;
}

.dashboard-cash-box {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: grid;
  align-content: start;
  gap: 0;
  min-width: 0;
}

.dashboard-cash-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.dashboard-cash-box strong {
  color: var(--brand-black);
  display: block;
  margin-top: 8px;
  max-width: 100%;
  font-size: clamp(20px, 1.25vw, 24px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}

.dashboard-profit-box small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.dashboard-cash-total-usd {
  background: #186CD7;
  border-color: #186CD7;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(24, 108, 215, 0.2);
}

.dashboard-cash-total-usd span,
.dashboard-cash-total-usd strong {
  color: #ffffff;
}

.dashboard-cash-modal-card {
  max-width: 380px;
}

.sheet-subbar {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 9px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
}

.sheet-subbar strong {
  color: var(--brand-black);
  font-size: 13px;
}

.sheet-table {
  min-width: 0;
  border-collapse: collapse;
}

.sheet-table th,
.sheet-table td {
  height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.25;
}

.sheet-table th {
  position: static;
  border-top: 0;
  background: #F3F4F6;
  color: var(--brand-black);
  font-size: 11px;
}

.sheet-table th span {
  display: none;
}

.sheet-table .row-action {
  width: 28px;
  height: 28px;
  border-radius: 5px;
}

.sheet-table .row-action svg {
  width: 14px;
  height: 14px;
}

.customer-main-table,
.customer-ledger-table,
.supplier-main-table,
.supplier-ledger-table {
  width: 100%;
}

.supplier-main-table th:nth-child(1) { width: 20%; }
.supplier-main-table th:nth-child(2) { width: 10%; }
.supplier-main-table th:nth-child(3) { width: 11%; }
.supplier-main-table th:nth-child(4),
.supplier-main-table th:nth-child(5),
.supplier-main-table th:nth-child(6),
.supplier-main-table th:nth-child(7) { width: 10%; }
.supplier-main-table th:nth-child(8) { width: 9%; }
.supplier-main-table th:nth-child(9) { width: 10%; }

.supplier-ledger-table th:nth-child(1) { width: 9%; }
.supplier-ledger-table th:nth-child(2) { width: 8%; }
.supplier-ledger-table th:nth-child(3) { width: 23%; }
.supplier-ledger-table th:nth-child(4),
.supplier-ledger-table th:nth-child(5),
.supplier-ledger-table th:nth-child(6),
.supplier-ledger-table th:nth-child(7),
.supplier-ledger-table th:nth-child(8) { width: 10%; }
.supplier-ledger-table th:nth-child(9) { width: 6%; }
.supplier-ledger-table th:nth-child(10) { width: 6%; }

.customer-main-table th:nth-child(1) { width: 28%; }
.customer-main-table th:nth-child(2) { width: 16%; }
.customer-main-table th:nth-child(3) { width: 28%; }
.customer-main-table th:nth-child(4) { width: 12%; }
.customer-main-table th:nth-child(5) { width: 16%; }

.customer-ledger-table th:nth-child(1) { width: 11%; }
.customer-ledger-table th:nth-child(2) { width: 10%; }
.customer-ledger-table th:nth-child(3) { width: 27%; }
.customer-ledger-table th:nth-child(4),
.customer-ledger-table th:nth-child(5),
.customer-ledger-table th:nth-child(6) { width: 12%; }
.customer-ledger-table th:nth-child(7) { width: 8%; }
.customer-ledger-table th:nth-child(8) { width: 8%; }

.customer-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(430px, calc(100vh - 315px));
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
}

.customer-ledger-table-wrap {
  max-height: min(420px, calc(100vh - 330px));
}

body[data-active-view="customer-sheet"] .customer-table-wrap,
body[data-active-view="customer-detail"] .customer-ledger-table-wrap,
body[data-active-view="people"] .supplier-table-wrap,
body[data-active-view="supplier-detail"] .supplier-ledger-table-wrap {
  max-height: none;
}

.customer-table-wrap .sheet-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #F3F4F6;
}

.sheet-summary {
  width: min(420px, 100%);
  margin: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  flex: 0 0 auto;
}

.ledger-summary {
  margin-top: 10px;
}

.sheet-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
}

.sheet-summary-head strong {
  color: var(--brand-black);
}

.sheet-summary .table-wrap {
  max-height: 150px;
  overflow: auto;
}

.sheet-summary-table {
  min-width: 0 !important;
}

.sheet-summary-table th,
.sheet-summary-table td {
  height: 24px;
  padding: 3px 8px;
  font-size: 11px;
}

.ledger-info-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.ledger-info-row .kpi {
  min-height: 0;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.ledger-info-row .kpi:last-child {
  border-right: 0;
}

.ledger-info-row .kpi span {
  font-size: 11px;
}

.ledger-info-row .kpi strong {
  margin-top: 4px;
  font-size: 14px;
}

.ledger-info-row .kpi small {
  margin-top: 2px;
  font-size: 11px;
}

.compact-filter-row {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
  align-items: end;
}

.compact-filter-row label {
  min-width: 150px;
  max-width: 190px;
  gap: 4px;
  font-size: 11px;
}

.compact-filter-row input {
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 5px;
}

.ledger-entry-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 0.8fr) minmax(92px, 0.55fr) minmax(130px, 0.75fr) minmax(110px, 0.65fr) minmax(180px, 1.4fr) auto;
  gap: 8px;
  align-items: end;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.ledger-entry-form label {
  min-width: 0;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
}

.ledger-entry-form input,
.ledger-entry-form select {
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 5px;
}

.ledger-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.ledger-actions .primary-button,
.ledger-actions .secondary-button {
  flex: 0 0 auto;
}

.total-row td {
  background: #fff0f0;
  color: var(--brand-black);
  font-weight: 800;
}

.action-buttons {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.link-cell {
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-primary);
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-cell:hover {
  color: var(--brand-black);
  background: transparent;
}

.attachment-link {
  color: var(--brand-primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}

.attachment-link:hover {
  color: var(--brand-black);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
}

.row-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #ffffff;
  color: #41515e;
}

.row-action:hover {
  background: var(--accent-soft);
  color: var(--brand-primary);
}

.row-action.print-action {
  color: var(--brand-black);
  border-color: var(--brand-border);
}

.row-action.print-action:hover {
  background: #fff5f5;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.row-action.danger {
  color: var(--red);
}

.row-action svg {
  width: 16px;
  height: 16px;
}

.amount {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.text-danger {
  color: var(--brand-primary) !important;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-black);
  font-size: 12px;
  font-weight: 700;
}

.tag.good {
  background: #dcfae6;
  color: var(--green);
}

.tag.warn {
  background: #fef0c7;
  color: var(--brand-primary);
}

.tag.bad {
  background: #fee4e2;
  color: var(--red);
}

.primary-button,
.icon-button:hover,
.row-action.danger,
.dashboard-cash-total-usd,
.tag.red,
.tag.danger,
.badge-red,
.bg-red,
.btn-red,
.active-red,
.red-card,
.red-header,
[class*="red-card"],
[class*="red-header"],
[style*="background: #186CD7"],
[style*="background:#186CD7"],
[style*="background: var(--brand-primary)"],
[style*="background:var(--brand-primary)"] {
  color: #ffffff !important;
}

.primary-button *,
.icon-button:hover *,
.row-action.danger *,
.dashboard-cash-total-usd *,
.tag.red *,
.tag.danger *,
.badge-red *,
.bg-red *,
.btn-red *,
.active-red *,
.red-card *,
.red-header *,
[class*="red-card"] *,
[class*="red-header"] *,
[style*="background: #186CD7"] *,
[style*="background:#186CD7"] *,
[style*="background: var(--brand-primary)"] *,
[style*="background:var(--brand-primary)"] * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

@media print {
  .sidebar,
  .navbar,
  .topbar,
  .actions,
  .btn,
  button,
  .row-action,
  .mini-button,
  .primary-button,
  .secondary-button,
  .button-row,
  .panel-actions,
  .mobile-menu-toggle,
  .mobile-sidebar,
  .mobile-sidebar-overlay,
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #111111 !important;
    font-family: "DejaVu Sans", "Noto Sans Arabic", Arial, sans-serif;
  }

  .print-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th,
  td {
    border: 1px solid #D9E1E6;
    padding: 7px;
    font-size: 11px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
  }

  th {
    background: #186CD7 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    size: A4;
    margin: 12mm;
  }
}

.simple-summary {
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  color: var(--brand-text);
  line-height: 1.8;
  padding: 10px 12px;
}

.simple-summary strong {
  color: var(--brand-black);
}

.summary-separator {
  color: var(--brand-muted);
}

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

.report-toolbar h2 {
  margin: 0;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.segment {
  min-width: 92px;
  padding: 9px 12px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  flex-direction: column;
  gap: 1px;
  line-height: 1.1;
  font-weight: 700;
}

.segment span {
  font-size: 11px;
  opacity: 0.82;
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment.active {
  background: var(--accent);
  color: #ffffff;
}

.schema-grid,
.partner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.schema-item,
.partner-item {
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.schema-item strong,
.partner-item strong {
  display: block;
  font-size: 14px;
}

.schema-item span,
.partner-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.schema-item .dari {
  margin-top: 8px;
  color: var(--brand-primary);
  direction: rtl;
  text-align: left;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  min-height: 42px;
  display: none;
  align-items: center;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--brand-black);
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity: 0;
}

.toast.show {
  display: flex;
  animation: toastWorked 0.28s ease-out forwards;
}

.toast.success {
  border-left: 5px solid var(--brand-primary);
}

button.is-loading {
  cursor: wait;
  opacity: 0.78;
}

button.is-loading svg {
  animation: spinOnce 0.8s linear infinite;
}

.panel.worked {
  animation: workedPulse 0.85s ease-out;
}

@keyframes spinOnce {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastWorked {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes workedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(24, 108, 215, 0.34), var(--shadow);
    transform: translateY(0);
  }
  45% {
    box-shadow: 0 0 0 6px rgba(24, 108, 215, 0.11), 0 16px 38px rgba(17, 17, 17, 0.14);
    transform: translateY(-1px);
  }
  100% {
    box-shadow: var(--shadow);
    transform: translateY(0);
  }
}

.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;
}

@media (min-width: 1181px) {
  .kpi-grid,
  .compact-kpis,
  .dashboard-cash-box-grid {
    grid-template-columns: repeat(6, minmax(160px, 1fr));
  }

  #view-dashboard #dashboardKpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  #view-dashboard #dashboardCashBoxes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1350px) {
  .kpi-grid,
  .compact-kpis,
  .dashboard-cash-box-grid {
    grid-template-columns: repeat(5, minmax(170px, 1fr));
  }

  #view-dashboard #dashboardKpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  #view-dashboard #dashboardCashBoxes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .kpi-grid,
  .compact-kpis,
  .dashboard-cash-box-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
  }

  #view-dashboard #dashboardKpis,
  #view-dashboard #dashboardCashBoxes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi strong,
  .dashboard-cash-box strong {
    font-size: clamp(22px, 1.45vw, 25px);
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .split-grid,
  .section-grid,
  #view-sales .section-grid,
  .two-forms {
    grid-template-columns: 1fr;
  }

  .purchase-sheet-controls,
  .sales-sheet-controls {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .purchase-page-controls,
  .popup-entry-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .multi-sale-row,
  .purchase-line-row {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .multi-sale-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1150px) {
  .kpi-grid,
  .compact-kpis,
  .dashboard-cash-box-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
  }

  #view-dashboard #dashboardKpis,
  #view-dashboard #dashboardCashBoxes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi strong,
  .dashboard-cash-box strong {
    font-size: clamp(22px, 2vw, 25px);
  }
}

@media (max-width: 767px) {
  body.mobile-menu-open {
    overflow: hidden;
  }

  body:not(.locked) .mobile-menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  body:not(.locked) .mobile-sidebar,
  body:not(.locked) .mobile-sidebar-overlay {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding: 72px 12px 16px;
  }

  body[data-active-view="customer-sheet"] .app-shell,
  body[data-active-view="customer-detail"] .app-shell,
  body[data-active-view="people"] .app-shell,
  body[data-active-view="purchases"] .app-shell,
  body[data-active-view="sales"] .app-shell,
  body[data-active-view="supplier-detail"] .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 72px 12px 16px;
  }

  body[data-active-view="customer-sheet"] #view-customer-sheet,
  body[data-active-view="customer-detail"] #view-customer-detail,
  body[data-active-view="people"] #view-people,
  body[data-active-view="purchases"] #view-purchases,
  body[data-active-view="sales"] #view-sales,
  body[data-active-view="supplier-detail"] #view-supplier-detail {
    height: auto;
    overflow: visible;
  }

  .customer-sheet-panel,
  .customer-ledger-panel,
  .supplier-sheet-panel,
  .supplier-ledger-panel {
    height: auto;
  }

  .topbar,
  .report-toolbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.18;
  }

  .topbar p {
    font-size: 13px;
  }

  .purchase-sheet-controls,
  .sales-sheet-controls,
  .purchase-page-controls,
  .popup-entry-form,
  .multi-sale-row,
  .purchase-line-row {
    grid-template-columns: 1fr;
  }

  .sheet-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .entry-modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .popup-entry-form {
    max-height: calc(100vh - 74px);
    padding: 8px;
  }

  .popup-entry-actions {
    flex-direction: column;
  }

  .purchase-line-items,
  .multi-sale-fields {
    padding: 8px 6px;
  }

  .purchase-line-total,
  .multi-sale-total {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .topbar-actions,
  .panel-actions,
  .report-actions,
  .filter-row,
  .form-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions > *,
  .panel-actions > *,
  .filter-row > *,
  .form-actions > * {
    max-width: 100%;
  }

  .link-button,
  .primary-button,
  .secondary-button,
  .mini-button {
    min-height: 42px;
    white-space: normal;
  }

  .kpi-grid,
  .compact-kpis,
  .dashboard-cash-box-grid,
  .detail-grid,
  .schema-grid,
  .partner-grid {
    grid-template-columns: 1fr;
  }

  .multi-sale-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }

  .multi-sale-row label:first-child {
    grid-column: 1 / -1;
  }

  .multi-sale-actions {
    align-self: end;
  }

  .multi-sale-header {
    display: none;
  }

  .multi-sale-actions {
    justify-content: flex-end;
  }

  .panel,
  .report-toolbar {
    padding: 14px;
  }

  .customer-sheet-panel,
  .customer-ledger-panel,
  .supplier-sheet-panel,
  .supplier-ledger-panel {
    padding: 0;
  }

  .customer-sheet-toolbar,
  .customer-ledger-toolbar,
  .supplier-sheet-toolbar,
  .supplier-ledger-toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .customer-sheet-toolbar h2,
  .customer-ledger-toolbar h2,
  .supplier-sheet-toolbar h2,
  .supplier-ledger-toolbar h2 {
    min-width: 0;
  }

  .customer-sheet-toolbar .panel-actions,
  .customer-ledger-toolbar .panel-actions,
  .supplier-sheet-toolbar .panel-actions,
  .supplier-ledger-toolbar .panel-actions {
    width: 100%;
  }

  .customer-sheet-toolbar .inline-search,
  .supplier-sheet-toolbar .inline-search {
    width: 100%;
  }

  .sheet-subbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stock-toolbar {
    align-items: stretch;
  }

  .stock-toolbar h2 {
    min-width: 0;
  }

  .stock-toolbar .panel-actions {
    width: 100%;
  }

  .stock-toolbar .inline-search,
  .stock-toolbar select,
  .stock-toolbar label {
    width: 100%;
  }

  .purchase-invoice-layout {
    grid-template-columns: 1fr;
  }

  .purchase-sheet-panel {
    min-height: auto;
  }

  .purchase-sheet-toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .purchase-sheet-toolbar h2 {
    min-width: 0;
  }

  .purchase-sheet-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-sheet-controls .inline-search,
  .purchase-sheet-controls .primary-button,
  .purchase-sheet-controls .secondary-button,
  .purchase-sheet-controls .mini-button {
    width: 100%;
  }

  .purchase-invoice-summary dl {
    grid-template-columns: 1fr;
  }

  .kpi strong,
  .dashboard-cash-box strong {
    font-size: clamp(20px, 6vw, 24px);
  }

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

  .ledger-info-row .kpi:nth-child(2n) {
    border-right: 0;
  }

  .ledger-info-row .kpi {
    border-bottom: 1px solid var(--line);
  }

  .compact-filter-row {
    align-items: stretch;
  }

  .compact-filter-row label {
    flex: 1 1 140px;
    min-width: 0;
    max-width: none;
  }

  .ledger-entry-form {
    grid-template-columns: 1fr 1fr;
  }

  .ledger-entry-form label:first-child,
  .ledger-entry-form label:nth-child(6),
  .ledger-actions {
    grid-column: 1 / -1;
  }

  .ledger-actions {
    justify-content: flex-start;
  }

  .sheet-summary {
    width: auto;
    margin: 8px;
  }

  .customer-main-table,
  .customer-ledger-table,
  .supplier-main-table,
  .supplier-ledger-table {
    min-width: 0;
  }

  .customer-main-table thead,
  .customer-ledger-table thead,
  .supplier-main-table thead,
  .supplier-ledger-table thead {
    display: none;
  }

  .customer-main-table,
  .customer-main-table tbody,
  .customer-main-table tr,
  .customer-main-table td,
  .customer-ledger-table,
  .customer-ledger-table tbody,
  .customer-ledger-table tr,
  .customer-ledger-table td,
  .supplier-main-table,
  .supplier-main-table tbody,
  .supplier-main-table tr,
  .supplier-main-table td,
  .supplier-ledger-table,
  .supplier-ledger-table tbody,
  .supplier-ledger-table tr,
  .supplier-ledger-table td {
    display: block;
    width: 100%;
  }

  .customer-main-table tr,
  .customer-ledger-table tr,
  .supplier-main-table tr,
  .supplier-ledger-table tr {
    margin: 8px;
    width: calc(100% - 16px);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand-primary);
    background: #ffffff;
  }

  .customer-main-table td,
  .customer-ledger-table td,
  .supplier-main-table td,
  .supplier-ledger-table td {
    min-height: 30px;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    padding: 6px 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .customer-main-table td:last-child,
  .customer-ledger-table td:last-child,
  .supplier-main-table td:last-child,
  .supplier-ledger-table td:last-child {
    border-bottom: 0;
  }

  .customer-main-table td::before,
  .customer-ledger-table td::before,
  .supplier-main-table td::before,
  .supplier-ledger-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .customer-main-table td:nth-child(1)::before { content: "Customer"; }
  .customer-main-table td:nth-child(2)::before { content: "Phone"; }
  .customer-main-table td:nth-child(3)::before { content: "Address"; }
  .customer-main-table td:nth-child(4)::before { content: "User"; }
  .customer-main-table td:nth-child(5)::before { content: "Download"; }

  .customer-ledger-table td:nth-child(1)::before { content: "Date"; }
  .customer-ledger-table td:nth-child(2)::before { content: "Type"; }
  .customer-ledger-table td:nth-child(3)::before { content: "Details"; }
  .customer-ledger-table td:nth-child(4)::before { content: "Sales / Paid"; }
  .customer-ledger-table td:nth-child(5)::before { content: "Received"; }
  .customer-ledger-table td:nth-child(6)::before { content: "Balance"; }
  .customer-ledger-table td:nth-child(7)::before { content: "Currency"; }
  .customer-ledger-table td:nth-child(8)::before { content: "Action"; }

  .supplier-main-table td:nth-child(1)::before { content: "Supplier"; }
  .supplier-main-table td:nth-child(2)::before { content: "Phone"; }
  .supplier-main-table td:nth-child(3)::before { content: "Country"; }
  .supplier-main-table td:nth-child(4)::before { content: "Purchases"; }
  .supplier-main-table td:nth-child(5)::before { content: "Expense"; }
  .supplier-main-table td:nth-child(6)::before { content: "Paid"; }
  .supplier-main-table td:nth-child(7)::before { content: "Balance"; }
  .supplier-main-table td:nth-child(8)::before { content: "User"; }
  .supplier-main-table td:nth-child(9)::before { content: "Download"; }

  .supplier-ledger-table td:nth-child(1)::before { content: "Date"; }
  .supplier-ledger-table td:nth-child(2)::before { content: "Type"; }
  .supplier-ledger-table td:nth-child(3)::before { content: "Details"; }
  .supplier-ledger-table td:nth-child(4)::before { content: "Purchased"; }
  .supplier-ledger-table td:nth-child(5)::before { content: "Expense"; }
  .supplier-ledger-table td:nth-child(6)::before { content: "Paid"; }
  .supplier-ledger-table td:nth-child(7)::before { content: "Received"; }
  .supplier-ledger-table td:nth-child(8)::before { content: "Balance"; }
  .supplier-ledger-table td:nth-child(9)::before { content: "Currency"; }
  .supplier-ledger-table td:nth-child(10)::before { content: "Action"; }

  .customer-main-table .amount,
  .customer-ledger-table .amount,
  .supplier-main-table .amount,
  .supplier-ledger-table .amount {
    text-align: left;
  }

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

  .section-grid,
  #view-sales .section-grid,
  .split-grid,
  .two-forms {
    grid-template-columns: minmax(0, 1fr);
  }

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

  table {
    min-width: 680px;
  }

  #view-dashboard table {
    min-width: 560px;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1;
    min-width: 112px;
  }
}

/* United Mobile branding: white text and icons on primary-color UI surfaces */
.primary-button,
.primary-button *,
.nav-button.active,
.nav-button.active *,
.mobile-menu-link.active,
.mobile-menu-link.active *,
.red-card,
.red-card *,
.cash-total,
.cash-total *,
.bg-red,
.bg-red *,
.btn-red,
.btn-red *,
.red-header,
.red-header *,
.sheet-table thead th,
.sheet-table thead th *,
.invoice-table thead th,
.invoice-table thead th *,
.tag.danger,
.tag.danger *,
.badge.danger,
.badge.danger * {
  color: #fff !important;
  fill: none;
  stroke: #fff !important;
}

.primary-button svg,
.nav-button.active svg,
.mobile-menu-link.active svg,
.red-card svg,
.cash-total svg,
.bg-red svg,
.btn-red svg,
.red-header svg {
  color: #fff !important;
  stroke: #fff !important;
}

/* Keep red buttons readable during hover/focus states */
.primary-button:hover,
.primary-button:focus-visible,
.btn-red:hover,
.btn-red:focus-visible {
  color: #fff !important;
}

/* Customer action buttons in main customer sheet */
#customerSheetRows .action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Final table/readability and action icon fixes */
.table-wrap,
.table-wrapper,
.panel table {
  overflow-x: auto;
}

table th,
.sheet-table th,
.data-table th,
.partner-accounts-table th,
.investment-table th {
  color: #000000 !important;
  font-weight: 800 !important;
}

table td,
.sheet-table td,
.data-table td,
.partner-accounts-table td,
.investment-table td {
  color: #111111 !important;
}

/* Keep readable white text only on red/dark backgrounds */
table th[style*="background: var(--brand-primary)"],
table th[style*="background:#186CD7"],
table th[style*="background: #186CD7"],
.red-header th,
.bg-red th,
.btn-red,
.btn-red *,
.primary-button,
.primary-button *,
.active-red,
.active-red *,
.red-card,
.red-card *,
.dashboard-cash-total-usd,
.dashboard-cash-total-usd * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Actions column must have enough room and never hide icons */
th:last-child,
td:last-child,
th.actions,
td.actions {
  min-width: 150px;
  white-space: nowrap;
}

td:last-child .action-buttons,
td.actions .action-buttons,
.action-buttons {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.row-action,
.action-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #d9e1ea !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #111111 !important;
  overflow: visible !important;
}

.row-action:hover,
.action-btn:hover {
  background: #fff5f5 !important;
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}

.row-action.danger,
.action-btn.danger,
.row-action.delete,
.action-btn.delete {
  color: var(--brand-primary) !important;
  background: #ffffff !important;
}

.row-action svg,
.row-action i,
.action-btn svg,
.action-btn i {
  width: 16px !important;
  height: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: currentColor !important;
  stroke: currentColor !important;
  fill: none;
}

/* Safe icon fallback if Lucide CDN does not load or icons are not hydrated */
i[data-lucide]::before {
  display: inline-block;
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  color: currentColor;
}

i[data-lucide="eye"]::before { content: "👁"; }
i[data-lucide="pencil"]::before { content: "✎"; }
i[data-lucide="trash-2"]::before { content: "🗑"; }
i[data-lucide="printer"]::before { content: "⎙"; }
i[data-lucide="file-down"]::before { content: "⇩"; }
i[data-lucide="plus"]::before { content: "+"; }
i[data-lucide="x"]::before { content: "×"; }

@media (max-width: 900px) {
  #saleForm.sales-sheet-controls.popup-entry-form {
    grid-template-columns: 1fr;
  }

  th:last-child,
  td:last-child,
  th.actions,
  td.actions {
    min-width: 140px;
  }

  .row-action,
  .action-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }
}


/* FINAL FIX: table header readability and action icon reliability */
.table-wrap table th,
.compact-table table th,
.sheet-table th,
.stock-table th,
.purchase-transactions-table th,
.sales-transactions-table th,
.customer-main-table th,
.customer-ledger-table th,
.supplier-main-table th,
.supplier-ledger-table th,
.investment-table th,
.partner-table th,
table thead th,
table th {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  font-weight: 800 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

/* Keep white text only when the real table header background is red/dark */
table th.red-header,
table th.bg-red,
table thead.red-header th,
table thead.bg-red th,
table.table-red th,
table.table-dark th,
.red-table th,
.dark-table th {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Robust action button/icon rendering in all table action columns */
.action-buttons,
td:last-child .action-buttons,
td.actions .action-buttons {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 7px !important;
  flex-wrap: nowrap !important;
  min-width: max-content !important;
}

.row-action,
.action-btn,
button.row-action {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  max-width: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #d8e0ea !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #111827 !important;
  -webkit-text-fill-color: currentColor !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  overflow: visible !important;
  opacity: 1 !important;
}

.row-action.danger,
.action-btn.danger,
button.row-action.danger {
  color: #186CD7 !important;
  -webkit-text-fill-color: #186CD7 !important;
}

.row-action svg,
.action-btn svg,
button.row-action svg,
.row-action i,
.action-btn i,
button.row-action i {
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  min-height: 17px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: currentColor !important;
  stroke: currentColor !important;
  fill: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* If Lucide JS/CDN fails, show a simple built-in icon instead of empty squares */
.row-action i[data-lucide]::before,
.action-btn i[data-lucide]::before,
button.row-action i[data-lucide]::before {
  content: "•";
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 17px;
  height: 17px;
  color: currentColor !important;
  -webkit-text-fill-color: currentColor !important;
  font-family: Arial, sans-serif !important;
  font-style: normal !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  line-height: 1 !important;
}
.row-action i[data-lucide="eye"]::before { content: "◉"; }
.row-action i[data-lucide="pencil"]::before { content: "✎"; }
.row-action i[data-lucide="trash-2"]::before { content: "×"; }
.row-action i[data-lucide="printer"]::before { content: "⎙"; }
.row-action i[data-lucide="file-down"]::before { content: "⇩"; }
.row-action i[data-lucide="plus"]::before { content: "+"; }
.row-action i[data-lucide="x"]::before { content: "×"; }

.table-wrap,
.sheet-table-wrap,
.stock-table-wrap,
.sales-table-wrap,
.purchase-table-wrap,
.sales-transactions-table-wrap,
.purchase-transactions-table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

th:last-child,
td:last-child,
th.actions,
td.actions {
  min-width: 150px !important;
  width: 150px;
  white-space: nowrap !important;
}

@media (max-width: 768px) {
  th:last-child,
  td:last-child,
  th.actions,
  td.actions {
    min-width: 132px !important;
    width: 132px;
  }
  .row-action,
  .action-btn,
  button.row-action {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }
}

/* FINAL UI FIX: readable light tables and reliable action icons */
table thead th,
.data-table thead th,
.table thead th,
.transactions-table thead th,
.ledger-table thead th,
.sheet-table thead th,
.purchase-transactions-table thead th,
.sales-transactions-table thead th,
.customer-main-table thead th,
.customer-ledger-table thead th,
.supplier-main-table thead th,
.supplier-ledger-table thead th,
.partner-accounts-table thead th,
.investment-table thead th {
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

table tbody td,
.data-table tbody td,
.table tbody td,
.transactions-table tbody td,
.ledger-table tbody td,
.sheet-table tbody td,
.purchase-transactions-table tbody td,
.sales-transactions-table tbody td,
.customer-main-table tbody td,
.customer-ledger-table tbody td,
.supplier-main-table tbody td,
.supplier-ledger-table tbody td,
.partner-accounts-table tbody td,
.investment-table tbody td {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  opacity: 1 !important;
}

table thead.red-header th,
table thead.bg-red th,
table thead.dark-header th,
table.table-red thead th,
table.table-dark thead th,
.red-table thead th,
.dark-table thead th,
.red-header table thead th,
.bg-red table thead th,
.dark-header table thead th {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.action-buttons,
.actions-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  min-width: max-content !important;
}

.row-action:not(.text-row-action),
.action-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #d9e1ea !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #111 !important;
  -webkit-text-fill-color: currentColor !important;
  line-height: 1 !important;
  opacity: 1 !important;
  overflow: visible !important;
}

.row-action.text-row-action {
  width: auto !important;
  max-width: none !important;
  padding: 0 10px !important;
}

.row-action.delete,
.row-action.danger,
.action-btn.delete,
.action-btn.danger {
  color: #186CD7 !important;
  -webkit-text-fill-color: #186CD7 !important;
}

body .row-action.delete svg,
body .row-action.delete svg *,
body .row-action.danger svg,
body .row-action.danger svg *,
body .action-btn.delete svg,
body .action-btn.delete svg *,
body .action-btn.danger svg,
body .action-btn.danger svg * {
  color: #186CD7 !important;
  stroke: #186CD7 !important;
  fill: none !important;
  -webkit-text-fill-color: #186CD7 !important;
}

.row-action svg,
.row-action i,
.action-btn svg,
.action-btn i {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  display: block !important;
  color: currentColor !important;
  stroke: currentColor !important;
  fill: none !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.row-action i[data-lucide]::before,
.action-btn i[data-lucide]::before {
  content: none !important;
}

.action-icon-label {
  display: inline-block;
  max-width: 28px;
  overflow: hidden;
  color: currentColor !important;
  -webkit-text-fill-color: currentColor !important;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

th.actions,
td.actions,
.actions-column,
th:last-child,
td:last-child {
  min-width: 150px !important;
  width: 150px !important;
  white-space: nowrap !important;
}

.table-wrapper,
.table-responsive,
.table-wrap,
.sheet-table-wrap {
  overflow-x: auto !important;
  width: 100% !important;
  -webkit-overflow-scrolling: touch;
}

body .table-wrap table thead th,
body .compact-table table thead th,
body .panel table thead th,
body table.sheet-table thead th,
body table.data-table thead th,
body table.table thead th,
body table.transactions-table thead th,
body table.ledger-table thead th,
body table.purchase-transactions-table thead th,
body table.sales-transactions-table thead th,
body table.customer-main-table thead th,
body table.customer-ledger-table thead th,
body table.supplier-main-table thead th,
body table.supplier-ledger-table thead th,
body table.partner-accounts-table thead th,
body table.investment-table thead th,
body table thead th {
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

body .table-wrap table tbody td,
body .compact-table table tbody td,
body .panel table tbody td,
body table.sheet-table tbody td,
body table.data-table tbody td,
body table.table tbody td,
body table.transactions-table tbody td,
body table.ledger-table tbody td,
body table.purchase-transactions-table tbody td,
body table.sales-transactions-table tbody td,
body table.customer-main-table tbody td,
body table.customer-ledger-table tbody td,
body table.supplier-main-table tbody td,
body table.supplier-ledger-table tbody td,
body table.partner-accounts-table tbody td,
body table.investment-table tbody td,
body table tbody td {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  opacity: 1 !important;
}

body table thead.red-header th,
body table thead.bg-red th,
body table thead.dark-header th,
body table.table-red thead th,
body table.table-dark thead th,
body .red-table thead th,
body .dark-table thead th,
body .red-header table thead th,
body .bg-red table thead th,
body .dark-header table thead th {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

body[data-active-view="transactions"] .roz-namcha-panel .panel-head {
  align-items: flex-start;
  gap: 14px;
}

body[data-active-view="transactions"] .roz-namcha-panel .panel-actions {
  align-items: center;
  gap: 8px;
}

body[data-active-view="transactions"] #openDailyCashModalButton {
  min-height: 38px;
}

body[data-active-view="transactions"] .kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

body[data-active-view="transactions"] .kpi strong {
  font-size: 18px;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

body[data-active-view="transactions"] #dailyCashDetailPanel,
body[data-active-view="transactions"] .roz-namcha-table-panel,
body[data-active-view="transactions"] .roz-namcha-panel > .panel:not(.hidden-modal-source) {
  border-color: #d9e1e7;
}

body[data-active-view="transactions"] #dailyCashRows td,
body[data-active-view="transactions"] #transactionRows td {
  vertical-align: middle;
}

body[data-active-view="transactions"] #dailyCashRows tr:hover,
body[data-active-view="transactions"] #transactionRows tr:hover {
  background: #f6fafb;
}

@media (max-width: 760px) {
  body[data-active-view="transactions"] .roz-namcha-panel .panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  body[data-active-view="transactions"] .roz-namcha-panel .panel-actions .inline-search,
  body[data-active-view="transactions"] .roz-namcha-panel .panel-actions #transactionSummary {
    grid-column: 1 / -1;
  }

  body[data-active-view="transactions"] .roz-namcha-panel .panel-actions button,
  body[data-active-view="transactions"] .roz-namcha-panel .panel-actions label {
    width: 100%;
  }
}


/* === Dashboard compact redesign requested 2026-06 === */
@media (min-width: 901px) {
  .sidebar {
    width: 180px !important;
    min-width: 180px !important;
    padding: 14px 12px !important;
  }
  .app-shell {
    margin-left: 180px !important;
    padding: 18px 20px !important;
  }
  .brand-logo {
    width: 48px;
    height: 48px;
  }
  .brand strong {
    font-size: 15px;
    line-height: 1.1;
  }
  .brand span {
    font-size: 12px;
  }
  .nav-button {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 14px;
  }
}

body:not([data-active-view="dashboard"]) .dashboard-top-filter {
  display: none !important;
}

body[data-active-view="dashboard"] .topbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 14px;
}

body[data-active-view="dashboard"] .topbar h1 {
  font-size: clamp(24px, 2.05vw, 30px);
  letter-spacing: -0.02em;
}

body[data-active-view="dashboard"] .topbar p {
  font-size: 13px;
  margin-top: 5px;
}

body[data-active-view="dashboard"] .topbar-actions {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}

.dashboard-top-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0;
}

.dashboard-top-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  height: 38px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
}

.dashboard-top-filter input[type="date"] {
  min-height: 0;
  height: 34px;
  width: 122px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  color: var(--ink);
  box-shadow: none;
}

.dashboard-top-filter svg,
.topbar-actions .status-pill svg,
.topbar-actions .link-button svg,
.icon-action-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.filter-separator {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-date-chip {
  display: none;
}

.icon-action-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.topbar-actions .status-pill,
.topbar-actions .link-button {
  min-height: 38px;
  height: 38px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  gap: 6px;
}

body[data-active-view="dashboard"] #view-dashboard {
  max-width: 1280px;
}

body[data-active-view="dashboard"] .dashboard-main-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(142px, 1fr));
  gap: 14px;
  align-items: stretch;
}

body[data-active-view="dashboard"] #dashboardKpis,
body[data-active-view="dashboard"] #dashboardCashBoxes {
  display: contents;
}

body[data-active-view="dashboard"] .kpi,
body[data-active-view="dashboard"] .dashboard-cash-box {
  min-height: 126px;
  margin: 0;
  padding: 17px 18px;
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.06);
  background: #fff;
  border: 1px solid #e1e7ee;
}

body[data-active-view="dashboard"] .kpi span,
body[data-active-view="dashboard"] .dashboard-cash-box span {
  font-size: 13px;
  font-weight: 700;
  color: #526072;
}

body[data-active-view="dashboard"] .kpi strong,
body[data-active-view="dashboard"] .dashboard-cash-box strong {
  margin-top: 22px;
  font-size: clamp(20px, 1.45vw, 26px);
  font-weight: 600;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

body[data-active-view="dashboard"] .kpi small,
body[data-active-view="dashboard"] .dashboard-cash-box small {
  display: block;
  margin-top: 9px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
}

body[data-active-view="dashboard"] .dashboard-cash-box {
  cursor: pointer;
}

.dashboard-summary-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-summary-card {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 9px;
  border: 1px solid #e1e7ee;
  background: #fff;
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.055);
}

.summary-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid #e8edf3;
}

.summary-card-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  color: #111;
}

.summary-card-head h3 svg {
  width: 18px;
  height: 18px;
  color: #2563eb;
}

.summary-card-head span {
  color: #64748b;
  font-size: 12px;
}

.compact-summary-table {
  overflow-x: auto;
}

.compact-summary-table table {
  min-width: 100%;
  width: 100%;
}

.compact-summary-table th {
  color: #111 !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  background: #f8fafc;
}

.compact-summary-table td {
  color: #111 !important;
  font-size: 13px;
  padding: 9px 14px;
}

.compact-summary-table td.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1260px) and (min-width: 901px) {
  body[data-active-view="dashboard"] .dashboard-main-grid {
    grid-template-columns: repeat(5, minmax(126px, 1fr));
    gap: 12px;
  }
  body[data-active-view="dashboard"] .kpi,
  body[data-active-view="dashboard"] .dashboard-cash-box {
    padding: 14px;
    min-height: 116px;
  }
  body[data-active-view="dashboard"] .kpi strong,
  body[data-active-view="dashboard"] .dashboard-cash-box strong {
    font-size: clamp(18px, 1.35vw, 23px);
  }
  .dashboard-top-filter input[type="date"] {
    width: 108px;
  }
  .topbar-actions .link-button span {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 1080px) and (min-width: 901px) {
  body[data-active-view="dashboard"] .topbar {
    grid-template-columns: 1fr;
  }
  body[data-active-view="dashboard"] .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  body[data-active-view="dashboard"] .dashboard-main-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body[data-active-view="dashboard"] .topbar {
    display: block;
  }
  body[data-active-view="dashboard"] .topbar-actions {
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .dashboard-top-filter {
    width: 100%;
    flex-wrap: wrap;
  }
  .dashboard-top-filter label {
    flex: 1 1 130px;
  }
  .dashboard-top-filter input[type="date"] {
    width: 100%;
  }
  body[data-active-view="dashboard"] .dashboard-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  body[data-active-view="dashboard"] #dashboardKpis,
  body[data-active-view="dashboard"] #dashboardCashBoxes {
    display: contents;
  }
  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* Final functional fixes: WhatsApp share + sales stock hint + expense USD preview */
.row-action.whatsapp-action {
  color: #16a34a !important;
  border-color: rgba(22, 163, 74, 0.28) !important;
  background: #f0fdf4 !important;
}
.row-action.whatsapp-action svg {
  stroke: currentColor !important;
  fill: none !important;
}
.sale-stock-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
  color: #16a34a;
  font-weight: 700;
  white-space: nowrap;
}
.sale-stock-hint.low { color: #d97706; }
.sale-stock-hint.out { color: #dc2626; }
.expense-usd-preview input {
  background: #f8fafc;
  color: #111827;
  font-weight: 700;
}
@media (max-width: 900px) {
  .sale-stock-hint { white-space: normal; }
}


/* Final invoice/WhatsApp/expense exchange polish */
.whatsapp-action { color: #16a34a !important; }
.whatsapp-action svg { stroke: #16a34a !important; }
.whatsapp-share-card { max-width: 520px; }
.whatsapp-share-card textarea { min-height: 140px; resize: vertical; }
.exchange-rate-field:not(.hidden) { display: block !important; }
.expense-usd-preview input { font-weight: 700; color: #166534; background: #f0fdf4; }
.sale-stock-hint { display: block; margin-top: 5px; font-size: 12px; font-weight: 700; color: #166534; }
.sale-stock-hint.low { color: #b45309; }
.sale-stock-hint.out { color: #dc2626; }


/* Final targeted fixes: expense exchange-rate field + role-safe UI */
.expense-currency-rate-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: end;
}
.expense-currency-rate-row .exchange-rate-field:not(.hidden) {
  display: block !important;
}
.expense-currency-rate-row .exchange-rate-title {
  display: block;
  margin-bottom: 8px;
}
.expense-currency-rate-row .exchange-rate-field input[readonly] {
  background: #f8fafc;
  font-weight: 700;
  color: #6b7280;
}
.expense-usd-preview {
  margin-top: -2px;
}
.expense-usd-preview input[readonly] {
  background: #f8fafc;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}
body.view-only .whatsapp-action,
body.view-only .share-action,
body.view-only .print-action,
body.view-only button[data-print-kind],
body.view-only button[data-whatsapp-kind],
body.view-only button[data-sale-action='pdf'] {
  display: none !important;
}
#userForm input:disabled,
#userForm select:disabled,
#userForm button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
@media (max-width: 760px) {
  .expense-currency-rate-row {
    grid-template-columns: 1fr;
  }
}


/* Expense form reset: exact AFN exchange-rate layout */
.expense-form-panel-reset { max-width: 640px; width: min(640px, calc(100vw - 28px)); }
.expense-entry-form .form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.expense-currency-rate-row { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px !important; align-items: end !important; }
.expense-currency-rate-row #expenseRateLabel,
.expense-currency-rate-row .exchange-rate-field { display: block !important; visibility: visible !important; opacity: 1 !important; }
#expenseRateLabel input { display: block !important; width: 100% !important; }
#expenseRateLabel .exchange-rate-title { display: block; margin-bottom: 8px; color: #6b7280; font-weight: 700; }
.expense-usd-preview { display: block !important; }
.expense-usd-preview input[readonly] { width: 100%; background: #f8fafc; color: #111827; font-size: 14px; font-weight: 800; }
@media (max-width: 720px) { .expense-entry-form .form-row, .expense-currency-rate-row { grid-template-columns: 1fr !important; } }


.currency-filter-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-filter-buttons .mini-button.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.exchange-modal-card {
  max-width: 620px;
}

.exchange-payment-form input[readonly] {
  font-weight: 700;
  background: #f8fafc;
}

.exchange-payment-form .form-row {
  align-items: end;
}

.exchange-payment-form .form-help {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .exchange-modal-card {
    max-width: calc(100vw - 20px);
  }
}

/* Re-coded Return page and popup */
.return-popup.hidden {
  display: none !important;
}
.return-popup {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.return-popup:not(.hidden) {
  display: flex !important;
}
.return-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}
.return-popup-card {
  position: relative;
  z-index: 1;
  width: min(760px, 96vw);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
}
.return-entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}
.return-entry-form label {
  display: grid;
  gap: 6px;
}
.return-entry-form input,
.return-entry-form select {
  width: 100%;
}
.return-note-field,
.return-form-actions {
  grid-column: 1 / -1;
}
#returnStockHint {
  color: #166534;
  font-weight: 700;
  font-size: 12px;
}
@media (max-width: 760px) {
  .return-entry-form {
    grid-template-columns: 1fr;
  }
}

/* FINAL runtime return popup */
.return-popup.hidden { display: none !important; }
.return-popup {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.return-popup:not(.hidden) { display: flex !important; }
.return-popup-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.return-popup-card {
  position: relative;
  z-index: 1;
  width: min(760px, 96vw);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
}
.return-entry-form { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 14px; }
.return-entry-form label { display: grid; gap: 6px; }
.return-entry-form input, .return-entry-form select { width: 100%; }
.return-note-field, .return-form-actions { grid-column: 1 / -1; }
#returnStockHint { color: #166534; font-weight: 700; font-size: 12px; }
@media (max-width: 760px) { .return-entry-form { grid-template-columns: 1fr; } }


/* Professional colorful dashboard + action buttons */
:root {
  --united-primary: #186CD7;
  --united-primary-dark: #05388E;
  --sp-blue: #2563eb;
  --sp-blue-dark: #1d4ed8;
  --sp-green: #16a34a;
  --sp-green-dark: #15803d;
  --sp-orange: #f97316;
  --sp-orange-dark: #ea580c;
  --sp-purple: #7c3aed;
  --sp-purple-dark: #6d28d9;
  --sp-cyan: #0891b2;
  --sp-cyan-dark: #0e7490;
  --sp-gold: #d97706;
  --sp-gold-dark: #b45309;
}

/* Dashboard top KPI/cash boxes: each has a different professional color */
#dashboardKpis .kpi,
#dashboardCashBoxes .dashboard-cash-box {
  position: relative;
  overflow: hidden;
  border: 0 !important;
  color: #fff !important;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

#dashboardKpis .kpi::after,
#dashboardCashBoxes .dashboard-cash-box::after {
  content: "";
  position: absolute;
  inset: auto -26px -46px auto;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  pointer-events: none;
}

#dashboardKpis .kpi span,
#dashboardKpis .kpi strong,
#dashboardKpis .kpi small,
#dashboardKpis .kpi svg,
#dashboardCashBoxes .dashboard-cash-box span,
#dashboardCashBoxes .dashboard-cash-box strong,
#dashboardCashBoxes .dashboard-cash-box small,
#dashboardCashBoxes .dashboard-cash-box svg,
#dashboardCashBoxes .dashboard-number {
  color: #fff !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.14);
}

#dashboardKpis .kpi:nth-child(1) {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
}
#dashboardKpis .kpi:nth-child(2) {
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%) !important;
}
#dashboardKpis .kpi:nth-child(3) {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%) !important;
}
#dashboardKpis .kpi:nth-child(4) {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
}
#dashboardKpis .kpi:nth-child(5) {
  background: linear-gradient(135deg, #7c3aed 0%, #581c87 100%) !important;
}
#dashboardKpis .kpi:nth-child(6) {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%) !important;
}
#dashboardKpis .kpi:nth-child(7) {
  background: linear-gradient(135deg, #0d9488 0%, #115e59 100%) !important;
}

#dashboardCashBoxes .dashboard-cash-box:nth-child(1) {
  background: linear-gradient(135deg, #0891b2 0%, #155e75 100%) !important;
}
#dashboardCashBoxes .dashboard-cash-box:nth-child(2) {
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%) !important;
}
#dashboardCashBoxes .dashboard-cash-box:nth-child(3) {
  background: linear-gradient(135deg, #d97706 0%, #92400e 100%) !important;
}
#dashboardCashBoxes .dashboard-cash-box:nth-child(4) {
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%) !important;
}

/* Currency summary panels: professional colored top border and subtle header */
.dashboard-summary-card {
  border: 0 !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
  overflow: hidden;
}
.dashboard-summary-card:nth-child(1) {
  border-top: 4px solid var(--sp-orange) !important;
}
.dashboard-summary-card:nth-child(2) {
  border-top: 4px solid var(--sp-blue) !important;
}
.dashboard-summary-card .summary-card-head {
  background: linear-gradient(90deg, rgba(255,255,255,1), rgba(248,250,252,1));
}
.dashboard-summary-card:nth-child(1) .summary-card-head h3,
.dashboard-summary-card:nth-child(1) .summary-card-head svg {
  color: var(--sp-orange-dark) !important;
}
.dashboard-summary-card:nth-child(2) .summary-card-head h3,
.dashboard-summary-card:nth-child(2) .summary-card-head svg {
  color: var(--sp-blue-dark) !important;
}
.dashboard-summary-card table thead tr {
  background: #f8fafc;
}

/* Main action buttons with colorful backgrounds */
.primary-button {
  background: linear-gradient(135deg, var(--united-primary), var(--united-primary-dark)) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(24,108,215,.20);
}
.primary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.secondary-button {
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-dark)) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(37,99,235,.18);
}
.secondary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.link-button,
button[id*="download"],
button[id*="Download"],
.mini-button.text-mini,
.sheet-subbar .mini-button,
.panel-actions .mini-button,
.action-buttons .mini-button {
  background: linear-gradient(135deg, #0ea5e9, #0369a1) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 7px 16px rgba(3,105,161,.18);
}

.link-button:hover,
button[id*="download"]:hover,
button[id*="Download"]:hover,
.mini-button.text-mini:hover,
.sheet-subbar .mini-button:hover,
.panel-actions .mini-button:hover,
.action-buttons .mini-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button[id*="print"],
.print-action {
  background: linear-gradient(135deg, #64748b, #334155) !important;
  color: #fff !important;
  border: 0 !important;
}

button[id*="delete"],
.delete-action {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  color: #fff !important;
  border: 0 !important;
}

button[id*="edit"],
.edit-action {
  background: linear-gradient(135deg, #f59e0b, #b45309) !important;
  color: #fff !important;
  border: 0 !important;
}

button[id*="Exchange"],
button[id*="exchange"],
.exchange-action {
  background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
  color: #fff !important;
  border: 0 !important;
}

/* Table/action row icons */
.row-action {
  border: 0 !important;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  color: #0f172a;
  box-shadow: 0 4px 10px rgba(15,23,42,.10);
}
.row-action:hover {
  color: #fff !important;
  background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-dark)) !important;
  transform: translateY(-1px);
}
.row-action.print-action:hover {
  background: linear-gradient(135deg, #64748b, #334155) !important;
}
.row-action.delete-action:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
}

/* Sidebar active/hover styling */
.nav-button:hover,
.nav-button.active {
  background: linear-gradient(135deg, rgba(24,108,215,.90), rgba(5,56,142,.94)) !important;
  border-left-color: #fff !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

/* Small top filter/search buttons */
#applyDashboardFilter,
#resetDashboardFilter,
#applySalesFilter,
#resetSalesFilter,
#applyPurchaseFilter,
#resetPurchaseFilter,
#applyExpenseFilter,
#resetExpenseFilter,
#applyPaymentFilter,
#resetPaymentFilter,
#applyTransactionFilter,
#resetTransactionFilter,
#applyCustomerDetailFilter,
#resetCustomerDetailFilter,
#applySupplierDetailFilter,
#resetSupplierDetailFilter {
  background: linear-gradient(135deg, #6366f1, #4338ca) !important;
  color: #fff !important;
  border: 0 !important;
}

#logoutButton,
#mobileLogoutButton {
  background: linear-gradient(135deg, #475569, #1e293b) !important;
  color: #fff !important;
  border: 0 !important;
}

/* Keep disabled buttons readable */
button:disabled,
button[disabled] {
  opacity: .58 !important;
  filter: grayscale(.15);
  cursor: not-allowed;
  transform: none !important;
}

/* More polished hover transition */
button,
.row-action,
.kpi,
.dashboard-cash-box,
.dashboard-summary-card {
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease, background .16s ease;
}


/* White text + clean professional typography fix */
:root {
  --app-font: "Inter", "Segoe UI", "Roboto", "Noto Sans", "Arial", sans-serif;
}

html,
body,
button,
input,
select,
textarea,
table,
.kpi,
.dashboard-cash-box,
.panel,
.nav-button,
.link-button,
.primary-button,
.secondary-button,
.mini-button {
  font-family: var(--app-font) !important;
  letter-spacing: .01em;
}

/* Any blue/colored button must show clear white text */
.primary-button,
.secondary-button,
.link-button,
.mini-button,
.icon-button,
.segment,
button[id*="download"],
button[id*="Download"],
button[id*="print"],
button[id*="edit"],
button[id*="delete"],
button[id*="Exchange"],
button[id*="exchange"],
#applyDashboardFilter,
#resetDashboardFilter,
#logoutButton,
#mobileLogoutButton {
  color: #ffffff !important;
  font-weight: 800 !important;
}

.primary-button *,
.secondary-button *,
.link-button *,
.mini-button *,
.icon-button *,
.segment *,
button[id*="download"] *,
button[id*="Download"] *,
button[id*="print"] *,
button[id*="edit"] *,
button[id*="delete"] *,
button[id*="Exchange"] *,
button[id*="exchange"] *,
#applyDashboardFilter *,
#resetDashboardFilter *,
#logoutButton *,
#mobileLogoutButton * {
  color: #ffffff !important;
  fill: none;
  stroke: currentColor;
}

/* Fix buttons like Partner Transaction on blue background */
button[style*="blue"],
button[style*="#2563eb"],
button[style*="#1d4ed8"],
button[class*="blue"],
.blue-button,
.partner-transaction-button {
  color: #ffffff !important;
  font-weight: 800 !important;
}

/* Dashboard colored cards: keep all text white and readable */
#dashboardKpis .kpi,
#dashboardCashBoxes .dashboard-cash-box {
  color: #ffffff !important;
}

#dashboardKpis .kpi *,
#dashboardCashBoxes .dashboard-cash-box * {
  color: #ffffff !important;
  text-shadow: none !important;
}

/* Remove the white/green strip behind Net Profit digit */
#dashboardKpis .kpi .tag,
#dashboardKpis .kpi .good,
#dashboardKpis .kpi .bad,
#dashboardKpis .kpi strong .tag,
#dashboardKpis .kpi strong span,
#dashboardCashBoxes .dashboard-cash-box .tag,
.dashboard-number .tag {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border: 0 !important;
  color: #ffffff !important;
}

/* Specifically make Net Profit card amount clean on green background */
#dashboardKpis .kpi:nth-child(3) strong,
#dashboardKpis .kpi:nth-child(3) strong *,
#dashboardKpis .kpi:nth-child(3) .dashboard-number,
#dashboardKpis .kpi:nth-child(3) .dashboard-number * {
  background: transparent !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

/* Improve dashboard card font weights and sizes */
#dashboardKpis .kpi span,
#dashboardCashBoxes .dashboard-cash-box span {
  font-weight: 800 !important;
  font-size: 13px !important;
}

#dashboardKpis .kpi strong,
#dashboardCashBoxes .dashboard-cash-box strong {
  font-weight: 900 !important;
  font-size: clamp(22px, 1.45vw, 28px) !important;
  letter-spacing: .005em;
}

#dashboardKpis .kpi small,
#dashboardCashBoxes .dashboard-cash-box small {
  font-weight: 700 !important;
  opacity: .92;
}

/* Keep dark/blue backgrounds readable everywhere */
[style*="background: blue"],
[style*="background-color: blue"],
[style*="background:#2563eb"],
[style*="background: #2563eb"],
[style*="background-color:#2563eb"],
[style*="background-color: #2563eb"],
[style*="background:#1d4ed8"],
[style*="background: #1d4ed8"],
[style*="background-color:#1d4ed8"],
[style*="background-color: #1d4ed8"] {
  color: #ffffff !important;
}

/* More modern table/body font */
.sheet-table,
.sheet-table th,
.sheet-table td,
.table-wrap table,
.table-wrap th,
.table-wrap td {
  font-family: var(--app-font) !important;
}

.sheet-table th,
.table-wrap th {
  font-weight: 900 !important;
  letter-spacing: .025em;
}

.sheet-table td,
.table-wrap td {
  font-weight: 600;
}

/* Polished button text */
button span,
.link-button span,
.primary-button span,
.secondary-button span,
.mini-button span {
  font-weight: 800 !important;
}

/* Make sidebar text clearer */
.nav-button,
.nav-button span,
.nav-button small,
.nav-button svg {
  color: #f8fafc !important;
}

/* Keep white buttons/inputs normal */
input,
select,
textarea {
  color: #111827 !important;
  font-weight: 650;
}


/* Summary table design + lighter professional text */
body,
button,
input,
select,
textarea,
table,
.sheet-table,
.table-wrap table {
  font-weight: 400 !important;
}

/* Do not make table text too bold */
.sheet-table th,
.table-wrap th,
.compact-summary-table th,
.sheet-summary-table th {
  font-weight: 650 !important;
  letter-spacing: .015em !important;
}

.sheet-table td,
.table-wrap td,
.compact-summary-table td,
.sheet-summary-table td,
#customerCurrencySummaryRows td,
#supplierSheetCurrencySummaryRows td,
#dashboardCustomerCurrencyRows td,
#dashboardSupplierCurrencyRows td {
  font-weight: 450 !important;
}

/* Keep buttons readable but not heavy-bold */
button span,
.link-button span,
.primary-button span,
.secondary-button span,
.mini-button span {
  font-weight: 650 !important;
}

/* Customer and Supplier page currency summary table like main dashboard cards */
.sheet-summary {
  margin-top: 14px;
  border: 0 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15,23,42,.10) !important;
}

#view-customer-sheet .sheet-summary {
  border-top: 4px solid #2563eb !important;
}

#view-people .sheet-summary {
  border-top: 4px solid #f97316 !important;
}

.sheet-summary-head {
  min-height: 48px;
  padding: 14px 18px !important;
  background: linear-gradient(90deg, #ffffff 0%, #f8fafc 100%) !important;
  border-bottom: 2px solid #186CD7 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-summary-head strong {
  font-weight: 650 !important;
  font-size: 15px !important;
  letter-spacing: .02em;
  color: #0f172a !important;
}

#view-customer-sheet .sheet-summary-head strong {
  color: #1d4ed8 !important;
}

#view-people .sheet-summary-head strong {
  color: #ea580c !important;
}

.sheet-summary-head span {
  color: #64748b !important;
  font-weight: 450 !important;
  font-size: 13px !important;
}

.sheet-summary .table-wrap,
.sheet-summary .compact-table {
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.sheet-summary-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff !important;
}

.sheet-summary-table thead tr {
  background: #f8fafc !important;
}

.sheet-summary-table th {
  padding: 13px 16px !important;
  color: #0f172a !important;
  font-size: 12px !important;
  text-transform: uppercase;
  border-bottom: 1px solid #e2e8f0 !important;
}

.sheet-summary-table td {
  padding: 13px 16px !important;
  color: #111827 !important;
  border-bottom: 1px solid #e5e7eb !important;
  font-size: 14px !important;
}

.sheet-summary-table td.amount,
.sheet-summary-table td:last-child,
#customerCurrencySummaryRows td:last-child,
#supplierSheetCurrencySummaryRows td:last-child {
  text-align: right;
  font-weight: 500 !important;
}

.sheet-summary-table tbody tr:nth-child(even),
#customerCurrencySummaryRows tr:nth-child(even),
#supplierSheetCurrencySummaryRows tr:nth-child(even) {
  background: #fbfdff !important;
}

.sheet-summary-table tbody tr:hover,
#customerCurrencySummaryRows tr:hover,
#supplierSheetCurrencySummaryRows tr:hover {
  background: #f1f5f9 !important;
}

/* Main dashboard summary tables also lighter and cleaner */
.dashboard-summary-card .summary-card-head h3 {
  font-weight: 650 !important;
}

.dashboard-summary-card .summary-card-head span {
  font-weight: 450 !important;
}

.dashboard-summary-card table th,
.dashboard-summary-card table td {
  font-weight: 500 !important;
}

/* Remove any extra bold from currency rows */
#customerCurrencySummaryRows,
#supplierSheetCurrencySummaryRows,
#dashboardCustomerCurrencyRows,
#dashboardSupplierCurrencyRows {
  font-weight: 400 !important;
}


/* Currency summary tables: no scroll container, full clean card layout */
#view-customer-sheet .sheet-summary,
#view-people .sheet-summary,
.dashboard-summary-card {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

#view-customer-sheet .sheet-summary .table-wrap,
#view-people .sheet-summary .table-wrap,
#view-customer-sheet .sheet-summary .compact-table,
#view-people .sheet-summary .compact-table,
.dashboard-summary-card .table-wrap,
.dashboard-summary-card .compact-summary-table {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  max-height: none !important;
  height: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  scrollbar-width: none !important;
}

#view-customer-sheet .sheet-summary .table-wrap::-webkit-scrollbar,
#view-people .sheet-summary .table-wrap::-webkit-scrollbar,
.dashboard-summary-card .table-wrap::-webkit-scrollbar,
.dashboard-summary-card .compact-summary-table::-webkit-scrollbar {
  display: none !important;
}

#view-customer-sheet .sheet-summary-table,
#view-people .sheet-summary-table,
.dashboard-summary-card table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

#view-customer-sheet .sheet-summary-table th,
#view-customer-sheet .sheet-summary-table td,
#view-people .sheet-summary-table th,
#view-people .sheet-summary-table td,
.dashboard-summary-card table th,
.dashboard-summary-card table td {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  word-break: normal !important;
}

#view-customer-sheet .sheet-summary-table th:first-child,
#view-customer-sheet .sheet-summary-table td:first-child,
#view-people .sheet-summary-table th:first-child,
#view-people .sheet-summary-table td:first-child,
.dashboard-summary-card table th:first-child,
.dashboard-summary-card table td:first-child {
  width: 45% !important;
  text-align: left !important;
}

#view-customer-sheet .sheet-summary-table th:last-child,
#view-customer-sheet .sheet-summary-table td:last-child,
#view-people .sheet-summary-table th:last-child,
#view-people .sheet-summary-table td:last-child,
.dashboard-summary-card table th:last-child,
.dashboard-summary-card table td:last-child {
  width: 55% !important;
  text-align: right !important;
}

#view-customer-sheet .sheet-summary,
#view-people .sheet-summary {
  margin-top: 16px !important;
  border-radius: 12px !important;
  background: #ffffff !important;
}

#view-customer-sheet .sheet-summary-head,
#view-people .sheet-summary-head {
  border-bottom: 3px solid #186CD7 !important;
  padding: 16px 20px !important;
}

#view-customer-sheet .sheet-summary-table th,
#view-people .sheet-summary-table th {
  padding: 16px 20px !important;
}

#view-customer-sheet .sheet-summary-table td,
#view-people .sheet-summary-table td {
  padding: 16px 20px !important;
  min-height: 44px !important;
}

/* Keep the summary card placed normally in the page, not as a scroll box */
.sheet-summary {
  position: relative !important;
  contain: none !important;
}


/* Small customer/supplier currency summary tables, matching main dashboard branding */
#view-customer-sheet .sheet-summary,
#view-people .sheet-summary {
  width: min(360px, 100%) !important;
  max-width: 360px !important;
  min-width: 0 !important;
  margin-top: 16px !important;
  margin-left: 0 !important;
  margin-right: auto !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  overflow: hidden !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08) !important;
  border: 1px solid #dbe3ea !important;
}

/* Same professional color language as the main dashboard cards */
#view-customer-sheet .sheet-summary {
  border-top: 4px solid #2563eb !important;
}

#view-people .sheet-summary {
  border-top: 4px solid #f97316 !important;
}

#view-customer-sheet .sheet-summary-head,
#view-people .sheet-summary-head {
  min-height: 34px !important;
  padding: 8px 12px !important;
  border-bottom: 2px solid #186CD7 !important;
  background: linear-gradient(90deg, #ffffff 0%, #f8fafc 100%) !important;
}

#view-customer-sheet .sheet-summary-head strong,
#view-people .sheet-summary-head strong {
  font-size: 12px !important;
  font-weight: 560 !important;
  letter-spacing: .01em !important;
  line-height: 1.15 !important;
}

#view-customer-sheet .sheet-summary-head span,
#view-people .sheet-summary-head span {
  font-size: 10.5px !important;
  font-weight: 400 !important;
  color: #64748b !important;
}

#view-customer-sheet .sheet-summary .table-wrap,
#view-people .sheet-summary .table-wrap,
#view-customer-sheet .sheet-summary .compact-table,
#view-people .sheet-summary .compact-table {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

#view-customer-sheet .sheet-summary-table,
#view-people .sheet-summary-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

#view-customer-sheet .sheet-summary-table th,
#view-people .sheet-summary-table th {
  padding: 7px 10px !important;
  font-size: 10px !important;
  font-weight: 560 !important;
  letter-spacing: .015em !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  border-bottom: 1px solid #dbe3ea !important;
}

#view-customer-sheet .sheet-summary-table td,
#view-people .sheet-summary-table td {
  padding: 7px 10px !important;
  min-height: 28px !important;
  font-size: 11px !important;
  font-weight: 420 !important;
  color: #111827 !important;
  border-bottom: 1px solid #e5e7eb !important;
  white-space: normal !important;
}

#view-customer-sheet .sheet-summary-table th:first-child,
#view-customer-sheet .sheet-summary-table td:first-child,
#view-people .sheet-summary-table th:first-child,
#view-people .sheet-summary-table td:first-child {
  width: 52% !important;
  text-align: left !important;
}

#view-customer-sheet .sheet-summary-table th:last-child,
#view-customer-sheet .sheet-summary-table td:last-child,
#view-people .sheet-summary-table th:last-child,
#view-people .sheet-summary-table td:last-child {
  width: 48% !important;
  text-align: right !important;
}

#view-customer-sheet .sheet-summary-table tbody tr:nth-child(even),
#view-people .sheet-summary-table tbody tr:nth-child(even) {
  background: #fbfdff !important;
}

#view-customer-sheet .sheet-summary-table tbody tr:hover,
#view-people .sheet-summary-table tbody tr:hover {
  background: #f1f5f9 !important;
}

/* Do not let older full-width summary overrides apply on customer/supplier pages */
#view-customer-sheet .customer-sheet-panel .sheet-summary,
#view-people .supplier-sheet-panel .sheet-summary {
  align-self: flex-start !important;
}


/* Dashboard first-load layout fix: desktop always keeps all 5 cards in one row */
@media (min-width: 1024px) {
  #view-dashboard .dashboard-main-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 18px !important;
    align-items: stretch !important;
  }

  #view-dashboard #dashboardKpis,
  #view-dashboard #dashboardCashBoxes {
    display: contents !important;
  }

  #view-dashboard #dashboardKpis .kpi,
  #view-dashboard #dashboardCashBoxes .dashboard-cash-box {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    grid-column: auto !important;
    min-height: 146px !important;
  }

  #view-dashboard .dashboard-summary-grid {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    margin-top: 0 !important;
  }
}

/* Tablet: keep neat rows without breaking mobile */
@media (min-width: 768px) and (max-width: 1023px) {
  #view-dashboard .dashboard-main-grid {
    display: block !important;
  }

  #view-dashboard #dashboardKpis,
  #view-dashboard #dashboardCashBoxes {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  #view-dashboard .dashboard-summary-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
}

/* Mobile dashboard stays vertical like the screenshot */
@media (max-width: 767px) {
  #view-dashboard .dashboard-main-grid {
    display: block !important;
  }

  #view-dashboard #dashboardKpis,
  #view-dashboard #dashboardCashBoxes {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
  }

  #view-dashboard #dashboardKpis .kpi,
  #view-dashboard #dashboardCashBoxes .dashboard-cash-box {
    width: 100% !important;
    min-height: 92px !important;
  }

  #view-dashboard .dashboard-summary-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Mobile menu must match desktop sidebar; remove extra legacy mobile-only items if cached HTML appears */
.mobile-menu-link[data-view="reports"],
.mobile-menu-link[data-mobile-secondary="true"],
.mobile-menu-link[data-view="payments"] {
  display: none !important;
}


/* Final button visibility, mobile action sizing, and live dashboard clock */
.live-dashboard-clock {
  min-width: 250px;
  padding: 11px 16px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: linear-gradient(135deg, #111827, #0f172a);
  color: #ffffff;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: .02em;
  text-align: center;
  box-shadow: 0 8px 18px rgba(15,23,42,.10);
  white-space: nowrap;
}

body:not([data-active-view="dashboard"]) .live-dashboard-clock {
  display: none !important;
}

/* Make white/empty form icon buttons visible */
.app-modal-card .panel-head .mini-button,
.panel-head .mini-button[id^="close"],
.panel-head .mini-button[title="Close"],
.modal-close,
button[data-modal-close] {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 9px !important;
  background: linear-gradient(135deg, #334155, #0f172a) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 6px 14px rgba(15,23,42,.18) !important;
}

.app-modal-card .panel-head .mini-button svg,
.panel-head .mini-button[id^="close"] svg,
.panel-head .mini-button[title="Close"] svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Line item add/remove/edit controls inside sales/purchase/return forms */
.purchase-line-row .row-action,
.multi-sale-row .row-action,
.purchase-line-actions .row-action,
.multi-sale-actions .row-action,
.return-entry-form .row-action,
.purchase-line-row button,
.multi-sale-row button {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  border-radius: 9px !important;
  border: 0 !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 13px rgba(37,99,235,.20) !important;
}

.purchase-line-row .row-action.danger,
.multi-sale-row .row-action.danger,
.purchase-line-actions .row-action.danger,
.multi-sale-actions .row-action.danger,
.purchase-line-row button.remove,
.multi-sale-row button.remove {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
}

.purchase-line-row .row-action svg,
.multi-sale-row .row-action svg,
.purchase-line-actions .row-action svg,
.multi-sale-actions .row-action svg,
.purchase-line-row button svg,
.multi-sale-row button svg {
  width: 16px !important;
  height: 16px !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Make Save/Add/Close buttons in entry forms balanced and not huge */
.popup-entry-actions {
  align-items: center !important;
}

.popup-entry-actions .primary-button,
.popup-entry-actions .secondary-button {
  min-height: 38px !important;
  height: 38px !important;
  padding: 8px 14px !important;
  border-radius: 9px !important;
  font-size: 13px !important;
  font-weight: 750 !important;
}

/* Secondary form buttons should not appear white/invisible */
.popup-entry-actions .secondary-button,
.form-actions .secondary-button,
.purchase-sheet-controls .secondary-button,
.sales-sheet-controls .secondary-button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 7px 16px rgba(37,99,235,.16) !important;
}

.popup-entry-actions .secondary-button[id*="cancel"],
.form-actions .secondary-button[id*="close"],
.form-actions .secondary-button[id*="hide"],
#cancelPurchaseEntry,
#cancelSaleEntry {
  background: linear-gradient(135deg, #475569, #1e293b) !important;
  color: #ffffff !important;
}

/* Nice compact mobile buttons */
@media (max-width: 767px) {
  .live-dashboard-clock {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    font-size: 12px;
    order: 2;
  }

  .popup-entry-actions {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: stretch !important;
  }

  .popup-entry-actions .primary-button,
  .popup-entry-actions .secondary-button {
    flex: 1 1 calc(33.333% - 8px) !important;
    min-width: 92px !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    border-radius: 9px !important;
    white-space: nowrap !important;
  }

  .form-actions .primary-button,
  .form-actions .secondary-button,
  .ledger-actions .primary-button,
  .ledger-actions .secondary-button {
    flex: 1 1 calc(50% - 8px) !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    border-radius: 9px !important;
  }

  .row-action,
  .sheet-table .row-action {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    border-radius: 8px !important;
  }

  .row-action svg,
  .sheet-table .row-action svg {
    width: 14px !important;
    height: 14px !important;
  }

  .app-modal-card .panel-head .mini-button,
  .panel-head .mini-button[id^="close"],
  .panel-head .mini-button[title="Close"] {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
  }

  .topbar-actions {
    gap: 8px !important;
  }
}


/* Live date/time: fixed in the marked desktop header section on all devices */
body[data-active-view="dashboard"] .topbar {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) minmax(270px, 360px) minmax(360px, auto) !important;
  align-items: center !important;
  gap: 14px !important;
}

body[data-active-view="dashboard"] .topbar > div:first-child {
  min-width: 0 !important;
}

.live-dashboard-clock {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 270px !important;
  width: 100% !important;
  max-width: 360px !important;
  min-height: 40px !important;
  padding: 10px 14px !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #111827, #0f172a) !important;
  color: #ffffff !important;
  font-weight: 750 !important;
  font-size: 13px !important;
  letter-spacing: .02em !important;
  text-align: center !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.12) !important;
  white-space: nowrap !important;
  justify-self: center !important;
}

.live-dashboard-clock::before {
  content: "🕒";
  margin-right: 7px;
  font-size: 14px;
}

body:not([data-active-view="dashboard"]) .live-dashboard-clock {
  display: none !important;
}

body[data-active-view="dashboard"] .topbar-actions {
  justify-self: end !important;
}

/* Tablet: clock stays visible and placed under title cleanly */
@media (min-width: 768px) and (max-width: 1180px) {
  body[data-active-view="dashboard"] .topbar {
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "title actions"
      "clock actions" !important;
    align-items: center !important;
  }

  body[data-active-view="dashboard"] .topbar > div:first-child {
    grid-area: title !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    grid-area: clock !important;
    justify-self: start !important;
    max-width: 360px !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    grid-area: actions !important;
    justify-self: end !important;
  }
}

/* Mobile: date/time is full width and always visible on dashboard */
@media (max-width: 767px) {
  body[data-active-view="dashboard"] .topbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 9px 10px !important;
    font-size: 12px !important;
    order: 2 !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    width: 100% !important;
    justify-self: stretch !important;
    order: 3 !important;
  }
}


/* Dashboard header compact filter/time fix */
@media (min-width: 1181px) {
  body[data-active-view="dashboard"] .topbar {
    display: grid !important;
    grid-template-columns: minmax(250px, 1fr) auto minmax(610px, auto) !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  body[data-active-view="dashboard"] .topbar > div:first-child {
    min-width: 0 !important;
    max-width: 320px !important;
  }

  body[data-active-view="dashboard"] .topbar h1 {
    white-space: nowrap !important;
  }

  body[data-active-view="dashboard"] .topbar p {
    max-width: 320px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    min-width: 190px !important;
    max-width: 230px !important;
    width: 230px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    justify-self: center !important;
    white-space: nowrap !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    min-width: 0 !important;
    width: auto !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter label {
    width: 150px !important;
    min-width: 150px !important;
    height: 38px !important;
    padding: 0 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    border: 1px solid #dbe3ea !important;
    border-radius: 8px !important;
    background: #fff !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter input[type="date"] {
    width: 112px !important;
    min-width: 0 !important;
    height: 34px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 12px !important;
  }

  body[data-active-view="dashboard"] .filter-separator {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    padding: 0 2px !important;
  }

  body[data-active-view="dashboard"] #applyDashboardFilter,
  body[data-active-view="dashboard"] #resetDashboardFilter {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    border-radius: 8px !important;
  }

  body[data-active-view="dashboard"] #dashboardDateSummary {
    display: none !important;
  }

  body[data-active-view="dashboard"] #currentUserPill {
    min-height: 38px !important;
    height: 38px !important;
    padding: 7px 11px !important;
    font-size: 13px !important;
    max-width: 240px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body[data-active-view="dashboard"] #downloadCurrentReport,
  body[data-active-view="dashboard"] #logoutButton {
    min-height: 38px !important;
    height: 38px !important;
    padding: 7px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }
}

/* Medium desktop/tablet: clean two-line header, no overlap */
@media (min-width: 768px) and (max-width: 1180px) {
  body[data-active-view="dashboard"] .topbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    justify-self: stretch !important;
    order: 2 !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter {
    flex: 1 1 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter label {
    flex: 1 1 160px !important;
    min-width: 150px !important;
  }

  body[data-active-view="dashboard"] #dashboardDateSummary {
    display: none !important;
  }
}

/* Mobile: keep filters compact and not stacked over each other */
@media (max-width: 767px) {
  body[data-active-view="dashboard"] .topbar-actions {
    gap: 7px !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 38px 38px !important;
    gap: 5px !important;
    width: 100% !important;
    align-items: center !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter label {
    min-width: 0 !important;
    width: 100% !important;
    height: 36px !important;
    padding: 0 6px !important;
  }

  body[data-active-view="dashboard"] .dashboard-top-filter input[type="date"] {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 11px !important;
  }

  body[data-active-view="dashboard"] #applyDashboardFilter,
  body[data-active-view="dashboard"] #resetDashboardFilter {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
  }

  body[data-active-view="dashboard"] #dashboardDateSummary {
    display: none !important;
  }
}


/* Dashboard filter popup button and clean header */
body[data-active-view="dashboard"] #viewMeta:empty {
  display: none !important;
}

body[data-active-view="dashboard"] .topbar {
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 360px) minmax(500px, auto) !important;
}

.dashboard-filter-trigger-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.dashboard-filter-trigger {
  min-height: 40px !important;
  height: 40px !important;
  padding: 8px 13px !important;
  border-radius: 9px !important;
  background: linear-gradient(135deg, #4f46e5, #3730a3) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(79, 70, 229, .18) !important;
}

.dashboard-filter-trigger * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.dashboard-filter-trigger + .dashboard-date-chip {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 36px !important;
  padding: 7px 10px !important;
  border-radius: 9px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #dbe3ea !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  white-space: nowrap !important;
}

.dashboard-filter-modal-card {
  width: min(460px, calc(100vw - 28px)) !important;
}

.dashboard-filter-popup-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
}

.dashboard-filter-popup-body label {
  display: grid;
  gap: 7px;
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
}

.dashboard-filter-popup-body input[type="date"] {
  min-height: 44px;
  border: 1px solid #dbe3ea;
  border-radius: 9px;
  padding: 9px 11px;
  background: #ffffff;
  color: #111827;
  font-weight: 650;
}

.dashboard-filter-popup-actions {
  padding: 0 18px 18px;
}

.dashboard-filter-popup-actions .primary-button,
.dashboard-filter-popup-actions .secondary-button {
  min-height: 40px !important;
  height: 40px !important;
}

@media (min-width: 1181px) {
  body[data-active-view="dashboard"] .topbar-actions {
    flex-wrap: nowrap !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    min-width: 250px !important;
    max-width: 360px !important;
    width: 100% !important;
  }
}

@media (max-width: 767px) {
  .dashboard-filter-trigger-wrap {
    width: 100% !important;
  }

  .dashboard-filter-trigger {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .dashboard-filter-trigger + .dashboard-date-chip {
    flex: 0 0 auto !important;
  }

  .dashboard-filter-popup-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* Reliable dashboard header + professional filter popup */
body[data-active-view="dashboard"] #viewMeta:empty,
body[data-active-view="dashboard"] #viewMeta {
  display: none !important;
}

/* Desktop header: title | clock | actions, always stable on first load */
@media (min-width: 1181px) {
  body[data-active-view="dashboard"] .topbar {
    display: grid !important;
    grid-template-columns: minmax(220px, 1fr) minmax(300px, 390px) minmax(560px, auto) !important;
    align-items: center !important;
    gap: 18px !important;
    overflow: visible !important;
  }

  body[data-active-view="dashboard"] .topbar > div:first-child {
    min-width: 0 !important;
    max-width: 340px !important;
  }

  body[data-active-view="dashboard"] .topbar h1 {
    white-space: nowrap !important;
    margin-bottom: 0 !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    justify-self: end !important;
    margin-right: 10px !important;
    width: 360px !important;
    min-width: 300px !important;
    max-width: 390px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
    border-radius: 11px !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
  }

  body[data-active-view="dashboard"] .dashboard-filter-trigger-wrap {
    flex: 0 0 auto !important;
  }

  body[data-active-view="dashboard"] .dashboard-date-chip {
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* Hide old inline date fields if browser cached an old layout */
body[data-active-view="dashboard"] .dashboard-top-filter label,
body[data-active-view="dashboard"] .dashboard-top-filter .filter-separator {
  display: none !important;
}

.dashboard-filter-trigger-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: auto !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.dashboard-filter-trigger {
  min-height: 42px !important;
  height: 42px !important;
  padding: 9px 15px !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #4f46e5, #3730a3) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 10px 22px rgba(79, 70, 229, .22) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-weight: 800 !important;
}

.dashboard-filter-trigger *,
.dashboard-filter-trigger svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.dashboard-filter-trigger + .dashboard-date-chip {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 38px !important;
  padding: 8px 11px !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #dbe3ea !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  white-space: nowrap !important;
}

/* Professional Dashboard Filter Modal */
#dashboardFilterModal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
}

#dashboardFilterModal.hidden {
  display: none !important;
}

#dashboardFilterModal .app-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, .58) !important;
  backdrop-filter: blur(3px) !important;
}

#dashboardFilterModal .dashboard-filter-modal-card {
  position: relative !important;
  width: min(520px, calc(100vw - 34px)) !important;
  max-height: calc(100vh - 44px) !important;
  overflow: hidden !important;
  border-radius: 18px !important;
  background: #ffffff !important;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .36) !important;
  border: 1px solid rgba(226, 232, 240, .95) !important;
  transform: none !important;
  margin: 0 !important;
}

#dashboardFilterModal .panel-head {
  padding: 22px 24px 17px !important;
  border-bottom: 1px solid #e5e7eb !important;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
}

#dashboardFilterModal .panel-head h2 {
  margin: 0 !important;
  color: #111827 !important;
  font-size: 24px !important;
  font-weight: 850 !important;
  letter-spacing: .01em !important;
}

#dashboardFilterModal .panel-head h2::after {
  content: "" !important;
  display: block !important;
  width: 52px !important;
  height: 3px !important;
  margin-top: 9px !important;
  border-radius: 999px !important;
  background: #186CD7 !important;
}

#dashboardFilterModal .panel-head p {
  margin: 12px 0 0 !important;
  color: #64748b !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  font-weight: 450 !important;
}

#closeDashboardFilterModal {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .18) !important;
}

#closeDashboardFilterModal svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.dashboard-filter-popup-body {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 16px !important;
  padding: 22px 24px 20px !important;
  background: #ffffff !important;
}

.dashboard-filter-field {
  display: grid !important;
  gap: 8px !important;
}

.dashboard-filter-field label {
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .01em !important;
}

.dashboard-filter-input-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  min-height: 48px !important;
  padding: 0 12px !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 12px !important;
  background: #f8fafc !important;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease !important;
}

.dashboard-filter-input-wrap:focus-within {
  border-color: #4f46e5 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12) !important;
}

.dashboard-filter-input-wrap svg {
  width: 18px !important;
  height: 18px !important;
  color: #64748b !important;
  stroke: #64748b !important;
  flex: 0 0 auto !important;
}

.dashboard-filter-input-wrap input[type="date"] {
  width: 100% !important;
  height: 46px !important;
  min-height: 46px !important;
  border: 0 !important;
  background: transparent !important;
  color: #111827 !important;
  font-size: 15px !important;
  font-weight: 650 !important;
  outline: none !important;
  padding: 0 !important;
}

.dashboard-filter-popup-actions {
  display: grid !important;
  grid-template-columns: 1.2fr .9fr .9fr !important;
  gap: 10px !important;
  padding: 0 24px 24px !important;
  background: #ffffff !important;
}

.dashboard-filter-popup-actions .primary-button,
.dashboard-filter-popup-actions .secondary-button {
  min-height: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  padding: 9px 13px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

.dashboard-filter-popup-actions .primary-button {
  background: linear-gradient(135deg, #186CD7, #05388E) !important;
  box-shadow: 0 10px 22px rgba(24, 108, 215, .18) !important;
}

.dashboard-filter-popup-actions .secondary-button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
}

.dashboard-filter-popup-actions #cancelDashboardFilter {
  background: linear-gradient(135deg, #475569, #1e293b) !important;
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1180px) {
  body[data-active-view="dashboard"] .topbar {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "title title"
      "clock actions" !important;
    align-items: center !important;
    gap: 12px !important;
  }

  body[data-active-view="dashboard"] .topbar > div:first-child {
    grid-area: title !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    grid-area: clock !important;
    justify-self: start !important;
    width: min(390px, 100%) !important;
    max-width: 390px !important;
    margin-right: 12px !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    grid-area: actions !important;
    justify-self: end !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }
}

/* Mobile */
@media (max-width: 767px) {
  body[data-active-view="dashboard"] .topbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  body[data-active-view="dashboard"] .live-dashboard-clock {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-right: 0 !important;
    height: 38px !important;
    min-height: 38px !important;
    font-size: 12px !important;
    order: 2 !important;
  }

  body[data-active-view="dashboard"] .topbar-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    order: 3 !important;
  }

  .dashboard-filter-trigger-wrap {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .dashboard-filter-trigger {
    flex: 1 1 auto !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 8px 11px !important;
  }

  .dashboard-filter-trigger + .dashboard-date-chip {
    min-height: 34px !important;
    font-size: 11px !important;
  }

  #dashboardFilterModal {
    padding: 12px !important;
    align-items: end !important;
  }

  #dashboardFilterModal .dashboard-filter-modal-card {
    width: 100% !important;
    border-radius: 18px 18px 14px 14px !important;
  }

  #dashboardFilterModal .panel-head {
    padding: 18px 18px 14px !important;
  }

  #dashboardFilterModal .panel-head h2 {
    font-size: 21px !important;
  }

  .dashboard-filter-popup-body {
    grid-template-columns: 1fr !important;
    padding: 18px !important;
    gap: 14px !important;
  }

  .dashboard-filter-popup-actions {
    grid-template-columns: 1fr !important;
    padding: 0 18px 18px !important;
  }

  .dashboard-filter-popup-actions .primary-button,
  .dashboard-filter-popup-actions .secondary-button {
    width: 100% !important;
    min-height: 42px !important;
    height: 42px !important;
  }
}


/* Perfect Dashboard Filter modal buttons */
#dashboardFilterModal .dashboard-filter-modal-card {
  width: min(660px, calc(100vw - 34px)) !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions {
  display: grid !important;
  grid-template-columns: 1.15fr .85fr .85fr !important;
  gap: 12px !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 2px 24px 24px !important;
  margin: 0 !important;
  background: #ffffff !important;
  border-top: 1px solid #eef2f7 !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button,
#dashboardFilterModal .dashboard-filter-popup-actions .primary-button,
#dashboardFilterModal .dashboard-filter-popup-actions .secondary-button {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 16px !important;
  border-radius: 13px !important;
  border: 0 !important;
  outline: 0 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 850 !important;
  letter-spacing: .01em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 9px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1 !important;
  box-shadow: 0 10px 20px rgba(15, 23, 42, .14) !important;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button:hover {
  transform: translateY(-1px) !important;
  filter: brightness(1.04) !important;
  box-shadow: 0 14px 25px rgba(15, 23, 42, .18) !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button:active {
  transform: translateY(0) !important;
}

#dashboardFilterModal #applyDashboardFilter {
  background: linear-gradient(135deg, #186CD7 0%, #05388E 100%) !important;
}

#dashboardFilterModal #resetDashboardFilter {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
}

#dashboardFilterModal #cancelDashboardFilter {
  background: linear-gradient(135deg, #475569 0%, #1e293b 100%) !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button *,
#dashboardFilterModal .dashboard-filter-popup-actions button svg,
#dashboardFilterModal .dashboard-filter-popup-actions button span {
  color: #ffffff !important;
  stroke: #ffffff !important;
  fill: none !important;
  flex: 0 0 auto !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button svg {
  width: 17px !important;
  height: 17px !important;
}

#dashboardFilterModal .dashboard-filter-popup-actions button span {
  display: inline-block !important;
  overflow: visible !important;
  max-width: none !important;
}

/* Medium and mobile: keep buttons clean and never clipped */
@media (max-width: 720px) {
  #dashboardFilterModal .dashboard-filter-modal-card {
    width: min(560px, calc(100vw - 24px)) !important;
  }

  #dashboardFilterModal .dashboard-filter-popup-actions {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 2px 18px 18px !important;
  }

  #dashboardFilterModal .dashboard-filter-popup-actions button,
  #dashboardFilterModal .dashboard-filter-popup-actions .primary-button,
  #dashboardFilterModal .dashboard-filter-popup-actions .secondary-button {
    height: 44px !important;
    min-height: 44px !important;
    font-size: 14px !important;
    justify-content: center !important;
  }
}

@media (min-width: 721px) and (max-width: 900px) {
  #dashboardFilterModal .dashboard-filter-modal-card {
    width: min(640px, calc(100vw - 34px)) !important;
  }

  #dashboardFilterModal .dashboard-filter-popup-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #dashboardFilterModal .dashboard-filter-popup-actions button {
    padding: 0 12px !important;
    font-size: 13px !important;
  }
}


/* User re-add, live database, and exchange/action responsive polish */
#openCustomerExchangeButton,
#openSupplierExchangeButton {
  min-width: 112px !important;
  height: 38px !important;
  padding: 0 13px !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%) !important;
  color: #ffffff !important;
  border: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  box-shadow: 0 8px 18px rgba(20, 184, 166, .22) !important;
}

#openCustomerExchangeButton *,
#openSupplierExchangeButton *,
#openCustomerExchangeButton svg,
#openSupplierExchangeButton svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.customer-ledger-panel .sheet-subbar,
.supplier-ledger-panel .sheet-subbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.customer-ledger-panel .sheet-subbar .action-buttons,
.supplier-ledger-panel .sheet-subbar .action-buttons {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 7px !important;
  flex-wrap: wrap !important;
}

.customer-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openCustomerExchangeButton),
.supplier-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openSupplierExchangeButton) {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #0ea5e9, #0369a1) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 7px 16px rgba(3, 105, 161, .18) !important;
}

.customer-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openCustomerExchangeButton) *,
.supplier-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openSupplierExchangeButton) * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Better exchange modal layout */
#customerExchangeModal .app-modal-card,
#supplierExchangeModal .app-modal-card,
#exchangeModal .app-modal-card {
  width: min(680px, calc(100vw - 26px)) !important;
  border-radius: 16px !important;
}

#customerExchangeModal .popup-entry-actions .primary-button,
#supplierExchangeModal .popup-entry-actions .primary-button,
#exchangeModal .popup-entry-actions .primary-button {
  background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
}

/* Fully responsive ledger top bar */
@media (max-width: 767px) {
  .customer-ledger-panel .sheet-subbar,
  .supplier-ledger-panel .sheet-subbar {
    align-items: stretch !important;
    gap: 8px !important;
  }

  .customer-ledger-panel .sheet-subbar > span:first-child,
  .supplier-ledger-panel .sheet-subbar > span:first-child {
    width: 100% !important;
  }

  .customer-ledger-panel .sheet-subbar .action-buttons,
  .supplier-ledger-panel .sheet-subbar .action-buttons {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 38px 38px 38px !important;
    gap: 7px !important;
  }

  #openCustomerExchangeButton,
  #openSupplierExchangeButton {
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    font-size: 12px !important;
  }

  .customer-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openCustomerExchangeButton),
  .supplier-ledger-panel .sheet-subbar .action-buttons .mini-button:not(#openSupplierExchangeButton) {
    width: 38px !important;
    min-width: 38px !important;
  }
}

/* Live sync status should never visually interrupt forms */
.live-sync-hidden {
  display: none !important;
}


/* Today Sales + Sales table scroll + Cash Exchange */
@media (min-width: 1181px) {
  body[data-active-view="dashboard"] .dashboard-main-grid {
    grid-template-columns: repeat(6, minmax(125px, 1fr)) !important;
  }
  body[data-active-view="dashboard"] .kpi,
  body[data-active-view="dashboard"] .dashboard-cash-box {
    min-height: 118px !important;
    padding: 15px 16px !important;
  }
  body[data-active-view="dashboard"] .kpi strong,
  body[data-active-view="dashboard"] .dashboard-cash-box strong {
    font-size: clamp(18px, 1.2vw, 24px) !important;
  }
}

#view-sales .table-wrap {
  max-height: calc(100vh - 320px) !important;
  overflow: auto !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 10px !important;
}

#view-sales .table-wrap table {
  min-width: 1180px !important;
}

#view-sales .table-wrap thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  background: #f8fafc !important;
}

.cash-exchange-open-button {
  background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 10px !important;
  min-height: 38px !important;
  padding: 8px 13px !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 18px rgba(20,184,166,.18) !important;
}

.cash-exchange-open-button *,
.cash-exchange-open-button svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.cash-exchange-modal-card {
  width: min(1040px, calc(100vw - 28px)) !important;
  max-height: min(88vh, 820px) !important;
  overflow: auto !important;
  border-radius: 16px !important;
}

.cash-exchange-tabs {
  display: flex !important;
  gap: 8px !important;
  padding: 0 18px 4px !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.cash-exchange-tab {
  min-height: 40px !important;
  padding: 8px 14px !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 10px 10px 0 0 !important;
  background: #f8fafc !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
}

.cash-exchange-tab.active {
  border-color: #0f766e !important;
  background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
  color: #ffffff !important;
}

.cash-exchange-tab.active svg,
.cash-exchange-tab.active * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.cash-exchange-form {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  padding: 18px !important;
}

.cash-exchange-form label {
  display: grid !important;
  gap: 7px !important;
  color: #64748b !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.cash-exchange-form input,
.cash-exchange-form select {
  min-height: 42px !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 10px !important;
  padding: 8px 11px !important;
  background: #ffffff !important;
  color: #111827 !important;
}

.cash-exchange-form .full-span {
  grid-column: 1 / -1 !important;
}

.cash-exchange-form .primary-button {
  background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
}

.cash-exchange-history-panel {
  padding: 16px 18px 20px !important;
}

.cash-exchange-history-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 12px !important;
  margin-bottom: 12px !important;
}

.cash-exchange-history-head h3 {
  margin: 0 0 4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: #0f172a !important;
}

.cash-exchange-history-head p {
  margin: 0 !important;
  color: #64748b !important;
  font-size: 13px !important;
}

.cash-exchange-history-table {
  max-height: 480px !important;
  overflow: auto !important;
  border: 1px solid #dbe3ea !important;
  border-radius: 12px !important;
}

.cash-exchange-history-table table {
  min-width: 920px !important;
}

.cash-exchange-history-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  background: #f8fafc !important;
}

.cash-exchange-history-table td:nth-child(5) {
  min-width: 220px !important;
  white-space: normal !important;
}

.cash-exchange-history-table .row-actions {
  flex-wrap: nowrap !important;
}

.muted-text {
  color: #94a3b8 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

@media (max-width: 767px) {
  .cash-exchange-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    padding-inline: 12px !important;
  }
  .cash-exchange-tab {
    justify-content: center !important;
    padding-inline: 8px !important;
    font-size: 12px !important;
  }
  .cash-exchange-form {
    grid-template-columns: 1fr !important;
    padding: 14px 12px !important;
  }
  .cash-exchange-history-panel {
    padding: 14px 12px 18px !important;
  }
  #view-sales .table-wrap {
    max-height: 62vh !important;
  }
}


/* Dashboard cash exchange option + clean ledger balance export */
.dashboard-cash-exchange-panel {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.dashboard-cash-exchange-button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(20, 184, 166, .22);
}

.dashboard-cash-exchange-button *,
.dashboard-cash-exchange-button svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

@media (max-width: 767px) {
  .dashboard-cash-exchange-panel {
    justify-content: stretch;
  }
  .dashboard-cash-exchange-button {
    width: 100%;
    justify-content: center;
  }
}

/* Sales date + original-currency display update */
@media (min-width: 901px) {
  #saleForm.sales-sheet-controls.popup-entry-form {
    grid-template-columns: minmax(220px, 1.35fr) minmax(165px, .9fr) minmax(145px, .72fr) minmax(155px, .75fr);
  }
}

#saleForm .sale-date-field input[type="date"] {
  min-height: 34px;
  background: #ffffff;
  color: #111827;
}

@media (max-width: 900px) {
  #saleForm .sale-date-field {
    width: 100%;
  }
}


/* Total Sales dashboard card — responsive final layout */
@media (min-width: 1450px) {
  body[data-active-view="dashboard"] .dashboard-main-grid {
    grid-template-columns: repeat(7, minmax(112px, 1fr)) !important;
    gap: 12px !important;
  }
  body[data-active-view="dashboard"] .kpi,
  body[data-active-view="dashboard"] .dashboard-cash-box {
    min-height: 116px !important;
    padding: 14px 15px !important;
  }
  body[data-active-view="dashboard"] .kpi strong,
  body[data-active-view="dashboard"] .dashboard-cash-box strong {
    font-size: clamp(17px, 1.08vw, 22px) !important;
  }
}

@media (min-width: 1024px) and (max-width: 1449px) {
  body[data-active-view="dashboard"] .dashboard-main-grid {
    grid-template-columns: repeat(4, minmax(145px, 1fr)) !important;
  }
}

#dashboardKpis .kpi:nth-child(5) {
  background: linear-gradient(135deg, #7c3aed 0%, #581c87 100%) !important;
}

/* Final explicit dashboard colors: Expense and Net Profit.
   Dedicated classes plus nth-child fallback prevent older cascade rules from making these cards white. */
#dashboardKpis .kpi.kpi-expense,
#dashboardKpis .kpi:nth-child(6) {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%) !important;
  border: 0 !important;
  color: #ffffff !important;
}

#dashboardKpis .kpi.kpi-net-profit,
#dashboardKpis .kpi:nth-child(7) {
  background: linear-gradient(135deg, #0d9488 0%, #115e59 100%) !important;
  border: 0 !important;
  color: #ffffff !important;
}

#dashboardKpis .kpi.kpi-expense *,
#dashboardKpis .kpi.kpi-net-profit *,
#dashboardKpis .kpi:nth-child(6) *,
#dashboardKpis .kpi:nth-child(7) * {
  color: #ffffff !important;
  background-color: transparent !important;
  box-shadow: none !important;
}



/* ============================================================
   Mobile customer/supplier vertical list scrolling (2026-07-26)
   ============================================================ */
@media (max-width: 767px) {
  body[data-active-view="customer-sheet"],
  body[data-active-view="people"] {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body[data-active-view="customer-sheet"] .app-shell,
  body[data-active-view="people"] .app-shell {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 72px 10px 10px !important;
  }

  body[data-active-view="customer-sheet"] #view-customer-sheet,
  body[data-active-view="people"] #view-people {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-active-view="customer-sheet"] .customer-sheet-panel,
  body[data-active-view="people"] .supplier-sheet-panel {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body[data-active-view="customer-sheet"] .customer-table-wrap,
  body[data-active-view="people"] .supplier-table-wrap {
    flex: 1 1 0 !important;
    min-height: 160px !important;
    max-height: none !important;
    width: 100% !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    scrollbar-gutter: stable;
    background: #f7f8fa;
  }

  body[data-active-view="customer-sheet"] .customer-main-table,
  body[data-active-view="people"] .supplier-main-table {
    min-width: 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  body[data-active-view="customer-sheet"] #customerSheetRows,
  body[data-active-view="people"] #supplierRows {
    display: block !important;
    width: 100% !important;
  }

  body[data-active-view="customer-sheet"] #customerSheetRows > tr,
  body[data-active-view="people"] #supplierRows > tr {
    display: block !important;
    width: calc(100% - 12px) !important;
    margin: 6px !important;
  }

  body[data-active-view="customer-sheet"] .sheet-summary,
  body[data-active-view="people"] .sheet-summary {
    flex: 0 0 auto !important;
    max-height: 126px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   Daily full-screen Bismillah opening (once per user/Kabul day)
   ============================================================ */
.daily-opening-blessing {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(24, 108, 215, .22), transparent 30%),
    linear-gradient(145deg, #050505 0%, #121212 46%, #2a0000 100%);
  transition: opacity .5s ease, visibility .5s ease;
}

.daily-opening-blessing.is-visible {
  opacity: 1;
  visibility: visible;
}

.daily-opening-blessing.is-closing {
  opacity: 0;
  visibility: hidden;
}

.daily-opening-blessing-glow {
  position: absolute;
  width: min(72vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 36px rgba(24,108,215,.035),
    0 0 0 90px rgba(255,255,255,.018),
    0 0 140px rgba(24,108,215,.22);
  animation: dailyBlessingPulse 2.8s ease-in-out infinite;
}

.daily-opening-blessing-content {
  position: relative;
  z-index: 1;
  width: min(940px, 94vw);
  display: grid;
  justify-items: center;
  gap: clamp(10px, 2.2vh, 24px);
  color: #fff;
  text-align: center;
  transform: translateY(18px) scale(.98);
  opacity: 0;
  transition: transform .7s cubic-bezier(.2,.8,.2,1), opacity .7s ease;
}

.daily-opening-blessing.is-visible .daily-opening-blessing-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.daily-opening-blessing-mark {
  color: #ff2020;
  font-family: "Traditional Arabic", "Noto Naskh Arabic", "Segoe UI", serif;
  font-size: clamp(52px, 8vw, 112px);
  line-height: 1;
  text-shadow: 0 12px 44px rgba(24,108,215,.36);
}

.daily-opening-blessing-text {
  max-width: 100%;
  color: #fff;
  font-family: "Traditional Arabic", "Noto Naskh Arabic", "DejaVu Sans", serif;
  font-size: clamp(34px, 7vw, 92px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 8px 30px rgba(0,0,0,.48);
}

.daily-opening-blessing-subtitle {
  color: rgba(255,255,255,.66);
  font-size: clamp(10px, 1.3vw, 14px);
  font-weight: 800;
  letter-spacing: .28em;
}

.daily-opening-blessing-close {
  min-width: 118px;
  min-height: 40px;
  margin-top: 8px;
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.daily-opening-blessing-close:hover,
.daily-opening-blessing-close:focus-visible {
  border-color: #ff3030;
  background: rgba(24,108,215,.28);
  outline: none;
}

@keyframes dailyBlessingPulse {
  0%, 100% { transform: scale(.97); opacity: .72; }
  50% { transform: scale(1.02); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .daily-opening-blessing,
  .daily-opening-blessing-content,
  .daily-opening-blessing-glow {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

/* Legacy compact login sizing; accessible flow overrides follow below. */
body.locked {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.locked .login-screen {
  width: 100%;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  padding: clamp(8px, 2.4vmin, 28px) !important;
  overflow: hidden !important;
  place-items: center !important;
  overscroll-behavior: none;
}

body.locked .login-layout {
  width: min(1040px, 100%) !important;
  height: min(640px, calc(100dvh - clamp(16px, 4.8vmin, 56px))) !important;
  max-height: 100% !important;
  min-height: 0 !important;
}

body.locked .daily-hadith-card,
body.locked .login-card {
  height: 100%;
  min-height: 0 !important;
  max-height: 100%;
  overflow: hidden !important;
}

body.locked .login-error:empty {
  min-height: 0;
}

@media (min-width: 781px) and (max-height: 720px) {
  body.locked .login-screen {
    padding: 12px !important;
  }

  body.locked .login-layout {
    height: calc(100dvh - 24px) !important;
    max-width: 980px;
    gap: 16px;
  }

  body.locked .daily-hadith-card,
  body.locked .login-card {
    border-radius: 22px;
  }

  body.locked .daily-hadith-card {
    padding: clamp(24px, 4vw, 40px);
  }

  body.locked .hadith-card-topline {
    margin-bottom: 18px;
  }

  body.locked .hadith-quote-mark {
    top: 82px;
    font-size: 104px;
  }

  body.locked .daily-hadith-arabic {
    font-size: clamp(27px, 3.5vw, 38px);
    line-height: 1.42;
  }

  body.locked .hadith-divider {
    margin: 17px 0 12px;
  }

  body.locked .daily-hadith-pashto {
    font-size: clamp(19px, 2.5vw, 25px);
    line-height: 1.48;
  }

  body.locked .hadith-source {
    padding-top: 14px;
  }

  body.locked .login-card {
    gap: 8px;
    padding: 18px 24px;
  }

  body.locked .login-logo {
    width: 72px;
    height: 72px;
    border-radius: 13px;
  }

  body.locked .login-card h1 {
    font-size: 21px;
  }

  body.locked .login-card p {
    font-size: 12px;
    line-height: 1.3;
  }

  body.locked .login-card > label {
    gap: 4px;
    font-size: 12px;
  }

  body.locked .login-card > label input {
    min-height: 39px;
    height: 39px;
    padding: 8px 11px;
  }

  body.locked .login-card > .primary-button {
    min-height: 41px;
    height: 41px;
  }

  body.locked .login-connection-status {
    min-height: 18px;
    font-size: 10px;
    line-height: 1.2;
  }

  body.locked .login-error {
    min-height: 13px;
    font-size: 11px;
  }
}

@media (min-width: 781px) and (max-height: 520px) {
  body.locked .login-card {
    gap: 5px;
    padding: 12px 20px;
  }

  body.locked .login-logo {
    width: 52px;
    height: 52px;
  }

  body.locked .login-card h1 {
    font-size: 18px;
  }

  body.locked .login-card > p,
  body.locked .hadith-source {
    display: none;
  }

  body.locked .login-card > label input {
    min-height: 34px;
    height: 34px;
  }

  body.locked .login-card > .primary-button {
    min-height: 36px;
    height: 36px;
  }
}

@media (max-width: 780px) {
  body.locked .login-screen {
    padding: clamp(7px, 1.8vmin, 12px) !important;
  }

  body.locked .login-layout {
    width: min(470px, 100%) !important;
    height: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, .74fr) minmax(0, 1.26fr);
    gap: clamp(6px, 1.4dvh, 12px);
  }

  body.locked .daily-hadith-card,
  body.locked .login-card {
    border-radius: clamp(14px, 2.8vmin, 21px);
  }

  body.locked .daily-hadith-card {
    padding: clamp(11px, 2.2dvh, 20px) clamp(15px, 4vw, 22px);
  }

  body.locked .hadith-card-topline {
    margin-bottom: clamp(5px, 1.5dvh, 13px);
  }

  body.locked .hadith-kicker {
    min-height: clamp(23px, 4dvh, 30px);
    padding: 4px 9px;
    font-size: clamp(10px, 1.9dvh, 13px);
  }

  body.locked .hadith-day-mark {
    font-size: clamp(20px, 4dvh, 25px);
  }

  body.locked .hadith-quote-mark {
    top: clamp(48px, 9dvh, 70px);
    font-size: clamp(58px, 13dvh, 88px);
  }

  body.locked .daily-hadith-arabic {
    font-size: clamp(18px, min(6vw, 3.8dvh), 29px);
    line-height: 1.38;
  }

  body.locked .hadith-divider {
    margin: clamp(5px, 1.5dvh, 12px) 0 clamp(4px, 1dvh, 9px);
  }

  body.locked .hadith-meaning-label {
    margin-bottom: 2px;
    font-size: clamp(10px, 1.6dvh, 12px);
  }

  body.locked .daily-hadith-pashto {
    font-size: clamp(14px, min(5vw, 3dvh), 21px);
    line-height: 1.4;
  }

  body.locked .hadith-source {
    padding-top: clamp(4px, 1.3dvh, 10px);
    font-size: clamp(9px, 1.5dvh, 11px);
  }

  body.locked .login-card {
    align-content: center;
    gap: clamp(4px, 1.15dvh, 10px);
    padding: clamp(10px, 2.1dvh, 20px) clamp(15px, 4vw, 22px);
  }

  body.locked .login-logo {
    width: clamp(42px, 9dvh, 76px);
    height: clamp(42px, 9dvh, 76px);
    border-radius: clamp(9px, 2dvh, 14px);
  }

  body.locked .login-card h1 {
    font-size: clamp(16px, 3dvh, 21px);
    line-height: 1.1;
  }

  body.locked .login-card p {
    font-size: clamp(10px, 1.8dvh, 13px);
    line-height: 1.25;
  }

  body.locked .login-card > label {
    gap: clamp(2px, .7dvh, 5px);
    font-size: clamp(10px, 1.7dvh, 12px);
  }

  body.locked .login-card > label input {
    min-height: clamp(32px, 5.8dvh, 44px);
    height: clamp(32px, 5.8dvh, 44px);
    padding: 6px 10px;
  }

  body.locked .login-card > .primary-button {
    min-height: clamp(34px, 5.8dvh, 45px);
    height: clamp(34px, 5.8dvh, 45px);
  }

  body.locked .login-connection-status {
    min-height: clamp(14px, 2.6dvh, 22px);
    font-size: clamp(9px, 1.55dvh, 11px);
    line-height: 1.15;
  }

  body.locked .login-error {
    min-height: clamp(10px, 2dvh, 16px);
    font-size: clamp(9px, 1.55dvh, 11px);
    line-height: 1.1;
  }
}

@media (max-width: 780px) and (max-height: 540px) {
  body.locked .login-layout {
    grid-template-rows: minmax(0, .66fr) minmax(0, 1.34fr);
    gap: 5px;
  }

  body.locked .hadith-source,
  body.locked .login-card > p {
    display: none;
  }

  body.locked .hadith-divider {
    margin: 3px 0;
  }

  body.locked .login-card {
    gap: 3px;
    padding-block: 7px;
  }

  body.locked .login-logo {
    width: 38px;
    height: 38px;
  }

  body.locked .login-card h1 {
    font-size: 15px;
  }

  body.locked .login-card > label input {
    min-height: 30px;
    height: 30px;
  }

  body.locked .login-card > .primary-button {
    min-height: 32px;
    height: 32px;
  }
}

@media (max-width: 780px) and (max-height: 560px) and (orientation: landscape) {
  body.locked .login-layout {
    width: min(920px, 100%) !important;
    grid-template-columns: minmax(0, 1fr) minmax(250px, .88fr) !important;
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
  }

  body.locked .daily-hadith-card,
  body.locked .login-card {
    height: 100%;
  }
}

@media (max-width: 390px) and (max-height: 430px) {
  body.locked .hadith-card-topline,
  body.locked .hadith-divider,
  body.locked .hadith-meaning-label,
  body.locked .login-card > p {
    display: none;
  }

  body.locked .login-logo {
    width: 32px;
    height: 32px;
  }

  body.locked .login-card > label input {
    min-height: 28px;
    height: 28px;
  }

  body.locked .login-card > .primary-button {
    min-height: 30px;
    height: 30px;
  }
}

/* Roz Namcha: compact source-linked cash book */
body[data-active-view="transactions"] .roz-namcha-panel {
  display: grid;
  gap: 10px;
}

body[data-active-view="transactions"] .roz-compact-header {
  display: grid;
  grid-template-columns: auto minmax(420px, 1fr) auto;
  align-items: end !important;
  gap: 10px 14px !important;
  min-height: 0;
  padding: 10px 12px !important;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

body[data-active-view="transactions"] .roz-title-block {
  display: grid;
  gap: 2px;
  min-width: 132px;
}

body[data-active-view="transactions"] .roz-title-block h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

body[data-active-view="transactions"] #transactionSummary {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

body[data-active-view="transactions"] .roz-primary-actions {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  align-items: center !important;
  gap: 7px !important;
  width: 100%;
}

body[data-active-view="transactions"] .roz-primary-actions .inline-search {
  width: 100%;
  min-width: 0;
  height: 36px;
}

body[data-active-view="transactions"] .roz-primary-actions button,
body[data-active-view="transactions"] .roz-date-filter button {
  min-height: 36px !important;
  height: 36px;
  padding: 0 11px;
  white-space: nowrap;
}

body[data-active-view="transactions"] .roz-date-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(122px, 1fr)) auto auto;
  align-items: end;
  gap: 6px;
}

body[data-active-view="transactions"] .roz-date-filter label {
  display: grid;
  gap: 2px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

body[data-active-view="transactions"] .roz-date-filter input {
  min-width: 122px;
  height: 36px;
  padding: 5px 8px;
}

body[data-active-view="transactions"] .roz-kpi-strip {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin: 0 !important;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi {
  min-height: 66px;
  padding: 8px 10px !important;
  border-radius: 11px;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi > span {
  font-size: 10px;
  line-height: 1.1;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi strong {
  margin-top: 4px;
  font-size: clamp(12px, 1.15vw, 16px) !important;
  line-height: 1.15 !important;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi small {
  display: none;
}

body[data-active-view="transactions"] .roz-daily-summary-panel {
  display: none !important;
}

body[data-active-view="transactions"] .roz-namcha-table-panel {
  margin: 0;
}

body[data-active-view="transactions"] .roz-namcha-table-panel > .panel-head {
  display: none;
}

body[data-active-view="transactions"] .roz-namcha-table-panel .table-wrap {
  max-height: calc(100dvh - 290px);
  min-height: 280px;
  overflow: auto;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
}

body[data-active-view="transactions"] .roz-namcha-table-panel table {
  min-width: 1040px;
}

body[data-active-view="transactions"] .roz-namcha-table-panel th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #17212b !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(1) { width: 102px; }
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(2) { width: 76px; }
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(3),
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(4),
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(6) { width: 130px; }
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(7) { width: 150px; }
body[data-active-view="transactions"] .roz-namcha-table-panel th:nth-child(8) { width: 92px; }

body[data-active-view="transactions"] .currency-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 27px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 800;
}

body[data-active-view="transactions"] .cash-in-value {
  color: #047857 !important;
  font-weight: 800;
}

body[data-active-view="transactions"] .cash-out-value {
  color: #b91c1c !important;
  font-weight: 800;
}

body[data-active-view="transactions"] .roz-description-cell {
  min-width: 310px;
}

body[data-active-view="transactions"] .roz-description-cell strong,
body[data-active-view="transactions"] .roz-description-cell span {
  display: block;
}

body[data-active-view="transactions"] .roz-description-cell strong {
  margin-bottom: 3px;
  color: #b91c1c;
  font-size: 11px;
}

body[data-active-view="transactions"] .roz-description-cell span {
  color: #334155;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button {
  display: inline-flex !important;
  width: auto !important;
  min-width: 70px !important;
  gap: 5px;
  padding-inline: 9px !important;
  border-color: #fecaca !important;
  background: #fff1f2 !important;
  color: #b91c1c !important;
}

.roz-open-button span {
  display: inline !important;
  font-size: 11px;
  font-weight: 800;
}

.roz-detail-card {
  width: min(760px, calc(100vw - 24px));
}

.roz-detail-card .panel-head {
  align-items: flex-start;
}

.roz-detail-location {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}

.roz-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(58dvh, 520px);
  overflow: auto;
  padding: 2px;
}

.roz-detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.roz-detail-item span {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.roz-detail-item strong {
  color: #0f172a;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

tr.source-row-focus > td {
  animation: source-row-pulse 3.2s ease both;
}

.return-exchange-hint {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.text-danger .return-exchange-hint {
  color: #9f1239;
}

@keyframes source-row-pulse {
  0%, 100% { background: inherit; }
  12%, 74% { background: #fee2e2 !important; box-shadow: inset 0 2px #ef4444, inset 0 -2px #ef4444; }
}

@media (max-width: 1180px) {
  body[data-active-view="transactions"] .roz-compact-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body[data-active-view="transactions"] .roz-date-filter {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 760px) {
  body[data-active-view="transactions"] .roz-compact-header {
    grid-template-columns: 1fr;
    align-items: stretch !important;
  }

  body[data-active-view="transactions"] .roz-title-block {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  body[data-active-view="transactions"] .roz-primary-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body[data-active-view="transactions"] .roz-primary-actions .inline-search {
    grid-column: 1 / -1;
  }

  body[data-active-view="transactions"] .roz-primary-actions button {
    width: 100%;
    padding-inline: 7px;
    font-size: 11px;
  }

  body[data-active-view="transactions"] .roz-date-filter {
    grid-column: auto;
    grid-template-columns: 1fr 1fr;
    justify-self: stretch;
  }

  body[data-active-view="transactions"] .roz-date-filter input {
    width: 100%;
    min-width: 0;
  }

  body[data-active-view="transactions"] .roz-kpi-strip {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 3px;
  }

  body[data-active-view="transactions"] .roz-kpi-strip .kpi {
    flex: 0 0 min(74vw, 220px);
    scroll-snap-align: start;
  }

  body[data-active-view="transactions"] .roz-namcha-table-panel .table-wrap {
    max-height: calc(100dvh - 335px);
  }

  .roz-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Roz Namcha compact workspace and overflow repair (2026-07-30) */
body[data-active-view="transactions"]:not(.locked) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-active-view="transactions"] .topbar {
  display: none !important;
}

body[data-active-view="transactions"] .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 8px 12px !important;
}

body[data-active-view="transactions"] #view-transactions {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body[data-active-view="transactions"] .roz-namcha-panel {
  height: 100%;
  min-height: 0;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
  padding: 0 !important;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-active-view="transactions"] .roz-compact-header {
  grid-template-columns: minmax(108px, auto) minmax(0, 1fr);
  align-items: center !important;
  gap: 6px 10px !important;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 8px !important;
  overflow: hidden;
  border-radius: 10px;
  box-sizing: border-box;
}

body[data-active-view="transactions"] .roz-title-block {
  min-width: 0;
}

body[data-active-view="transactions"] .roz-title-block h2 {
  font-size: 18px;
  white-space: nowrap;
}

body[data-active-view="transactions"] .roz-primary-actions {
  grid-template-columns: minmax(130px, 1fr) repeat(3, max-content) !important;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

body[data-active-view="transactions"] .roz-primary-actions > *,
body[data-active-view="transactions"] .roz-date-filter > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

body[data-active-view="transactions"] .roz-primary-actions .inline-search {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 34px;
  padding-inline: 10px;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

body[data-active-view="transactions"] .roz-primary-actions button,
body[data-active-view="transactions"] .roz-date-filter button {
  min-height: 34px !important;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
}

body[data-active-view="transactions"] .roz-date-filter {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(116px, 158px)) auto auto;
  justify-content: end;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
}

body[data-active-view="transactions"] .roz-date-filter label,
body[data-active-view="transactions"] .roz-date-filter input {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

body[data-active-view="transactions"] .roz-date-filter input {
  width: 100%;
  height: 34px;
}

body[data-active-view="transactions"] .roz-kpi-strip {
  gap: 6px !important;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi {
  min-height: 58px;
  padding: 6px 8px !important;
  border-radius: 9px;
}

body[data-active-view="transactions"] .roz-kpi-strip .kpi strong {
  margin-top: 3px;
}

body[data-active-view="transactions"] .roz-namcha-table-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
  border-radius: 10px;
}

body[data-active-view="transactions"] .roz-namcha-table-panel .table-wrap {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none !important;
  overflow: auto;
  border-radius: 10px;
  scrollbar-gutter: stable;
}

body[data-active-view="transactions"] .roz-namcha-table-panel th {
  height: 34px;
  padding-block: 7px;
}

body[data-active-view="transactions"] .roz-namcha-table-panel thead th:last-child,
body[data-active-view="transactions"] #transactionRows td:last-child {
  position: sticky !important;
  right: 0;
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  padding: 6px 10px !important;
  text-align: center;
  box-shadow: -9px 0 16px -14px rgba(15, 23, 42, .78);
}

body[data-active-view="transactions"] .roz-namcha-table-panel thead th:last-child {
  z-index: 7;
  background: #17212b !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

body[data-active-view="transactions"] #transactionRows td:last-child {
  z-index: 3;
  background: #fff !important;
}

body[data-active-view="transactions"] #transactionRows tr:nth-child(even) td:last-child {
  background: #f8fafc !important;
}

body[data-active-view="transactions"] #transactionRows tr:hover td:last-child {
  background: #f6fafb !important;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button {
  position: relative;
  isolation: isolate;
  width: 82px !important;
  min-width: 82px !important;
  max-width: none !important;
  min-height: 32px !important;
  height: 32px;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px 4px 6px !important;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  border-radius: 999px !important;
  background: linear-gradient(120deg, #111827 0%, #27364a 68%, #e11d48 68%, #be123c 100%) !important;
  color: #fff !important;
  box-shadow: 0 5px 13px rgba(15, 23, 42, .22), inset 0 1px rgba(255, 255, 255, .16) !important;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, .22) 45%, transparent 67%);
  transform: translateX(-120%);
  transition: transform .34s ease;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button svg {
  width: 22px;
  height: 22px;
  padding: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff !important;
  stroke: #fff !important;
  box-sizing: border-box;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button span {
  color: #fff !important;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button:hover,
body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button:focus-visible {
  background: linear-gradient(120deg, #020617 0%, #1e293b 62%, #f43f5e 62%, #be123c 100%) !important;
  color: #fff !important;
  box-shadow: 0 7px 16px rgba(15, 23, 42, .3), 0 0 0 3px rgba(244, 63, 94, .14) !important;
  transform: translateY(-1px);
}

body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button:hover::after,
body[data-active-view="transactions"] #transactionRows .row-action.roz-open-button:focus-visible::after {
  transform: translateX(120%);
}

@media (min-width: 1580px) {
  body[data-active-view="transactions"] .roz-compact-header {
    grid-template-columns: minmax(108px, auto) minmax(420px, 1fr) auto;
  }

  body[data-active-view="transactions"] .roz-date-filter {
    grid-column: auto;
    width: auto;
  }
}

@media (max-width: 900px) {
  body[data-active-view="transactions"] .roz-compact-header {
    grid-template-columns: 1fr;
    align-items: stretch !important;
  }

  body[data-active-view="transactions"] .roz-title-block {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  body[data-active-view="transactions"] .roz-primary-actions,
  body[data-active-view="transactions"] .roz-date-filter {
    grid-column: auto;
  }
}

@media (max-width: 767px) {
  body[data-active-view="transactions"] .app-shell {
    padding: 62px 7px 7px !important;
  }

  body[data-active-view="transactions"] .roz-primary-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body[data-active-view="transactions"] .roz-primary-actions .inline-search {
    grid-column: 1 / -1;
  }

  body[data-active-view="transactions"] .roz-primary-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 5px;
    font-size: 10px;
  }

  body[data-active-view="transactions"] .roz-date-filter {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    justify-self: stretch;
  }

  body[data-active-view="transactions"] .roz-kpi-strip .kpi {
    flex-basis: min(68vw, 190px);
  }
}

@media (max-width: 460px) {
  body[data-active-view="transactions"] .roz-primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-active-view="transactions"] #openDailyCashModalButton {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) and (max-height: 520px) {
  body[data-active-view="transactions"] .app-shell {
    padding-top: 52px !important;
  }

  body[data-active-view="transactions"] .roz-title-block {
    display: none;
  }

  body[data-active-view="transactions"] .roz-compact-header {
    gap: 4px !important;
    padding: 4px 6px !important;
  }

  body[data-active-view="transactions"] .roz-kpi-strip .kpi {
    min-height: 52px;
  }
}

@media (min-width: 560px) and (max-width: 900px) and (max-height: 520px) {
  body[data-active-view="transactions"] .roz-primary-actions {
    grid-template-columns: minmax(130px, 1fr) repeat(3, max-content) !important;
  }

  body[data-active-view="transactions"] .roz-namcha-panel .roz-primary-actions .inline-search {
    grid-column: auto !important;
  }

  body[data-active-view="transactions"] .roz-date-filter {
    grid-template-columns: repeat(2, minmax(116px, 1fr)) auto auto;
  }
}

/* Content must remain reachable on small screens and with the keyboard open. */
body.locked .login-screen {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: block;
  -webkit-overflow-scrolling: touch;
}
body.locked .login-layout {
  height: auto !important;
  max-height: none !important;
  min-height: 100% !important;
  margin: 0 auto;
  align-content: center;
  grid-template-rows: auto !important;
}
body.locked .login-card,
body.locked .daily-hadith-card {
  height: auto !important;
  max-height: none !important;
  min-width: 0;
  flex-shrink: 0;
}
body.locked .login-card { align-content: center; gap: 10px; padding: 24px; }
body.locked .login-card > p,
body.locked .hadith-source,
body.locked .hadith-meaning-label { display: block; }
body.locked .hadith-card-topline { display: flex; }
body.locked .hadith-divider { display: block; }
body.locked .login-card > label input { min-width: 0; width: 100%; font-size: 16px; height: 44px; min-height: 44px; }
body.locked .login-card > .primary-button { min-height: 44px; height: auto; }
@media (max-width: 780px) {
  body.locked .login-layout { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; align-content: start; }
  body.locked .login-card { padding: 20px 16px; }
  body.locked .login-logo { width: 68px; height: 68px; }
  body.locked .login-card h1 { font-size: 23px; }
  body.locked .login-card > p,
  body.locked .login-card > label { font-size: 13px; }
  body.locked .login-connection-status { font-size: 12px; line-height: 1.4; }
  body.locked .daily-hadith-card { padding: 20px; }
  body.locked .daily-hadith-arabic { font-size: 24px; }
  body.locked .daily-hadith-pashto { font-size: 18px; }
}
@media (max-width: 380px) {
  .login-developer-footer { padding: 14px 8px; }
  .login-developer-footer strong { font-size: 16px; }
  .developer-phones { gap: 6px; }
  .developer-phones a { padding: 10px 6px; font-size: 12px; }
  .developer-email { font-size: 12px; }
  body:not(.locked) .app-shell { min-width: 0 !important; max-width: 100%; }
  .app-modal { padding: 8px !important; }
  .app-modal .app-modal-card,
  .app-modal .confirm-modal-card { min-width: 0 !important; width: 100% !important; max-width: 100% !important; max-height: calc(100vh - 16px) !important; overflow: auto !important; }
  .table-wrap { max-width: 100%; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid > * { min-width: 0; grid-column: auto !important; }
  body[data-active-view="transactions"]:not(.locked),
  body[data-active-view="customer-sheet"]:not(.locked),
  body[data-active-view="people"]:not(.locked) { height: auto !important; min-height: 100vh !important; overflow-y: auto !important; }
  body[data-active-view="transactions"] .app-shell,
  body[data-active-view="customer-sheet"] .app-shell,
  body[data-active-view="people"] .app-shell,
  body[data-active-view="transactions"] #view-transactions,
  body[data-active-view="customer-sheet"] #view-customer-sheet,
  body[data-active-view="people"] #view-people,
  body[data-active-view="transactions"] .roz-namcha-panel,
  body[data-active-view="customer-sheet"] .customer-sheet-panel,
  body[data-active-view="people"] .supplier-sheet-panel { height: auto !important; max-height: none !important; overflow: visible !important; }
  body[data-active-view="transactions"] .roz-namcha-panel { grid-template-rows: auto auto auto; }
  body[data-active-view="transactions"] .roz-namcha-table-panel .table-wrap { min-height: 160px; }
}
