@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  --bg: #060915;
  --bg-alt: #0c1120;
  --panel: rgba(17, 24, 39, 0.88);
  --panel-strong: rgba(12, 17, 32, 0.96);
  --panel-soft: rgba(148, 163, 184, 0.08);
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e5edf8;
  --muted: #97a5bc;
  --accent: #14b8a6;
  --accent-soft: rgba(20, 184, 166, 0.18);
  --accent-strong: #0f766e;
  --warning: #f59e0b;
  --danger: #fb7185;
  --success: #22c55e;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: min(1940px, calc(100vw - 24px));
  --body-size: 16px;
  --shell-gap: 20px;
  --shell-padding-y: 20px;
  --sidebar-width: 290px;
  --sidebar-padding: 20px;
  --workspace-padding: 18px;
  --panel-padding: 20px;
  --hero-padding: 28px;
  --card-padding: 18px;
  --card-gap: 14px;
  --section-gap: 20px;
  --topbar-padding-y: 14px;
  --topbar-padding-x: 16px;
  --sidebar-top: 20px;
  --sidebar-max-height: calc(100vh - 40px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: var(--body-size);
  background:
    radial-gradient(circle at 14% 16%, rgba(20, 184, 166, 0.12), transparent 22%),
    radial-gradient(circle at 88% 20%, rgba(245, 158, 11, 0.09), transparent 18%),
    linear-gradient(180deg, #040712 0%, #070b15 38%, #080d19 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

img,
iframe {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

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

code {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #c4f1ec;
  font-size: 0.92em;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  width: 34vw;
  height: 34vw;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}

.ambient-left {
  top: 8vh;
  left: -12vw;
  background: rgba(20, 184, 166, 0.18);
}

.ambient-right {
  right: -10vw;
  bottom: 4vh;
  background: rgba(245, 158, 11, 0.14);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(9, 14, 26, 0.94);
  box-shadow: var(--shadow);
  color: var(--text);
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.3);
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.35);
}

.login-shell,
.app-shell {
  position: relative;
  z-index: 1;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  gap: 28px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(10, 16, 29, 0.96), rgba(7, 11, 21, 0.94));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-brand,
.login-form {
  padding: 18px;
  border-radius: 22px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  background:
    linear-gradient(145deg, rgba(20, 184, 166, 0.12), transparent 48%),
    linear-gradient(180deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.03));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.login-brand h1,
.sidebar-brand h2,
.topbar h3,
.hero-copy h1,
.panel h2,
.modal-header h3,
.items-header h4 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  letter-spacing: -0.04em;
}

.login-brand h1 {
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.98;
  max-width: 10ch;
}

.login-copy,
.hero-text,
.filter-hint span,
.empty-copy,
.muted {
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(11, 16, 28, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.credential-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.94rem;
}

.app-shell {
  width: var(--container);
  margin: 0 auto;
  padding: var(--shell-padding-y) 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--shell-gap);
  min-height: 100vh;
}

.sidebar,
.workspace,
.panel,
.modal-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: 28px;
  padding: var(--sidebar-padding);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: var(--sidebar-top);
  max-height: var(--sidebar-max-height);
}

.eyebrow {
  margin: 0 0 10px;
  color: #9fb0ca;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.sidebar-brand h2 {
  font-size: 1.65rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-button,
.secondary-link {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-button span,
.secondary-link {
  font-weight: 600;
}

.nav-button small,
.sidebar-note {
  color: var(--muted);
}

.nav-button:hover,
.secondary-link:hover,
.nav-button.is-active,
.secondary-link.is-active {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.34);
  background: rgba(20, 184, 166, 0.12);
}

.sidebar-footer {
  margin-top: auto;
}

.workspace {
  border-radius: 32px;
  padding: var(--workspace-padding);
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: var(--topbar-padding-y) var(--topbar-padding-x);
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(6, 10, 20, 0.62);
  backdrop-filter: blur(12px);
}

.topbar h3 {
  font-size: 1.5rem;
}

.topbar-actions,
.hero-actions,
.quick-actions,
.table-actions,
.card-actions,
.modal-actions,
.modal-header-actions,
.items-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view-root {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 420px);
  gap: var(--section-gap);
}

.hero-copy,
.hero-glass,
.panel,
.quick-card,
.stat-card,
.company-card,
.items-panel {
  border-radius: var(--radius-lg);
}

.hero-copy {
  padding: var(--hero-padding);
  background:
    linear-gradient(140deg, rgba(20, 184, 166, 0.15), transparent 42%),
    linear-gradient(180deg, rgba(11, 16, 28, 0.98), rgba(8, 13, 24, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin-bottom: 14px;
}

.hero-text {
  max-width: 60ch;
  line-height: 1.7;
}

.hero-glass {
  padding: var(--card-padding);
  display: grid;
  gap: var(--card-gap);
  background:
    linear-gradient(180deg, rgba(245, 158, 11, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(12, 17, 32, 0.96), rgba(8, 13, 24, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.stat-card,
.quick-card,
.company-card {
  padding: var(--card-padding);
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.stat-label {
  margin: 0 0 8px;
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--section-gap);
}

.content-grid.wide {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.panel {
  padding: var(--panel-padding);
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 1.65rem;
}

.quick-grid,
.company-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--card-gap);
}

.quick-card h3,
.company-title {
  margin: 0 0 8px;
  font-family: "Manrope", sans-serif;
}

.quick-card-acts h3 {
  font-size: 1.08rem;
  line-height: 1.2;
  max-width: 11ch;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.activity-item p,
.activity-item span,
.activity-item time,
.company-meta,
.filter-hint p {
  margin: 0;
}

.activity-item span,
.activity-item time {
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

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

.field span {
  color: #c7d3e7;
  font-size: 0.92rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(7, 11, 21, 0.82);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(20, 184, 166, 0.5);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.search-field {
  flex: 1;
}

.documents-layout {
  display: grid;
  gap: 18px;
}

.documents-filter-panel,
.documents-table-panel {
  width: 100%;
}

.documents-filters-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  align-items: end;
}

.documents-filters-grid.is-invoices {
  grid-template-columns: minmax(280px, 1.5fr) repeat(4, minmax(180px, 1fr));
}

.documents-search-field {
  min-width: 0;
}

.filter-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-hint {
  padding: 14px;
  border-radius: 16px;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.18);
}

.filter-hint p {
  margin-bottom: 8px;
}

.data-table-wrap,
.items-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.data-table,
.items-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1280px;
}

.data-table th,
.data-table td,
.items-table th,
.items-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  border-right: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: top;
  text-align: left;
}

.data-table th:last-child,
.data-table td:last-child,
.items-table th:last-child,
.items-table td:last-child {
  border-right: none;
}

.data-table th,
.items-table th {
  position: sticky;
  top: 0;
  background: rgba(10, 16, 29, 0.98);
  color: #c1d0e6;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 1;
}

.data-table tbody tr:hover,
.items-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.05);
}

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

.company-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.company-card > div span,
.company-meta {
  color: var(--muted);
}

.company-meta {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

#pdf-modal {
  z-index: 90;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, 0.76);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  margin: 28px auto;
  border-radius: 28px;
  padding: 22px;
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.modal-card-wide {
  width: min(1420px, calc(100vw - 24px));
}

.pdf-card {
  padding-bottom: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-form,
.document-form,
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-sections {
  display: grid;
  gap: 18px;
}

.settings-section {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(7, 11, 21, 0.92));
}

.settings-section-copy {
  display: grid;
  gap: 6px;
}

.settings-section h3 {
  margin: 0;
  font-size: 1.08rem;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.form-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full-span {
  grid-column: 1 / -1;
}

.items-panel {
  padding: 18px;
  background: rgba(148, 163, 184, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

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

.items-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.64);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #c7d3e7;
}

.deal-bundle-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.deal-bundle-panel h4 {
  margin: 4px 0 0;
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
}

.deal-bundle-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drag-cell {
  min-width: 96px;
  white-space: nowrap;
}

.drag-handle {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text);
  cursor: grab;
}

.drag-handle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drag-handle:active {
  cursor: grabbing;
}

.item-order-stack {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.sort-order-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(7, 11, 21, 0.55);
  color: var(--text);
  font: inherit;
  text-align: center;
}

.documents-table {
  min-width: 1010px;
  table-layout: fixed;
}

.documents-table th,
.documents-table td {
  padding: 12px 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.documents-table .doc-col-pdf {
  width: 72px;
  text-align: center;
}

.documents-table .doc-col-number {
  width: 126px;
}

.documents-table .doc-col-kind {
  width: 120px;
}

.documents-table .doc-col-pr {
  width: 78px;
  font-weight: 700;
}

.pr-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #7dd3fc;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pr-link-button:hover {
  color: #bef264;
}

.documents-table .doc-col-company {
  width: 165px;
  min-width: 165px;
}

.documents-table .doc-col-order {
  width: 110px;
}

.documents-table .doc-col-currency {
  width: 72px;
  text-align: center;
}

.documents-table .doc-col-valid,
.documents-table .doc-col-delivery {
  width: 108px;
}

.documents-table .doc-col-actions {
  width: 240px;
  min-width: 240px;
}

.documents-table .table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.documents-table .tiny-button {
  width: 100%;
  justify-content: center;
  min-height: 34px;
  padding: 8px 10px;
  font-size: 0.76rem;
}

.item-product-col,
.item-product-cell {
  min-width: 420px;
}

.item-unit-col,
.item-unit-cell {
  width: 120px;
}

.item-qty-col,
.item-price-col,
.item-total-col,
.item-qty-cell,
.item-price-cell,
.item-total-cell {
  width: 150px;
}

.item-index-col,
.item-delete-col,
.item-delete-cell {
  width: 120px;
}

.item-product-area {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(7, 11, 21, 0.55);
  color: var(--text);
  resize: none;
  overflow: hidden;
  line-height: 1.45;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-panel div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.16);
}

.summary-panel span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.summary-panel strong {
  font-family: "Manrope", sans-serif;
  font-size: 1.1rem;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding-top: 16px;
  background: linear-gradient(180deg, rgba(7, 11, 21, 0), rgba(7, 11, 21, 0.92) 32%);
}

.primary-button,
.ghost-button,
.small-button,
.tiny-button,
.icon-button {
  border: none;
  border-radius: 14px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button,
.small-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
}

.primary-button {
  min-height: 48px;
  padding: 12px 18px;
}

.wide {
  width: 100%;
}

.ghost-button,
.tiny-button.secondary,
.small-button.secondary,
.icon-button,
.danger-outline {
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text);
}

.small-button,
.tiny-button {
  min-height: 38px;
  padding: 10px 14px;
}

.tiny-button {
  font-size: 0.84rem;
}

.danger,
.danger-outline {
  color: #ffd3dc;
  border-color: rgba(251, 113, 133, 0.22);
}

.danger {
  background: rgba(251, 113, 133, 0.14);
}

.icon-button {
  width: 42px;
  height: 42px;
  font-size: 1.45rem;
  line-height: 1;
}

.primary-button:hover,
.ghost-button:hover,
.small-button:hover,
.tiny-button:hover,
.icon-button:hover,
.nav-button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.pdf-frame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background: white;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.inline-link {
  color: #7dd3fc;
}

.empty-state.compact {
  padding: 18px 0;
  text-align: center;
  color: var(--muted);
}

.is-dragging {
  opacity: 0.5;
}

.is-drop-target {
  outline: 2px dashed rgba(20, 184, 166, 0.4);
}

.pr-sheet-panel {
  gap: 18px;
}

.pr-sheet-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(280px, 1.15fr) minmax(220px, 0.7fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.pr-sheet-search-field input {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.pr-legend-title-input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  background: rgba(7, 11, 21, 0.72);
  color: var(--text);
}

.pr-legend-title-input {
  min-height: 56px;
  padding: 14px 18px;
  line-height: 1.5;
}

.pr-sheet-legend-top {
  display: grid;
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(248, 250, 252, 0.96);
}

.pr-sheet-legend-head {
  display: grid;
  gap: 10px;
}

.pr-sheet-description-copy {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.07);
  color: #475569;
  line-height: 1.5;
}

.pr-sheet-selection {
  min-height: 84px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.12), transparent 52%),
    rgba(10, 16, 29, 0.92);
}

.pr-sheet-selection span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pr-sheet-selection strong {
  font-family: "Manrope", sans-serif;
  font-size: 1.12rem;
}

.pr-sheet-stage {
  display: block;
}

.pr-sheet-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(248, 250, 252, 0.96);
}

.pr-sheet-table {
  width: 100%;
  min-width: 1030px;
  border-collapse: collapse;
  table-layout: fixed;
  color: #111827;
  font-size: 0.85rem;
}

.pr-sheet-table th,
.pr-sheet-table td {
  border: 1px solid rgba(15, 23, 42, 0.22);
  padding: 0;
  vertical-align: top;
}

.pr-sheet-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: #f8fafc;
  color: #374151;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  text-align: left;
  vertical-align: top;
  position: sticky;
}

.pr-header-input {
  width: 100%;
  min-height: 56px;
  border: none;
  background: transparent;
  padding: 10px 8px;
  resize: none;
  overflow: hidden;
  text-align: left;
  font-weight: 700;
  color: #374151;
  outline: none;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pr-column-resize {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  border: none;
  background: transparent;
  cursor: col-resize;
  padding: 0;
}

.pr-column-resize::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.7);
}

.pr-col-pr {
  width: 80px;
}

.pr-col-po {
  width: 56px;
}

.pr-col-supplier {
  width: 128px;
}

.pr-col-amount {
  width: 96px;
}

.pr-col-alfa_payment_day,
.pr-col-azala_payment,
.pr-col-followup_deadline,
.pr-col-contract {
  width: 96px;
}

.pr-col-alfa_status {
  width: 140px;
}

.pr-col-azal_status {
  width: 118px;
}

.pr-col-employee {
  width: 70px;
}

.pr-legend-list {
  display: grid;
  gap: 10px;
}

.pr-legend-list-inline {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.pr-legend-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.pr-legend-tone,
.pr-legend-input {
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  color: #111827;
}

.pr-legend-tone {
  padding: 0 8px;
}

.pr-legend-input {
  width: 100%;
  padding: 8px 10px;
}

.pr-sheet-table tbody tr {
  transition: box-shadow 140ms ease, transform 140ms ease;
}

.pr-sheet-table tbody tr.is-selected {
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.3);
}

.pr-sheet-table tbody tr:hover {
  transform: translateY(-1px);
}

.pr-sheet-table tbody tr.is-hidden-search {
  display: none;
}

.pr-cell-input {
  width: 100%;
  min-height: 40px;
  padding: 7px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  outline: none;
  line-height: 1.3;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  text-align: left;
  box-shadow: none;
}

.pr-cell-input.is-bold {
  font-weight: 700;
}

.pr-cell-input.is-numeric {
  font-variant-numeric: tabular-nums;
}

.pr-cell-area {
  resize: none;
  overflow: hidden;
}

.pr-pr-cell {
  display: grid;
  gap: 4px;
}

.pr-open-pdf-button {
  margin: 0 8px 8px;
  min-height: 30px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.pr-open-pdf-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.structured-field {
  gap: 10px;
}

.structured-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.structured-slot {
  min-width: 0;
}

.field-help {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.pr-cell-input,
.pr-cell-area,
.pr-header-input,
.pr-legend-title-input,
.pr-legend-input {
  font: inherit;
}

.pr-cell-input:focus {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(13, 148, 136, 0.34);
}

.pr-header-input:focus,
.pr-legend-title-input:focus,
.pr-legend-input:focus {
  box-shadow: inset 0 0 0 2px rgba(20, 184, 166, 0.26);
}

.pr-tone-none {
  background: #ffffff;
}

.pr-tone-green {
  background: #16c25f;
}

.pr-tone-yellow {
  background: #fff200;
}

.pr-tone-red {
  background: #f21d1d;
  color: #fff6f6;
}

.pr-tone-gray {
  background: #d9d9d9;
}

.pr-tone-blue {
  background: #27b0e8;
}

.pr-tone-red .pr-cell-input,
.pr-tone-green .pr-cell-input,
.pr-tone-gray .pr-cell-input,
.pr-tone-yellow .pr-cell-input,
.pr-tone-blue .pr-cell-input,
.pr-tone-none .pr-cell-input {
  color: #111827;
}

.app-shell.is-pr-control-mode {
  width: calc(100vw - 16px);
  max-width: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 8px 0;
}

.app-shell.is-pr-control-mode .sidebar,
.app-shell.is-pr-control-mode .topbar {
  display: none;
}

.app-shell.is-pr-control-mode .workspace {
  padding: 0;
  border-radius: 22px;
  background: rgba(8, 13, 24, 0.98);
}

.app-shell.is-pr-control-mode .view-root {
  gap: 0;
}

.pr-control-view {
  min-height: calc(100vh - 16px);
  padding: 16px;
  color: var(--text);
}

.pr-control-header,
.pr-control-searchbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.pr-control-header {
  position: relative;
  padding-right: 52px;
  margin-bottom: 14px;
}

.pr-control-header h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(1.7rem, 2.5vw, 2.45rem);
  letter-spacing: -0.045em;
}

.pr-control-header p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--muted);
}

.pr-control-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pr-control-close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid rgba(248, 113, 113, 0.38);
  border-radius: 13px;
  background: rgba(127, 29, 29, 0.2);
  color: #fecaca;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.pr-control-close:hover {
  border-color: rgba(248, 113, 113, 0.68);
  background: rgba(153, 27, 27, 0.34);
}

.pr-control-searchbar {
  align-items: stretch;
  margin-bottom: 12px;
}

.pr-control-searchbar .field {
  flex: 1 1 520px;
}

.pr-control-searchbar input {
  min-height: 44px;
}

.pr-control-automation-note {
  flex: 0 1 520px;
  display: grid;
  gap: 3px;
  padding: 10px 14px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 14px;
  background: rgba(20, 184, 166, 0.1);
  color: #bdece6;
  font-size: 0.82rem;
}

.pr-control-automation-note span {
  color: var(--muted);
}

.pr-control-table-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: #f8fafc;
}

.pr-control-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  color: #172033;
  font-size: clamp(0.59rem, 0.68vw, 0.76rem);
}

.pr-control-table th,
.pr-control-table td {
  border: 1px solid rgba(71, 85, 105, 0.24);
  vertical-align: middle;
  text-align: center;
  overflow-wrap: anywhere;
}

.pr-control-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 58px;
  padding: 10px 6px;
  background: #101827;
  color: #f8fafc;
  text-align: center;
  line-height: 1.2;
}

.pr-control-table th.is-active-column {
  background: #134e4a;
  color: #f0fdfa;
  box-shadow: inset 0 -3px 0 #2dd4bf;
}

.pr-control-table td.is-active-column {
  box-shadow: inset 2px 0 0 rgba(13, 148, 136, 0.72), inset -2px 0 0 rgba(13, 148, 136, 0.72);
}

.pr-control-table th > span {
  display: block;
}

.pr-control-column-resize {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 4;
  width: 9px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
}

.pr-control-column-resize::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.58);
}

.pr-control-column-resize:hover::after {
  background: #2dd4bf;
}

.pr-control-table td {
  padding: 0;
  line-height: 1.28;
}

.pr-control-table td input,
.pr-control-table td textarea,
.pr-control-table td select,
.pr-control-readonly,
.pr-control-document-link {
  width: 100%;
  min-height: 58px;
  padding: 8px 6px;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: center;
}

.pr-control-table td textarea {
  align-content: center;
}

.pr-control-table td select {
  text-align-last: center;
}

.pr-control-table td input:focus,
.pr-control-table td textarea:focus,
.pr-control-table td select:focus {
  box-shadow: inset 0 0 0 2px rgba(13, 148, 136, 0.58);
  background: rgba(255, 255, 255, 0.62);
}

.pr-control-readonly {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr-control-document-link {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(15, 23, 42, 0.34);
}

.pr-control-pr-cell {
  display: grid;
}

.pr-control-pr-cell input[data-pr-control-field="pr"] {
  min-height: 36px !important;
  font-weight: 700;
}

.pr-control-pr-cell button {
  min-height: 28px;
  margin: 0 5px 6px;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #0f172a;
  font-size: 0.64rem;
  font-weight: 700;
}

.pr-control-pr-cell button span {
  display: inline-grid;
  min-width: 18px;
  min-height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
}

.pr-control-table tr.is-hidden-search {
  display: none;
}

.pr-control-tone-gray td { background: #e5e7eb; }
.pr-control-tone-blue td { background: #dbeafe; }
.pr-control-tone-red td { background: #fee2e2; }
.pr-control-tone-orange td { background: #ffedd5; }
.pr-control-tone-green td { background: #dcfce7; }
.pr-control-tone-gray td:nth-child(16) { background: #d1d5db; }
.pr-control-tone-blue td:nth-child(16) { background: #93c5fd; font-weight: 700; }
.pr-control-tone-red td:nth-child(16) { background: #f87171; font-weight: 700; }
.pr-control-tone-orange td:nth-child(16) { background: #fdba74; font-weight: 700; }
.pr-control-tone-green td:nth-child(16) { background: #86efac; font-weight: 700; }

.pr-control-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pr-control-legend span {
  padding: 8px 10px;
  border-radius: 10px;
  color: #172033;
  font-size: 0.75rem;
}

.pr-deal-card {
  width: min(1500px, calc(100vw - 24px));
}

.pr-deal-help {
  margin: -4px 0 18px;
  color: var(--muted);
}

.pr-deal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pr-deal-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(251, 113, 133, 0.32);
  border-radius: 16px;
  background: rgba(127, 29, 29, 0.12);
}

.pr-deal-danger-zone > div {
  display: grid;
  gap: 4px;
}

.pr-deal-danger-zone strong {
  color: #fecdd3;
}

.pr-deal-danger-zone span {
  color: var(--muted);
  font-size: 0.84rem;
}

.pr-deal-slot {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.pr-deal-slot-head,
.pr-deal-file-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.pr-deal-slot-head span {
  font-family: "Manrope", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.pr-deal-slot-head strong {
  color: #5eead4;
}

.pr-deal-documents {
  display: grid;
  gap: 8px;
}

.pr-deal-file-row {
  align-items: flex-start;
  padding: 9px;
  border-radius: 12px;
  background: rgba(6, 10, 20, 0.6);
}

.pr-deal-file-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #d8e3f2;
  font-size: 0.78rem;
}

.pr-deal-file-row > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.pr-control-upload-form {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.pr-deal-file-picker {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px dashed rgba(94, 234, 212, 0.42);
  border-radius: 12px;
  color: #bdece6;
  cursor: pointer;
}

.pr-deal-file-picker input {
  width: 100%;
  color: var(--muted);
  font-size: 0.76rem;
}

.download-card {
  width: min(560px, calc(100vw - 32px));
}

.download-name-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(148, 163, 184, 0.06);
  cursor: pointer;
}

.download-name-option span {
  display: grid;
  gap: 3px;
}

.download-name-option small {
  color: var(--muted);
}

@media (max-width: 1440px) {
  .pr-control-view { padding: 10px; }
  .pr-control-table { font-size: 0.58rem; }
  .pr-control-table th { padding: 8px 3px; }
  .pr-control-table td input,
  .pr-control-table td textarea,
  .pr-control-table td select,
  .pr-control-readonly,
  .pr-control-document-link { padding: 7px 4px; }
  .pr-deal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .pr-control-header,
  .pr-control-searchbar { align-items: stretch; flex-direction: column; }
  .pr-control-header-actions { justify-content: flex-start; }
  .pr-control-table-wrap { overflow-x: auto; }
  .pr-control-table { min-width: 1180px; }
  .pr-deal-grid { grid-template-columns: 1fr; }
  .pr-deal-danger-zone { align-items: stretch; flex-direction: column; }
}

.primary-button:disabled,
.ghost-button:disabled,
.small-button:disabled,
.tiny-button:disabled,
.icon-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1920px) {
  :root {
    --container: min(1820px, calc(100vw - 24px));
    --body-size: 15px;
    --shell-gap: 18px;
    --shell-padding-y: 16px;
    --sidebar-width: 268px;
    --sidebar-padding: 18px;
    --workspace-padding: 16px;
    --panel-padding: 18px;
    --hero-padding: 24px;
    --card-padding: 16px;
    --card-gap: 12px;
    --section-gap: 18px;
    --topbar-padding-y: 12px;
    --topbar-padding-x: 14px;
    --sidebar-top: 16px;
    --sidebar-max-height: calc(100vh - 32px);
  }

  .topbar h3 {
    font-size: 1.38rem;
  }

  .panel h2,
  .sidebar-brand h2 {
    font-size: 1.5rem;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 3.6vw, 3rem);
  }

  .stat-value {
    font-size: 2.3rem;
  }
}

@media (max-width: 1440px) {
  :root {
    --container: min(1380px, calc(100vw - 20px));
    --body-size: 14px;
    --shell-gap: 16px;
    --shell-padding-y: 12px;
    --sidebar-width: 244px;
    --sidebar-padding: 16px;
    --workspace-padding: 14px;
    --panel-padding: 16px;
    --hero-padding: 20px;
    --card-padding: 14px;
    --card-gap: 10px;
    --section-gap: 16px;
    --topbar-padding-y: 10px;
    --topbar-padding-x: 12px;
    --sidebar-top: 12px;
    --sidebar-max-height: calc(100vh - 24px);
  }

  .topbar h3 {
    font-size: 1.28rem;
  }

  .panel h2,
  .sidebar-brand h2 {
    font-size: 1.36rem;
  }

  .hero-copy h1 {
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  }

  .stat-value {
    font-size: 2rem;
  }

  .nav-button,
  .secondary-link {
    padding: 12px 14px;
  }
}

@media (max-width: 1366px) {
  :root {
    --container: min(1328px, calc(100vw - 16px));
    --body-size: 13.5px;
    --shell-gap: 14px;
    --shell-padding-y: 10px;
    --sidebar-width: 230px;
    --sidebar-padding: 14px;
    --workspace-padding: 12px;
    --panel-padding: 14px;
    --hero-padding: 18px;
    --card-padding: 12px;
    --card-gap: 10px;
    --section-gap: 14px;
    --topbar-padding-y: 9px;
    --topbar-padding-x: 10px;
    --sidebar-top: 10px;
    --sidebar-max-height: calc(100vh - 20px);
  }

  .topbar h3 {
    font-size: 1.18rem;
  }

  .panel h2,
  .sidebar-brand h2 {
    font-size: 1.26rem;
  }

  .hero-copy h1 {
    font-size: clamp(1.7rem, 2.8vw, 2.35rem);
  }

  .stat-value {
    font-size: 1.82rem;
  }
}

@media (max-width: 1440px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

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

  .content-grid.wide,
  .hero-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .pr-sheet-stage {
    display: block;
  }
}

@media (max-width: 980px) {
  .login-card,
  .quick-grid,
  .company-grid,
  .form-grid.two-col,
  .form-grid.three-col,
  .summary-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .modal-header,
  .items-header {
    flex-direction: column;
  }

  .topbar-actions,
  .hero-actions,
  .modal-actions {
    width: 100%;
  }

  .topbar-actions > *,
  .hero-actions > *,
  .modal-actions > * {
    flex: 1 1 180px;
  }

  .pr-sheet-toolbar {
    grid-template-columns: 1fr;
  }

  .pr-legend-item {
    grid-template-columns: 1fr;
  }

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

  .documents-filters-grid,
  .documents-filters-grid.is-invoices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --container: min(100vw - 16px, 1600px);
  }

  .login-shell {
    padding: 14px;
  }

  .login-card,
  .workspace,
  .panel,
  .sidebar,
  .modal-card {
    border-radius: 22px;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .topbar h3 {
    font-size: 1.2rem;
  }
}
