/* Stitch Enterprise Precision for focused transaction and record workspaces. */

:root {
  --ws-navy: #0f172a;
  --ws-blue: #1e40af;
  --ws-blue-hover: #1d4ed8;
  --ws-canvas: #f7f9fb;
  --ws-surface: #ffffff;
  --ws-soft: #f2f4f6;
  --ws-text: #191c1e;
  --ws-muted: #64748b;
  --ws-border: #d8dee8;
  --ws-border-strong: #aeb8c8;
  --ws-danger: #b42318;
  --ws-success: #087443;
  --ws-radius-sm: 4px;
  --ws-radius: 8px;
  --ws-focus: 0 0 0 4px rgba(30, 64, 175, .2);
}

body.erp-workstation,
body.erp-record-workspace,
body.baigo-login {
  box-sizing: border-box;
  background: var(--ws-canvas) !important;
  color: var(--ws-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif !important;
  font-size: 14px;
  line-height: 1.4;
}

body.erp-workstation *,
body.erp-record-workspace *,
body.baigo-login *,
body.erp-workstation *::before,
body.erp-workstation *::after,
body.erp-record-workspace *::before,
body.erp-record-workspace *::after,
body.baigo-login *::before,
body.baigo-login *::after {
  box-sizing: border-box;
}

body.erp-workstation :where(button, a, input, select, textarea):focus-visible,
body.erp-record-workspace :where(button, a, input, select, textarea):focus-visible,
body.baigo-login :where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--ws-blue) !important;
  outline-offset: 2px;
  box-shadow: var(--ws-focus);
}

body.erp-workstation .cv-wrap {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  background: var(--ws-canvas);
}

body.erp-workstation .cv-titlebar {
  min-height: 58px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--ws-border);
  background: var(--ws-surface);
  color: var(--ws-navy);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.02em;
}

body.erp-workstation .cv-shortcut-bar {
  min-height: 44px;
  padding: 6px 20px;
  gap: 10px 16px;
  border-bottom: 1px solid var(--ws-border);
  background: var(--ws-surface);
  color: #334155;
  font-size: 12px;
}

body.erp-workstation .cv-shortcut-bar a {
  min-height: 30px;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--ws-radius-sm);
  color: #334155;
  text-decoration: none;
}

body.erp-workstation .cv-shortcut-bar a:hover {
  background: #eef3ff;
  color: var(--ws-blue);
}

body.erp-workstation .cv-shortcut-bar .ico {
  display: none;
}

body.erp-workstation .cv-shortcut-bar kbd,
body.erp-workstation kbd {
  min-height: 20px;
  padding: 2px 6px !important;
  display: inline-flex;
  align-items: center;
  border: 1px solid #475569;
  border-radius: var(--ws-radius-sm) !important;
  background: var(--ws-navy) !important;
  color: #fff !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1;
}

body.erp-workstation .cv-shortcut-bar + div {
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--ws-border) !important;
  background: var(--ws-surface) !important;
}

body.erp-workstation .sales-header-grid,
body.erp-workstation .cv-header-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
}

body.erp-workstation .sales-header-field,
body.erp-workstation .cv-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

body.erp-workstation .sales-header-field .cv-label,
body.erp-workstation .cv-field .cv-label {
  width: auto;
  flex: 0 0 auto;
}

body.erp-workstation .cv-label {
  padding: 0;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .035em;
  text-transform: uppercase;
}

body.erp-workstation .cv-input,
body.erp-workstation select.cv-input,
body.erp-workstation textarea.cv-input {
  width: 100%;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--ws-border-strong);
  border-radius: var(--ws-radius-sm);
  background: var(--ws-surface);
  color: var(--ws-text);
  font-family: inherit;
  font-size: 14px;
}

body.erp-workstation .cv-input.invoice-no {
  border-color: #8fa4e8;
  background: #eef3ff;
  color: var(--ws-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.erp-workstation .cv-input:focus,
body.erp-workstation select.cv-input:focus,
body.erp-workstation textarea.cv-input:focus {
  border-color: var(--ws-blue);
  background: #fff;
  outline: 2px solid rgba(30, 64, 175, .18);
  box-shadow: none;
}

body.erp-workstation .cv-balance {
  padding: 2px 0 0;
  color: var(--ws-muted);
  font-size: 11px;
}

body.erp-workstation .cv-shortcut-bar + div + div {
  padding: 12px 20px !important;
  border-bottom: 1px solid var(--ws-border) !important;
  background: var(--ws-surface) !important;
}

body.erp-workstation .cv-shortcut-bar + div + div > table td {
  padding-right: 10px;
}

body.erp-workstation .cv-hint-red {
  color: var(--ws-muted);
  font-size: 11px;
  font-weight: 650;
}

body.erp-workstation .cv-table {
  flex: 1 1 auto;
  width: 100%;
  min-height: 280px;
  border: 0;
  border-collapse: collapse;
  background: var(--ws-surface);
  color: var(--ws-text);
  font-size: 13px;
}

body.erp-workstation .cv-table thead th {
  height: 40px;
  padding: 8px 10px;
  border-right: 1px solid var(--ws-border);
  border-bottom: 1px solid var(--ws-border-strong);
  background: var(--ws-soft);
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

body.erp-workstation .cv-table tbody td {
  height: 40px;
  border-right: 1px solid #e8ebf0;
  border-bottom: 1px solid #e8ebf0;
}

body.erp-workstation .cv-table tbody input {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 13px;
}

body.erp-workstation .cv-table tbody input:focus {
  background: #eef3ff;
  outline: 2px solid rgba(30, 64, 175, .2);
}

body.erp-workstation .cv-table + div {
  grid-template-columns: minmax(0, 1fr) 380px !important;
  gap: 16px !important;
  padding: 16px 20px 72px !important;
  border-top: 1px solid var(--ws-border) !important;
  background: var(--ws-canvas) !important;
}

body.erp-workstation .cv-table + div > div {
  min-width: 0;
  padding: 16px !important;
  border: 1px solid var(--ws-border) !important;
  border-radius: var(--ws-radius);
  background: var(--ws-surface);
}

body.erp-workstation .cv-table + div > div:last-child {
  border-color: var(--ws-border-strong) !important;
  border-top: 4px solid var(--ws-navy) !important;
  background: #f8fafc !important;
  color: var(--ws-text);
}

body.erp-workstation .cv-table + div > div:last-child .cv-label {
  color: #334155;
}

body.erp-workstation .cv-table + div > div:last-child .cv-input {
  border-color: var(--ws-border-strong);
  background: #fff;
  color: var(--ws-navy);
}

body.erp-workstation .cv-table + div > div:last-child .total-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

body.erp-workstation .cv-calculation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px 20px 72px;
  border-top: 1px solid var(--ws-border);
  background: var(--ws-canvas);
}

body.erp-workstation .cv-calculation-options {
  display: flex;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

body.erp-workstation .cv-narration-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

body.erp-workstation .cv-narration-label {
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}

body.erp-workstation .cv-totals-card .total-row {
  gap: 16px;
  margin-bottom: 8px;
}

body.erp-workstation .cv-totals-card .total-row-grand {
  margin: 10px 0 0;
  padding: 12px 0 0;
  border-top: 2px solid var(--ws-navy);
}

body.erp-workstation .cv-totals-card .total-row-grand .total-box {
  border-color: #8fa4e8;
  background: #eef3ff;
  color: var(--ws-blue);
  font-size: 16px;
  font-weight: 850;
}

body.erp-workstation .mode-btn {
  min-height: 30px;
  border: 1px solid var(--ws-border-strong);
  border-radius: var(--ws-radius-sm);
  background: var(--ws-surface);
  color: #334155;
}

body.erp-workstation .cv-bottom-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 80;
  min-height: 56px;
  padding: 8px 20px;
  border-top: 1px solid var(--ws-border);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, .06);
}

body.erp-workstation .cv-exit,
body.erp-workstation .cv-save-alt,
body.erp-workstation .btn-action {
  min-height: 38px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-border-strong);
  border-radius: var(--ws-radius-sm);
  background: var(--ws-surface);
  color: var(--ws-navy);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

body.erp-workstation .btn-action-save,
body.erp-workstation .btn-action-submit,
body.erp-workstation .cv-save-big {
  border-color: var(--ws-blue) !important;
  background: var(--ws-blue) !important;
  color: #fff !important;
}

body.erp-workstation .btn-action-save:hover,
body.erp-workstation .btn-action-submit:hover,
body.erp-workstation .cv-save-big:hover {
  border-color: var(--ws-blue-hover) !important;
  background: var(--ws-blue-hover) !important;
}

/* Record workspaces use the same polished surface without changing their data layout. */
body.erp-record-workspace {
  min-width: 0;
  margin: 0;
}

body.erp-record-workspace .cv-wrap {
  width: min(100% - 32px, 1440px) !important;
  margin: 16px auto 80px !important;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius);
  background: var(--ws-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

body.erp-record-workspace .cv-titlebar {
  min-height: 56px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ws-border);
  background: var(--ws-surface) !important;
  color: var(--ws-navy) !important;
  font-size: 20px;
  font-weight: 750;
}

body.erp-record-workspace .cv-section-head {
  min-height: 40px;
  padding: 9px 14px !important;
  border-bottom: 1px solid var(--ws-border);
  background: var(--ws-blue) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  letter-spacing: .05em !important;
  text-transform: uppercase !important;
}

body.erp-record-workspace .cv-input,
body.erp-record-workspace input:not([type="checkbox"]):not([type="radio"]),
body.erp-record-workspace select,
body.erp-record-workspace textarea {
  min-height: 36px;
  border-color: var(--ws-border-strong) !important;
  border-radius: var(--ws-radius-sm) !important;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

body.erp-record-workspace .cv-bottom-bar {
  position: sticky !important;
  bottom: 0;
  z-index: 40;
  min-height: 56px;
  padding: 8px 16px !important;
  border-top: 1px solid var(--ws-border) !important;
  background: rgba(255, 255, 255, .98) !important;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, .06);
}

body.erp-record-workspace table.bk th {
  height: 40px;
  background: var(--ws-soft);
  color: #475569;
  font-size: 11px;
}

body.erp-record-workspace table.bk td {
  height: 40px;
  border-bottom-color: #e8ebf0;
}

/* Authentication follows the approved Stitch login proportions. */
body.baigo-login {
  margin: 0;
  min-height: 100vh;
  padding: 72px 20px 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  background: #f7f8fc !important;
}

body.baigo-login .login-card {
  width: min(100%, 500px);
  max-width: 500px;
  margin: 0;
  padding: 36px 40px 34px;
  border: 1px solid var(--ws-border-strong);
  border-radius: var(--ws-radius);
  background: var(--ws-surface);
  box-shadow: 0 12px 36px rgba(15, 23, 42, .09);
}

body.baigo-login .login-logo {
  display: block;
  width: 190px;
  height: auto;
  margin: 0 auto 20px;
}

body.baigo-login .login-eyebrow {
  margin: 0 0 8px;
  color: var(--ws-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-align: center;
  text-transform: uppercase;
}

body.baigo-login .login-title {
  color: var(--ws-navy);
  font-size: 28px;
  font-weight: 750;
  text-align: center;
}

body.baigo-login .login-sub {
  margin-bottom: 28px;
  color: var(--ws-muted);
  text-align: center;
}

body.baigo-login .login-label {
  margin: 0;
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .035em;
  text-transform: uppercase;
}

body.baigo-login .login-label > span {
  display: block;
}

body.baigo-login .login-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border-color: var(--ws-border-strong);
  border-radius: var(--ws-radius-sm);
  font-size: 16px;
}

body.baigo-login .login-submit {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-blue);
  border-radius: var(--ws-radius-sm);
  background: var(--ws-blue);
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

body.baigo-login .login-submit:hover {
  background: var(--ws-blue-hover);
}

body.baigo-login .login-forgot {
  margin-left: auto;
  color: var(--ws-blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

body.baigo-login .login-forgot:hover,
body.baigo-login .login-back-link:hover {
  text-decoration: underline;
}

body.baigo-login .login-hint {
  margin: 12px 0 0;
  color: var(--ws-muted);
  text-align: center;
}

body.baigo-login .login-hints {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--ws-border);
  color: var(--ws-muted);
  font-size: 12px;
  text-align: center;
}

body.baigo-login .login-hints summary {
  color: var(--ws-blue);
  font-weight: 700;
  cursor: pointer;
}

body.baigo-login .login-hints p {
  margin: 8px 0 0;
  line-height: 1.45;
}

body.baigo-login .login-submit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

body.baigo-login .login-back-link {
  margin-top: 18px;
  display: block;
  color: var(--ws-blue);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

body.baigo-login .recovery-form {
  display: grid;
  gap: 16px;
}

body.baigo-login .login-privacy-note {
  margin: 14px 0 0;
  color: var(--ws-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

body.baigo-login .recovery-card .login-back-link {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ws-border);
}

body.baigo-login .login-recovery-note {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--ws-radius-sm);
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.45;
}

body.baigo-login .access-denied-card {
  text-align: center;
}

body.baigo-login .access-denied-code {
  margin-bottom: 8px;
  color: var(--ws-danger);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .12em;
}

body.baigo-login .access-denied-actions {
  margin-top: 22px;
}

body.baigo-login .login-refresh {
  min-height: 36px;
  border-color: var(--ws-border);
  border-radius: var(--ws-radius-sm);
  color: var(--ws-blue);
}

@media (max-width: 900px) {
  body.erp-workstation .sales-header-grid,
  body.erp-workstation .cv-header-grid,
  body.erp-workstation .cv-header-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.erp-workstation .cv-table + div {
    grid-template-columns: 1fr !important;
  }

  body.erp-workstation .cv-calculation-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body.erp-workstation {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.erp-workstation .cv-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.erp-workstation .cv-titlebar {
    min-height: 54px;
    padding: 12px 14px;
    font-size: 20px;
  }

  body.erp-workstation .cv-shortcut-bar {
    padding: 6px 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  body.erp-workstation .cv-shortcut-bar > * {
    flex: 0 0 auto;
  }

  body.erp-workstation .cv-shortcut-bar .ml-auto {
    margin-left: 0 !important;
  }

  body.erp-workstation .cv-shortcut-bar + div,
  body.erp-workstation .cv-shortcut-bar + div + div {
    padding: 12px !important;
  }

  body.erp-workstation .sales-header-grid,
  body.erp-workstation .cv-header-grid,
  body.erp-workstation .cv-header-grid.two {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.erp-workstation .sales-header-grid > span:empty {
    display: none;
  }

  body.erp-workstation .cv-input,
  body.erp-workstation select.cv-input,
  body.erp-workstation textarea.cv-input {
    min-height: 44px;
    font-size: 16px;
  }

  body.erp-workstation .cv-shortcut-bar + div + div > table {
    display: block;
    width: 100%;
  }

  body.erp-workstation .cv-shortcut-bar + div + div > table tbody,
  body.erp-workstation .cv-shortcut-bar + div + div > table tr,
  body.erp-workstation .cv-shortcut-bar + div + div > table td {
    width: 100% !important;
    display: block;
    padding: 4px 0 !important;
  }

  body.erp-workstation .cv-shortcut-bar + div + div > table td[style*="padding-left"] {
    padding-left: 0 !important;
  }

  body.erp-workstation .cv-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 300px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.erp-workstation .cv-table thead,
  body.erp-workstation .cv-table tbody {
    width: 900px;
    min-width: 900px;
    display: table;
    table-layout: fixed;
  }

  body.erp-workstation .cv-table + div {
    grid-template-columns: 1fr !important;
    padding: 12px 12px 80px !important;
  }

  body.erp-workstation .cv-calculation-layout {
    grid-template-columns: 1fr;
    padding: 12px 12px 80px;
  }

  body.erp-workstation .cv-calculation-layout > div {
    padding: 12px !important;
  }

  body.erp-workstation .cv-narration-row {
    grid-template-columns: 1fr;
  }

  body.erp-workstation .cv-table + div > div {
    padding: 12px !important;
  }

  body.erp-workstation .cv-table + div > div:first-child > div:first-child {
    gap: 10px !important;
    align-items: flex-start !important;
    flex-wrap: wrap;
  }

  body.erp-workstation .cv-bottom-bar {
    min-height: 64px;
    padding: 8px 10px;
  }

  body.erp-workstation .cv-bottom-bar .btn-action,
  body.erp-workstation .cv-bottom-bar .cv-exit {
    min-height: 44px;
  }

  body.erp-record-workspace .cv-wrap {
    width: 100% !important;
    margin: 0 0 72px !important;
    border: 0;
    border-radius: 0;
  }

  body.erp-record-workspace .cv-form-grid,
  body.erp-record-workspace .cv-master-fields,
  body.erp-record-workspace .cv-supplier-grid,
  body.erp-record-workspace .cv-pricing-grid {
    grid-template-columns: 1fr !important;
  }

  body.erp-record-workspace .cv-form-grid > *,
  body.erp-record-workspace .cv-master-fields > *,
  body.erp-record-workspace .cv-supplier-grid > *,
  body.erp-record-workspace .cv-pricing-grid > * {
    grid-column: 1 !important;
  }

  body.erp-record-workspace input:not([type="checkbox"]):not([type="radio"]),
  body.erp-record-workspace select,
  body.erp-record-workspace textarea {
    min-height: 44px;
    font-size: 16px;
  }

  body.baigo-login {
    align-items: flex-start;
    padding: 52px 14px 24px;
  }

  body.baigo-login .login-card {
    padding: 28px 22px;
  }

  body.baigo-login .login-refresh {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.erp-workstation *,
  body.erp-record-workspace *,
  body.baigo-login * {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
