:root {
  --navy-950: #11182c;
  --navy-900: #17213c;
  --navy-800: #202d4e;
  --navy-700: #2b3b63;
  --blue-700: #3755ca;
  --blue-600: #4664dc;
  --blue-100: #e9edff;
  --blue-50: #f4f6ff;
  --green-700: #16755a;
  --green-100: #dff5ec;
  --amber-700: #9b6210;
  --amber-100: #fff0cf;
  --red-700: #b43b4a;
  --red-100: #fde7ea;
  --ink: #182035;
  --muted: #687187;
  --muted-light: #9aa2b3;
  --line: #e3e6ed;
  --line-dark: #d4d8e2;
  --surface: #ffffff;
  --canvas: #f5f6f9;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 4%), 0 4px 12px rgb(16 24 40 / 4%);
  --shadow-lg: 0 18px 48px rgb(16 24 40 / 14%);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --sidebar-width: 258px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 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;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: -100px;
  left: 20px;
  padding: 10px 16px;
  color: #fff;
  background: var(--navy-950);
  border-radius: 0 0 8px 8px;
}

.skip-link:focus {
  top: 0;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #e9ecf5;
  background: var(--navy-950);
}

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

.brand {
  padding: 0 8px 28px;
}

.brand-mark {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.03em;
  background: var(--blue-600);
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(44 69 176 / 30%);
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand-copy strong {
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.brand-copy small {
  margin-top: 2px;
  color: #8f9ab3;
  font-size: 12px;
  letter-spacing: .03em;
}

.nav-list {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 5px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgb(170 179 199 / 55%) transparent;
}

.nav-list::-webkit-scrollbar { width: 8px; }
.nav-list::-webkit-scrollbar-track { background: transparent; }
.nav-list::-webkit-scrollbar-thumb { background: rgb(170 179 199 / 42%); border-radius: 999px; }
.nav-list::-webkit-scrollbar-thumb:hover { background: rgb(170 179 199 / 65%); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 11px;
  color: #aab3c7;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-link:hover {
  color: #fff;
  background: rgb(255 255 255 / 5%);
}

.nav-link.is-active {
  color: #fff;
  background: #28365d;
  border-color: rgb(255 255 255 / 6%);
}

.nav-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: #cad1df;
  font-size: 11px;
  font-weight: 800;
  background: rgb(255 255 255 / 7%);
  border-radius: 8px;
}

.nav-link.is-active .nav-icon {
  color: #fff;
  background: var(--blue-600);
}

.sidebar-branch-menu summary {
  cursor: pointer;
  list-style: none;
}

.sidebar-branch-menu summary::-webkit-details-marker {
  display: none;
}

.sidebar-branch-caret {
  margin-left: auto;
  transition: transform 160ms ease;
}

.sidebar-branch-menu[open] .sidebar-branch-caret {
  transform: rotate(90deg);
}

.sidebar-branch-list {
  display: grid;
  gap: 2px;
  max-height: 280px;
  margin: 2px 0 8px 40px;
  overflow: auto;
}

.sidebar-branch-group-label {
  margin: 8px 8px 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-branch-user {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  color: inherit;
  font-size: 0.78rem;
  text-decoration: none;
}

.sidebar-branch-user:hover,
.sidebar-branch-user.is-active {
  background: var(--surface-muted);
  color: var(--primary);
}

.sidebar-branch-user small {
  color: var(--muted);
  font-size: 0.65rem;
}

.sidebar-branch-empty {
  padding: 3px 9px 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.admin-branch-preview-note {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 0.74rem;
}

.admin-branch-preview-note a {
  color: var(--primary);
}

.sidebar-footer {
  flex: 0 0 auto;
  padding-top: 18px;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 5px 14px;
}

.sidebar-user-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.sidebar-user-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy small {
  margin-top: 3px;
  color: #8f9ab3;
  font-size: 11px;
}

.avatar,
.company-avatar,
.profile-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  font-weight: 800;
  background: var(--blue-100);
  border-radius: 10px;
}

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

.sidebar .avatar {
  color: #fff;
  background: #34436c;
}

.avatar-small {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.app-main {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky !important;
  z-index: 30;
  top: 0;
  display: flex;
  height: 72px;
  align-items: center;
  padding: 0 clamp(22px, 4vw, 48px);
  background: rgb(255 255 255 / 92%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-title {
  display: flex;
  flex-direction: column;
}

.topbar-title strong {
  margin-top: 1px;
  font-size: 15px;
}

.topbar-greeting {
  display: flex;
  min-width: 0;
  max-width: min(58vw, 780px);
  align-items: center;
  margin-left: 22px;
  overflow: hidden;
  color: #59657a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.topbar-greeting [data-ai-greeting-text] {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topbar-greeting[hidden] {
  display: none;
}

.topbar-greeting-cursor {
  width: 1px;
  height: 16px;
  flex: 0 0 1px;
  margin-left: 2px;
  background: var(--blue-600);
  animation: ai-greeting-cursor 850ms steps(1, end) infinite;
}

@keyframes ai-greeting-cursor {
  50% { opacity: 0; }
}

.ai-pa-toast {
  position: fixed;
  z-index: 180;
  top: 84px;
  right: 18px;
  display: grid;
  width: min(520px, calc(100vw - 36px));
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 10px;
  padding: 12px;
  color: #263149;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  background: rgb(255 255 255 / 97%);
  border: 1px solid #d8deeb;
  border-left: 3px solid var(--blue-600);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgb(29 40 70 / 20%);
  backdrop-filter: blur(10px);
  animation: ai-pa-toast-in 180ms ease-out;
}

.ai-pa-toast[hidden] {
  display: none;
}

.branch-sheet-workspace-body .ai-pa-toast {
  top: 64px;
}

.ai-pa-toast[data-type='success'] {
  border-left-color: var(--green-700);
}

.ai-pa-toast[data-type='error'] {
  border-left-color: var(--red-700);
}

.ai-pa-toast[data-type='greeting'] {
  border-left-color: #7c5ce5;
}

.ai-pa-toast-avatar {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
  background: var(--navy-900);
  border-radius: 10px;
}

.ai-pa-toast-message {
  padding-top: 7px;
}

.ai-pa-toast-close {
  width: 24px;
  height: 24px;
  padding: 0;
  color: #778197;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.ai-pa-toast-close:hover,
.ai-pa-toast-close:focus-visible {
  color: var(--ink);
  background: var(--canvas);
}

@keyframes ai-pa-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.topbar-title .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 5px 8px 5px 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
}

.topbar-profile:hover {
  color: var(--ink);
  background: var(--canvas);
}

.dashboard-topbar .topbar-greeting {
  flex: 1 1 auto;
  max-width: none;
}

.dashboard-topbar .topbar-greeting [data-ai-greeting-text] {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-line-clamp: unset;
}

.menu-button {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  margin-right: 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.menu-button span:not(.sr-only) {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.content {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 38px clamp(22px, 4vw, 48px) 64px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -.035em;
  line-height: 1.08;
}

.page-heading p:last-child {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.page-heading-dashboard h1 {
  font-size: clamp(30px, 3vw, 42px);
}

.page-heading-with-back {
  align-items: center;
}

.company-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.back-link:hover,
.text-link:hover {
  color: var(--blue-700);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(70 100 220 / 25%);
  outline-offset: 2px;
}

.button-primary {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
  box-shadow: 0 6px 16px rgb(55 85 202 / 18%);
}

.button-primary:hover {
  background: var(--blue-700);
}

.button-secondary {
  background: #fff;
}

.button-quiet {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.sidebar .button-quiet {
  color: #aab3c7;
  border-color: rgb(255 255 255 / 8%);
}

.sidebar .button-quiet:hover {
  color: #fff;
  background: rgb(255 255 255 / 5%);
}

.button-full {
  width: 100%;
}

.button-large {
  min-height: 50px;
  font-size: 14px;
  border-radius: 11px;
}

.button-small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 11px;
  border-radius: 8px;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading .eyebrow {
  margin-bottom: 5px;
}

.panel-heading h2,
.section-heading h2 {
  margin-bottom: 0;
  font-size: 17px;
  letter-spacing: -.02em;
}

.text-link {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  min-height: 155px;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stats-grid-compact {
  width: fit-content;
  grid-template-columns: max-content;
  margin-top: 0;
  margin-bottom: 12px;
}

.dashboard-summary-chips {
  display: flex;
  width: 100%;
  align-items: center;
  flex-wrap: wrap;
}

.stats-grid-compact .stat-card {
  min-height: 0;
  padding: 8px 12px;
  border-radius: 9px;
  grid-column: auto;
}

.stats-grid-compact .stat-label {
  width: fit-content;
  margin: 0;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 650;
}

.stats-grid-compact .stat-value {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -.02em;
}

.stats-grid-compact .stat-value-text {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
  .topbar-greeting-cursor {
    animation: none;
  }

  .ai-pa-toast {
    animation: none;
  }
}

@media (max-width: 680px) {
  .topbar-greeting {
    max-width: calc(100vw - 190px);
    margin-left: 12px;
    font-size: 11px;
  }

  .ai-pa-toast,
  .branch-sheet-workspace-body .ai-pa-toast {
    top: 64px;
    right: 10px;
    width: calc(100vw - 20px);
  }
}

@media print {
  .ai-pa-toast {
    display: none !important;
  }
}

/* Branch invoice workspace */
.invoice-page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.invoice-page-heading > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
}

.invoice-page-heading .back-link,
.invoice-page-heading .eyebrow {
  display: none;
}

.invoice-page-heading h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 32px);
  white-space: nowrap;
}

.invoice-page-heading p:last-child {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}

.invoice-page-heading .page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-settings-form {
  display: grid;
  gap: 16px;
  padding-bottom: 76px;
}

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

.invoice-image-setting,
.invoice-bank-logo-setting {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.invoice-image-preview-box {
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 78px;
}

.invoice-image-preview-box > img {
  width: 104px;
  height: 78px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-image-preview-box.is-bank { width: 156px; height: 64px; }
.invoice-image-preview-box.is-bank > img { width: 156px; height: 64px; object-fit: contain; background: #fff; }
.invoice-image-remove { position: absolute; top: -8px; right: -8px; z-index: 2; width: 24px; height: 24px; border: 1px solid #b8c2d1; border-radius: 50%; background: #fff; color: #b42318; font-size: 18px; line-height: 20px; cursor: pointer; box-shadow: 0 2px 6px rgb(15 23 42 / 14%); }
.invoice-image-remove:hover { background: #fee4e2; }

.invoice-bank-logo-setting {
  margin-top: 16px;
}

.invoice-image-setting .field,
.invoice-bank-logo-setting .field {
  flex: 1;
}

.invoice-settings-actions {
  z-index: 20;
}

.invoice-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 0;
}

.invoice-editor {
  position: static;
  display: grid;
  width: 100%;
  max-height: none;
  gap: 14px;
  overflow: visible;
  padding: 18px;
}

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

.invoice-packing-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
}

.invoice-packing-toggle input { width: 18px; height: 18px; margin: 0; }
.invoice-packing-toggle span { display: grid; gap: 2px; }
.invoice-packing-toggle small { color: var(--muted); }

.invoice-generate-actions {
  display: grid;
  gap: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.invoice-generate-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px;
}

.invoice-generate-buttons .button { width: 100%; }

@media (max-width: 680px) {
  .invoice-generate-buttons { grid-template-columns: 1fr; }
}

.invoice-preview-stack {
  display: grid;
  justify-items: center;
  gap: 24px;
  width: 100%;
  min-width: 0;
  padding: 0 4px 30px;
}

.invoice-paper {
  box-sizing: border-box;
  width: min(100%, 760px);
  aspect-ratio: 210 / 297;
  padding: 14px;
  overflow: hidden;
  color: #050505;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  line-height: 1.22;
  background: #fff;
  border: 1px solid #b8c0cc;
  box-shadow: 0 10px 32px rgb(22 34 55 / 13%);
}

.invoice-preview-header {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  min-height: 82px;
  border: 1px solid #000;
}

.invoice-preview-header img {
  width: 64px;
  height: 64px;
  margin: 4px;
  object-fit: contain;
}

.invoice-preview-header > div {
  text-align: center;
}

.invoice-preview-header h2 {
  margin: 0 0 5px;
  color: #05aeed;
  font-size: clamp(22px, 3.15vw, 42px);
  line-height: 1;
  letter-spacing: -.03em;
}

.invoice-preview-header p {
  margin: 2px 5px;
  font-weight: 700;
}

.invoice-preview-title {
  margin: 2px 0 0;
  padding: 3px;
  font-size: 14px;
  text-align: center;
  border: 1px solid #000;
}

.invoice-preview-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 106px;
}

.invoice-preview-meta dl {
  margin: 0;
  padding-top: 0;
}

.invoice-preview-meta dl:last-child {
  margin-left: 20%;
}

.invoice-preview-meta dl div {
  display: grid;
  grid-template-columns: minmax(94px, 1fr) 1fr;
  min-height: 19px;
  border: 1px solid #000;
  border-top: 0;
}

.invoice-preview-meta dt,
.invoice-preview-meta dd {
  margin: 0;
  padding: 3px 5px;
  font-weight: 700;
}

.invoice-preview-meta dd {
  border-left: 1px solid #000;
}

.invoice-preview-parties {
  display: grid;
  grid-template-columns: 56% 44%;
  min-height: 72px;
  border: 1px solid #000;
}

.invoice-preview-parties > div {
  padding: 5px;
}

.invoice-preview-parties > div + div {
  border-left: 1px solid #000;
}

.invoice-preview-parties h4,
.invoice-preview-parties p {
  margin: 4px 0;
}

.invoice-preview-items {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.invoice-preview-items th,
.invoice-preview-items td {
  min-height: 20px;
  padding: 2px 4px;
  overflow: hidden;
  text-align: right;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  border: 1px dotted #000;
}

.invoice-preview-items thead th {
  height: 25px;
  text-align: center;
  white-space: normal;
  background: #f1f1f1;
  border-style: solid;
}

.invoice-preview-items col.invoice-item-sr { width: 7%; }
.invoice-preview-items col.invoice-item-description-a { width: 18%; }
.invoice-preview-items col.invoice-item-description-b { width: 41%; }
.invoice-preview-items col.invoice-item-weight { width: 11%; }
.invoice-preview-items col.invoice-item-rate { width: 11%; }
.invoice-preview-items col.invoice-item-amount { width: 12%; }
.invoice-preview-items tfoot th { border-style: solid; }

.invoice-discount-editor { margin-top: 14px; }
.invoice-discount-editor > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.invoice-discount-editor small { color: var(--ink-muted); font-size: 10px; }
.invoice-discount-editor table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 11px; }
.invoice-discount-editor th,
.invoice-discount-editor td { padding: 4px 5px; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); }
.invoice-discount-editor th:first-child,
.invoice-discount-editor td:first-child { text-align: left; }
.invoice-discount-editor input { width: 100%; min-width: 0; padding: 3px 4px; text-align: right; border: 1px solid transparent; background: #fff; }
.invoice-discount-editor input:focus { border-color: var(--blue-600); outline: 0; }
.branch-invoice-item-editor { grid-column: 1 / -1; }
.branch-invoice-item-scroll { width: 100%; overflow: auto; border: 1px solid var(--line); }
.branch-invoice-item-editor table { min-width: 1080px; }
.branch-invoice-item-editor input { min-width: 74px; font: inherit; }
.branch-invoice-item-editor input[readonly] { color: var(--ink); background: #f8fafc; cursor: default; }
.branch-invoice-packing-toggle-row td { padding: 3px 5px; text-align: left !important; background: #f8fafc; }
.branch-invoice-packing-editor { margin-top: 8px; }
.branch-invoice-packing-editor h3 { margin: 0 0 5px; font-size: 12px; }

.invoice-packing-paper { aspect-ratio: auto; min-height: 1075px; }
.invoice-packing-meta { display: flex; justify-content: space-between; padding: 7px 5px; border: 1px solid #000; border-top: 0; }
.invoice-packing-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.invoice-packing-table th,
.invoice-packing-table td { min-height: 20px; padding: 3px; overflow: visible; text-align: center; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; border: 1px solid #000; vertical-align: middle; }
.invoice-packing-table th { background: #f1f1f1; }
.invoice-packing-table th:nth-child(1) { width: 5%; }
.invoice-packing-table th:nth-child(2) { width: 7%; }
.invoice-packing-table th:nth-child(3) { width: 14%; }
.invoice-packing-table th:nth-child(4) { width: 22%; }
.invoice-packing-table th:nth-child(5),
.invoice-packing-table th:nth-child(6),
.invoice-packing-table th:nth-child(7) { width: 8%; }
.invoice-packing-table th:nth-child(8) { width: 13%; }
.invoice-packing-table th:nth-child(9) { width: 15%; }
.invoice-packing-table td:nth-last-child(-n + 3),
.invoice-packing-table tfoot th:nth-last-child(-n + 3) { text-align: right; }
.invoice-packing-table .invoice-packing-group-row th { background: #e9eef7; }
.invoice-packing-table .invoice-packing-subtotal-row th { background: #f3f4f6; font-weight: 700; }
.invoice-packing-table .invoice-packing-subtotal-row th:first-child { text-align: center; }
.invoice-packing-signature { display: grid; justify-content: end; gap: 22px; padding: 24px 8px 0; text-align: right; }

.invoice-preview-declaration {
  min-height: 88px;
  padding: 5px;
  font-size: 6.7px;
  font-weight: 700;
  border: 1px solid #000;
}

.invoice-preview-declaration p {
  margin: 0 0 3px;
}

.invoice-preview-banks > div {
  display: grid;
  grid-template-columns: 28% 1fr;
  min-height: 52px;
  border: 1px solid #000;
  border-top: 0;
}

.invoice-preview-banks img {
  width: 96%;
  height: 48px;
  padding: 3px;
  object-fit: contain;
}

.invoice-preview-banks p {
  margin: 0;
  padding: 3px 5px;
  line-height: 1.35;
  border-left: 1px solid #000;
}

.invoice-preview-banks.is-expanded > div {
  grid-template-columns: 32% 1fr;
  min-height: 78px;
}

.invoice-preview-banks.is-expanded img {
  height: 72px;
  padding: 4px;
}

.invoice-preview-banks.is-expanded p {
  padding: 6px 7px;
  font-size: 9px;
  line-height: 1.5;
}

.invoice-preview-signatures {
  display: grid;
  grid-template-columns: 42% 58%;
  min-height: 94px;
  border: 1px solid #000;
  border-top: 0;
}

.invoice-preview-signatures > div {
  position: relative;
  padding: 6px;
  font-style: italic;
}

.invoice-preview-signatures > div + div {
  text-align: center;
  border-left: 1px solid #000;
}

.invoice-preview-signatures img {
  display: block;
  width: 145px;
  height: 66px;
  margin: 2px auto;
  object-fit: contain;
}

.invoice-preview-signatures small {
  position: absolute;
  right: 5px;
  bottom: 3px;
  left: 5px;
  font-style: normal;
  text-align: center;
  border-top: 1px dotted #000;
}

.invoice-declaration-paper {
  padding: 42px 54px;
}

.invoice-declaration-paper .invoice-preview-header {
  grid-template-columns: 110px 1fr;
  min-height: 118px;
}

.invoice-declaration-paper .invoice-preview-header img {
  width: 96px;
  height: 96px;
}

.invoice-declaration-body {
  position: relative;
  min-height: calc(100% - 120px);
  padding: 16px 3px;
  color: #064617;
  font-size: 10px;
  font-weight: 700;
  text-decoration: underline;
  border: 1px solid #000;
  border-top: 0;
}

.invoice-declaration-body p {
  margin: 0 0 20px;
  white-space: pre-line;
}

.invoice-declaration-date {
  text-align: right;
}

.invoice-declaration-sanctions {
  margin-top: 42px !important;
}

.invoice-declaration-signature {
  position: absolute;
  right: 55px;
  bottom: 25px;
  display: grid;
  width: 190px;
  color: #111;
  text-decoration: none;
}

.invoice-declaration-signature strong {
  color: #05aeed;
}

.invoice-declaration-signature img {
  width: 150px;
  height: 75px;
  object-fit: contain;
}

.invoice-declaration-signature span {
  padding-top: 5px;
  border-top: 1px dotted #000;
}

@media (max-width: 1120px) {
  .invoice-page-heading {
    display: flex;
  }

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

  .invoice-editor {
    position: static;
    max-height: none;
  }

  .invoice-preview-stack {
    overflow-x: auto;
  }
}

@media (max-width: 680px) {
  .invoice-page-heading > div {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .invoice-page-heading h1 {
    white-space: normal;
  }

  .invoice-image-settings,
  .invoice-editor-grid {
    grid-template-columns: 1fr;
  }

  .invoice-image-setting,
  .invoice-bank-logo-setting {
    align-items: flex-start;
    flex-direction: column;
  }

  .invoice-preview-stack {
    justify-items: start;
  }
}

.stat-card-primary {
  border-color: #d8def8;
}

.stat-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 850;
  background: var(--blue-100);
  border-radius: 12px;
}

.stat-icon-green {
  color: var(--blue-700);
  background: var(--green-100);
}

.stat-icon-amber {
  color: var(--amber-700);
  background: var(--amber-100);
}

.stat-card > div:last-child {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-value {
  margin: 3px 0 11px;
  font-size: 34px;
  letter-spacing: -.04em;
  line-height: 1.1;
}

.stat-value-text {
  overflow: hidden;
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card a,
.stat-caption {
  margin-top: auto;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 750;
}

.stat-caption {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  gap: 20px;
}

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

.dashboard-trade-card {
  min-width: 0;
  overflow: hidden;
}

.dashboard-trade-card-heading {
  min-height: 58px;
  padding: 14px 16px;
}

.dashboard-trade-card-heading h2 {
  font-size: 16px;
}

.stat-card.dashboard-active-users-card > div.dashboard-active-users-line {
  display: flex;
  flex: none;
  align-items: center;
  flex-direction: row;
  gap: 7px;
}

.stats-grid-compact .dashboard-active-users-card {
  align-items: center;
  flex-direction: row;
  gap: 9px;
}

.dashboard-online-users {
  display: flex !important;
  min-width: 0;
  align-items: center;
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 5px 9px;
}

.dashboard-online-user {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.dashboard-online-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--green-600, #16a34a);
  border-radius: 50%;
  box-shadow: 0 0 0 2px #dcfce7;
}

.dashboard-online-empty {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.dashboard-online-empty[hidden] {
  display: none;
}

.dashboard-branch-payments {
  margin-top: 16px;
  overflow: hidden;
}

.dashboard-branch-payment-heading {
  min-height: 54px;
  padding: 10px 16px;
}

.dashboard-branch-payment-heading > div {
  display: grid;
  gap: 1px;
}

.dashboard-branch-payment-heading .eyebrow,
.dashboard-branch-payment-heading h2 {
  margin: 0;
}

.dashboard-branch-payment-heading h2 {
  font-size: 16px;
}

.dashboard-payment-certi-search {
  display: inline-flex;
  width: min(330px, 36vw);
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.dashboard-payment-certi-search label {
  flex: 1;
}

.dashboard-payment-certi-search input {
  width: 100%;
  height: 32px;
  padding: 5px 10px;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  outline: none;
}

.dashboard-payment-certi-search .button {
  min-height: 32px;
  padding: 5px 10px;
}

.dashboard-payment-certi-search input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 2px var(--blue-100);
}

.dashboard-branch-payment-tabs {
  display: flex;
  min-height: 40px;
  align-items: end;
  gap: 2px;
  padding: 6px 12px 0;
  overflow: hidden;
  scrollbar-width: none;
  background: var(--surface-muted, #f7f8fb);
  border-bottom: 1px solid var(--line);
}

.dashboard-branch-payment-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
}

.dashboard-branch-payment-tab:hover,
.dashboard-branch-payment-tab:focus-visible,
.dashboard-branch-payment-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.dashboard-branch-payment-tab.is-active {
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.dashboard-branch-payment-tab small {
  min-width: 17px;
  padding: 1px 5px;
  color: var(--blue-700);
  font-size: 9px;
  text-align: center;
  background: var(--blue-50, #eef4ff);
  border-radius: 999px;
}
.dashboard-payment-tab-total { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.dashboard-payment-total { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface-subtle, #f7f9fc); font-variant-numeric: tabular-nums; }
.dashboard-payment-total strong { color: var(--ink); }

.dashboard-branch-payment-panel {
  overflow: hidden;
}

.dashboard-branch-payment-panel[hidden] {
  display: none;
}

.dashboard-branch-payment-grid {
  min-width: 700px;
}
.dashboard-branch-payment-grid { width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: auto; padding-bottom: 4px; }
.dashboard-branch-payment-grid.is-payment-scroll { max-height: 430px; overflow-y: auto; }
.payment-updates-workspace { width: 100%; min-width: 0; }
.payment-updates-workspace .dashboard-branch-payment-grid.is-payment-scroll { max-height: calc(100vh - 230px); }
.dashboard-branch-payment-grid.is-payment-scroll .dashboard-branch-payment-labels { position: sticky; top: 0; z-index: 2; }
.dashboard-branch-payment-row { grid-template-columns: var(--payment-grid-columns, 150px 180px 260px 180px 90px 120px 140px 140px 110px 160px); min-width: 1530px; }
.dashboard-payment-sent-filter { display:inline-flex; align-items:center; gap:5px; min-height:34px; padding:7px 11px; color:var(--muted); font:inherit; font-size:11px; font-weight:650; white-space:nowrap; background:transparent; border:1px solid transparent; border-bottom:0; border-radius:7px 7px 0 0; cursor:pointer; }
.dashboard-payment-sent-filter:hover, .dashboard-payment-sent-filter:focus-within, .dashboard-payment-sent-filter:has(input:checked) { color:var(--ink); background:var(--surface); border-color:var(--line); }
.dashboard-payment-sent-filter:has(input:checked) { margin-bottom:-1px; padding-bottom:8px; }
.dashboard-payment-sent-filter input { width:12px; height:12px; margin:0; }

.dashboard-branch-payment-row {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: var(--payment-grid-columns, 150px 180px 260px 180px 90px 120px 140px 140px 250px 250px 110px 160px);
  min-height: 35px;
  align-items: center;
}

.dashboard-branch-payment-row > span {
  min-width: 0;
  padding: 8px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid var(--line);
}
.dashboard-payment-resize-handle { position: absolute; top: 0; right: -1px; bottom: 0; width: 7px; padding: 0; cursor: col-resize; border: 0; background: transparent; }
.dashboard-payment-resize-handle:hover, .dashboard-payment-resize-handle:focus-visible { background: #8ca8e8; }
.dashboard-branch-payment-labels > span { position: relative; }
.dashboard-payment-brate { width: 100%; box-sizing: border-box; border: 1px solid transparent; background: transparent; font: inherit; color: inherit; padding: 4px; touch-action: manipulation; }
.dashboard-payment-brate-cell { display: flex; align-items: center; gap: 3px; overflow: visible !important; text-overflow: clip !important; white-space: normal !important; }
.dashboard-payment-brate:focus { border-color: var(--accent, #5576c9); background: #fff; outline: none; }
.dashboard-payment-send-cell { display: flex; flex-flow: column nowrap; align-items: flex-start; gap: 2px; overflow: visible !important; text-overflow: clip !important; white-space: normal !important; }
.dashboard-payment-recipient { display: inline-flex; align-items: center; max-width: 100%; color: #25518c; font-size: 9px; font-weight: 650; line-height: 1; white-space: normal; word-break: break-word; }
.dashboard-payment-recipient-label { display: inline-flex; align-items: center; min-height: 17px; max-width: 100%; gap: 3px; padding: 1px 4px; color: inherit; font: inherit; line-height: 1; text-align: left; background: #edf4ff; border: 1px solid #bdd0ef; border-radius: 999px 0 0 999px; }
.dashboard-payment-recipient-send:hover:not(:disabled), .dashboard-payment-recipient-send:focus-visible:not(:disabled) { color: #173d6c; background: #dceaff; border-color: #87a9df; outline: none; }
.dashboard-payment-recipient-send:disabled { color: #6d7d95; cursor: not-allowed; background: #f1f3f6; border-color: #d9dee7; }
.dashboard-payment-recipient-kind { display: inline-grid; min-width: 11px; height: 11px; place-items: center; color: #fff; font-size: 7px; font-weight: 800; letter-spacing: .02em; background: #4b73ae; border-radius: 50%; }
.dashboard-payment-recipient-remove { display: inline-grid; flex: 0 0 auto; width: 17px; height: 17px; margin-left: -1px; padding: 0; place-items: center; color: #25518c; font: inherit; font-size: 13px; font-weight: 750; line-height: 1; background: #edf4ff; border: 1px solid #bdd0ef; border-radius: 0 999px 999px 0; cursor: pointer; }
.dashboard-payment-recipient-remove:hover, .dashboard-payment-recipient-remove:focus-visible { color: #fff; background: #b42318; border-color: #b42318; outline: none; }
.dashboard-payment-recipient-remove.is-error { color: #b42318; }
.dashboard-payment-send-all { align-self: stretch; min-height: 18px; margin-top: 2px; padding: 1px 7px; color: #fff; font-size: 9px; font-weight: 750; line-height: 1; background: #25518c; border: 1px solid #25518c; border-radius: 3px; cursor: pointer; }
.dashboard-payment-recipient + .dashboard-payment-send-all { border-top: 1px solid #bdd0ef; }
.dashboard-payment-send-all:hover:not(:disabled), .dashboard-payment-send-all:focus-visible:not(:disabled) { background: #173d6c; border-color: #173d6c; outline: none; }
.dashboard-payment-send-all:disabled { color: #6d7d95; background: #f1f3f6; border-color: #d9dee7; cursor: not-allowed; }
.dashboard-payment-link { color: inherit; text-decoration: none; }
.dashboard-payment-link:hover { text-decoration: underline; }
.dashboard-payment-message { white-space: pre-line !important; line-height: 1.3; user-select: text; text-decoration: none !important; }

.dashboard-branch-payment-row > span:last-child {
  border-right: 0;
}

.dashboard-branch-payment-labels {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--surface-muted, #f7f8fb);
  border-bottom: 1px solid var(--line);
}

.dashboard-branch-payment-link {
  color: var(--ink);
  font-size: 11px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.dashboard-branch-payment-link:last-child {
  border-bottom: 0;
}

.dashboard-branch-payment-link:hover,
.dashboard-branch-payment-link:focus-visible {
  background: var(--blue-50, #eef4ff);
  outline: none;
}

.dashboard-branch-payment-empty {
  min-height: 88px;
}

.branch-payment-history-heading {
  align-items: end;
}

.branch-payment-history {
  overflow: hidden;
}

.branch-payment-history-tabs {
  padding-top: 10px;
}

.branch-payment-history-table-wrap {
  overflow: auto;
}

.branch-payment-history-table {
  width: 100%;
  min-width: 1750px;
  border-collapse: collapse;
  table-layout: fixed;
}

.branch-payment-history-table th,
.branch-payment-history-table td {
  padding: 6px 8px;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.branch-payment-history-table th {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--surface-muted, #f7f8fb);
  position: sticky;
  top: 22px;
  z-index: 2;
}

.branch-payment-history-table td {
  max-width: 420px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-payment-history-table .sheet-column-letters th {
  height: 22px;
  padding: 3px 8px;
  text-align: center;
  top: 0;
  z-index: 3;
}

.branch-payment-history-table th:first-child,
.branch-payment-history-table .sheet-row-number {
  width: 42px;
  min-width: 42px;
  text-align: center;
  background: var(--surface-muted, #f7f8fb);
}

.branch-payment-history-table .dashboard-payment-message {
  width: 300px;
  white-space: pre-wrap;
  cursor: copy;
}

.branch-payment-description-link {
  color: inherit;
  text-decoration: none;
}

.branch-payment-description-link:hover,
.branch-payment-description-link:focus-visible {
  color: var(--blue-700);
  text-decoration: underline;
}

.invoice-output-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.invoice-output-toggles .invoice-packing-toggle { min-width: 0; }
.invoice-history-table .invoice-previous-issue { color: #b42318; background: #fff3f2; }
.invoice-history-table td:first-child small { display: block; margin-top: 2px; font-size: 9px; font-weight: 500; }
.account-invoice-link { display: inline-block; margin: 0 4px 2px 0; color: var(--blue-700); font-size: 10px; text-decoration: underline; }

.dashboard-task-chips {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-task-chips[hidden] {
  display: none;
}

.stats-grid-compact .dashboard-task-chip {
  min-width: 0;
  max-width: min(260px, 70vw);
  align-items: center;
  gap: 8px;
}

.dashboard-task-chip input,
.dashboard-task-item input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--blue-600);
  cursor: pointer;
}

.dashboard-airway-bill-task .dashboard-task-readonly,
.dashboard-airway-bill-task .dashboard-task-edit {
  width: 100%;
}

.invoice-airway-pending { color: #b42318; font-weight: 600; }

.dashboard-task-chip input:disabled,
.dashboard-task-item input:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.dashboard-task-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dashboard-task-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dashboard-task-mention {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 1px 5px;
  border-radius: 999px;
  background: #eef2f7;
  color: #536176;
  font-size: 9px;
  font-weight: 650;
}

.dashboard-task-mention.is-green { background: #dcfae6; color: #067647; }
.dashboard-task-mention.is-red { background: #fee4e2; color: #b42318; }

.dashboard-task-edit,
.dashboard-task-readonly {
  min-width: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.dashboard-task-readonly { cursor: pointer; }

.dashboard-task-edit {
  cursor: pointer;
}

.dashboard-task-edit:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 3px;
  border-radius: 3px;
}

.dashboard-task-chip .dashboard-task-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-task-chip .dashboard-task-copy small {
  display: none;
}

.dashboard-branch-task-strip {
  padding: 6px 12px 0;
}

.dashboard-branch-task-strip .dashboard-task-chip {
  min-height: 0;
  max-width: min(280px, 85vw);
  padding: 7px 10px;
  border-radius: 8px;
}

.dashboard-today-heading {
  align-items: center;
  gap: 8px;
}

.dashboard-today-filter {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.dashboard-today-filter span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1;
}

.dashboard-today-filter input {
  width: 15ch;
  min-height: 27px;
  padding: 4px 7px;
  color: var(--ink);
  font: inherit;
  font-size: 9px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
}

.dashboard-trade-preview-scroll {
  overflow-x: auto;
}

.dashboard-trade-preview {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.dashboard-trade-preview th,
.dashboard-trade-preview td {
  overflow: hidden;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-trade-preview th {
  color: var(--muted);
  background: var(--canvas);
  font-size: 10px;
  font-weight: 650;
}

.dashboard-today-preview .dashboard-number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dashboard-today-preview tfoot th {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--ink);
  background: #f3f6fb;
  border-top: 2px solid var(--line-dark);
  font-variant-numeric: tabular-nums;
}

.dashboard-today-preview tfoot th:first-child {
  text-align: left;
}

.dashboard-today-preview tfoot th:last-child {
  text-align: right;
}

.dashboard-today-preview tfoot span,
.dashboard-today-preview tfoot strong {
  display: block;
}

.dashboard-today-preview tfoot span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
}

.dashboard-today-preview tfoot strong {
  font-size: 10px;
  font-weight: 750;
}

.dashboard-today-card .dashboard-trade-preview-scroll {
  max-height: 310px;
}

.dashboard-today-card [hidden] {
  display: none !important;
}

.dashboard-trade-empty {
  min-height: 114px;
  padding: 28px 16px;
}

.dashboard-update-card > p {
  padding: 6px 16px 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.topbar-add-task {
  flex: 0 0 auto;
  margin-left: 8px;
  white-space: nowrap;
}

.dashboard-task-dialog textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
}

.dashboard-task-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dashboard-task-paste-zone { padding: 10px 12px; border: 1px dashed var(--line-dark); border-radius: 9px; color: var(--muted); font-size: 11px; background: #f8fafc; }
.dashboard-task-paste-zone:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.dashboard-task-attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dashboard-task-attachments[hidden] { display: none; }
.dashboard-task-attachment-card { display: grid; gap: 5px; align-content: start; padding: 6px; border: 1px solid var(--line); border-radius: 8px; font-size: 10px; background: #fff; overflow: hidden; }
.dashboard-task-attachment-card img { display: block; width: 100%; height: 120px; object-fit: contain; border-radius: 5px; background: #f8fafc; }
.dashboard-task-attachment-card > span { display: flex; align-items: center; justify-content: space-between; gap: 5px; overflow-wrap: anywhere; }
.dashboard-task-attachment-remove { border: 0; background: transparent; color: #b42318; cursor: pointer; font-size: 16px; line-height: 1; }

.dashboard-task-list {
  display: grid;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.dashboard-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.dashboard-task-item .dashboard-task-edit {
  flex: 1;
}

.dashboard-task-item:last-child {
  border-bottom: 0;
}

.dashboard-task-item .dashboard-task-copy strong {
  font-size: 12px;
  font-weight: 650;
}

.dashboard-task-item .dashboard-task-copy small,
.dashboard-task-empty {
  color: var(--muted);
  font-size: 10px;
}

.dashboard-task-empty {
  padding: 15px;
  text-align: center;
}

.dashboard-task-history-link {
  margin-right: auto;
}

.dashboard-task-conversation {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.dashboard-task-conversation[hidden] { display: none; }
.dashboard-task-replies { display: grid; max-height: 180px; overflow: auto; gap: 6px; }
.dashboard-task-replies article { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.dashboard-task-replies article strong { font-size: 10px; }
.dashboard-task-replies article p { margin: 2px 0; white-space: pre-wrap; font-size: 11px; }
.dashboard-task-replies article time { color: var(--muted); font-size: 9px; }

.dashboard-task-history-panel {
  overflow: hidden;
}

.dashboard-task-history-replies { grid-column: 1 / -1; padding-top: 5px; border-top: 1px solid var(--line); }
.dashboard-task-history-replies p { margin: 2px 0; font-size: 10px; white-space: pre-wrap; }

.dashboard-task-history-list {
  display: grid;
}

.dashboard-task-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, max-content) minmax(150px, max-content) max-content;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.dashboard-task-history-restore {
  margin: 0;
}

.dashboard-task-history-row:last-child {
  border-bottom: 0;
}

.dashboard-task-history-row strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.dashboard-task-history-meta {
  display: grid;
  gap: 2px;
}

.dashboard-task-history-meta span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.dashboard-task-history-meta time,
.dashboard-task-history-meta small {
  color: var(--ink);
  font-size: 11px;
}

@media (max-width: 720px) {
  .dashboard-task-history-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.record-list {
  padding: 4px 12px 12px;
}

.record-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
}

.record-row:last-child {
  border-bottom: 0;
}

.record-row:hover {
  background: var(--canvas);
}

.company-avatar {
  width: 38px;
  height: 38px;
  font-size: 11px;
}

.record-main,
.stacked-cell,
.entity-cell > span:last-child {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.record-main strong,
.entity-cell strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main small,
.entity-cell small,
.stacked-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.record-date {
  color: var(--muted-light);
  font-size: 10px;
}

.timeline {
  padding: 20px 24px;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:not(:last-child)::before {
  position: absolute;
  top: 11px;
  bottom: -2px;
  left: 4px;
  width: 1px;
  content: "";
  background: var(--line-dark);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 4px;
  background: var(--blue-600);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--blue-100);
}

.timeline-item strong {
  display: block;
  font-size: 12px;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.access-card {
  padding: 28px 24px 24px;
  text-align: center;
}

.access-shield {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  color: var(--green-700);
  font-weight: 900;
  background: var(--green-100);
  border-radius: 50%;
}

.access-card h3 {
  margin: 14px 0 5px;
}

.access-card p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.table-panel {
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  width: min(100%, 430px);
}

.search-field > span {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--muted);
  font-size: 20px;
  transform: translateY(-53%);
}

.search-field input {
  width: 100%;
  padding-left: 39px;
}

.filter-actions,
.table-actions,
.form-actions,
.sticky-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 3%);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

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

input::placeholder,
textarea::placeholder {
  color: #a5acba;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(70 100 220 / 10%);
  outline: 0;
}

input[readonly],
select:disabled {
  color: var(--muted);
  background: #f1f3f6;
  cursor: not-allowed;
}

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

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

th,
td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  background: #fafbfc;
}

td {
  color: #30384b;
  font-size: 12px;
}

tbody tr:hover {
  background: #fbfcfe;
}

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

.entity-cell {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 11px;
}

.stacked-cell {
  min-width: 130px;
}

.table-actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.table-footer {
  display: flex;
  justify-content: flex-end;
  padding: 11px 18px;
  color: var(--muted);
  font-size: 10px;
  background: #fafbfc;
  border-top: 1px solid var(--line);
}

.pagination-bar {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  color: var(--muted);
  font-size: 11px;
  background: #fafbfc;
  border-top: 1px solid var(--line);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-indicator {
  padding: 0 6px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
}

.status,
.badge,
.system-tag {
  display: inline-flex;
  align-items: center;
  width: max-content;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  border-radius: 999px;
}

.status {
  gap: 6px;
  padding: 6px 9px;
}

.status::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.status-active {
  color: var(--green-700);
  background: var(--green-100);
}

.status-muted {
  color: var(--muted);
  background: #eef0f4;
}

.badge-role {
  padding: 7px 10px;
  color: var(--blue-700);
  background: var(--blue-100);
}

.system-tag {
  margin-left: 5px;
  padding: 4px 6px;
  color: var(--amber-700);
  vertical-align: middle;
  background: var(--amber-100);
}

.empty-state,
.error-state,
.standalone-error {
  display: flex;
  min-height: 380px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 50px 24px;
  text-align: center;
}

.empty-state-compact {
  min-height: 270px;
}

.empty-icon {
  display: inline-flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  font-weight: 850;
  background: var(--blue-100);
  border-radius: 16px;
}

.empty-state h2,
.empty-state h3 {
  margin: 16px 0 7px;
  font-size: 18px;
}

.empty-state p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.form-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-layout-narrow {
  max-width: 820px;
}

.form-panel {
  padding: 26px;
}

.form-panel .panel-heading {
  margin: -26px -26px 22px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-number {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  font-size: 9px;
  font-weight: 850;
  background: var(--blue-100);
  border-radius: 9px;
}

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

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

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

.field label,
.label-row label {
  margin-bottom: 7px;
  color: #343c4f;
  font-size: 12px;
  font-weight: 750;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-row label {
  margin-bottom: 7px;
}

.field-hint,
.field-help {
  color: var(--muted);
  font-size: 10px;
}

.field-help,
.field-error {
  margin-top: 6px;
  line-height: 1.4;
}

.field-error {
  color: var(--red-700);
  font-size: 10px;
  font-weight: 650;
}

.is-invalid {
  border-color: var(--red-700) !important;
}

.required {
  margin-left: 4px;
  color: var(--blue-700);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.sticky-actions {
  position: sticky;
  z-index: 10;
  bottom: 16px;
  align-self: flex-end;
  padding: 8px;
  background: rgb(255 255 255 / 90%);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgb(16 24 40 / 12%);
  backdrop-filter: blur(10px);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.toggle-row span {
  display: flex;
  flex-direction: column;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.toggle-row input {
  width: 42px;
  height: 22px;
  min-height: 0;
  accent-color: var(--blue-600);
}

.branch-visible-peers-field { gap: 8px; }
.branch-visible-peers-list { display: grid; gap: 8px; }
.branch-visible-peer { margin: 0; }

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.role-grid article {
  padding: 16px;
  background: transparent;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
}

.role-grid strong {
  font-size: 12px;
}

.role-grid p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.user-role-cell {
  display: flex;
  min-width: 150px;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
}

.user-role-cell small {
  max-width: 250px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.branch-dashboard-heading {
  margin-bottom: 18px;
}

.branch-access-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.branch-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.branch-code-badge {
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 6px 9px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  background: var(--blue-100);
  border-radius: 999px;
}

.branch-match-count {
  display: flex;
  min-width: 110px;
  align-items: flex-end;
  flex-direction: column;
  gap: 4px;
}

.branch-match-count strong {
  color: var(--ink);
  font-size: 25px;
}

.branch-trade-panel {
  margin-bottom: 24px;
}

.branch-trade-table {
  min-width: 1080px;
}

.branch-trade-table td:nth-child(3),
.branch-trade-table td:nth-child(6) {
  min-width: 180px;
}

.numeric-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Branch office spreadsheet */
.branch-sheet-workspace-body {
  overflow: hidden;
}

.branch-sheet-workspace-body .app-main {
  height: 100dvh;
  overflow: hidden;
}

.branch-sheet-workspace-body .topbar {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  height: 52px;
  padding: 0 14px;
}

.branch-sheet-workspace-body .topbar.branch-account-topbar {
  grid-template-columns: 52px auto minmax(0, 1fr) auto;
}

.branch-account-topbar .topbar-title {
  min-width: max-content;
}

.branch-account-topbar .topbar-greeting {
  max-width: none;
  justify-self: start;
  margin-left: 12px;
  font-size: 10px;
  white-space: nowrap;
}

.branch-account-topbar .topbar-greeting [data-ai-greeting-text] {
  display: block;
  white-space: nowrap;
}

.branch-account-topbar .topbar-profile {
  justify-self: end;
}

.branch-sheet-workspace-body .menu-button {
  margin-right: 0;
}

.branch-company-switcher {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.branch-company-switcher strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-stone-search {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 55ch) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.branch-inline-greeting {
  width: 100%;
  max-width: none;
  grid-column: 1;
  justify-self: stretch;
  margin: 0;
  color: #657087;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.branch-inline-greeting [data-ai-greeting-text] {
  display: block;
  white-space: nowrap;
  -webkit-line-clamp: 1;
}

.branch-inline-greeting .topbar-greeting-cursor {
  height: 12px;
}

.branch-stone-filters {
  display: grid;
  grid-column: 2;
  grid-template-columns: 142px minmax(220px, 1fr);
  gap: 7px;
}

.branch-stone-filters input {
  width: 100%;
  height: 30px;
  padding: 4px 9px;
  color: #253047;
  font: inherit;
  font-size: 12px;
  background: #fff;
  border: 1px solid #cbd2df;
  border-radius: 6px;
  outline: 0;
}

.branch-stone-filters input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(70 100 220 / 16%);
}

.branch-search-empty {
  position: absolute;
  z-index: 8;
  top: 78px;
  left: 50%;
  padding: 8px 12px;
  color: #687389;
  font-size: 12px;
  font-weight: 700;
  background: rgb(255 255 255 / 94%);
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgb(27 37 62 / 10%);
  transform: translateX(-50%);
}

.branch-sheet-topbar-status {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.branch-invoice-selection-form {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.branch-invoice-selection-count {
  min-width: 48px;
  color: #59657a;
  font-size: 9px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.branch-make-invoice-button {
  min-height: 28px;
  padding: 5px 9px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  background: var(--blue-600);
  border-color: var(--blue-600);
  border-radius: 5px;
}

.branch-make-invoice-button:hover:not(:disabled),
.branch-make-invoice-button:focus-visible:not(:disabled) {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.branch-make-invoice-button:disabled {
  color: #8a93a4;
  background: #edf0f4;
  border-color: #d7dce5;
  cursor: not-allowed;
}

.branch-stone-count {
  white-space: nowrap;
}

.branch-new-stone-link {
  color: var(--blue-700);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.branch-new-stone-link:hover,
.branch-new-stone-link:focus-visible {
  color: var(--navy-800);
}

.branch-new-stone-link > strong {
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 850;
}

.branch-pending-stones > strong,
.branch-total-stones > strong {
  color: var(--ink);
  font-weight: 800;
}

.branch-sheet-workspace-body .topbar-title .eyebrow {
  display: none;
}

.branch-sheet-workspace-body .content {
  display: flex;
  width: 100%;
  max-width: none;
  height: calc(100dvh - 52px);
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.branch-sheet-workspace-body .dashboard-branch-task-strip {
  flex: 0 0 auto;
}

.branch-sheet-workspace-body .dashboard-branch-task-strip + .branch-sheet-panel {
  height: auto;
  flex: 1 1 auto;
}

.branch-sheet-workspace-body .content > .alert {
  position: fixed;
  z-index: 90;
  top: 60px;
  right: 16px;
  max-width: min(430px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}

.branch-sheet-panel {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.branch-sheet-toolbar {
  position: relative;
  z-index: 12;
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 44px;
  gap: 18px;
  padding: 5px 12px;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line-dark);
}

.branch-sheet-identity,
.branch-sheet-toolbar-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.branch-sheet-identity > strong {
  flex: 0 0 auto;
  color: #30394d;
  font-size: 11px;
}

.branch-sheet-toolbar .branch-code-list {
  min-width: 0;
  flex-wrap: nowrap;
  margin-top: 0;
  overflow: hidden;
}

.branch-sheet-toolbar .branch-code-badge {
  padding: 5px 8px;
  font-size: 9px;
}

.branch-sheet-toolbar-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.branch-save-status {
  min-width: 94px;
  color: var(--green-700);
  font-weight: 750;
  text-align: right;
}

.branch-save-status.is-dirty {
  color: var(--amber-700);
}

.branch-save-status.is-saving {
  color: var(--blue-700);
}

.branch-save-status.is-error {
  color: var(--red-700);
}

.branch-sheet-scroll {
  position: relative;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  scrollbar-color: #aeb6c4 #edf0f4;
  scrollbar-width: thin;
}

.branch-sheet-scroll:focus-visible {
  outline: 0;
}

.branch-sheet-grid {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.branch-sheet-grid .branch-row-number-column {
  width: 38px;
}

.branch-sheet-grid th,
.branch-sheet-grid td {
  height: 30px;
  padding: 0;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.branch-sheet-grid thead th {
  position: sticky;
  z-index: 6;
  top: 0;
  height: 32px;
  padding: 0 8px;
  overflow: hidden;
  color: #30394d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
  background: #eef1f5;
}

.branch-sheet-grid .branch-letter-row th {
  top: 0;
  height: 22px;
  color: #7c8598;
  font-size: 9px;
  font-weight: 750;
  background: #f5f6f8;
}

.branch-sheet-grid .branch-name-row th {
  top: 22px;
  height: 30px;
}

.branch-sheet-grid .branch-name-row th[data-branch-sort-header],
.branch-account-name-row th[data-account-sort-header] {
  cursor: pointer;
  user-select: none;
}

.branch-sort-indicator {
  margin-left: 5px;
  color: #68758d;
  font-size: 9px;
}

.branch-sheet-grid thead th[data-branch-resizable-column]::after {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  background: transparent;
  cursor: col-resize;
  content: '';
}

.branch-sheet-grid thead th[data-branch-resizable-column]:hover::after,
.branch-sheet-grid thead th[data-branch-resizable-column].is-resizing::after {
  box-shadow: inset -2px 0 0 var(--blue-600);
}

.is-branch-column-resizing,
.is-branch-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.branch-sheet-grid .branch-sheet-corner {
  z-index: 9;
  left: 0;
  padding: 0;
  background: #e8ebf0;
}

.branch-invoice-select-all,
.branch-invoice-row-selector input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--blue-600);
  cursor: pointer;
}

.branch-invoice-select-all:disabled {
  cursor: not-allowed;
}

.branch-sheet-row-number {
  position: sticky;
  z-index: 4;
  left: 0;
  width: 38px;
  color: #747e91;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  background: #f5f6f8;
  box-shadow: 1px 0 0 #dfe3ea;
}

.branch-invoice-row-selector {
  display: flex;
  width: 100%;
  height: 29px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 5px;
  cursor: pointer;
}

.branch-row-number-text {
  min-width: 0;
  max-width: 42px;
  flex: 0 1 auto;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-sheet-grid tr.is-invoice-selected .branch-sheet-row-number {
  color: var(--blue-700);
  background: #e6ecff;
  box-shadow: inset 3px 0 0 var(--blue-600), 1px 0 0 #dfe3ea;
}

.branch-new-stone-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 0 2px;
  color: #fff;
  font-size: 6px;
  font-weight: 900;
  line-height: 9px;
  letter-spacing: 0.02em;
  background: var(--blue-600);
  border-radius: 3px;
}

.branch-sheet-grid tr.is-new-stone .branch-sheet-row-number {
  color: var(--blue-700);
  background: var(--blue-50);
}

.branch-sheet-grid tr.is-new-stone-revealed .branch-sheet-cell {
  background: var(--blue-100) !important;
  box-shadow: inset 0 1px 0 var(--blue-600), inset 0 -1px 0 var(--blue-600);
}

.branch-sheet-grid tbody tr.is-today-trade > .branch-sheet-row-number,
.branch-sheet-grid tbody tr.is-today-trade > .branch-sheet-cell {
  color: #9f1711;
  background: #ffe1df !important;
}

.branch-sheet-grid tbody tr.is-today-trade > .branch-sheet-cell input,
.branch-sheet-grid tbody tr.is-today-trade > .branch-sheet-cell a,
.branch-sheet-grid tbody tr.is-today-trade > .branch-sheet-cell button {
  color: #9f1711;
}

.branch-sheet-grid tbody tr:hover .branch-sheet-row-number {
  color: var(--blue-700);
  background: #e9edff;
}

.branch-sheet-cell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  color: #253047;
  font-size: 11px;
  line-height: 29px;
  white-space: nowrap;
  background: #fff;
  outline: 0;
}

.branch-sheet-cell > span {
  display: block;
  height: 29px;
  padding: 0 7px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-gia-report-link {
  display: block;
  height: 29px;
  padding: 0 7px;
  overflow: hidden;
  color: var(--blue-700);
  font-weight: 750;
  text-decoration: underline;
  text-overflow: ellipsis;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.branch-gia-report-link:hover,
.branch-gia-report-link:focus-visible {
  color: var(--navy-800);
}

.branch-invoice-certi-link {
  display: block;
  height: 29px;
  padding: 0 7px;
  overflow: hidden;
  color: var(--blue-700);
  font: inherit;
  line-height: 29px;
  text-align: inherit;
  text-decoration: underline;
  text-overflow: ellipsis;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.branch-invoice-certi-link:hover,
.branch-invoice-certi-link:focus-visible {
  color: var(--navy-800);
}

.branch-sheet-cell.is-readonly {
  color: #4e586e;
  cursor: cell;
  background: #fafbfc;
  user-select: text;
}

.branch-sheet-grid tbody tr:hover .branch-sheet-cell:not(.is-selection-focus) {
  background: #fbfcff;
}

.branch-sheet-cell.is-numeric,
.branch-sheet-cell.is-numeric .branch-amount-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.branch-sheet-cell.is-range-selected {
  background: #e8edff !important;
}

.branch-sheet-row-number.is-grid-selected {
  color: var(--blue-700);
  background: #dfe7ff;
}

.branch-sheet-cell.is-selection-focus,
.branch-sheet-cell:focus {
  z-index: 3;
  background: #fff !important;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.branch-amount-input,
.branch-my-remarks-input,
.branch-rcd-timestamp-input {
  display: block;
  width: 100%;
  height: 29px;
  min-height: 29px;
  padding: 0 7px;
  color: #17213c;
  font-size: 11px;
  line-height: 29px;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
}

.branch-amount-input:focus,
.branch-my-remarks-input:focus,
.branch-rcd-timestamp-input:focus {
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.branch-sheet-grid tr.is-dirty .branch-sheet-cell.is-editable,
.branch-sheet-grid tr.is-dirty .branch-amount-input:not(:focus) {
  background: #fffdf5;
}

.branch-sheet-grid tr.is-saving .branch-amount-input {
  color: var(--blue-700);
  background: var(--blue-50);
}

.branch-sheet-grid tr.has-save-error .branch-amount-input {
  color: var(--red-700);
  background: var(--red-100);
  box-shadow: inset 0 0 0 1px var(--red-700);
}

.branch-sheet-cell.is-payment-mismatch,
.branch-sheet-cell.is-payment-mismatch .branch-amount-input,
.branch-amount-input.is-payment-mismatch {
  color: var(--payment-warning-color, #b42318) !important;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--payment-warning-color, #b42318);
}

.branch-sheet-empty {
  min-height: 0;
  flex: 1 1 auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-summary {
  padding: 28px;
  text-align: center;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  margin-bottom: 14px;
  font-size: 22px;
  border-radius: 20px;
}

.profile-summary h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.profile-summary > p {
  color: var(--muted);
  font-size: 12px;
}

.detail-list {
  margin: 24px 0 0;
  text-align: left;
}

.detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.panel-intro {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: #31415c;
  font-size: 12px;
  line-height: 1.45;
  background: var(--blue-50);
  border: 1px solid #d8def8;
  border-radius: 10px;
}

.alert-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 4px;
  background: var(--blue-600);
  border-radius: 50%;
}

.alert-success {
  color: #125d49;
  background: var(--green-100);
  border-color: #bee9da;
}

.alert-success .alert-dot {
  background: var(--green-700);
}

.alert-error {
  color: #8c2c39;
  background: var(--red-100);
  border-color: #f4c8ce;
}

.alert-error .alert-dot {
  background: var(--red-700);
}

.sheet-source-note > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sheet-source-note small {
  color: var(--muted);
  font-size: 10px;
}

.login-body {
  color: var(--ink);
  background: #eef1f7;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(400px, .9fr) minmax(500px, 1.1fr);
}

.login-story {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 6vw, 72px);
  color: #fff;
  background: var(--navy-950);
}

.login-story::before,
.login-story::after {
  position: absolute;
  content: "";
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 50%;
}

.login-story::before {
  width: 520px;
  height: 520px;
  right: -260px;
  bottom: -160px;
}

.login-story::after {
  width: 320px;
  height: 320px;
  right: -150px;
  bottom: -55px;
}

.login-brand {
  position: relative;
  z-index: 1;
}

.brand-mark-large {
  width: 48px;
  height: 48px;
  font-size: 15px;
  border-radius: 14px;
}

.login-brand strong {
  font-size: 22px;
}

.login-story-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: auto 0;
  padding: 80px 0;
}

.story-kicker {
  color: #9faee5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.login-story h1 {
  max-width: 520px;
  margin: 18px 0;
  font-size: clamp(42px, 5vw, 66px);
  letter-spacing: -.055em;
  line-height: 1.02;
}

.login-story-copy p {
  max-width: 470px;
  margin-bottom: 0;
  color: #aeb7ca;
  font-size: 16px;
  line-height: 1.7;
}

.security-note {
  position: relative;
  z-index: 1;
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgb(255 255 255 / 6%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 12px;
}

.security-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: #8fe1c4;
  font-weight: 900;
  background: rgb(80 190 151 / 12%);
  border-radius: 9px;
}

.security-note > span:last-child {
  display: flex;
  flex-direction: column;
}

.security-note strong {
  font-size: 11px;
}

.security-note small {
  margin-top: 3px;
  color: #929db4;
  font-size: 9px;
}

.login-panel {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: #f6f7fa;
}

.login-card {
  width: min(100%, 430px);
  padding: 42px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-heading {
  margin-bottom: 28px;
}

.login-heading h2 {
  margin-bottom: 9px;
  font-size: 27px;
  letter-spacing: -.035em;
}

.login-heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.mobile-login-mark {
  display: none;
}

.login-help {
  margin: 24px 0 0;
  color: var(--muted-light);
  font-size: 10px;
  text-align: center;
}

.error-code {
  margin-bottom: 10px;
  color: var(--blue-600);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: .12em;
}

.error-state h1,
.standalone-error h1 {
  margin-bottom: 10px;
  font-size: 32px;
  letter-spacing: -.035em;
}

.error-state p,
.standalone-error p {
  max-width: 500px;
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.standalone-error .brand-mark {
  margin-bottom: 35px;
}

.mobile-backdrop {
  display: none;
}

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

  .stat-card:last-child {
    grid-column: span 2;
  }

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

  .dashboard-trade-grid {
    grid-template-columns: 1fr;
  }

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

  .login-shell {
    grid-template-columns: minmax(360px, .8fr) minmax(460px, 1.2fr);
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 270px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 20px 0 50px rgb(10 17 33 / 22%);
  }

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

  .mobile-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    pointer-events: none;
    opacity: 0;
    background: rgb(10 17 33 / 42%);
    transition: opacity 180ms ease;
  }

  .sidebar-open .mobile-backdrop {
    pointer-events: auto;
    opacity: 1;
  }

  .app-main {
    margin-left: 0;
  }

  .menu-button {
    display: flex;
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    padding: 28px 18px 50px;
  }

  .branch-sheet-workspace-body .content {
    padding: 0;
  }

  .login-story {
    display: none;
  }

  .login-shell {
    display: block;
  }

  .login-panel {
    min-height: 100vh;
    padding: 24px;
  }

  .mobile-login-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    background: var(--blue-600);
    border-radius: 12px;
  }

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

@media (max-width: 620px) {
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading > .button {
    align-self: flex-start;
  }

  .branch-access-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .branch-match-count {
    align-items: flex-start;
  }

  .branch-sheet-toolbar {
    align-items: stretch;
    flex-direction: column;
    flex-basis: auto;
    gap: 3px;
    padding: 6px 9px;
  }

  .branch-sheet-workspace-body .topbar {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding: 0 7px;
  }

  .branch-company-switcher {
    justify-content: flex-start;
  }

  .branch-total-stones {
    display: none;
  }

  .branch-pending-stones,
  .branch-save-status {
    display: none;
  }

  .branch-company-switcher strong {
    max-width: 100%;
  }

  .branch-save-status {
    min-width: 78px;
  }

  .branch-sheet-toolbar-status {
    justify-content: space-between;
  }

  .branch-save-status {
    min-width: 0;
  }

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

  .stat-card:last-child {
    grid-column: auto;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .filter-actions {
    flex-wrap: wrap;
  }

  .filter-actions select {
    flex: 1;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .form-panel {
    padding: 20px;
  }

  .form-panel .panel-heading {
    margin: -20px -20px 20px;
  }

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

  .topbar-profile > span:last-child {
    display: none;
  }

  .login-panel {
    align-items: flex-start;
    padding: 0;
    background: #fff;
  }

  .login-card {
    min-height: 100vh;
    padding: 42px 24px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .sticky-actions {
    bottom: 8px;
    align-self: stretch;
  }

  .sticky-actions .button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* RapRate diamond price lists */

.raprate-layout {
  display: grid;
  grid-template-columns: minmax(340px, .9fr) minmax(420px, 1.1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.raprate-upload-panel,
.raprate-current-panel,
.raprate-preview-panel {
  overflow: hidden;
}

.raprate-upload-form {
  padding: 22px 24px 20px;
}

.raprate-dropzone {
  position: relative;
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: #fafbff;
  border: 1.5px dashed #aeb9df;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.raprate-dropzone:hover,
.raprate-dropzone.is-dragging,
.raprate-dropzone:focus-within {
  background: #f4f6ff;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(70 100 220 / 9%);
}

.raprate-dropzone strong {
  color: var(--ink);
  font-size: 14px;
}

.raprate-dropzone > span:last-of-type {
  font-size: 11px;
}

.raprate-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  overflow: hidden;
}

.raprate-dropzone[hidden],
.raprate-file-summary[hidden] {
  display: none;
}

.raprate-upload-icon {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  background: var(--blue-100);
  border-radius: 15px;
}

.raprate-file-summary {
  display: flex;
  min-height: 110px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  background: #f7f9ff;
  border: 1px solid #d9e0f8;
  border-radius: 12px;
}

.raprate-file-summary > span,
.raprate-import-main,
.raprate-import-date {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.raprate-file-summary strong,
.raprate-import-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.raprate-file-summary small,
.raprate-import-main small,
.raprate-import-date small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.raprate-upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}

.raprate-upload-actions p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.raprate-upload-actions .button {
  flex: 0 0 auto;
}

.raprate-upload-message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
}

.raprate-upload-message.is-working {
  color: var(--blue-700);
}

.raprate-upload-message.is-success {
  color: var(--green-700);
}

.raprate-upload-message.is-error {
  color: #b42318;
}

.raprate-current-count,
.raprate-preview-caption {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.raprate-import-list {
  padding: 8px 12px 12px;
}

.raprate-import-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  color: inherit;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 9px;
}

.raprate-import-card:last-child {
  border-bottom-color: transparent;
}

.raprate-import-card:hover {
  background: var(--canvas);
}

.raprate-import-card.is-selected {
  background: #f4f6ff;
  border-color: #d9e0f8;
}

.raprate-shape-mark {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 900;
  background: var(--blue-100);
  border-radius: 12px;
}

.raprate-import-main strong {
  font-size: 12px;
}

.raprate-import-date {
  align-items: flex-end;
  text-align: right;
}

.raprate-import-date strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.raprate-empty-state {
  min-height: 280px;
}

.raprate-preview-panel {
  margin-bottom: 24px;
}

.raprate-preview-panel th:first-child,
.raprate-preview-panel td:first-child {
  width: 54px;
  color: var(--muted);
  text-align: right;
}

.raprate-preview-panel tbody th[scope="row"] {
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  background: transparent;
}

.raprate-preview-panel th:nth-last-child(2),
.raprate-preview-panel td:nth-last-child(2) {
  text-align: right;
}

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

@media (max-width: 620px) {
  .raprate-upload-form {
    padding: 18px;
  }

  .raprate-upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .raprate-upload-actions .button {
    width: 100%;
  }

  .raprate-import-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .raprate-import-date {
    grid-column: 2;
    align-items: flex-start;
    text-align: left;
  }
}

/* RapPrice full-screen comparison workspace */

.rapprice-workspace-body .content {
  width: 100%;
  max-width: none;
  padding: 12px 14px 40px;
}

.rapprice-workspace-body .topbar {
  height: 58px;
  padding-inline: 18px;
}

.rapprice-workspace-body .content > .alert {
  margin: 0 0 10px;
}

.rapprice-workspace {
  min-width: 0;
}

.rapprice-toolbar {
  position: sticky;
  z-index: 22;
  top: 58px;
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 8px 12px;
  background: rgb(255 255 255 / 96%);
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 6px 16px rgb(23 33 60 / 5%);
  backdrop-filter: blur(12px);
}

.rapprice-heading .eyebrow {
  margin-bottom: 2px;
  font-size: 8px;
}

.rapprice-heading h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.03em;
  line-height: 1;
}

.rapprice-list-tabs {
  display: inline-flex;
  padding: 3px;
  background: #eef1f8;
  border-radius: 8px;
}

.rapprice-list-tab {
  padding: 7px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  border-radius: 6px;
}

.rapprice-list-tab:hover {
  color: var(--ink);
}

.rapprice-list-tab.is-active {
  color: #fff;
  background: var(--blue-700);
  box-shadow: 0 3px 8px rgb(43 66 161 / 18%);
}

.rapprice-version-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rapprice-version-summary > span:not(.rapprice-version-arrow) {
  display: flex;
  min-width: 90px;
  flex-direction: column;
  text-align: center;
}

.rapprice-version-summary small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rapprice-version-summary strong {
  margin-top: 2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.rapprice-version-arrow {
  color: var(--blue-600);
  font-weight: 900;
}

.rapprice-upload-open {
  min-height: 34px;
  padding-inline: 14px;
}

.rapprice-toolbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.rapprice-toolbar-actions .button {
  min-height: 34px;
  padding-inline: 11px;
  white-space: nowrap;
}

.rapprice-toolbar-actions .rapprice-download {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rapprice-range-nav {
  position: sticky;
  z-index: 21;
  top: 120px;
  display: flex;
  gap: 5px;
  padding: 7px 10px;
  overflow-x: auto;
  background: #f7f8fc;
  border: 1px solid var(--line);
  border-top: 0;
  scrollbar-width: thin;
}

.rapprice-range-nav a {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  background: #fff;
  border: 1px solid #dfe3ed;
  border-radius: 5px;
}

.rapprice-range-nav a:hover {
  color: var(--blue-700);
  border-color: #aeb9df;
}

.rapprice-comparison-grid {
  display: grid;
  grid-template-columns: minmax(430px, 50%) minmax(320px, 30%);
  align-items: start;
  justify-content: start;
  gap: 4px;
  padding-top: 6px;
  overflow-x: auto;
}

.rapprice-band {
  min-width: 320px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #263042;
  scroll-margin-top: 170px;
}

.rapprice-band-title {
  display: flex;
  min-height: 20px;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  padding: 2px 4px;
  color: #111827;
  font-size: 9px;
  line-height: 1.25;
  text-align: center;
  border-bottom: 1px solid #263042;
}

.rapprice-band-title strong {
  font-size: 9px;
  letter-spacing: .01em;
}

.rapprice-band-title span {
  font-weight: 650;
}

.rapprice-matrix-scroll {
  overflow-x: auto;
}

.rapprice-matrix {
  width: 100%;
  min-width: 315px;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.rapprice-current-band {
  min-width: 430px;
}

.rapprice-current-matrix {
  min-width: 425px;
}

.rapprice-matrix th,
.rapprice-matrix td {
  height: 18px;
  padding: 1px 2px;
  font-size: 8px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid #687386;
  border-bottom: 1px solid #687386;
}

.rapprice-matrix tr:last-child th,
.rapprice-matrix tr:last-child td {
  border-bottom: 0;
}

.rapprice-matrix th:last-child,
.rapprice-matrix td:last-child {
  border-right: 0;
}

.rapprice-matrix thead th {
  color: #0e1728;
  font-size: 7.5px;
  font-weight: 850;
  background: #e7eaf0;
}

.rapprice-matrix thead th:first-child,
.rapprice-matrix tbody th {
  width: 35px;
}

.rapprice-matrix tbody th {
  color: #0e1728;
  font-size: 8px;
  font-weight: 850;
  background: #f1f3f7;
}

.rapprice-change-cell {
  color: #48536a;
  font-weight: 750;
  cursor: default;
}

.rapprice-price-cell {
  color: #111827;
  font-weight: 750;
  cursor: default;
  background: #fff;
}

.rapprice-price-cell.is-new {
  color: #175cd3;
  background: #eff8ff;
}

.rapprice-price-cell.is-missing,
.rapprice-price-cell.is-removed {
  color: #a5adbb;
  background: #fff;
}

.rapprice-change-cell.is-positive {
  color: #102a00;
  background: #9ee540;
}

.rapprice-change-cell.is-negative {
  color: #b42318;
  background: #fff1f0;
}

.rapprice-change-cell.is-zero {
  color: transparent;
  background: #fff;
}

.rapprice-change-cell.is-new {
  color: #175cd3;
  background: #eff8ff;
}

.rapprice-change-cell.is-removed {
  color: #9a3412;
  background: #fff7ed;
}

.rapprice-change-cell.is-missing {
  color: #a5adbb;
  background: #fff;
}

.rapprice-empty-sheet {
  display: flex;
  min-height: 460px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
}

.rapprice-empty-sheet > span {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--blue-700);
  font-size: 22px;
  font-weight: 900;
  background: var(--blue-100);
  border-radius: 15px;
}

.rapprice-empty-sheet h2 {
  margin-bottom: 7px;
  font-size: 20px;
}

.rapprice-empty-sheet p {
  max-width: 500px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.rapprice-history {
  margin-top: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.rapprice-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.rapprice-history summary span {
  font-size: 12px;
  font-weight: 800;
}

.rapprice-history summary small {
  color: var(--muted);
  font-size: 9px;
}

.rapprice-history-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.rapprice-history-body > p {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.rapprice-history-item {
  display: grid;
  grid-template-columns: 90px minmax(180px, 1.5fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.rapprice-history-item:last-child {
  border-bottom: 0;
}

.rapprice-history-item > span:not(.status) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.rapprice-history-item strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rapprice-history-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.rapprice-history-rank {
  color: var(--blue-700);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.rapprice-history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rapprice-history-actions .button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 8px;
}

.rapprice-upload-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 28px 90px rgb(10 20 45 / 35%);
}

.rapprice-upload-dialog::backdrop {
  background: rgb(10 20 45 / 52%);
  backdrop-filter: blur(2px);
}

.rapprice-upload-dialog .raprate-upload-form {
  padding: 22px;
}

.rapprice-upload-dialog .raprate-dropzone {
  min-height: 150px;
}

.rapprice-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.rapprice-dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}

.rapprice-dialog-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
  background: var(--canvas);
  border: 0;
  border-radius: 8px;
}

.rapprice-list-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.rapprice-list-choice legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rapprice-list-choice label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d9dfed;
  border-radius: 9px;
  cursor: pointer;
}

.rapprice-list-choice label:has(input:checked) {
  background: #f2f5ff;
  border-color: var(--blue-600);
}

.rapprice-list-choice input {
  margin-top: 2px;
}

.rapprice-list-choice span {
  display: flex;
  flex-direction: column;
}

.rapprice-list-choice strong {
  font-size: 11px;
}

.rapprice-list-choice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

@media (max-width: 1000px) {
  .rapprice-comparison-grid {
    grid-template-columns: minmax(430px, 1fr);
    justify-content: stretch;
  }
}

@media (max-width: 760px) {
  .rapprice-workspace-body .content {
    padding: 8px 8px 28px;
  }

  .rapprice-toolbar {
    position: static;
    grid-template-columns: 1fr auto;
    gap: 9px;
  }

  .rapprice-heading {
    grid-column: 1;
  }

  .rapprice-list-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .rapprice-list-tab {
    flex: 1;
    text-align: center;
  }

  .rapprice-version-summary {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
  }

  .rapprice-toolbar-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .rapprice-range-nav {
    top: 58px;
  }

  .rapprice-history-item {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .rapprice-history-item > span:nth-child(3),
  .rapprice-history-item > .rapprice-history-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .rapprice-list-choice {
    grid-template-columns: 1fr;
  }
}

/* Trade spreadsheet */
.trade-page-heading {
  align-items: center;
}

.trade-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.trade-sheet-panel {
  overflow: hidden;
}

.trade-sheet-toolbar,
.trade-sheet-footer,
.trade-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.trade-sheet-toolbar {
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.trade-sheet-instructions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.trade-sheet-instructions > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.trade-sheet-instructions strong {
  font-size: 12px;
}

.trade-sheet-instructions small,
.trade-sheet-summary,
.trade-save-bar,
.trade-sheet-footer {
  color: var(--muted);
  font-size: 11px;
}

.trade-sheet-badge {
  display: inline-flex;
  min-width: 52px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 850;
  background: var(--blue-100);
  border-radius: 9px;
}

.trade-sheet-summary {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
}

.trade-sheet-summary strong {
  color: var(--blue-700);
}

.trade-message {
  min-height: 34px;
  padding: 9px 18px;
  color: #53617a;
  font-size: 11px;
  line-height: 1.45;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}

.trade-message.is-success {
  color: var(--green-700);
  background: #f1fbf7;
}

.trade-message.is-error {
  color: var(--red-700);
  background: #fff7f8;
}

.trade-grid-scroll {
  position: relative;
  width: 100%;
  height: min(64vh, 710px);
  min-height: 430px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  scrollbar-color: #b8bfcc #f1f3f6;
  scrollbar-width: thin;
}

.trade-grid-scroll:focus-visible {
  outline: 3px solid rgb(70 100 220 / 18%);
  outline-offset: -3px;
}

.trade-grid {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.trade-grid .trade-row-number-column {
  width: 46px;
}

[data-row-reference-prefix]:not([data-row-reference-prefix=""]) .trade-grid .trade-row-number-column,
[data-row-reference-prefix]:not([data-row-reference-prefix=""]) .trade-grid .trade-row-number {
  width: 62px;
}

.trade-grid .trade-column-xs {
  width: 78px;
}

.trade-grid .trade-column-sm {
  width: 108px;
}

.trade-grid .trade-column-md {
  width: 150px;
}

.trade-grid .trade-column-lg {
  width: 230px;
}

.trade-grid .trade-column-xl {
  width: 330px;
}

.trade-grid th,
.trade-grid td {
  height: 30px;
  padding: 0;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.trade-grid thead th {
  overflow: hidden;
  padding: 0 7px;
  text-align: center;
  text-overflow: ellipsis;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  background: #f5f6f8;
}

.trade-grid .trade-letter-row th {
  position: sticky;
  z-index: 5;
  top: 0;
  height: 23px;
  color: #7c8598;
  font-size: 9px;
  font-weight: 750;
}

.trade-letter-button {
  width: 100%;
  height: 21px;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: cell;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.trade-letter-button:focus-visible {
  color: var(--blue-700);
  box-shadow: inset 0 0 0 2px var(--blue-600);
  outline: 0;
}

.trade-grid .trade-name-row th {
  position: sticky;
  z-index: 5;
  top: 23px;
  height: 34px;
  color: #30394d;
  font-size: 10px;
  font-weight: 800;
  background: #eef1f5;
}

.trade-grid .trade-corner-cell {
  position: sticky;
  z-index: 8;
  top: 0;
  left: 0;
  background: #e8ebf0;
}

.trade-grid .trade-row-number {
  position: sticky;
  z-index: 4;
  left: 0;
  width: 46px;
  color: #747e91;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  background: #f5f6f8;
  box-shadow: 1px 0 0 #dfe3ea;
  cursor: cell;
  user-select: none;
}

.trade-grid tbody tr:hover .trade-row-number {
  color: var(--blue-700);
  background: #e9edff;
}

.trade-grid .trade-row-number.is-trade-search-result {
  color: #175cd3;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.trade-grid tbody tr.is-dirty .trade-row-number {
  color: var(--amber-700);
  background: var(--amber-100);
}

.trade-grid .trade-cell {
  display: block;
  width: 100%;
  min-width: 0;
  height: 29px;
  min-height: 29px;
  padding: 4px 7px;
  color: #253047;
  font-size: 11px;
  line-height: 20px;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
}

.trade-grid .trade-cell:not(.is-editing) {
  caret-color: transparent;
}

.trade-grid .trade-cell.is-editing {
  cursor: text;
  caret-color: auto;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.trade-grid tr.is-date-highlight .trade-row-number,
.trade-grid tr.is-date-highlight .trade-cell,
.trade-grid tr.is-date-highlight .trade-cell[readonly] {
  color: var(--trade-row-date-color);
}

.trade-grid .trade-cell.is-behavior-calculated {
  background-image: linear-gradient(90deg, rgb(23 92 211 / 8%), transparent 34%);
}

.trade-grid .trade-cell.is-due-required,
.trade-grid .trade-cell.is-due-required[readonly] {
  color: var(--due-warning-color, #b42318);
  background: color-mix(in srgb, var(--due-warning-color, #b42318) 15%, white) !important;
  box-shadow: inset 0 0 0 1px var(--due-warning-color, #b42318);
}

.trade-grid .trade-cell.is-due-required:focus {
  box-shadow: inset 0 0 0 2px var(--due-warning-color, #b42318) !important;
}

.trade-grid td.trade-date-cell {
  position: relative;
}

.trade-grid td.trade-date-cell .trade-cell {
  padding-right: 7px;
}

.trade-grid td.has-trade-proofs {
  position: relative;
}

.trade-grid td.has-trade-proofs .trade-cell {
  padding-right: 43px;
}

.trade-proof-count {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  padding: 1px 4px;
  color: var(--blue-700);
  font-size: 9px;
  font-weight: 750;
  line-height: 16px;
  pointer-events: none;
  background: #edf1ff;
  border-radius: 5px;
}

.trade-date-picker-button {
  position: absolute;
  z-index: 5;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 23px;
  padding: 0;
  color: #647087;
  font-size: 13px;
  line-height: 22px;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.trade-date-picker-button:hover:not([disabled]) {
  color: var(--blue-700);
  background: #e8edff;
}

.trade-date-picker-button[disabled] {
  display: none;
}

.trade-date-native-picker,
.day-book-date-native-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

.day-book-grid td.day-book-date-cell {
  position: relative;
}

.trade-grid tbody tr:hover .trade-cell {
  background: #fbfcff;
}

.trade-grid tbody tr.is-dirty .trade-cell {
  background: #fffdf5;
}

.trade-grid .trade-cell:focus {
  position: relative;
  z-index: 3;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue-600);
  outline: 0;
}

.trade-grid .trade-cell[readonly] {
  color: #4e586e;
  background: #fafbfc;
  cursor: default;
}

.trade-sheet-footer {
  min-height: 50px;
  padding: 9px 18px;
  background: #fafbfc;
  border-top: 1px solid var(--line);
}

.trade-save-bar {
  min-height: 58px;
  padding: 9px 14px 9px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.trade-save-bar .button[disabled],
.trade-page-heading .button[disabled] {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
  box-shadow: none;
}

@media (max-width: 820px) {
  .trade-sheet-toolbar,
  .trade-sheet-footer,
  .trade-save-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .trade-grid-scroll {
    height: 62vh;
    min-height: 390px;
  }
}

@media (max-width: 620px) {
  .trade-heading-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .trade-heading-actions .button {
    flex: 1;
  }

  .trade-sheet-summary {
    flex-wrap: wrap;
  }
}

/* Off-canvas application navigation */
.sidebar {
  transform: translateX(-100%);
  transition: transform 180ms ease;
  box-shadow: 20px 0 50px rgb(10 17 33 / 22%);
}

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

.app-main {
  margin-left: 0;
}

.menu-button {
  display: flex;
}

.topbar {
  z-index: 45;
}

.mobile-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: block;
  pointer-events: none;
  opacity: 0;
  background: rgb(10 17 33 / 42%);
  transition: opacity 180ms ease;
}

.sidebar-open .mobile-backdrop {
  pointer-events: auto;
  opacity: 1;
}

body.sidebar-open {
  overflow: hidden;
}

/* Fullscreen Trade workspace */
.trade-workspace-body {
  overflow: hidden;
}

.trade-workspace-body .app-main {
  height: 100dvh;
  overflow: hidden;
}

.trade-workspace-body .topbar {
  height: 52px;
  padding: 0 14px;
}

.trade-workspace-body .topbar-title .eyebrow {
  display: none;
}

.trade-workspace-body .content {
  width: 100%;
  max-width: none;
  height: calc(100dvh - 52px);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Export Invoice keeps the full-width sheet layout, but also contains the
   invoice and supporting-document pages below the grid. Allow this workspace
   to scroll vertically so those live previews remain reachable. */
.trade-workspace-body:has(.export-invoice-workspace) .content {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.trade-workspace-body .content > .alert {
  position: fixed;
  z-index: 90;
  top: 60px;
  right: 16px;
  max-width: min(430px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}

.trade-workspace-body .trade-sheet-panel {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.branch-client-controls {
  justify-content: flex-start;
}

.branch-client-sheet-label {
  color: #30394d;
  font-size: 12px;
  font-weight: 800;
}

.branch-client-save-status {
  overflow: hidden;
  color: #687389;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-client-controls [data-branch-client-discard] {
  margin-left: auto;
}

.branch-client-grid .branch-client-corner {
  width: 46px;
  min-width: 46px;
  background: #e8ebf0;
}

.branch-client-grid [data-branch-client-column] {
  cursor: default;
}

.branch-client-grid [data-branch-client-column]::after {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  content: '';
}

.branch-client-grid [data-branch-client-column].is-resizing::after,
.branch-client-grid [data-branch-client-column]:hover::after {
  background: linear-gradient(90deg, transparent 4px, var(--blue-600) 4px, var(--blue-600) 6px, transparent 6px);
}

.company-grid [data-company-column] {
  position: relative;
  cursor: grab;
}
.company-grid [data-company-column].is-column-dragging {
  opacity: .55;
  cursor: grabbing;
}
.company-grid [data-company-column]::after {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  content: '';
}
.company-grid [data-company-column].is-resizing::after,
.company-grid [data-company-column]:hover::after {
  background: linear-gradient(90deg, transparent 4px, var(--blue-600) 4px, var(--blue-600) 6px, transparent 6px);
}
body.is-company-column-resizing,
body.is-company-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-branch-client-column-resizing,
body.is-branch-client-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.branch-client-grid .trade-row-number {
  cursor: pointer;
  user-select: none;
}

.branch-client-grid .branch-client-cell {
  overflow: hidden;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
}

.branch-client-grid .branch-client-cell.is-numeric-value {
  text-align: right;
}

.branch-client-grid .branch-client-cell.is-duplicate-value {
  color: #d93025 !important;
  font-weight: 700;
}

.branch-client-grid-body {
  width: max-content;
  min-width: 100%;
}

.branch-client-grid-header {
  position: sticky;
  z-index: 9;
  top: 0;
}

.branch-client-grid-chunk {
  width: max-content;
  min-width: 100%;
  content-visibility: auto;
  contain-intrinsic-size: auto var(--branch-client-chunk-height, 1500px);
}

.branch-client-grid-body-table {
  margin: 0;
}

/* Company directory spreadsheet */
.company-directory-sheet {
  position: relative;
}

.company-sheet-toolbar {
  z-index: 12;
  display: flex;
  min-height: 44px;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 5px 10px;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line-dark);
}

.company-sheet-filters {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.company-sheet-filters input[type="search"] {
  width: clamp(180px, 25vw, 340px);
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11px;
}

.company-sheet-filters select {
  width: 112px;
  min-height: 30px;
  padding: 4px 26px 4px 8px;
  font-size: 10px;
}

.company-sheet-status {
  margin-left: auto;
  overflow: hidden;
  color: #687389;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-sheet-help {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
  padding: 4px 11px;
  color: #667188;
  font-size: 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.company-sheet-help kbd {
  padding: 1px 4px;
  color: #34405a;
  font: inherit;
  font-weight: 750;
  background: #f2f4f8;
  border: 1px solid #d7dce5;
  border-radius: 3px;
}

.company-directory-sheet .company-grid-scroll {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

.company-grid-header {
  position: sticky;
  z-index: 8;
  top: 0;
  background: #eef1f5;
}

.company-grid-body {
  width: max-content;
  min-width: 100%;
}

.company-grid-chunk {
  width: max-content;
  min-width: 100%;
  content-visibility: auto;
  contain-intrinsic-size: auto var(--company-chunk-height, 1500px);
}

.company-grid-body-table {
  margin: 0;
}

.company-grid .company-grid-corner {
  position: sticky;
  z-index: 13;
  left: 0;
  width: 46px;
  min-width: 46px;
  background: #eef1f5;
}

.company-grid .trade-row-number {
  position: sticky;
  z-index: 6;
  left: 0;
  background: #f7f8fa;
}

.company-grid .company-grid-frozen-name {
  position: sticky;
  z-index: 5;
  left: 46px;
  background: #fff;
  box-shadow: 1px 0 0 #cbd2dc;
}

.company-grid-header .company-grid-frozen-name {
  z-index: 12;
  background: #eef1f5;
}

.company-grid .company-grid-cell.company-grid-frozen-name.is-protected,
.company-grid .company-grid-cell.company-grid-frozen-name[aria-readonly="true"] {
  background: #fafbfc;
}

.company-grid .company-grid-cell.company-grid-frozen-name.is-selection-focus,
.company-grid .company-grid-cell.company-grid-frozen-name.is-editing {
  position: sticky;
  z-index: 7;
}

.trade-grid.company-grid td.company-grid-cell {
  display: table-cell;
  width: auto;
  overflow: hidden;
  vertical-align: top;
  text-overflow: clip;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.company-grid .company-grid-cell.is-protected,
.company-grid .company-grid-cell.is-protected[aria-readonly="true"] {
  color: #455168;
  background: #fafbfc;
}

.company-grid .company-grid-cell.is-protected:hover {
  background: #f3f5f9;
}

.company-grid .company-grid-cell.is-range-selected {
  background: #f4f6ff;
}

.company-grid .company-grid-cell.is-selection-focus {
  position: relative;
  z-index: 3;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.company-grid .company-grid-cell.is-editing {
  color: #253047;
  cursor: text;
  caret-color: auto;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.company-grid .company-grid-cell.is-duplicate-value,
.company-grid .company-grid-cell.is-duplicate-value[aria-readonly="true"] {
  color: #d93025 !important;
}

@media (max-width: 760px) {
  .company-sheet-toolbar,
  .company-sheet-help {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .company-sheet-filters {
    width: 100%;
  }

  .company-sheet-filters input[type="search"] {
    flex: 1;
  }

  .company-sheet-status {
    margin-left: 0;
    margin-right: auto;
  }
}

.trade-sheet-controls {
  position: relative;
  z-index: 12;
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 38px;
  gap: 6px;
  padding: 3px 10px;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line-dark);
}

.sheet-quick-tabs { display: inline-flex; align-items: center; gap: 3px; margin-right: auto; padding: 2px; background: #e9ecf2; border-radius: 8px; }
.sheet-quick-tab { min-height: 28px; padding: 6px 13px; color: #5c667a; font-size: 11px; font-weight: 750; line-height: 16px; text-decoration: none; border-radius: 6px; }
.sheet-quick-tab:hover, .sheet-quick-tab.is-active { color: #15213a; background: #fff; box-shadow: 0 1px 2px rgb(15 23 42 / 12%); }
.sheet-live-search { flex: 1 1 300px; max-width: 420px; margin: 0 auto; }
.sheet-live-search input { width: 100%; min-height: 30px; padding: 5px 12px; border: 1px solid var(--line, #d5dbe7); border-radius: 7px; background: #fff; color: inherit; }
.sheet-certi-search { max-width: 220px; }
.security-csv-import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
@media (max-width: 680px) { .security-csv-import-grid { grid-template-columns: 1fr; } }
.trade-name-row th { position: relative; }
.trade-column-resize-handle { position: absolute; top: 0; right: -3px; bottom: 0; width: 7px; cursor: col-resize; z-index: 3; }
.trade-column-resize-handle:hover, .trade-column-resize-handle:focus-visible { background: #8ca8e8; }
body.is-column-resizing, body.is-column-resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 760px) { .sheet-live-search { order: 3; flex-basis: 100%; max-width: none; margin-top: 6px; } }

.trade-icon-button,
.trade-corner-button {
  position: relative;
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  color: #536078;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
}

.trade-icon-button:hover,
.trade-corner-button:hover {
  color: var(--blue-700);
  background: var(--blue-50);
  border-color: #b9c4ef;
}

.trade-icon-button:focus-visible,
.trade-corner-button:focus-visible,
.trade-column-trigger:focus-visible,
.trade-column-menu button:focus-visible {
  z-index: 3;
  outline: 3px solid rgb(70 100 220 / 24%);
  outline-offset: 1px;
}

.trade-icon-button[disabled] {
  cursor: not-allowed;
  opacity: .42;
}

.trade-icon-button-primary {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.trade-icon-button-primary:hover:not([disabled]) {
  color: #fff;
  background: var(--blue-700);
}

.trade-icon-button svg,
.trade-corner-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trade-icon-button.is-busy svg {
  animation: trade-pulse 800ms ease-in-out infinite alternate;
}

.trade-control-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  line-height: 16px;
  text-align: center;
  background: var(--red-700);
  border: 2px solid #f8f9fb;
  border-radius: 999px;
}

.trade-workspace-body .trade-grid-scroll {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  scrollbar-color: #aeb6c4 #edf0f4;
  scrollbar-width: thin;
  overflow-anchor: none;
}

.trade-grid {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow-anchor: none;
}

.trade-grid .trade-row-number-column {
  width: 46px;
}

.trade-grid col.is-column-hidden {
  width: 0;
  visibility: collapse;
}

.trade-grid th,
.trade-grid td {
  height: 30px;
  padding: 0;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.trade-grid thead th {
  overflow: hidden;
  padding: 0;
  text-align: center;
  text-overflow: ellipsis;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  background: #f5f6f8;
}

.trade-grid .trade-letter-row th {
  position: sticky;
  z-index: 6;
  top: 0;
  height: 22px;
  padding: 0 6px;
  color: #7c8598;
  font-size: 9px;
  font-weight: 750;
}

.trade-grid .trade-name-row th {
  position: sticky;
  z-index: 6;
  top: 22px;
  height: 30px;
  color: #30394d;
  font-size: 10px;
  font-weight: 800;
  background: #eef1f5;
}

.trade-grid .trade-corner-cell {
  position: sticky;
  z-index: 9;
  top: 0;
  left: 0;
  padding: 0;
  background: #e8ebf0;
}

.trade-corner-button {
  width: 100%;
  height: 52px;
  color: #687389;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.trade-corner-button svg {
  width: 15px;
  height: 15px;
}

.trade-column-trigger {
  display: flex;
  width: 100%;
  height: 29px;
  min-height: 29px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 4px 0 7px;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.trade-column-trigger > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-column-trigger .trade-formula-badge {
  min-width: auto;
  flex: 0 0 auto;
  padding: 1px 3px;
  overflow: visible;
  color: #3151c6;
  font-size: 8px;
  font-style: italic;
  font-weight: 850;
  line-height: 1;
  text-overflow: clip;
  background: #e3e9ff;
  border-radius: 3px;
}

.trade-column-trigger .trade-rule-badge {
  min-width: auto;
  flex: 0 0 auto;
  padding: 1px 3px;
  overflow: visible;
  color: #3151c6;
  font-size: 8px;
  font-style: italic;
  font-weight: 850;
  line-height: 1;
  text-overflow: clip;
  background: #e3e9ff;
  border-radius: 3px;
}

.trade-column-trigger .trade-rule-badge[hidden] {
  display: none;
}

.trade-column-trigger .trade-formula-badge[hidden] {
  display: none;
}

.trade-column-trigger svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: currentColor;
  opacity: .45;
}

.trade-column-trigger:hover,
.trade-column-trigger[aria-expanded="true"] {
  color: var(--blue-700);
  background: #e6eafd;
}

.trade-grid .trade-row-number {
  position: sticky;
  z-index: 4;
  left: 0;
  width: 46px;
  color: #747e91;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  background: #f5f6f8;
  box-shadow: 1px 0 0 #dfe3ea;
}

.trade-grid tbody tr:hover .trade-row-number {
  color: var(--blue-700);
  background: #e9edff;
}

.trade-grid tbody tr.is-dirty .trade-row-number {
  color: var(--amber-700);
  background: var(--amber-100);
}

.trade-grid .trade-cell {
  display: block;
  width: 100%;
  min-width: 0;
  height: 29px;
  min-height: 29px;
  padding: 4px 7px;
  color: #253047;
  font-size: 11px;
  line-height: 20px;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
}

.trade-grid tbody tr:hover .trade-cell:not(:focus) {
  background: #fbfcff;
}

.trade-grid tbody tr.is-dirty .trade-cell:not(:focus) {
  background: #fffdf5;
}

.trade-grid .trade-cell:focus {
  position: relative;
  z-index: 3;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue-600);
  outline: 0;
}

.trade-grid .trade-cell[readonly] {
  color: #4e586e;
  background: #fafbfc;
  caret-color: transparent;
  cursor: cell;
  user-select: none;
}

.trade-grid .trade-cell.is-unlocked {
  background: var(--blue-50);
  box-shadow: inset 0 0 0 1px #aebcef;
}

.trade-grid .trade-cell.is-unlocked:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.trade-grid thead th.is-grid-selected,
.trade-grid .trade-row-number.is-grid-selected {
  color: var(--blue-700);
  background: #dfe7ff;
}

.trade-grid .trade-cell.is-range-selected {
  background: #e8edff !important;
}

.trade-grid .trade-cell.is-selection-focus {
  position: relative;
  z-index: 3;
  background: #fff !important;
  box-shadow: inset 0 0 0 2px var(--blue-600) !important;
}

.trade-grid .trade-cell:not(.is-editing) {
  caret-color: transparent;
}

.trade-grid .trade-cell.is-editing {
  cursor: text;
  caret-color: auto;
}

.trade-grid tr.is-date-highlight .trade-row-number,
.trade-grid tr.is-date-highlight .trade-cell,
.trade-grid tr.is-date-highlight .trade-cell[readonly] {
  color: var(--trade-row-date-color);
}

.trade-grid .trade-cell.is-behavior-calculated {
  background-image: linear-gradient(90deg, rgb(23 92 211 / 8%), transparent 34%);
}

.trade-grid .trade-cell.is-due-required,
.trade-grid .trade-cell.is-due-required[readonly] {
  color: var(--due-warning-color, #b42318);
  background: color-mix(in srgb, var(--due-warning-color, #b42318) 15%, white) !important;
  box-shadow: inset 0 0 0 1px var(--due-warning-color, #b42318);
}

.trade-grid .trade-cell.is-due-required:focus {
  box-shadow: inset 0 0 0 2px var(--due-warning-color, #b42318) !important;
}

.trade-grid .trade-cell.is-company-unlisted,
.trade-grid .trade-cell.is-company-unlisted[readonly] {
  color: var(--red-700);
  font-weight: 600;
}

.trade-grid .trade-cell.is-certificate-duplicate,
.trade-grid .trade-cell.is-certificate-duplicate[readonly] {
  color: #5f4b00;
  background: #fff2a8 !important;
  font-weight: 700;
}

.trade-packing-list-grid td.is-certificate-duplicate {
  color: #5f4b00;
  background: #fff2a8 !important;
  font-weight: 700;
}

.branch-sheet-cell.is-certificate-duplicate {
  color: #5f4b00 !important;
  background: #fff2a8 !important;
  font-weight: 700;
}

.trade-grid .trade-cell.is-payment-mismatch,
.trade-grid .trade-cell.is-payment-mismatch[readonly] {
  color: var(--payment-warning-color, #b42318);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--payment-warning-color, #b42318);
}

.trade-grid .trade-cell.is-branch-payment-mismatch,
.trade-grid .trade-cell.is-branch-payment-mismatch[readonly] {
  color: #c62828 !important;
  background: #fff1f1 !important;
  font-weight: 600;
}

.trade-grid .trade-cell.is-required-missing,
.trade-grid .trade-cell.is-required-missing[readonly] {
  color: var(--red-700);
  background: var(--red-100) !important;
  box-shadow: inset 0 0 0 1px var(--red-700);
}

.trade-grid .trade-cell.is-required-missing:focus {
  box-shadow: inset 0 0 0 2px var(--red-700) !important;
}

.trade-grid .trade-cell.is-calculated {
  color: #3d4960;
  background: #f3f6fb;
  font-style: italic;
}

.trade-grid .trade-cell.is-cell-arithmetic-formula:not(.is-editing) {
  font-style: italic;
}

.trade-grid .trade-cell[data-column-key="partyCode"] {
  text-align: right;
}

.trade-grid tbody td {
  direction: ltr;
  text-align: right;
}

/* Saved header alignment applies to normal cells and link presentations alike. */
.trade-grid tbody td[data-trade-alignment="right"],
.trade-grid tbody td[data-trade-alignment="right"] .trade-cell,
.trade-grid tbody td[data-trade-alignment="right"] .trade-gia-report-link,
.trade-grid tbody td[data-trade-alignment="right"] .trade-whatsapp-company-link,
.trade-grid tbody td[data-trade-alignment="right"] .trade-company-kyc-link {
  text-align: right;
}

.trade-grid tbody td[data-trade-alignment="left"],
.trade-grid tbody td[data-trade-alignment="left"] .trade-cell,
.trade-grid tbody td[data-trade-alignment="left"] .trade-gia-report-link,
.trade-grid tbody td[data-trade-alignment="left"] .trade-whatsapp-company-link,
.trade-grid tbody td[data-trade-alignment="left"] .trade-company-kyc-link {
  text-align: left;
}

.trade-grid tbody td[data-trade-alignment="center"],
.trade-grid tbody td[data-trade-alignment="center"] .trade-cell,
.trade-grid tbody td[data-trade-alignment="center"] .trade-gia-report-link,
.trade-grid tbody td[data-trade-alignment="center"] .trade-whatsapp-company-link,
.trade-grid tbody td[data-trade-alignment="center"] .trade-company-kyc-link {
  text-align: center;
}

.trade-grid td.has-gia-report-link {
  position: relative;
}

.trade-grid .trade-cell.has-gia-report-link,
.trade-grid .trade-cell.has-gia-report-link[readonly] {
  color: transparent;
  font-style: normal;
}

.trade-gia-report-link {
  position: absolute;
  z-index: 5;
  top: 4px;
  left: 7px;
  right: 7px;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.trade-gia-report-link:hover {
  color: var(--navy-800);
}

.trade-grid td.has-whatsapp-company-link {
  position: relative;
}

.trade-grid .trade-cell.has-whatsapp-company-link,
.trade-grid .trade-cell.has-whatsapp-company-link[readonly] {
  color: transparent;
  font-style: normal;
}

.trade-whatsapp-company-link {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  overflow: hidden;
  padding: 7px;
  color: var(--blue-700);
  font-size: 11px;
  line-height: 16px;
  text-align: left;
  text-overflow: ellipsis;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.trade-whatsapp-company-link:hover {
  color: var(--navy-800);
}

.trade-grid td.has-company-kyc-link {
  position: relative;
}

.trade-grid .trade-cell.has-company-kyc-link,
.trade-grid .trade-cell.has-company-kyc-link[readonly] {
  color: transparent;
  font-style: normal;
}

.trade-company-kyc-link {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  overflow: hidden;
  padding: 7px;
  color: var(--blue-700);
  font-size: 11px;
  line-height: 16px;
  text-overflow: ellipsis;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.trade-company-kyc-link:hover {
  color: var(--navy-800);
}

.trade-grid .trade-remarks-emphasis,
.trade-company-kyc-link .trade-remarks-emphasis,
.branch-sheet-cell .trade-remarks-emphasis {
  color: #dc2626;
  font-weight: 700;
}

.branch-company-kyc-link {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.branch-company-kyc-link:hover {
  color: var(--navy-800);
}

.trade-grid .trade-virtual-spacer,
.trade-grid .trade-virtual-spacer td {
  min-height: 0;
  padding: 0;
  pointer-events: none;
  background: transparent;
  border: 0;
}

.trade-loading {
  position: absolute;
  z-index: 20;
  inset: 38px 0 0;
  display: grid;
  place-items: center;
  background: rgb(255 255 255 / 78%);
  backdrop-filter: blur(2px);
}

.trade-loading[hidden] {
  display: none;
}

.trade-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: trade-spin 700ms linear infinite;
}

.trade-toast {
  position: fixed;
  z-index: 140;
  right: 18px;
  bottom: 18px;
  max-width: min(460px, calc(100vw - 36px));
  padding: 11px 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  background: var(--navy-900);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.trade-toast.is-success {
  background: var(--green-700);
}

.trade-toast.is-error {
  background: var(--red-700);
}

.trade-column-menu {
  position: fixed;
  z-index: 130;
  display: grid;
  width: 190px;
  overflow: hidden;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.trade-column-menu[hidden] {
  display: none;
}

.trade-column-menu button {
  min-height: 34px;
  padding: 7px 9px;
  color: #30394d;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.trade-column-menu button:hover {
  color: var(--blue-700);
  background: var(--blue-50);
}

.trade-row-action-menu {
  position: fixed;
  z-index: 150;
  display: grid;
  min-width: 190px;
  overflow: hidden;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.trade-row-action-menu[hidden] {
  display: none;
}

.trade-row-action-menu button {
  min-height: 34px;
  padding: 7px 9px;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.trade-row-action-menu button:hover {
  background: var(--blue-50);
}

.trade-row-action-menu button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.branch-packing-list-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  color: var(--blue-700);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--blue-50);
  border: 1px solid #b8c9ef;
  border-radius: 6px;
}

.branch-packing-list-toggle[aria-expanded="true"] {
  color: #fff;
  background: var(--blue-700);
}

.branch-packing-list-remark {
  margin-left: 7px;
}

.branch-packing-list-item > th,
.branch-packing-list-item > td {
  background: #f8faff;
}

.branch-packing-list-item-number {
  color: var(--blue-700);
  font-weight: 700;
}

.trade-packing-list-toggle {
  width: 100%;
  min-height: 24px;
  padding: 2px 6px;
  overflow: hidden;
  color: var(--blue-700);
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  background: var(--blue-50);
  border: 1px solid #b8c9ef;
  border-radius: 5px;
}

.trade-packing-list-toggle[aria-expanded="true"] {
  color: #fff;
  background: var(--blue-700);
}

.trade-packing-list-panel {
  position: fixed;
  inset: 92px 24px 24px;
  z-index: 160;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.trade-packing-list-panel:not([open]) {
  display: none;
}

.trade-packing-list-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 7px 10px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line-dark);
}

.trade-packing-list-panel > header button {
  min-height: 30px;
  padding: 4px 10px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
}

.trade-packing-list-totals {
  margin-left: auto;
  margin-right: 12px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
}

.trade-packing-list-scroll {
  width: 100%;
  height: calc(100% - 44px);
  overflow: auto;
}

.trade-packing-list-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.trade-packing-list-grid th,
.trade-packing-list-grid td {
  min-width: 90px;
  height: 28px;
  padding: 4px 7px;
  text-align: right;
  white-space: nowrap;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.trade-packing-list-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf1f7;
}

.trade-packing-list-grid td:has(input) {
  padding: 0;
}

.trade-packing-list-grid input {
  width: 100%;
  min-width: 90px;
  height: 27px;
  padding: 3px 7px;
  color: inherit;
  font: inherit;
  text-align: right;
  background: transparent;
  border: 0;
  outline: 0;
}

.trade-packing-list-grid input:focus {
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.trade-packing-list-grid input.is-multi-selected {
  background: #e8f0fe;
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

.trade-packing-list-grid th[data-packing-row-select] {
  cursor: pointer;
  user-select: none;
}

.trade-packing-list-grid th[data-packing-row-select].is-multi-selected {
  color: #fff;
  background: var(--blue-600);
}

.trade-packing-list-grid input[readonly] {
  cursor: default;
}

.branch-today-grid td.is-qr-scan-revealed {
  animation: qr-scan-reveal 600ms ease-in-out 2 alternate;
  outline: 3px solid #2563eb;
  outline-offset: -3px;
}

@keyframes qr-scan-reveal {
  from { outline-color: #2563eb; }
  to { outline-color: #facc15; }
}

.trade-cell-dropdown {
  position: fixed;
  z-index: 145;
  display: grid;
  max-height: min(320px, 48vh);
  overflow: auto;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
}

.trade-cell-dropdown[hidden] {
  display: none;
}

.trade-cell-dropdown button {
  min-height: 30px;
  padding: 6px 9px;
  overflow: hidden;
  color: #30394d;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.trade-cell-dropdown button:hover,
.trade-cell-dropdown button.is-active {
  color: var(--blue-700);
  background: var(--blue-50);
}

.trade-dialog {
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.trade-dialog::backdrop {
  background: rgb(10 17 33 / 50%);
  backdrop-filter: blur(2px);
}

.trade-dialog-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.trade-dialog h2 {
  margin-bottom: 8px;
  font-size: 21px;
  letter-spacing: -.025em;
}

.trade-dialog p:last-child,
.trade-dialog-form > div:first-child > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.trade-dialog .field {
  display: grid;
  gap: 7px;
}

.trade-dialog .field > span {
  color: #3c465c;
  font-size: 12px;
  font-weight: 750;
}

.trade-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.trade-formula-dialog {
  width: min(780px, calc(100vw - 28px));
}

.trade-proof-dialog {
  width: min(820px, calc(100vw - 28px));
}

.trade-proof-dialog-content {
  gap: 14px;
}

.trade-proof-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.trade-proof-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-proof-paste-zone {
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: #f8f9fc;
  border: 1px dashed var(--line-dark);
  border-radius: 10px;
  outline: 0;
}

.trade-proof-paste-zone:focus {
  color: var(--blue-700);
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgb(67 97 238 / 12%);
}

.trade-proof-capture-stage {
  padding: 14px;
  background: #111827;
  border-radius: 12px;
}

.trade-proof-capture-stage video {
  display: block;
  width: min(100%, 640px);
  max-height: 46vh;
  margin: 0 auto 12px;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}

.trade-proof-capture-status {
  margin-bottom: 12px;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.trade-proof-list {
  display: grid;
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.trade-proof-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.trade-proof-item:last-child {
  border-bottom: 0;
}

.trade-proof-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-proof-item span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}

.trade-proof-empty {
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.trade-formula-dialog textarea {
  width: 100%;
  min-height: min(380px, 48vh);
  resize: vertical;
  padding: 12px;
  color: #202a3e;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  background: #fbfcff;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
}

.trade-formula-dialog code {
  padding: 1px 4px;
  color: #2948bd;
  font-size: 11px;
  background: #eef1ff;
  border-radius: 4px;
}

.trade-behavior-dialog {
  width: min(620px, calc(100vw - 28px));
}

.trade-behavior-fields {
  display: grid;
  gap: 14px;
}

.trade-behavior-fields[hidden] {
  display: none;
}

.trade-behavior-fields input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.trade-behavior-fields textarea {
  min-height: 92px;
  padding: 10px 12px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.trade-formula-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.trade-formula-actions {
  align-items: center;
}

.trade-dialog-action-spacer {
  flex: 1 1 auto;
}

.trade-formula-actions .button-danger {
  color: var(--red-700);
  background: #fff5f6;
  border-color: #efc7cc;
}

.trade-hidden-column-list {
  display: grid;
  max-height: min(420px, 52vh);
  gap: 7px;
  overflow: auto;
}

.trade-hidden-column-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 7px 6px 11px;
  color: #344057;
  font-size: 12px;
  font-weight: 700;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.trade-hidden-columns-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: #fafbfc;
  border: 1px dashed var(--line-dark);
  border-radius: 9px;
}

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

@keyframes trade-pulse {
  to {
    opacity: .45;
  }
}

@media (max-width: 620px) {
  .trade-workspace-body .topbar {
    height: 48px;
    padding: 0 8px;
  }

  .trade-workspace-body .content {
    height: calc(100dvh - 48px);
  }

  .trade-sheet-controls {
    padding-right: 6px;
  }

  .trade-toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }

  .trade-dialog-form {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trade-spinner,
  .trade-icon-button.is-busy svg {
    animation: none;
  }
}

/* Day Book virtual spreadsheet */
.day-book-controls {
  justify-content: flex-start;
}

.day-book-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: #e9ecf2;
  border-radius: 8px;
}

.day-book-tab {
  min-height: 28px;
  padding: 6px 13px;
  color: #5c667a;
  font-size: 11px;
  font-weight: 750;
  line-height: 16px;
  text-decoration: none;
  border-radius: 6px;
}

.day-book-tab:hover {
  color: var(--blue-700);
  background: rgb(255 255 255 / 65%);
}

.day-book-tab.is-active {
  color: var(--blue-700);
  background: #fff;
  box-shadow: 0 1px 3px rgb(22 32 55 / 14%);
}

.day-book-controls [data-day-book-discard] {
  margin-left: auto;
}

.cash-book-print-action,
.cash-book-balance-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cash-book-balance-controls {
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.cash-book-print-action[hidden] {
  display: none;
}

.cash-book-print-date-label,
.cash-book-compare-label {
  display: inline-flex;
  align-items: center;
}

.cash-book-print-date-label input,
.cash-book-compare-label input {
  width: 128px;
  height: 26px;
  padding: 2px 6px;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  background: #fff;
  border: 1px solid #cfd5df;
  border-radius: 6px;
}

.cash-book-compare-label input {
  width: 136px;
  text-align: right;
}

.cash-book-compare-label input[aria-invalid="true"] {
  border-color: #b42318;
}

.cash-book-balance-difference {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cash-book-balance-difference[data-state="error"] {
  color: #b42318;
}

@media (max-width: 760px) {
  .day-book-sheet[data-day-book-active-book="cash"] .day-book-controls {
    flex-wrap: wrap;
    flex-basis: auto;
  }

  .day-book-sheet[data-day-book-active-book="cash"] .sheet-quick-tabs {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
  }

  .cash-book-balance-difference {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
}

.book-download-controls,
.book-download-controls label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.book-download-controls label {
  color: #5c667a;
  font-size: 10px;
  font-weight: 650;
}

.book-download-controls input {
  width: 116px;
  height: 26px;
  padding: 2px 5px;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  background: #fff;
  border: 1px solid #cfd5df;
  border-radius: 6px;
}

.bank-book-download-button {
  border: 1px solid #cfd5df;
  cursor: pointer;
}

.branch-workspace-tabs {
  flex: none;
  margin: 6px 10px;
}

.branch-account-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100vh - var(--topbar-height));
  background: #f7f8fb;
}

.branch-account-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 4px 12px;
  color: #697386;
  font-size: 11px;
  background: #fff;
  border-block: 1px solid var(--line);
}

.branch-account-search {
  width: min(380px, 42vw);
  min-width: 220px;
  height: 30px;
  padding: 4px 10px;
  border: 1px solid #cfd6e4;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.branch-account-filters {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.branch-account-date-filter {
  width: 142px;
  height: 30px;
  padding: 4px 8px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  border: 1px solid #cfd6e4;
  border-radius: 7px;
}

.branch-account-search:focus {
  border-color: var(--blue-600);
  outline: 2px solid rgb(66 99 235 / 14%);
}

.branch-account-search-empty {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff8e8;
  color: #8a5a00;
  font-size: 11px;
}

.branch-account-scroll {
  min-height: 0;
  overflow: auto;
  flex: 1;
  background: #fff;
}

.branch-account-grid {
  width: max(100%, 1150px);
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.branch-account-grid th,
.branch-account-grid td {
  height: 30px;
  padding: 0 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid #d7dce6;
  border-bottom: 1px solid #d7dce6;
}

.branch-account-name-row th[data-account-column-header] {
  position: sticky;
}

.branch-account-resize-handle {
  position: absolute;
  inset: 0 -3px 0 auto;
  width: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  z-index: 2;
}

.branch-account-resize-handle:hover,
.branch-account-resize-handle:focus-visible {
  background: #8ca8e8;
}

.branch-account-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #39445a;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  background: #f1f3f7;
}

.branch-account-grid .branch-account-letter-row th {
  top: 0;
  height: 22px;
  color: #7c8598;
  font-size: 9px;
  background: #f5f6f8;
}

.branch-account-grid .branch-account-name-row th {
  top: 22px;
  height: 30px;
  background: #eef1f5;
}

.branch-account-row-number-col { width: 46px; }
.branch-account-row-number {
  color: #778197;
  font-weight: 500;
  text-align: center;
  background: #f6f7fa;
}

.branch-account-grid input {
  width: 100%;
  height: 29px;
  min-height: 0;
  padding: 0;
  line-height: 29px;
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
  outline: 0;
}

.branch-account-grid input:not([readonly]),
.branch-account-grid tr.is-editing input {
  background: #fffef0;
  box-shadow: inset 0 0 0 2px #2f6fed;
}

.branch-account-grid td.is-range-selected {
  background: #e8f0fe;
  box-shadow: inset 0 0 0 1px #7aa2ee;
}

.branch-account-grid td.is-selection-focus {
  box-shadow: inset 0 0 0 2px #2f6fed;
}

.account-remark-attachment-link {
  display: block;
  overflow: hidden;
  color: #1a5fd0;
  text-decoration: underline;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-account-grid tr:not(.is-editing) .account-attachment-edit-input {
  display: none;
}

.branch-account-grid tr.is-editing .account-remark-attachment-link {
  display: none;
}

.account-attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.account-attachment-item .trade-proof-item {
  border-bottom: 0;
}

.account-attachment-remove {
  align-self: center;
  margin-right: 10px;
  color: #b4232a;
}

.branch-account-grid .is-pay-in { color: #08783e; text-align: right; }
.branch-account-grid .is-pay-out { color: #c3262d; text-align: right; }
.branch-account-grid .branch-account-total-row th,
.branch-account-grid .branch-account-total-row td {
  background: #e9edf4;
  border-top: 2px solid #aab4c5;
  font-weight: 700;
}

.branch-today-workspace {
  min-width: 0;
  height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  background: #fff;
}

.branch-today-workspace form {
  min-height: 0;
  flex: 1;
}

.branch-today-search {
  display: flex;
  align-items: center;
  width: clamp(180px, 25vw, 360px);
  margin-inline: 8px;
}
.branch-today-search input {
  width: 100%;
  height: 29px;
  padding: 4px 10px;
  border: 1px solid #c3ccdc;
  border-radius: 6px;
  background: #fff;
  color: #14203a;
  font: inherit;
  outline: none;
}
.branch-today-search input:focus {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.branch-today-date-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 2px 6px;
  color: var(--ink-muted);
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
}

.branch-today-date-filter input {
  width: 128px;
  padding: 2px;
  font: inherit;
  border: 0;
  outline: 0;
}

.today-label-company-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 6px;
  color: #24324a;
  font-size: 11px;
  white-space: nowrap;
}

.today-label-company-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.today-history-snapshot-label,
.today-history-list-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.today-history-revised-tag {
  color: #9b1c1c;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.today-history-update-button {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line-dark);
}

.today-history-update-status {
  min-width: 80px;
  color: var(--ink-muted);
  font-size: 11px;
}

.today-history-selection-summary {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 180;
  padding: 7px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: #17213c;
  border-radius: 7px;
  box-shadow: var(--shadow-md);
}

.branch-today-grid td.is-history-range-selected {
  background: #e8f0fe !important;
  box-shadow: inset 0 0 0 1px #4d78dd;
}

.history-row-number-button {
  width: 100%;
  height: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.history-row-action-menu {
  position: fixed;
  z-index: 190;
  display: grid;
  width: 160px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  box-shadow: var(--shadow-md);
}

.history-row-action-menu[hidden] {
  display: none;
}

.history-row-action-menu button {
  padding: 7px 9px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.history-row-action-menu button:hover {
  background: #edf2fb;
}
.branch-today-grid td.is-grid-selection-focus {
  position: relative;
  z-index: 2;
  box-shadow: inset 0 0 0 2px #2563eb;
  outline: none;
}

.branch-today-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  border-top: 1px solid #cfd6e4;
  border-bottom: 1px solid #cfd6e4;
}

.branch-today-grid {
  width: max-content;
  min-width: 0;
  max-width: none;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
  color: #14203a;
}

.branch-today-grid th,
.branch-today-grid td {
  min-width: 0;
  height: 25px;
  padding: 2px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid #d8deea;
  border-bottom: 1px solid #d8deea;
  background: #fff;
  text-align: center;
  vertical-align: middle;
  font-weight: 400;
}

.branch-today-grid thead th {
  position: sticky;
  z-index: 4;
  background: #f1f3f7;
}

.branch-today-grid .branch-today-letter-row th {
  top: 0;
  height: 23px;
  padding: 2px 6px;
  text-align: center;
  color: #66718a;
  font-size: 10px;
}

.branch-today-grid .branch-today-name-row th {
  top: 23px;
  height: 32px;
  padding: 3px 5px;
  color: #26334f;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
  overflow: visible;
}

.branch-today-grid .branch-today-name-row th > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-today-total-toggle {
  display: block;
  width: 100%;
  height: 23px;
  padding: 0 10px 0 20px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.branch-today-sort {
  position: absolute;
  z-index: 5;
  top: 7px;
  left: 2px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #66718a;
  font: 700 12px/18px Arial, sans-serif;
  cursor: pointer;
}
.branch-today-sort:hover,
.branch-today-grid th[aria-sort='ascending'] .branch-today-sort,
.branch-today-grid th[aria-sort='descending'] .branch-today-sort {
  background: #dce7ff;
  color: #174ea6;
}
.branch-today-column-menu-trigger,
.branch-today-row-menu-trigger {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #66718a;
  font: 700 14px/18px Arial, sans-serif;
  cursor: pointer;
}
.branch-today-column-menu-trigger {
  position: absolute;
  z-index: 7;
  top: 7px;
  right: 5px;
}
.branch-today-column-menu-trigger:hover,
.branch-today-row-menu-trigger:hover { color: #174ea6; background: #dce7ff; }
.branch-today-row-menu-trigger { display: block; margin: 0 auto; }
.branch-today-action-menu { z-index: 180; }
.branch-today-workspace.is-column-sorted .branch-today-grid tbody tr.is-total,
.branch-today-workspace.is-column-sorted .branch-today-grid tbody tr.is-blank {
  display: none;
}
.branch-today-certi-duplicate {
  color: #c3262d;
  font-weight: 700;
}
.branch-today-total-toggle:hover,
.branch-today-total-toggle[aria-pressed='true'] {
  color: #174ea6;
  background: #e8f0fe;
}
.branch-today-workspace.is-group-totals-hidden .branch-today-grid tbody tr.is-total,
.branch-today-workspace.is-group-totals-hidden .branch-today-grid tbody tr.is-blank {
  display: none;
}

.branch-today-filter {
  position: relative;
  display: block;
  min-width: 0;
  max-width: 100%;
  margin-top: 0;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.branch-today-filter summary {
  display: flex;
  align-items: center;
  width: 100%;
  height: 23px;
  padding: 2px 18px 2px 22px;
  border: 1px solid #c7cfdf;
  border-radius: 3px;
  background: #fff;
  color: #14203a;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}
.branch-today-filter summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.branch-today-filter summary::after {
  content: '▾';
  position: absolute;
  right: 6px;
  color: #66718a;
}
.branch-today-filter summary::-webkit-details-marker { display: none; }
.branch-today-filter[open] summary {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.branch-today-filter-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 3px);
  left: 0;
  width: max(210px, 100%);
  padding: 7px;
  border: 1px solid #b8c2d5;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(20 32 58 / 18%);
}
.branch-today-grid .branch-today-filter-popover input[type='search'] {
  display: block;
  width: 100%;
  height: 23px;
  margin-top: 3px;
  padding: 2px 6px;
  border: 1px solid #c7cfdf;
  border-radius: 3px;
  background: #fff;
  color: #14203a;
  font: inherit;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  outline: none;
}
.branch-today-grid .branch-today-filter-popover input[type='search']:focus {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.branch-today-filter-options {
  max-height: 230px;
  margin: 6px 0;
  overflow: auto;
  border-block: 1px solid #e1e6ef;
}
.branch-today-filter-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 3px;
  font-size: 11px;
  cursor: pointer;
}
.branch-today-filter-options label:hover { background: #f1f5ff; }
.branch-today-filter-options label input { width: 14px; height: 14px; margin: 0; }
.branch-today-filter-options label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-today-filter-empty { display: block; padding: 10px 4px; color: #7a8498; }
.branch-today-filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.branch-today-filter-actions button {
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid #c7cfdf;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}
.branch-today-filter-actions button:last-child {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.branch-today-resize {
  position: absolute;
  z-index: 8;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}
.branch-today-resize:hover,
body.is-resizing-column .branch-today-resize { border-right: 2px solid #2563eb; }

.branch-today-row-number-col { width: 46px; }
.branch-today-row-number {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: center !important;
  color: #66718a;
  background: #f3f5f8 !important;
}
.branch-today-row-number > button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.branch-today-grid tr.is-row-selected td,
.branch-today-grid tr.is-row-selected th { background: #dbe8ff !important; }

.branch-today-grid td.is-number { text-align: center; }

.branch-today-serial-cell {
  font-variant-numeric: tabular-nums;
}

.branch-today-label-check {
  width: 14px;
  height: 14px;
  margin: 0 5px 0 0;
  vertical-align: -2px;
  accent-color: var(--blue-700);
  cursor: pointer;
}
.branch-today-grid tr.is-blank td { height: 18px; background: #fafbfc; }
.branch-today-grid tr.is-total td {
  background: #e5e7eb;
  font-weight: 700;
}
.branch-today-grid tr.is-total td.is-total-label,
.branch-today-grid tr.is-grand td.is-total-label {
  overflow: visible;
  text-overflow: clip;
  text-align: left;
  white-space: nowrap;
}
.branch-today-grid tr.is-grand td,
.branch-today-grid tr.is-grand th {
  background: #d8dee9 !important;
  font-weight: 800;
  border-top: 2px solid #7d879b;
}
.branch-today-empty {
  height: 72px !important;
  text-align: center !important;
  color: #6b7280;
}
.branch-today-summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 5px 12px;
  border-top: 1px solid #d8deea;
  background: #f6f8fb;
  font-size: 11px;
  color: #526079;
}

.branch-stock-export-link,
.branch-stock-email-button {
  min-width: auto;
  padding-inline: 12px;
  font: inherit;
  cursor: pointer;
}

.branch-stock-email-status {
  color: #08783e;
  margin: 0;
}
.branch-account-balance { font-weight: 700; text-align: right; }
.branch-account-balance.is-pay { color: #c3262d; }
.branch-account-balance.is-take { color: #08783e; }
.branch-account-balance.is-zero { color: #697386; }

.day-book-grid .day-book-corner,
.day-book-grid .trade-row-number {
  cursor: cell;
  user-select: none;
}

.day-book-grid [data-day-book-column] {
  cursor: default;
}

.day-book-rule-trigger {
  display: inline-flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  overflow: hidden;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.day-book-rule-trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-book-rule-trigger:disabled {
  cursor: default;
}

.day-book-fx-badge {
  display: inline-flex;
  min-width: 21px;
  height: 16px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #687389;
  font-family: Georgia, serif;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  background: #dfe3ea;
  border-radius: 4px;
}

.day-book-rule-trigger.is-configured .day-book-fx-badge {
  color: var(--blue-700);
  background: var(--blue-100);
}

.day-book-grid [data-day-book-column]::after {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  content: '';
}

.day-book-grid [data-day-book-column].is-resizing::after,
.day-book-grid [data-day-book-column]:hover::after {
  background: linear-gradient(
    90deg,
    transparent 4px,
    var(--blue-600) 4px,
    var(--blue-600) 6px,
    transparent 6px
  );
}

body.is-day-book-column-resizing,
body.is-day-book-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.day-book-grid .day-book-cell {
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.day-book-attachment-hover-preview {
  position: fixed;
  z-index: 60;
  display: grid;
  width: min(360px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  gap: 7px;
  padding: 8px;
  pointer-events: none;
  background: #fff;
  border: 1px solid #aeb8c8;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgb(15 23 42 / 24%);
}

.day-book-attachment-hover-preview img {
  display: block;
  width: 100%;
  max-height: min(360px, calc(100vh - 70px));
  object-fit: contain;
  background: #f4f6fa;
  border-radius: 6px;
}

.day-book-attachment-hover-preview span {
  overflow: hidden;
  color: #465168;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-book-grid .day-book-cell.is-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.day-book-grid .day-book-cell.has-cash-list {
  padding-right: 19px;
  background-image: linear-gradient(45deg, transparent 50%, #7b8495 50%),
    linear-gradient(135deg, #7b8495 50%, transparent 50%);
  background-position: calc(100% - 10px) 13px, calc(100% - 6px) 13px;
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px;
}

.day-book-cash-dropdown button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.day-book-cash-dropdown button > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-book-cash-option-outstanding {
  color: #687389;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.day-book-cash-dropdown button:hover .day-book-cash-option-outstanding,
.day-book-cash-dropdown button.is-active .day-book-cash-option-outstanding {
  color: inherit;
}

.day-book-grid tr.is-saving .day-book-cell:not(:focus) {
  background: #f4f7ff;
}

.day-book-grid tr.has-save-error .trade-row-number,
.day-book-grid tr.has-save-error .day-book-cell:not(:focus) {
  color: var(--red-700);
  background: var(--red-100);
}

.day-book-formula-dialog {
  width: min(680px, calc(100vw - 28px));
}

.day-book-formula-dialog textarea {
  min-height: 190px;
  resize: vertical;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.day-book-today-print-button {
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.cash-book-print-dialog {
  width: min(470px, calc(100vw - 32px));
}

.cash-book-print-options {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border-color, #d8deea);
  border-radius: 8px;
}

.cash-book-print-options legend {
  padding: 0 5px;
  font-size: 0.78rem;
  color: var(--muted, #657089);
}

.cash-book-print-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cash-book-print-heading {
  align-items: end;
}

.cash-book-print-page {
  max-width: 760px;
}

.cash-book-print-page-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cash-book-print-explanation {
  display: grid;
  grid-template-columns: minmax(140px, 0.55fr) minmax(240px, 1fr);
  border: 1px solid var(--border-color, #d8deea);
  border-radius: 8px;
  overflow: hidden;
}

.cash-book-print-explanation > * {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-color, #d8deea);
}

.cash-book-print-explanation > :nth-last-child(-n + 2) {
  border-bottom: 0;
}

.cash-book-print-explanation span {
  color: var(--muted, #657089);
  background: #f6f8fc;
}

.cash-book-print-page-actions {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .cash-book-print-page-form,
  .cash-book-print-explanation {
    grid-template-columns: 1fr;
  }

  .cash-book-print-explanation > * {
    border-bottom: 1px solid var(--border-color, #d8deea);
  }
}

.print-settings-sheet {
  height: calc(100vh - var(--topbar-height, 64px) - 22px);
  min-height: 520px;
  overflow: hidden;
}

.print-settings-controls {
  min-height: 48px;
  gap: 10px;
}

.print-settings-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #40506b;
}

.print-settings-control-spacer {
  flex: 1;
}

.print-settings-grid-scroll {
  height: calc(100% - 86px);
  min-height: 390px;
}

.print-settings-grid {
  --print-settings-row-number-width: 46px;
  table-layout: fixed;
  min-width: 1410px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.print-settings-grid th,
.print-settings-grid td {
  height: 26px;
  padding: 0;
  border: 1px solid #d8dde6;
  vertical-align: middle;
}

.print-settings-grid .trade-name-row th {
  height: 28px;
  color: #30394d;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  background: #f7f8fa;
}

.print-settings-grid .trade-letter-row th {
  height: 22px;
  color: #7c8598;
  font-size: 9px;
  font-weight: 750;
  background: #f2f4f7;
}

.print-settings-grid .trade-row-number-column {
  width: var(--print-settings-row-number-width);
}

.print-settings-grid .trade-row-number {
  width: var(--print-settings-row-number-width);
  min-width: var(--print-settings-row-number-width);
  font-size: 10px;
  font-weight: 400;
  text-align: center;
  color: #4d5870;
  background: #f5f6f8;
}

.print-settings-grid [data-print-settings-letter="type"],
.print-settings-grid [data-print-settings-header="type"],
.print-settings-grid [data-print-settings-key="type"] {
  position: sticky;
  left: var(--print-settings-row-number-width);
  box-shadow: 1px 0 0 #b8c1cf;
}

.print-settings-grid [data-print-settings-key="type"] {
  z-index: 3;
  background: #fff;
}

/* Frozen headings stay above scrolling headings; the corner remains on top. */
.print-settings-grid .trade-letter-row [data-print-settings-letter="type"],
.print-settings-grid .trade-name-row [data-print-settings-header="type"] {
  z-index: 8;
}

.print-settings-grid .trade-letter-row .trade-corner-cell {
  z-index: 9;
}

.print-settings-cell-input {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: #253047;
  font: inherit;
  font-size: 11px;
  line-height: 20px;
}

.print-settings-cell-input:focus {
  box-shadow: inset 0 0 0 2px #1a73e8;
}

.print-settings-checkbox {
  display: block;
  width: 15px;
  height: 15px;
  margin: 0 auto;
  accent-color: #5f6368;
}

.print-settings-test-button {
  display: block;
  min-width: 52px;
  height: 22px;
  margin: 1px auto;
  padding: 0 8px;
  border: 1px solid #c9d0dc;
  border-radius: 4px;
  background: #fff;
  color: #1a56db;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.print-settings-test-button:hover:not(:disabled) {
  background: #f1f5ff;
}

.print-settings-test-button:disabled {
  color: #a4a9b3;
  background: #f7f8fa;
  cursor: default;
}

.print-settings-footer {
  min-height: 38px;
  padding: 7px 12px;
  border-top: 1px solid #d8dde6;
  background: #fff;
}

.print-settings-footer p {
  margin: 0;
}

@media (max-width: 620px) {
  .day-book-tab {
    padding-inline: 9px;
  }
}

/* Lookup virtual spreadsheet */
.lookup-controls {
  justify-content: flex-start;
}

.lookup-sheet-label {
  color: #30394d;
  font-size: 12px;
  font-weight: 800;
}

.lookup-save-status {
  min-width: 0;
  overflow: hidden;
  color: #687389;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup-controls [data-lookup-discard] {
  margin-left: auto;
}

.trade-grid.lookup-grid {
  width: max-content;
  min-width: 0;
}

.lookup-grid .lookup-corner,
.lookup-grid .trade-row-number {
  cursor: cell;
  user-select: none;
}

.lookup-grid [data-lookup-column] {
  position: sticky;
  cursor: default;
}

.lookup-grid [data-lookup-column]::after {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  content: '';
}

.lookup-grid [data-lookup-column].is-resizing::after,
.lookup-grid [data-lookup-column]:hover::after {
  background: linear-gradient(90deg, transparent 4px, var(--blue-600) 4px, var(--blue-600) 6px, transparent 6px);
}

body.is-lookup-column-resizing,
body.is-lookup-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.lookup-grid .lookup-cell {
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.lookup-grid .lookup-cell.is-numeric {
  color: #30394d;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: #fafbfc;
}

.lookup-grid tr.is-saving .lookup-cell:not(:focus) {
  background: #f4f7ff;
}

.lookup-grid tr.has-save-error .trade-row-number,
.lookup-grid tr.has-save-error .lookup-cell:not(:focus) {
  color: var(--red-700);
  background: var(--red-100);
}

.lookup-formula-trigger {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.lookup-formula-trigger:disabled {
  cursor: default;
}

.lookup-fx-badge {
  display: inline-flex;
  min-width: 22px;
  height: 17px;
  align-items: center;
  justify-content: center;
  color: #536078;
  font-family: Georgia, serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  background: #e8ebf0;
  border-radius: 4px;
}

.lookup-formula-trigger.is-configured .lookup-fx-badge {
  color: var(--blue-700);
  background: var(--blue-100);
}

.lookup-formula-dialog {
  width: min(560px, calc(100vw - 24px));
}

.lookup-formula-form {
  gap: 13px;
  padding: 20px;
}

.lookup-formula-form textarea {
  min-height: 132px;
  resize: vertical;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 620px) {
  .lookup-save-status {
    max-width: 42vw;
  }
}

/* The Trade header is independent from its permanent row chunks so it remains
   fixed while each nearby chunk can be laid out independently. */
.trade-grid-header {
  position: sticky;
  z-index: 8;
  top: 0;
  background: #eef1f5;
}

.trade-grid-body {
  width: max-content;
  min-width: 100%;
}

.trade-grid-chunk {
  width: max-content;
  min-width: 100%;
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: auto var(--trade-chunk-height, 1500px);
}

.trade-grid-body-table {
  margin: 0;
}

.trade-find-index {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

.trade-find-entry:not([hidden]) {
  white-space: pre;
}

/* Full Trade rows use the <td> itself for ordinary cells. This preserves the
   fixed table geometry while avoiding one extra element per searchable cell. */
.trade-grid td.trade-cell[data-trade-cell-inline="true"] {
  display: table-cell;
  width: auto;
  overflow: hidden;
  vertical-align: top;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
}

.report-sheet-filters {
  display: grid;
  grid-template-columns: 90px minmax(180px, 300px) 24px minmax(220px, 1fr) 24px;
  gap: 4px 0;
  align-items: center;
  margin: 0 0 12px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.report-sheet-label { padding: 8px; font-size: 12px; color: var(--ink-muted); }
.report-sheet-cell input, .report-sheet-search input {
  width: 100%; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line-dark); border-radius: 5px;
}
.report-sheet-search { grid-column: 4; grid-row: 2; display: grid; gap: 3px; font-size: 11px; color: var(--ink-muted); }
.report-data-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.report-data-filters label { display: grid; gap: 3px; min-width: 180px; font-size: 12px; color: var(--ink-muted); }
.report-data-filters select { min-height: 34px; }
.report-inline-filters { align-items: end; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.report-inline-filters label { min-width: 150px; }
.report-inline-filters .report-search-field { min-width: 240px; flex: 1 1 280px; }
.report-inline-filters .report-refresh-button { flex: 0 0 auto; white-space: nowrap; }
.report-inline-filters .report-pending-filter { display:inline-flex; min-width:0; flex:0 0 auto; align-items:center; gap:5px; min-height:32px; padding:5px 9px; color:var(--muted); font-size:11px; font-weight:650; white-space:nowrap; border:1px solid var(--line-dark); border-radius:7px; background:var(--surface); cursor:pointer; }
.report-inline-filters .report-pending-filter input { width:12px; height:12px; margin:0; }
.report-data-grid { display: none; }
.report-data-table-panel { margin-top: 8px; border: 1px solid #9aa6b8; border-radius: 0; box-shadow: none; background: #fff; }
.report-data-table-panel .panel-heading { display: none; }
.report-data-table-panel .table-scroll { max-height: 68vh; overflow: auto; }
.report-data-table-panel .data-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
.report-data-table-panel .data-table th,
.report-data-table-panel .data-table td { padding: 6px 8px; border: 1px solid #b7c0ce; white-space: nowrap; text-align: left; }
.report-data-table-panel .data-table th { background: #e9edf3; color: #1b2942; font-weight: 600; }
.report-data-table-panel .data-table td:nth-child(4),
.report-data-table-panel .data-table td:nth-child(5) { text-align: right; }
.report-data-tabs { margin-bottom: 10px; }
.report-data-tabs .day-book-tab { border: 0; background: transparent; cursor: pointer; }
.report-data-tabs .day-book-tab.is-active { background: #fff; }
.report-certi-panel { min-width: 0; }
.report-bottom-totals { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px; background: #fff; border-top: 1px solid #c9d2df; text-align: right; font-size: 13px; font-weight: 700; }
.report-certi-search-row {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 8px;
}
.report-certi-search-row label {
  display: grid;
  gap: 3px;
  flex: 1 1 300px;
  min-width: 220px;
  max-width: 620px;
  font-size: 12px;
  color: var(--ink-muted);
}
.report-certi-search-row input { min-height: 34px; }
.report-xlsx-button { margin-left: 4px; min-height: 30px; padding: 4px 10px; font-size: 11px; }
.report-certi-search-row span { padding-bottom: 8px; color: var(--ink-muted); font-size: 11px; }
.report-certi-scroll { max-height: 72vh; border: 1px solid #b9c4d6; background: #fff; }
.report-certi-sheet { width: 100%; min-width: 850px; table-layout: fixed; user-select: text; }
.report-certi-sheet .report-certi-row-number-column { width: 44px; }
/* The shared Admin sheet uses two sticky header offsets. On this compact
   result grid they can cover the first tbody row, especially when there is
   only one match. Keep both header rows in normal table flow. */
.report-certi-sheet th,
.report-certi-sheet .admin-sheet-letters th { position: static; top: auto; }
.report-certi-sheet [data-report-certi-header] { position: relative; top: auto; z-index: 1; cursor: pointer; }
.report-certi-sheet [data-report-certi-cell] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-certi-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  z-index: 4;
  width: 7px;
  cursor: col-resize;
}
.report-certi-resize-handle:hover { background: #8ca8e8; }
.report-certi-sheet th:first-child { width: 44px; text-align: center; }
.report-certi-sheet td:last-child { text-align: right; }
.report-certi-sheet [data-report-certi-cell] { cursor: cell; }
.report-certi-sheet [data-report-certi-cell].is-selected {
  background: #e8f0fe;
  box-shadow: inset 0 0 0 1px #1a73e8;
}
.report-certi-selection-summary {
  position: fixed;
  right: 18px;
  bottom: 12px;
  z-index: 40;
  padding: 7px 12px;
  border: 1px solid #c7cfdb;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 12px rgb(20 31 54 / 18%);
  color: #263650;
  font-size: 12px;
  font-weight: 600;
  white-space: pre;
}
.security-whatsapp-panel { margin-top: 1.25rem; }
.security-email-profile-tabs { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1rem; }
.security-email-profile-tabs .sheet-quick-tab { text-decoration: none; }
.security-email-enabled input { width: auto; margin-right: .4rem; }
.security-clear-data-panel { margin-top: 1.25rem; }
.security-clear-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.security-clear-data-grid form { display: flex; flex-direction: column; gap: .75rem; padding: 1rem; border: 1px solid var(--line, #cbd5e1); border-radius: .65rem; }
.security-email-panel { margin-top: 1.25rem; }
.security-email-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.security-email-form .form-actions { display: flex; justify-content: flex-end; padding-top: .25rem; }
.button-danger { background: #b42318; color: #fff; }
.trade-selection-summary { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 1.25rem; align-items: center; justify-content: flex-end; min-height: 2rem; padding: .35rem .75rem; border-top: 1px solid var(--line, #cbd5e1); background: #fff; color: #334155; font-size: .78rem; font-variant-numeric: tabular-nums; }
[data-branch-selection-summary] { flex-wrap: wrap; gap: .3rem 1rem; }

.export-invoice-history-panel { margin: 0; border-radius: 0; }
.export-invoice-history-sheet { table-layout: fixed; }
.export-invoice-history-sheet th,
.export-invoice-history-sheet td { height: 30px; padding: .3rem .45rem; white-space: nowrap; border-right: 1px solid #dfe3ea; border-bottom: 1px solid #dfe3ea; }
.export-invoice-history-sheet td { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 680px) { .security-clear-data-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .security-email-form { grid-template-columns: 1fr; } .security-email-form .field-span-2 { grid-column: auto; } }
.security-whatsapp-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0; }
.security-whatsapp-sheet { overflow-x: auto; margin: 0 0 1rem; }
.security-whatsapp-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; }
.security-whatsapp-sheet th, .security-whatsapp-sheet td { height: 34px; padding: 4px 7px; border: 1px solid #cbd3e1; text-align: left; vertical-align: middle; }
.security-whatsapp-sheet th { background: #edf1f6; color: #46516a; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.security-whatsapp-sheet th:first-child { width: 130px; }
.security-whatsapp-sheet th:last-child { width: 90px; }
.security-whatsapp-sheet input { width: 100%; min-width: 240px; height: 27px; padding: 3px 6px; border: 0; outline: 0; font: inherit; background: transparent; }
.security-whatsapp-body { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 1.25rem; align-items: start; }
.security-whatsapp-qr-wrap { min-height: 220px; display: grid; place-items: center; padding: 1rem; border: 1px dashed var(--line, #cbd5e1); border-radius: .65rem; background: #fafbff; }
.security-whatsapp-qr { width: 220px; height: 220px; image-rendering: pixelated; }
.security-whatsapp-details { min-width: 0; }
.security-whatsapp-status { white-space: nowrap; }
.security-whatsapp-ready { color: #087443; }
.security-whatsapp-authenticated { color: #087443; }
.security-whatsapp-error { color: #b42318; }
.topbar-profile-copy { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.topbar-whatsapp-presence { display: inline-flex; align-items: center; gap: 4px; color: #087443; font-size: 10px; line-height: 1; white-space: nowrap; }
.topbar-whatsapp-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, .15); }
@media (max-width: 680px) { .security-whatsapp-body { grid-template-columns: 1fr; } }
.company-sheet-filters input[data-company-gst-input] { width: 150px; text-transform: uppercase; }
.company-gst-dialog { border: 0; border-radius: 12px; padding: 0; width: min(680px, calc(100vw - 2rem)); color: inherit; box-shadow: 0 24px 70px rgba(15, 23, 42, .25); }
.company-gst-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.company-gst-dialog-card { padding: 1.25rem; background: #fff; }
.company-gst-message { margin: .75rem 0; color: #334155; }
.company-gst-message.is-error { color: #b42318; }
.company-gst-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem 1rem; margin: 0; }
.company-gst-details div { border-top: 1px solid #e2e8f0; padding-top: .45rem; }
.company-gst-details dt { color: #64748b; font-size: .75rem; }
.company-gst-details dd { margin: .15rem 0 0; word-break: break-word; }
.trade-grid tbody tr.has-save-error > th,
.trade-grid tbody tr.has-save-error > td { background: #fff3f2; }
.trade-grid tbody tr.has-save-error > th { color: #b42318; font-weight: 700; }
.trade-grid tbody tr.has-save-error > th[data-row-error="error"]::after { content: ' !'; color: #b42318; font-weight: 800; }
@media (max-width: 560px) { .company-gst-details { grid-template-columns: 1fr; } }

/* F4 daily audit marker. It deliberately overrides calculated, locked, date,
   and selection backgrounds without changing the cell's stored value. */
td.is-audit-yellow,
td.is-audit-yellow .trade-cell,
td.is-audit-yellow input,
td.is-audit-yellow textarea,
td.is-audit-yellow [contenteditable] {
  background-color: #fff2a8 !important;
}
td.is-qr-scan-yellow,
td.is-qr-scan-yellow .trade-cell,
td.is-qr-scan-yellow input,
td.is-qr-scan-yellow textarea,
td.is-qr-scan-yellow [contenteditable] {
  background-color: #ffe66d !important;
}
/* A single certificate lookup on Today briefly marks only the Certi cell. */
.branch-today-grid tbody td.is-today-search-flash {
  background-color: #fff2a8 !important;
  box-shadow: inset 0 0 0 1px #e2b500;
}
.today-certi-scanner { width: min(680px, 100%); margin: 0 auto; padding: 1rem; }
.today-certi-scanner > header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.today-certi-scanner h1 { margin: .1rem 0; font-size: 1.55rem; }
.today-certi-scanner header p { margin: .25rem 0 0; color: #64748b; font-size: .82rem; }
.today-certi-camera { position: relative; min-height: min(58vh, 430px); overflow: hidden; border-radius: 14px; background: #101827; display: grid; place-items: center; }
.today-certi-camera video { width: 100%; height: min(58vh, 430px); object-fit: cover; }
.today-certi-camera p { max-width: 260px; margin: 0; color: #dbe7f7; text-align: center; line-height: 1.5; }
.today-certi-camera-guide { position: absolute; z-index: 2; width: min(66vw, 280px); aspect-ratio: 1; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.23); pointer-events: none; }
.today-certi-scanner-actions { display: flex; align-items: end; gap: .5rem; margin-top: .75rem; }
.today-certi-scanner-actions .button { flex: 1; justify-content: center; min-height: 44px; }
.today-certi-camera-select { display: grid; flex: 2; gap: .2rem; color: #475569; font-size: .72rem; }
.today-certi-camera-select select { min-height: 44px; width: 100%; padding: .5rem .65rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #17213c; }
.today-certi-scan-status { min-height: 42px; margin: .75rem 0; padding: .65rem .8rem; border-radius: 8px; background: #eef2f7; color: #334155; font-weight: 600; }
.today-certi-scan-status[data-state="success"] { background: #dcfce7; color: #166534; }
.today-certi-scan-status[data-state="duplicate"] { background: #fef3c7; color: #92400e; }
.today-certi-scan-status[data-state="error"] { background: #fee2e2; color: #991b1b; }
.today-certi-scan-status[data-state="active"] { background: #dbeafe; color: #1e40af; }
.today-certi-manual { margin-top: 1rem; }
.today-certi-manual label { display: block; margin-bottom: .3rem; font-size: .75rem; color: #475569; }
.today-certi-manual > div { display: flex; gap: .5rem; }
.today-certi-manual input { flex: 1; min-width: 0; min-height: 42px; padding: .55rem .7rem; border: 1px solid #bdc8d8; border-radius: 8px; font: inherit; }
.today-certi-recent { margin-top: 1.25rem; }
.today-certi-recent h2 { font-size: 1rem; }
.today-certi-recent h2 span { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: .3rem; border-radius: 999px; background: #e8edff; color: #2449c6; font-size: .72rem; }
.today-certi-recent ol { margin: 0; padding: 0; list-style: none; border: 1px solid #d5dce7; border-radius: 8px; overflow: hidden; }
.today-certi-recent li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .7rem; border-bottom: 1px solid #e2e8f0; }
.today-certi-recent li:last-child { border-bottom: 0; }
.today-certi-recent li span { color: #64748b; font-size: .72rem; }
@media (max-width: 560px) {
  .today-certi-scanner { padding: .65rem; }
  .today-certi-scanner > header { align-items: center; }
  .today-certi-camera { min-height: 52vh; }
  .today-certi-scanner-actions { flex-wrap: wrap; }
  .today-certi-camera-select { flex-basis: 100%; }
}
.today-packing-list-open { width: 100%; min-height: 26px; padding: .15rem .3rem; border: 0; background: transparent; color: #1d4ed8; text-align: inherit; font: inherit; cursor: pointer; }
.today-packing-list-open small { margin-left: .35rem; font-size: .62rem; text-decoration: underline; }
.today-packing-list-dialog { width: calc(100vw - 2rem); max-width: none; max-height: calc(100vh - 2rem); padding: 0; border: 1px solid #9eabc0; border-radius: 8px; background: #fff; color: #17213c; box-shadow: 0 22px 70px rgba(15,23,42,.3); }
.today-packing-list-dialog::backdrop { background: rgba(15,23,42,.42); }
.today-packing-list-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 40px; padding: .45rem .65rem; border-bottom: 1px solid #b9c4d6; }
.today-packing-list-dialog > header button { width: 30px; height: 30px; border: 0; background: transparent; font-size: 1.35rem; cursor: pointer; }
.today-packing-list-scroll { max-height: calc(100vh - 90px); overflow: auto; }
.today-packing-list-dialog table { width: 100%; min-width: 850px; border-collapse: collapse; table-layout: fixed; font-size: .75rem; }
.today-packing-list-dialog th, .today-packing-list-dialog td { height: 28px; padding: .3rem .4rem; border-right: 1px solid #c9d2df; border-bottom: 1px solid #c9d2df; text-align: right; white-space: nowrap; }
.today-packing-list-dialog th { position: sticky; top: 0; z-index: 1; background: #eef2f7; color: #34435e; font-size: .66rem; text-transform: uppercase; }
.today-packing-list-dialog th:nth-child(-n+6), .today-packing-list-dialog td:nth-child(-n+6) { text-align: left; }
.today-packing-list-dialog th:first-child,
.today-packing-list-dialog td:first-child { width: 38px; text-align: center; }
.today-packing-list-dialog input[type='checkbox'] { width: 14px; height: 14px; accent-color: var(--blue-700); cursor: pointer; }
.branch-today-grid tr.is-packing-item th,
.branch-today-grid tr.is-packing-item td { background: #f7faff; color: #334155; }
.branch-today-grid tr.is-packing-item:hover th,
.branch-today-grid tr.is-packing-item:hover td { background: #eef5ff; }
.branch-today-grid tr.is-packing-item .branch-today-row-number { color: #64748b; text-align: center; }
.branch-today-grid tr.is-packing-item .branch-today-serial-cell span { color: #475569; font-size: .68rem; }
.branch-today-grid tr.is-packing-item .branch-today-packing-date { display: block; margin-top: 2px; color: #64748b; font-size: .6rem; line-height: 1.1; white-space: nowrap; }
.admin-ledger-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 0 0 0.65rem;
}
.admin-ledger-heading h1 { margin: 0.15rem 0 0; font-size: 1.45rem; }
.admin-sheet-tabs { display: flex; align-items: center; gap: 0.25rem; overflow-x: auto; margin-bottom: 0; }
.admin-sheet-tabs .sheet-quick-tab { border-radius: 0.45rem 0.45rem 0 0; white-space: nowrap; }
.admin-sheet-tabs .sheet-quick-tab.is-active { background: #fff; color: #17213c; border-color: #b9c4d6; border-bottom-color: #fff; }
.admin-sheet-panel { background: #fff; border: 1px solid #b9c4d6; overflow: hidden; }
.admin-sheet-title { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 0.65rem; border-bottom: 1px solid #c9d2df; }
.admin-sheet-title span { color: #66738b; font-size: 0.75rem; }
.admin-sheet-title-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.55rem; }
.admin-sheet-title-actions form { margin: 0; }
.admin-sheet-title-actions .button { min-height: 30px; padding: 0.3rem 0.65rem; }
[data-report-panel="due"] .due-pending-toggle { display: inline-flex; flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; margin: 0; min-width: 0; padding-bottom: 7px; }
[data-report-panel="due"] .due-pending-toggle input { width: 14px; height: 14px; min-height: 14px; margin: 0; padding: 0; flex: 0 0 14px; }
[data-report-panel="due"] [data-due-header] { position: sticky; top: 0; overflow: hidden; }
[data-report-panel="due"] .admin-log-sheet { border-collapse: separate; border-spacing: 0; }
[data-report-panel="due"] .admin-log-sheet th:first-child, [data-report-panel="due"] .admin-log-sheet td:first-child { width: auto; text-align: left; }
[data-report-panel="due"] .admin-log-sheet td { overflow-wrap: anywhere; }
.admin-sheet-scroll { overflow: auto; max-height: calc(100vh - 220px); }
.admin-log-sheet { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; font-size: 0.76rem; }
.admin-log-sheet th, .admin-log-sheet td { height: 30px; padding: 0.35rem 0.5rem; border-right: 1px solid #c9d2df; border-bottom: 1px solid #c9d2df; vertical-align: middle; }
.admin-log-sheet th { background: #eef2f7; color: #34435e; font-size: 0.67rem; letter-spacing: 0.04em; text-transform: uppercase; text-align: left; position: sticky; top: 24px; z-index: 2; }
.admin-log-sheet .admin-sheet-letters th { height: 24px; padding: 0.2rem; text-align: center; background: #f5f7fa; color: #647089; position: sticky; top: 0; z-index: 3; }
.admin-log-sheet th:first-child, .admin-log-sheet td:first-child { width: 42px; text-align: center; background: #f5f7fa; color: #647089; }
.admin-log-sheet td strong { display: block; font-weight: 500; }
.admin-log-sheet td small { display: block; margin-top: 0.12rem; }
.admin-log-sheet .is-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.admin-sheet-empty { color: #768198; text-align: center; }
.admin-log-status { display: inline-flex; min-width: 58px; justify-content: center; padding: 0.15rem 0.42rem; border-radius: 999px; background: #edf1f6; }
.admin-log-status-sent { color: #08733e; background: #e8f7ee; }
.admin-log-status-pending { color: #8b5b00; background: #fff4d6; }
.admin-log-status-failed { color: #b42318; background: #fdecea; }
.admin-whatsapp-sheet { min-width: 1200px; }
.admin-whatsapp-sheet .log-row-number { width: 42px; }
.admin-whatsapp-sheet .log-name { width: 290px; }
.admin-whatsapp-sheet .log-destination { width: 320px; }
.admin-whatsapp-sheet .log-value { width: 110px; }
.admin-whatsapp-sheet .log-status { width: 110px; }
.admin-whatsapp-sheet .log-sent-time { width: 175px; }
.admin-whatsapp-sheet.is-rate-log { min-width: 1700px; }
.admin-whatsapp-sheet.is-rate-log .log-value { width: 340px; }
.admin-whatsapp-sheet td { vertical-align: top; }
.admin-log-inline-content { display: flex; align-items: baseline; gap: 0.5rem; max-width: 100%; overflow-x: auto; white-space: nowrap; }
.admin-log-inline-content > * { flex-shrink: 0; }
.admin-log-invoice-number { color: #647089; font-size: 0.68rem; }
.admin-whatsapp-sheet .admin-log-message { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.admin-log-unclassified > span { color: #647089; font-size: 0.68rem; }
.admin-log-status-partial { color: #8b5b00; background: #fff4d6; }
/* Export Invoice workspace */
.trade-invoices-workspace { display: grid; gap: 10px; padding: 8px 12px 24px; }
.trade-invoice-ignore-bar { display: grid; gap: 5px; padding: 8px 10px; border: 1px solid #d9deea; background: #fff; }
.trade-invoice-ignore-bar > label { font-size: 11px; font-weight: 700; color: #26344d; }
.trade-invoice-ignore-bar > small { color: var(--text-muted); font-size: 10px; }
.trade-invoice-ignore-inline { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.trade-invoice-ignore-inline > input { width: 118px; height: 26px; border: 1px solid #cbd3e1; border-radius: 5px; padding: 3px 6px; font: inherit; }
.trade-invoice-ignore-inline > .sheet-quick-tab { min-height: 26px; padding: 3px 7px; }
.trade-invoice-ignore-inline .trade-invoice-tags { flex-wrap: nowrap; max-width: 320px; overflow-x: auto; }
.trade-invoice-tag-editor { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.trade-invoice-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.trade-invoice-tag { display: inline-flex; align-items: center; gap: 5px; min-height: 27px; padding: 2px 5px 2px 8px; border: 1px solid #b9c6dc; border-radius: 5px; background: #eef4ff; color: #17366b; font-size: 11px; }
.trade-invoice-tag button { width: 20px; height: 20px; border: 0; border-radius: 3px; background: transparent; color: #5b6780; font-size: 16px; line-height: 18px; cursor: pointer; }
.trade-invoice-tag button:hover { background: #dbe7fb; color: #b42318; }
.trade-invoice-tag-editor input { flex: 1 1 220px; min-width: 160px; height: 30px; border: 1px solid #cbd3e1; border-radius: 4px; padding: 4px 8px; font: inherit; }
.trade-invoice-group-tabs { overflow-x: auto; flex-wrap: nowrap; }
.trade-invoice-group-tabs .sheet-quick-tab { flex: 0 0 auto; }
.trade-invoice-group-choice { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.trade-invoice-group-choice > input { width: 14px; height: 14px; margin: 0; accent-color: #245dcc; }
.trade-invoice-open-selected:disabled { opacity: .5; cursor: not-allowed; }
.trade-invoice-group-summary { padding: 6px 9px; border: 1px solid #d9deea; background: #fff; font-size: 12px; }
.trade-invoice-edit-link { width: max-content; }
.trade-invoice-document-stack { display: grid; gap: 12px; }
.trade-invoice-document { padding: 0; overflow: hidden; }
.trade-invoice-document .panel-heading { padding: 7px 10px; border-bottom: 1px solid #d9deea; }
.trade-invoice-document .panel-heading h2 { margin: 0; font-size: 14px; }
.trade-invoice-document iframe { display: block; width: 100%; min-height: 900px; border: 0; background: #e6e6e6; }
.trade-invoice-lut { padding: 10px; }
.export-invoice-type-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid #cbd3e1;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 18px 50px rgb(15 23 42 / 22%);
}

.export-invoice-type-dialog::backdrop { background: rgb(15 23 42 / 35%); }
.export-invoice-type-dialog form { padding: 18px; }
.export-invoice-type-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.export-invoice-type-dialog header button { border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.export-invoice-type-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.export-invoice-type-options button { min-height: 72px; border: 1px solid #cbd3e1; border-radius: 8px; background: #fff; font-weight: 700; cursor: pointer; }
.export-invoice-type-options button:disabled { color: #8791a3; background: #f5f7fa; cursor: default; }
.export-branch-choice-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.export-branch-choice-options[hidden] { display: none; }
.export-branch-choice-options button { min-height: 38px; border: 1px solid #cbd3e1; border-radius: 6px; background: #fff; color: #10203c; font-weight: 600; cursor: pointer; }
.export-invoice-type-options small { display: block; margin-top: 5px; font-weight: 400; }

.export-invoice-workspace { min-height: calc(100vh - 70px); display: flex; flex-direction: column; overflow: visible; background: #f5f7fb; }
.export-invoice-toolbar { flex: 0 0 auto; }
.export-invoice-lock-state, .export-invoice-status { align-self: center; font-size: 12px; color: #596579; }
.export-invoice-status.is-error { color: #b42318; font-weight: 700; }
.export-invoice-sheet { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; overflow-x: auto; overflow-y: visible; padding: 12px; }
.export-invoice-packing-toggle-row td { padding: 3px 8px; text-align: left; background: #f8fafc; }
.export-packing-item-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); }
.export-packing-item-scroll table { min-width: 1180px; width: 100%; border-collapse: collapse; }
.export-packing-item-scroll th, .export-packing-item-scroll td { border: 1px solid var(--line); padding: 3px; }
.export-packing-item-scroll input { width: 100%; min-width: 70px; border: 0; background: transparent; font: inherit; }
.export-document-previews { margin: 0 12px 18px; border: 1px solid var(--line); background: #fff; }
.export-document-previews .panel-heading { align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.export-document-previews .sheet-quick-tabs { padding: 6px 10px; }
.export-document-preview-stack { display: grid; justify-items: center; gap: 24px; padding: 18px 12px 30px; background: #eef2f7; }
.export-document-preview-card { width: min(100%, 760px); overflow: hidden; border: 1px solid #b8c0cc; background: #fff; box-shadow: 0 10px 32px rgb(22 34 55 / 13%); }
.export-document-preview-card h3 { margin: 0; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; text-align: center; }
.export-document-rendered-pages { display: grid; gap: 18px; min-height: 160px; padding: 0; background: #eef2f7; }
.export-document-rendered-page { display: block; width: 100%; height: auto; background: #fff; }
.export-document-render-status { margin: 0; padding: 54px 16px; color: var(--muted-text); text-align: center; background: #fff; }
.export-document-render-status.is-error { color: var(--danger); }
@media (max-width: 680px) {
  .export-document-preview-stack { justify-items: start; overflow-x: auto; padding-inline: 6px; }
  .export-document-preview-card { min-width: 680px; }
}
.export-invoice-grid, .export-invoice-details-grid { flex: 0 0 auto; border-collapse: collapse; table-layout: fixed; background: #fff; color: #10203c; font-size: 12px; }
.export-invoice-grid th, .export-invoice-grid td, .export-invoice-details-grid th, .export-invoice-details-grid td { border: 1px solid #cbd3e1; padding: 0; vertical-align: middle; }
.export-invoice-grid thead th, .export-invoice-details-grid thead th { height: 34px; padding: 0 7px; background: #edf1f6; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.export-invoice-grid thead th { position: relative; }
.export-invoice-grid .export-invoice-letter-row th { height: 22px; background: #f7f9fc; color: #68758b; }
.export-invoice-grid tbody th { width: 48px; background: #f7f9fc; text-align: center; font-weight: 500; }
.export-invoice-grid input, .export-invoice-details-grid textarea, .export-invoice-details-grid input, .export-invoice-details-grid select { box-sizing: border-box; width: 100%; min-height: 36px; border: 0; border-radius: 0; padding: 6px 7px; background: transparent; color: inherit; font: inherit; outline: none; resize: vertical; }
.export-invoice-grid .export-invoice-lab-link { display: block; min-height: 36px; padding: 10px 7px 6px; text-align: center; }
.export-invoice-grid td:has(.export-invoice-lab-link) input { display: none; }
.export-invoice-grid td.is-editing .export-invoice-lab-link { display: none; }
.export-invoice-grid td.is-editing input { display: block; }
.export-invoice-grid td small { display: block; min-height: 14px; padding: 0 7px 4px; color: #40526f; font-size: 9px; text-align: right; }
.export-invoice-grid { min-width: max-content; }
.export-invoice-details-grid { order: -1; width: 100%; min-width: 760px; }
.export-invoice-details-grid > h3 { margin: 0; padding: 7px; border: 1px solid #cbd3e1; background: #edf1f6; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.export-invoice-details-fields { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); }
.export-invoice-detail-field { display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 32px; border-right: 1px solid #cbd3e1; border-bottom: 1px solid #cbd3e1; border-left: 1px solid #cbd3e1; }
.export-invoice-detail-field > span { padding: 7px; background: #f7f9fc; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.export-invoice-detail-field > span a { color: #1d4ed8; text-decoration: underline; }
.export-invoice-detail-field input { box-sizing: border-box; width: 100%; min-width: 0; border: 0; padding: 5px 7px; background: #fff; color: inherit; font: inherit; outline: none; }
.export-invoice-edit-actions { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 6px; border: 1px solid #cbd3e1; background: #f7f9fc; }
.export-invoice-edit-actions .sheet-quick-tab { min-height: 24px; padding: 3px 8px; }
.export-invoice-check-fields { display: flex; align-items: center; gap: 18px; padding: 5px 10px; border: 1px solid #cbd3e1; }
.export-invoice-check-field { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.export-invoice-check-field input { width: 15px; height: 15px; min-height: 0; margin: 0; }
.export-invoice-workspace:not(.is-editing) input, .export-invoice-workspace:not(.is-editing) textarea, .export-invoice-workspace:not(.is-editing) select { cursor: default; }
.export-invoice-workspace.is-editing input:focus, .export-invoice-workspace.is-editing textarea:focus, .export-invoice-workspace.is-editing select:focus { box-shadow: inset 0 0 0 2px #2563eb; background: #fff; }
.export-invoice-grid td.has-invoice-error, .export-invoice-details-grid tr.has-invoice-error > * { background: #fee4e2; }
.export-invoice-detail-field.has-invoice-error, .export-invoice-check-field.has-invoice-error { background: #fee4e2; }
.export-invoice-grid tr.has-hrd-review > * { background: #fee4e2; }
.export-invoice-grid tr.has-hrd-review td.has-invoice-error { background: #fecdca; }
.export-invoice-help { flex: 0 0 auto; margin: 0; padding: 7px 12px; border-top: 1px solid #d8dee9; background: #fff; color: #526078; font-size: 12px; }

@media (max-width: 900px) {
  .export-invoice-sheet { display: block; }
  .export-invoice-details-grid { margin-top: 14px; }
  .export-invoice-type-options { grid-template-columns: 1fr; }
}
.branch-client-kyc-column { width: 140px; }
.branch-client-kyc-cell { white-space: nowrap; padding: 2px 5px; }
.company-kyc-cell { white-space: nowrap; padding: 2px 5px; height: 30px; }
.invoice-admin-company-match { margin-top: 6px; padding: 9px; border: 1px solid #cbd5e1; border-radius: 7px; background: #f8fafc; font-size: 12px; }
.invoice-admin-company-match p { margin: 2px 0 7px; }
.invoice-packing-search { display: flex; justify-content: flex-end; margin: 5px 0; }
.invoice-packing-search input { width: 230px; min-height: 28px; border: 1px solid #cbd5e1; border-radius: 5px; padding: 4px 8px; }
.invoice-packing-table tbody tr { cursor: pointer; }
.invoice-packing-table tbody tr.is-summary-selected td { background: #dbeafe; }
.invoice-packing-summary { position: static; margin-top: 4px; }
.invoice-history-actions {
  min-width: 190px;
  white-space: nowrap;
}

.invoice-update-button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  margin-left: 12px;
  padding: 0;
  cursor: pointer;
}

.invoice-update-button:disabled {
  cursor: wait;
  opacity: .55;
}

.invoice-update-status {
  display: block;
  margin-top: 4px;
  max-width: 260px;
  white-space: normal;
}

.invoice-update-status.is-success { color: #16803a; }
.invoice-update-status.is-error { color: #b42318; }
.invoice-update-status.is-saving { color: #52627d; }
.today-history-version-links {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.today-history-version-links .sheet-quick-tab {
  min-height: 30px;
  padding: 5px 9px;
}

.today-history-version-links small {
  color: var(--muted-text, #667085);
  font-size: 11px;
}
.embedded-invoice-body .sidebar,
.embedded-invoice-body .topbar,
.embedded-invoice-body .mobile-backdrop,
.embedded-invoice-body .skip-link {
  display: none !important;
}

.embedded-invoice-body .app-shell,
.embedded-invoice-body .app-main {
  display: block;
  width: 100%;
  min-width: 0;
}

.embedded-invoice-body #main-content {
  padding: 0;
  margin: 0;
}

.trade-invoice-editor-panel {
  overflow: hidden;
}

.trade-invoice-editor-panel .panel-heading {
  align-items: center;
  gap: 16px;
}

.trade-invoice-editor-panel .panel-heading p:last-child {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.trade-invoice-editor-panel iframe {
  display: block;
  width: 100%;
  min-height: 1050px;
  border: 0;
  border-top: 1px solid var(--border);
  background: #fff;
}

.export-invoice-embedded-title {
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
.branch-invoice-company-search {
  width: min(360px, 42vw);
}

.invoice-option-field {
  display: flex;
  min-width: 0;
  align-items: stretch;
  background: #fff;
}

.invoice-option-field > input {
  flex: 1;
}

.invoice-option-toggle {
  flex: 0 0 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e4e8ef;
  border-radius: 0;
  background: #f8faff;
  color: #59677f;
  cursor: pointer;
}

.invoice-option-panel {
  position: fixed;
  z-index: 10050;
  box-sizing: border-box;
  overflow: auto;
  padding: 4px;
  border: 1px solid #cbd4e4;
  border-radius: 6px;
  background: #fff;
  color: #24324a;
  box-shadow: 0 5px 18px #17254324;
  font: 12px/1.4 Arial, sans-serif;
}

.invoice-option-panel[hidden] { display: none; }
.invoice-option-hint { margin: 3px 5px 6px; color: #68758a; font-size: 11px; }
.invoice-option-row { display: flex; align-items: stretch; border-top: 1px solid #edf0f6; }
.invoice-option-choice, .invoice-option-remove {
  min-height: 30px;
  padding: 5px 7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.invoice-option-choice { flex: 1; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.invoice-option-choice:disabled { opacity: .7; cursor: default; }
.invoice-option-remove { flex: 0 0 28px; color: #8d3441; font-size: 18px; line-height: 1; }
.invoice-option-choice:not(:disabled):hover, .invoice-option-toggle:hover { background: #edf2ff; }
.invoice-option-remove:not(:disabled):hover { background: #fff0f1; }
.invoice-option-panel button:focus-visible, .invoice-option-toggle:focus-visible { outline: 2px solid #536dfe; outline-offset: -2px; }

@media print {
  .invoice-option-panel, .invoice-option-toggle { display: none !important; }
}

.branch-invoice-company-search input {
  width: 100%;
}

[data-branch-invoice-search-empty] td {
  padding: 18px;
  text-align: center;
  color: var(--ink-muted);
}

/* A generated invoice remains one row; each revision links to its own saved PDF. */
.invoice-revision-control { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; max-width: 100%; font-size: 11px; line-height: 20px; }
.invoice-revision-control .invoice-latest-link { white-space: nowrap; flex: 0 0 auto; line-height: 20px; }
.invoice-revision-details { min-width: 0; flex: 0 0 auto; }
.invoice-revision-summary { cursor: pointer; color: #53627c; font-size: 10px; line-height: 16px; white-space: nowrap; }
.invoice-revision-options { display: grid; gap: 3px; padding: 7px 0 2px; font-size: 10px; line-height: 20px; }
.invoice-revision-option { white-space: nowrap; }
.invoice-original-revision-option { margin-left: 8px; white-space: nowrap; }
.invoice-revision-option[aria-current="true"] { font-weight: 700; }
.invoice-revision-unavailable { display: inline-block; max-width: 125px; color: #7c8493; font-size: 9px; white-space: normal; line-height: 15px; }
.invoice-revision-control summary:focus-visible, .invoice-revision-control a:focus-visible { outline: 2px solid #536dfe; outline-offset: 2px; }
.admin-log-sheet td.invoice-revision-cell { vertical-align: top; overflow: visible; white-space: nowrap; }

/* The Branch invoice ledger is intentionally independent of Stock sheet styling. */
.branch-invoice-history-panel .panel-heading { gap: 16px; }
.branch-invoice-history-panel .branch-invoice-company-search { flex: 0 1 380px; width: 380px; max-width: 100%; margin: 0; }
.branch-invoice-history-panel .branch-invoice-company-search input { min-height: 36px; font-size: 12px; }
.branch-invoice-history-scroll { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.branch-invoice-history-scroll:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.branch-invoice-history-panel .invoice-history-table { width: 100%; min-width: 1120px; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.branch-invoice-history-panel .history-number-column { width: 144px; }
.branch-invoice-history-panel .history-original-column { width: 8%; }
.branch-invoice-history-panel .history-date-column { width: 10%; }
.branch-invoice-history-panel .history-buyer-column { width: auto; }
.branch-invoice-history-panel .history-carats-column { width: 7%; }
.branch-invoice-history-panel .history-amount-column { width: 12%; }
.branch-invoice-history-panel .history-airway-column { width: 14%; }
.branch-invoice-history-panel .history-actions-column { width: 14%; }
.branch-invoice-history-panel .invoice-history-table th { height: 38px; padding: 9px 12px; border-bottom: 1px solid var(--line-dark); background: #f5f7fb; color: #526078; font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; }
.branch-invoice-history-panel .invoice-history-table td { height: 46px; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.branch-invoice-history-panel .invoice-history-table tbody tr:last-child td { border-bottom: 0; }
.branch-invoice-history-panel .invoice-history-table tbody tr:not(.invoice-previous-issue):hover { background: #fafbff; }
.branch-invoice-history-panel .invoice-history-table .is-numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.branch-invoice-history-panel .history-date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.branch-invoice-history-panel .history-original-cell { white-space: nowrap; }
.branch-invoice-history-panel .history-original-cell > a { color: var(--blue-700); font-size: 11px; font-weight: 600; }
.branch-invoice-history-panel .history-buyer-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-invoice-history-panel .history-invoice-label { display: flex; align-items: center; gap: 5px; min-width: 0; }
.branch-invoice-history-panel .history-invoice-label > a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue-700); }
.branch-invoice-history-panel .history-revision-badge,
.branch-invoice-history-panel .history-previous-badge { flex: 0 0 auto; padding: 2px 4px; border-radius: 4px; background: #edf1fa; color: #576681; font-size: 9px; font-weight: 600; white-space: nowrap; }
.branch-invoice-history-panel .history-previous-badge { background: #fee4e2; color: #b42318; }
.branch-invoice-history-panel .history-airway-cell > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue-700); font-weight: 500; }
.branch-invoice-history-panel .history-airway-cell .invoice-airway-pending { font-size: 11px; font-weight: 500; white-space: nowrap; }
.branch-invoice-history-panel .history-no-file { color: var(--muted-light); }
.branch-invoice-history-panel .invoice-history-actions { min-width: 0; white-space: normal; }
.branch-invoice-history-panel .history-action-links { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; }
.branch-invoice-history-panel .history-action-links > a,
.branch-invoice-history-panel .history-action-links > button,
.branch-invoice-history-panel .history-more-actions > summary { min-height: 28px; padding: 6px 0; font-size: 11px; font-weight: 600; line-height: 16px; }
.branch-invoice-history-panel .invoice-update-button { margin: 0; color: var(--blue-700); }
.branch-invoice-history-panel .history-more-actions { min-width: 0; }
.branch-invoice-history-panel .history-more-actions[open] { flex: 1 0 100%; }
.branch-invoice-history-panel .history-more-actions > summary { color: var(--muted); cursor: pointer; }
.branch-invoice-history-panel .history-more-content { display: grid; gap: 7px; padding: 6px 0; color: var(--muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.branch-invoice-history-panel .history-more-content .text-link { color: var(--blue-700); font-size: 11px; }
.branch-invoice-history-panel .history-more-content .invoice-delete-button { justify-self: start; color: #b42318; padding: 0; text-align: left; }
.branch-invoice-history-panel .history-more-content time { display: block; }
.branch-invoice-history-panel .invoice-update-status:empty { display: none; }
.branch-invoice-history-panel .invoice-update-status { font-size: 10px; line-height: 1.45; }
.branch-invoice-history-panel a:hover,
.branch-invoice-history-panel .invoice-update-button:hover { text-decoration: underline; }
.branch-invoice-history-panel a:focus-visible,
.tracking-table { min-width: 0; border-collapse: separate; border-spacing: 0; }
.tracking-table th { top: 0; padding-right: 16px; }
.tracking-table th:first-child, .tracking-table td:first-child { width: auto; text-align: left; }
.tracking-column-resize { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: col-resize; touch-action: none; }
.tracking-column-resize:hover, .tracking-column-resize:focus { background: #93c5fd; }
.tracking-table td { white-space: normal; overflow-wrap: anywhere; }
.tracking-table tr.tracking-new td, .tracking-legend.tracking-new { background: #dcfce7; color: #14532d; }
.tracking-table tr.tracking-missing td, .tracking-legend.tracking-missing { background: #fee2e2; color: #7f1d1d; }
.tracking-table tr.tracking-returned td, .tracking-legend.tracking-returned { background: #fef08a; color: #713f12; }
.tracking-legend { display: inline-block; padding: 5px 10px; border-radius: 4px; }
[data-tracking-history] { max-width: min(720px, 80vw); }
.branch-invoice-history-panel button:focus-visible,
.branch-invoice-history-panel summary:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 3px; border-radius: 2px; }
.branch-invoice-history-panel [data-branch-invoice-search-empty] td { height: 82px; color: var(--muted); white-space: normal; }
@media (max-width: 760px) {
  .branch-invoice-history-heading p:last-child { white-space: normal; }
  .branch-invoice-history-panel .panel-heading { align-items: stretch; flex-direction: column; padding: 18px 16px; }
  .branch-invoice-history-panel .branch-invoice-company-search { flex-basis: auto; width: 100%; margin: 0; }
}
.sheet-quick-tab.is-invoice-generated {
  color: #1558d6;
}
.label-sent-dots { display: flex; justify-content: center; margin: 2px auto; }
.label-sent-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #facc15; border: 1px solid #a16207; }
.label-sent-dot + .label-sent-dot { margin-left: -2px; }
.is-payment-amount-mismatch, .is-payment-amount-mismatch a { color: #dc2626 !important; font-weight: 700; }

/* Keep Stock search and invoice actions in separate, non-overlapping rows. */
.branch-sheet-workspace-body .app-main:has(.branch-stock-topbar) {
  display: flex;
  flex-direction: column;
}
.branch-sheet-workspace-body .topbar.branch-stock-topbar {
  grid-template-columns: 40px minmax(0, 1fr);
  height: auto;
  min-height: 82px;
  flex: 0 0 auto;
  gap: 4px 10px;
  padding: 6px 14px;
}
.branch-stock-topbar .branch-stone-search {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.branch-stock-topbar .branch-inline-greeting {
  flex: 1 1 180px;
  min-width: 0;
  overflow: hidden;
}
.branch-stock-topbar .branch-stone-filters {
  flex: 2 1 440px;
  min-width: 0;
  grid-template-columns: 142px minmax(0, 1fr);
}
.branch-stock-topbar .branch-stone-filters input {
  min-width: 0;
  box-sizing: border-box;
}
.branch-stock-topbar .branch-sheet-topbar-status {
  grid-column: 2;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px 12px;
}
.branch-stock-topbar .branch-invoice-selection-form {
  margin-left: auto;
  flex-shrink: 0;
}
.branch-sheet-workspace-body .branch-stock-topbar ~ .content {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}
@media (max-width: 480px) {
  .branch-stock-topbar .branch-stone-filters { grid-template-columns: minmax(0, 1fr); }
  .branch-stock-topbar .branch-inline-greeting { display: none; }
}
.trade-grid .day-book-cell.bank-remarks-warning,
.trade-grid .day-book-cell.bank-remarks-warning:focus {
  background-color: #fff176 !important;
  color: #172033;
}
