/* App structure on top of design/tokens.css and design/components.css.
   Module screens should use the rc-* classes from src/ui/components.js. */

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--rocam-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

.rc-search svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.rc-account {
  position: relative;
}

.rc-account summary {
  list-style: none;
  cursor: pointer;
}

.rc-account summary::-webkit-details-marker {
  display: none;
}

.rc-account[open] .rc-account-panel {
  animation: rc-menu-in var(--duration-base) var(--ease-out) both;
}

.rc-account.is-closing .rc-account-panel {
  animation: rc-menu-out var(--duration-base) var(--ease-out) forwards;
}

.rc-account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 30;
  min-width: 220px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--shadow-glow-blue);
}

.rc-account-panel a {
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
}

.rc-account-panel a:hover {
  color: var(--rocam-blue-text);
}

a.rc-stat,
a.rc-stat:hover,
.rc-tab,
.rc-btn {
  text-decoration: none;
}

a.rc-stat {
  color: inherit;
}

.rc-toasts {
  position: fixed;
  z-index: 25;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.rc-toasts .flash {
  pointer-events: auto;
  width: min(420px, 100%);
  margin: 0;
}

.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 2px solid var(--rocam-blue);
  background: var(--surface);
  box-shadow: var(--shadow-glass);
  color: var(--text);
}

.flash-error {
  color: var(--rocam-red-text);
  border-left-color: var(--rocam-red);
  box-shadow: var(--shadow-glow-red);
}

.flash-ok {
  color: var(--badge-green-text);
  border-left-color: var(--status-ready);
}

.rc-toasts .flash {
  animation: rc-menu-in var(--duration-base) var(--ease-out) both;
}

.flash.is-leaving {
  animation: rc-menu-out var(--duration-base) var(--ease-out) forwards;
}

.flash-dismiss {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.rc-modal-open {
  overflow: hidden;
}

form.rc-is-saving {
  cursor: progress;
}

form.rc-is-saving .rc-btn,
form.rc-is-saving button,
form.rc-is-saving input[type="submit"] {
  pointer-events: none;
}

form.rc-is-saving .rc-btn[type="submit"]::after,
form.rc-is-saving button[type="submit"]::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rc-spin 0.7s linear infinite;
}

@keyframes rc-menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rc-menu-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes rc-spin {
  to { transform: rotate(360deg); }
}

html.rc-pull-on,
html.rc-pull-on body {
  overscroll-behavior-y: none;
}

html.rc-nav-on .rc-main {
  transition: transform var(--duration-base) var(--ease-out), opacity var(--duration-base) var(--ease-out);
}

html.rc-nav-on.rc-nav-drag .rc-main {
  transition: none;
}

.rc-pull {
  position: fixed;
  z-index: 24;
  left: 50%;
  top: calc(8px + env(safe-area-inset-top));
  transform: translate3d(-50%, -120%, 0);
  pointer-events: none;
  transition: transform var(--duration-base) var(--ease-out);
}

.rc-pull.is-dragging {
  transition: none;
}

.rc-pull[hidden] {
  display: none !important;
}

.rc-pull-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-glass), var(--shadow-glow-blue);
}

.rc-pull[data-state="ready"] .rc-pull-pill,
.rc-pull[data-state="refreshing"] .rc-pull-pill {
  box-shadow: var(--shadow-glass), var(--shadow-glow-blue), 0 0 22px rgba(237, 28, 36, 0.28);
}

.rc-pull-spin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(37, 74, 159, 0.28);
  border-top-color: var(--rocam-blue);
  border-right-color: var(--rocam-red);
  background: radial-gradient(circle, rgba(37, 74, 159, 0.42), transparent 68%);
  box-shadow: var(--shadow-glow-blue);
  transform: rotate(calc(var(--pull-turn, 0) * 1deg));
}

.rc-pull[data-state="refreshing"] .rc-pull-spin {
  animation: rc-spin 0.7s linear infinite;
}

.rc-pull-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

@media (max-width: 720px) {
  .rc-modal-backdrop {
    padding: 12px;
    align-items: end;
  }

  .rc-modal {
    width: 100%;
  }
}

.stack {
  display: grid;
  gap: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.rc-client-picker {
  display: contents;
}

.rc-picker {
  position: relative;
}

.rc-picker.is-open {
  z-index: 40;
}

.rc-picker-control {
  display: flex;
  align-items: stretch;
}

.rc-picker-query {
  font-size: 16px;
  min-height: 48px;
}

.rc-picker.is-on .rc-picker-query {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.rc-picker-toggle {
  display: none;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--input-bg, var(--surface));
  color: inherit;
}

.rc-picker.is-on .rc-picker-toggle {
  display: inline-flex;
}

.rc-picker-toggle svg {
  display: block;
  transition: transform var(--duration-fast) var(--ease-out);
}

.rc-picker.is-open .rc-picker-toggle svg {
  transform: rotate(180deg);
}

.rc-picker.is-on .rc-picker-control:focus-within .rc-picker-query,
.rc-picker.is-on .rc-picker-control:focus-within .rc-picker-toggle {
  border-color: rgba(37, 74, 159, 0.75);
}

.rc-picker.is-on .rc-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rc-picker-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% - 8px);
  max-height: min(50vh, 420px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-glass);
}

.rc-picker.is-open .rc-picker-menu {
  animation: rc-picker-in var(--duration-base) var(--ease-out);
}

@keyframes rc-picker-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rc-picker-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  text-align: left;
}

.rc-picker-menu button.is-current,
.rc-picker-menu button:hover,
.rc-picker-menu button:focus-visible {
  background: rgba(37, 74, 159, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  .rc-picker.is-open .rc-picker-menu,
  .rc-picker-toggle svg {
    animation: none;
    transition: none;
  }
}

.rc-picker-empty {
  padding: 10px 12px;
  color: var(--text-muted);
}

.rc-picker-locked {
  margin: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.rc-party-card {
  grid-column: 1 / -1;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rc-party-card .rc-label {
  margin: 0 0 8px;
}

.rc-party-card [data-party-field="address"] {
  white-space: pre-line;
}

.rc-quick-client {
  grid-column: 1 / -1;
  margin-bottom: 14px;
}

.rc-quick-client summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  color: var(--rocam-blue-text);
  font-weight: 600;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}

.filters .rc-field,
.filters .grow {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: box-shadow var(--duration-base) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.subnav a[aria-current="page"] {
  color: var(--text);
  background: var(--badge-blue-bg);
  border-color: rgba(37, 74, 159, 0.55);
  box-shadow: var(--shadow-glow-blue);
}

.rc-defs,
fieldset.card .checks,
.checks {
  display: grid;
  gap: 8px 16px;
}

.rc-defs {
  grid-template-columns: minmax(120px, 180px) 1fr;
  margin: 8px 0 4px;
  font-size: var(--text-sm);
}

.rc-defs > div {
  display: contents;
}

.rc-defs dt {
  align-self: center;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rc-defs dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

fieldset.card {
  margin: 8px 0 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-glass);
}

fieldset.card legend {
  padding: 0 6px;
  font-family: var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}

.perm-grid {
  display: grid;
  gap: 12px;
}

.perm-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.perm-matrix th,
.perm-matrix td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--table-line);
  text-align: center;
  vertical-align: middle;
}

.perm-matrix th {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.perm-matrix th:first-child,
.perm-matrix td:first-child,
.perm-matrix tbody th {
  text-align: left;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.perm-matrix input {
  width: 16px;
  height: 16px;
  accent-color: var(--rocam-blue);
}

.perm-empty {
  background: transparent;
}

.role-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.role-pick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
}

.role-pick.is-on {
  border-color: rgba(37, 74, 159, 0.55);
  box-shadow: var(--shadow-glow-blue);
}

.role-pick strong {
  display: block;
  font-size: var(--text-sm);
}

.role-pick small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.session-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--table-line);
}

.session-row:last-child {
  border-bottom: 0;
}

.perm-group h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.narrow {
  max-width: 520px;
}

.muted,
.rc-subtle {
  color: var(--text-muted);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.badge-off {
  margin-left: 6px;
}

.empty p {
  color: var(--text-secondary);
}

.rc-login-card .rc-error {
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .form-grid,
  .rc-defs {
    grid-template-columns: 1fr;
  }
}

/* Quotation and tax invoice paper, laid out like the Pastel documents. */
.rc-sheet.rc-sheet-doc {
  width: min(1040px, 100%);
  padding: 28px 28px 24px;
}

.rc-sheet table.rc-commercial {
  font-size: 12px;
}

.rc-sheet table.rc-commercial th {
  background: #e4e4e4;
  color: #222;
  padding: 7px 6px;
  border-bottom: 0;
  letter-spacing: 0.04em;
  text-transform: none;
  font-family: var(--font-body, Helvetica, sans-serif);
}

.rc-pastel-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
}

.rc-ariba-band {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.rc-sheet.rc-pastel h1,
.rc-sheet.rc-pastel h2,
.rc-pastel-title h1,
.rc-ariba-doc h1 {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}

.rc-pastel-title h1,
.rc-pastel-title .rc-docno {
  color: #254a9f;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rc-pastel-title h1 {
  justify-self: start;
}

.rc-pastel-page {
  margin: 0;
  justify-self: center;
  white-space: nowrap;
  font-size: 12px;
  color: #222;
}

.rc-pastel-title .rc-docno {
  justify-self: end;
  margin: 0;
  text-align: right;
}

.rc-sheet.rc-pastel h2 {
  margin: 0 0 4px;
  font-size: 12px;
  color: #222;
}

.rc-sheet-idblock,
.rc-pastel-letter {
  margin: 8px 0 14px;
  font-size: 12px;
  line-height: 1.35;
}

.rc-pastel-letter {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px 16px;
  align-items: start;
}

.rc-sheet img.rc-pastel-logo {
  display: block;
  width: 156px;
  height: auto;
  max-width: 100%;
}

.rc-pastel-address,
.rc-pastel-contact {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rc-pastel-address strong {
  display: block;
  margin-bottom: 2px;
}

.rc-pastel-parties {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 12px 16px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.rc-pastel-parties > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rc-pastel-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.3fr) 88px;
  gap: 3px 12px;
  margin: 8px 0 14px;
  font-size: 12px;
  align-items: start;
}

.rc-pastel-field {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  column-gap: 8px;
  min-width: 0;
  margin: 0;
}

.rc-pastel-field span,
.rc-pastel-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rc-pastel-flag {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.rc-pastel-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-top: 28px;
}

.rc-pastel-foot .rc-totals,
.rc-ariba-doc .rc-totals {
  margin-top: 0;
}

.rc-sheet.rc-pastel .rc-totals .grand,
.rc-sheet.rc-ariba-doc .rc-totals .grand {
  font-family: var(--font-body, Helvetica, sans-serif);
  font-size: 13px;
  letter-spacing: 0;
  border-top: 1px solid #222;
  font-weight: 700;
}

.rc-sheet tr.rc-heading td {
  font-weight: 700;
  border-bottom: 0;
  padding-top: 12px;
}

.rc-ariba-addresses {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px 16px;
  margin: 12px 0;
  font-size: 12px;
  line-height: 1.4;
}

.rc-ariba-addresses h2 {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rc-pastel-parties p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 3px;
}

.rc-ariba-band {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #f3f3f3;
  font-size: 12px;
}

.rc-ariba-band p {
  margin: 0;
}

.rc-sheet table.rc-commercial td {
  padding: 8px 6px;
}

.rc-sheet .rc-ariba {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #f4f7fc;
  border-left: 3px solid #254a9f;
  font-size: 13px;
}

.rc-sheet .rc-ariba h2 {
  margin-bottom: 4px;
}

.rc-sheet .rc-ariba p {
  margin: 0;
}

.rc-proof {
  width: min(880px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.rc-proof-art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}

.rc-proof-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 16px;
}

.rc-tabs-scroll {
  position: relative;
}

.rc-tabs {
  scrollbar-width: thin;
}

.rc-install {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 16px;
  background: rgba(37, 74, 159, 0.18);
  border-bottom: 1px solid rgba(37, 74, 159, 0.45);
  box-shadow: inset 0 -1px 0 rgba(237, 28, 36, 0.45);
}

.rc-install[hidden],
.rc-install [hidden] {
  display: none !important;
}

.rc-install p {
  margin: 0;
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text);
}

.rc-install strong {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rc-remember-help {
  margin: -6px 0 14px;
}

.rc-login .rc-check {
  min-height: 44px;
  margin-bottom: 2px;
}

.rc-login .rc-check input {
  width: 22px;
  height: 22px;
}

body.rc-install-open .rc-login {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

body:not(:has(.rc-app)) .rc-install:not([hidden]) {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

@media (max-width: 980px) {
  .rc-chrome {
    padding-top: env(safe-area-inset-top);
  }

  .rc-tabs {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-padding-inline: 12px;
  }

  .rc-tabs::-webkit-scrollbar {
    display: none;
  }

  .rc-tab {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .rc-tabs-scroll::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--header));
  }

  .rc-main {
    padding-bottom: calc(var(--space-16) + env(safe-area-inset-bottom));
  }
}

.rc-status-jump {
  display: none;
}

@media (max-width: 720px) {
  .rc-brand {
    min-width: 0;
    max-width: calc(100% - 132px);
  }

  .rc-brand img {
    height: 36px;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
  }

  .rc-header-actions {
    gap: 8px;
  }

  .rc-tab {
    padding: 12px 12px 14px;
    letter-spacing: 0.08em;
  }

  .rc-account-panel {
    right: 0;
    max-width: min(280px, calc(100vw - 24px));
  }

  .rc-input,
  .rc-select,
  .rc-textarea,
  .rc-search input {
    font-size: 16px;
  }

  .rc-sheet.rc-sheet-doc {
    padding: 16px 12px;
  }

  .rc-filters {
    display: none;
  }

  .rc-status-jump {
    display: flex;
    align-items: end;
    gap: 8px;
    margin-bottom: var(--space-4);
  }

  .rc-status-jump .rc-field {
    margin: 0;
  }

  .rc-ariba-band,
  .rc-pastel-letter {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rc-pastel-title {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .rc-install {
    flex-wrap: wrap;
  }

  .rc-install .rc-btn {
    min-height: 44px;
  }
}

.rc-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 16px;
}

.rc-chain-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 8rem;
  padding: 8px 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.rc-chain-step a {
  font-weight: 600;
}

.rc-chain-sep {
  align-self: center;
  color: var(--rocam-red);
  font-weight: 700;
}

.rc-waiting {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rc-waiting li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--table-line);
}

.rc-waiting a {
  font-weight: 600;
}

.rc-waiting li.is-overdue,
tr.is-overdue td {
  background: rgba(237, 28, 36, 0.16);
}

.rc-overdue {
  color: var(--rocam-red-text);
}

.rc-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: var(--space-4);
}

.rc-grace {
  margin: 0;
  padding: 12px 16px;
  background: rgba(37, 74, 159, 0.16);
  border-bottom: 1px solid rgba(37, 74, 159, 0.45);
  color: var(--text);
}

.rc-grace a {
  color: inherit;
  font-weight: 600;
}

.perm-finish {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
  line-height: 1.3;
  max-width: 9rem;
}

@media screen and (max-width: 720px) {
  .rc-sheet.rc-sheet-doc {
    overflow-x: visible;
    min-width: 0;
    max-width: 100%;
  }

  .rc-pastel-parties,
  .rc-pastel-fields,
  .rc-ariba-addresses {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .rc-pastel-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .rc-pastel-foot .rc-totals,
  .rc-line-foot .rc-totals {
    width: min(240px, 100%);
    margin-left: auto;
  }

  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) thead {
    display: none;
  }

  table.rc-commercial:not(.rc-line-grid):has(td[data-label]),
  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) tbody,
  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) tr,
  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) td {
    display: block;
    width: 100%;
  }

  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--table-line);
  }

  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    text-align: right;
    border: 0;
  }

  table.rc-commercial:not(.rc-line-grid):has(td[data-label]) td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
  }
}

@media print {
  table.rc-commercial,
  table.rc-commercial thead,
  table.rc-commercial tbody,
  table.rc-commercial tr,
  table.rc-commercial td {
    display: revert;
  }
}

/* Pastel-style line grid. One row per line. The scroller, not the page, moves sideways. */
.stack,
.rc-card,
.rc-line-editor,
.rc-sheet.rc-sheet-doc {
  min-width: 0;
}

.stack > * {
  min-width: 0;
  max-width: 100%;
}

.rc-line-editor {
  max-width: 100%;
}

.rc-line-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.rc-line-grid,
.rc-sheet table.rc-line-grid,
.rc-line-scroll table.rc-line-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.rc-line-editor .rc-line-grid th,
.rc-line-editor .rc-line-grid td,
.rc-line-scroll .rc-line-grid th,
.rc-line-scroll .rc-line-grid td {
  white-space: nowrap;
  vertical-align: middle;
}

.rc-line-editor .rc-line-grid th,
.rc-line-editor .rc-line-grid td {
  padding: 8px 4px;
}

.rc-line-grid .rc-line-desc {
  position: sticky;
  left: 0;
  z-index: 2;
  white-space: normal;
  background: var(--surface-solid);
  box-shadow: 8px 0 10px -10px rgba(0, 0, 0, 0.55);
}

.rc-line-grid thead .rc-line-desc {
  z-index: 3;
}

.rc-sheet .rc-line-grid .rc-line-desc {
  background: #fff;
  min-width: 12rem;
  max-width: 22rem;
}

.rc-sheet .rc-line-grid thead .rc-line-desc {
  background: #e4e4e4;
}

.rc-sheet .rc-line-grid th,
.rc-sheet .rc-line-grid td {
  white-space: nowrap;
}

.rc-sheet .rc-line-grid th.rc-line-desc,
.rc-sheet .rc-line-grid td.rc-line-desc {
  white-space: normal;
}

/* Pastel document grid fits the page. Headers stay whole; descriptions wrap inside their cell. */
.rc-pastel .rc-line-scroll {
  overflow: visible;
}

.rc-pastel table.rc-pastel-grid {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.rc-pastel col.rc-c-code { width: 10%; }
.rc-pastel col.rc-c-desc { width: 30%; }
.rc-pastel col.rc-c-qty { width: 7%; }
.rc-pastel col.rc-c-unit { width: 7%; }
.rc-pastel col.rc-c-price { width: 13%; }
.rc-pastel col.rc-c-disc { width: 8%; }
.rc-pastel col.rc-c-tax { width: 12%; }
.rc-pastel col.rc-c-nett { width: 13%; }

.rc-pastel .rc-pastel-grid th {
  font-size: 10px;
  letter-spacing: 0;
  white-space: nowrap;
}

.rc-pastel .rc-pastel-grid .rc-line-desc {
  position: static;
  z-index: auto;
  min-width: 0;
  max-width: none;
  box-shadow: none;
  overflow: visible;
  overflow-wrap: anywhere;
}

.rc-print-sheet {
  width: min(210mm, calc(100% - 24px));
  margin: 16px auto 32px;
}

.rc-print-sheet .rc-sheet.rc-sheet-doc {
  width: 100%;
  min-height: 297mm;
  margin: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.rc-line-grid .rc-num,
.rc-line-grid th.num,
.rc-line-grid td.num {
  text-align: right;
}

.rc-line-grid td.rc-num .rc-input,
.rc-line-grid td.num .rc-input {
  text-align: right;
}

.rc-line-grid .rc-input,
.rc-line-grid .rc-select {
  width: 6.5rem;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
}

.rc-line-grid .rc-col-code .rc-input { width: 5.5rem; }
.rc-line-grid .rc-col-item .rc-select { width: 7.5rem; }
.rc-line-grid .rc-col-desc .rc-input { width: 10.5rem; }
.rc-line-grid .rc-col-cat .rc-select { width: 7.2rem; }
.rc-line-grid .rc-col-qty .rc-input { width: 3.8rem; }
.rc-line-grid .rc-col-unit .rc-input { width: 3.4rem; }
.rc-line-grid .rc-col-price .rc-input { width: 6.4rem; }
.rc-line-grid .rc-col-disc .rc-input { width: 3.8rem; }
.rc-line-grid .rc-col-tax .rc-select { width: 6.8rem; }
.rc-line-grid .rc-col-money { min-width: 5.8rem; }
.rc-line-grid .rc-col-cost .rc-input { width: 5.6rem; }

.rc-line-grid .rc-line-desc {
  min-width: 10.5rem;
  max-width: 16rem;
}

.rc-line-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 10px 14px 14px;
}

.rc-line-foot .rc-subtle {
  margin: 0;
  max-width: 36rem;
}

.rc-line-foot .rc-totals {
  flex: 0 0 auto;
  margin-top: 0;
  margin-left: auto;
}

.rc-table tbody tr:hover .rc-line-desc {
  background: var(--surface-solid);
}

@media screen and (max-width: 720px) {
  .rc-line-editor .rc-line-grid th,
  .rc-line-editor .rc-line-grid td {
    padding: 6px 4px;
  }

  .rc-line-grid .rc-input,
  .rc-line-grid .rc-select {
    min-height: 40px;
    padding: 6px 8px;
  }

  .rc-line-grid .rc-col-desc,
  .rc-line-grid .rc-col-desc .rc-input,
  .rc-sheet .rc-line-grid .rc-line-desc {
    min-width: 9.5rem;
    max-width: 12rem;
  }

  .rc-line-foot {
    flex-direction: column;
    align-items: stretch;
  }
}

.rc-doc-actions {
  display: contents;
}

.rc-row-menu {
  position: relative;
  display: inline-block;
}

.rc-row-menu > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
}

.rc-row-menu > summary::-webkit-details-marker {
  display: none;
}

.rc-row-menu[open] > summary {
  border-color: var(--text);
}

.rc-row-menu-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 180px;
  margin-top: 6px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.rc-row-menu-panel a,
.rc-row-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.rc-row-menu-panel a:hover,
.rc-row-menu-panel button:hover {
  background: var(--surface);
}

.rc-print-body {
  margin: 0;
  background: #d5d5d5;
  color: #222;
}

.rc-print-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: #1b1b1b;
}

.rc-print-toolbar .rc-btn {
  color: #fff;
  border-color: #555;
}

.rc-paper {
  width: 210mm;
  min-height: 297mm;
  margin: 16px auto 32px;
  padding: 12mm 12mm 16mm;
  background: #fff;
  color: #222;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.35;
}

.rc-paper-head,
.rc-paper-party,
.rc-paper-foot,
.rc-paper-brand,
.rc-paper-bank {
  display: flex;
  gap: 16px;
}

.rc-paper-head,
.rc-paper-foot {
  justify-content: space-between;
  align-items: flex-start;
}

.rc-paper-brand img {
  height: 42px;
  width: auto;
}

.rc-paper-brand div,
.rc-paper-party,
.rc-paper-bank {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rc-paper-title {
  text-align: right;
}

.rc-paper-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rc-paper-title p,
.rc-paper-date {
  margin: 4px 0 0;
}

.rc-paper-party {
  margin: 16px 0;
  padding: 10px 12px;
  border: 1px solid #cfcfcf;
  max-width: 92mm;
}

.rc-paper-party h2 {
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rc-paper-party p {
  margin: 2px 0;
}

.rc-paper-party p span {
  color: #555;
}

.rc-paper-grid {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.rc-paper-grid th,
.rc-paper-grid td {
  border: 1px solid #cfcfcf;
  padding: 4px 6px;
  vertical-align: top;
}

.rc-paper-grid th {
  background: #ececec;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
}

.rc-paper-grid .num,
.rc-paper-grid th.num {
  text-align: right;
  white-space: nowrap;
}

.rc-paper-grid tr.is-bold td {
  font-weight: 700;
}

.rc-paper-grid thead {
  display: table-header-group;
}

.rc-paper-running th {
  background: #fff;
  border: 0;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
  font-size: 10px;
  color: #444;
  padding-bottom: 8px;
}

.rc-paper-foot {
  margin-top: 16px;
}

.rc-paper-totals {
  min-width: 180px;
  margin-left: auto;
}

.rc-paper-totals div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 3px 0;
  border-bottom: 1px solid #e4e4e4;
}

.rc-paper-totals .grand {
  font-weight: 700;
  font-size: 13px;
  border-bottom: 0;
}

.rc-paper-bank,
.rc-remittance {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #888;
}

.rc-remittance h2 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media print {
  .rc-chrome,
  .rc-header,
  .rc-tabs-scroll,
  .rc-toasts,
  .rc-grace,
  .skip,
  .rc-print-toolbar,
  .rc-row-menu {
    display: none !important;
  }

  .rc-print-body,
  .rc-body {
    background: #fff;
  }

  .rc-paper {
    box-shadow: none;
    margin: 0;
    width: auto;
    min-height: 0;
    padding: 0;
  }

  .rc-paper-grid thead {
    display: table-header-group;
  }

  .rc-paper,
  .rc-paper-grid tr {
    break-inside: avoid;
  }

  .rc-print-sheet {
    width: auto;
    margin: 0;
  }

  .rc-print-sheet .rc-sheet.rc-sheet-doc,
  .rc-sheet.rc-sheet-doc {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .rc-pastel-title {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  }

  .rc-pastel-letter {
    display: grid !important;
    grid-template-columns: 42mm minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  .rc-pastel-parties {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.9fr) !important;
  }

  .rc-pastel-fields {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.3fr) 22mm !important;
  }

  .rc-pastel .rc-line-scroll,
  .rc-pastel table.rc-pastel-grid {
    overflow: visible !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  @page {
    size: A4;
    margin: 12mm;
  }
}
