/* Source: templates/base.html */
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --warn: #b45309;
  --error: #dc2626
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--text)
}

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

.app {
  display: grid;
  grid-template-columns: 110px 1fr;
  height: 100vh
}

/* Removed conflicting media query - sidebar visibility handled at 1024px breakpoint */

.sidebar {
  background: #193352;
  color: #e2e8f0;
  position: relative;
  z-index: 650
}

.sidebar-inner {
  min-height: 100%
}

.sidebar-scroll {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin: 8px 8px 18px
}

.brand svg {
  flex: 0 0 auto
}

.brand .title {
  line-height: 1
}

.menu {
  flex: 1
}

.menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd5e1
}

.menu a:hover {
  background: #111827;
  color: #fff
}

.menu a.active {
  background: var(--accent);
  color: #fff
}

.subnav {
  margin-top: 12px;
  border-top: 1px solid #1f2937;
  padding-top: 12px
}

.subnav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #cbd5e1
}

.subnav a img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1)
}

.subnav a svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px
}

.subnav a:hover {
  background: #111827;
  color: #fff
}

.subnav a.active {
  background: var(--accent);
  color: #fff
}

.sidebar-footer {
  border-top: 1px solid #1f2937;
  margin-top: 12px;
  padding-top: 12px
}

.account-dropdown {
  position: relative;
  margin-top: 4px;
  z-index: 680
}

.account-button {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: #0f1f38;
  border: 1px solid #1f2937;
  color: #e2e8f0;
  cursor: pointer;
  gap: 12px;
  font: inherit;
  font-weight: 600
}

.account-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.account-button .account-avatar {
  flex: 0 0 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border-radius: 50%;
  padding: 6px
}

.account-button .account-avatar svg {
  width: 100%;
  height: 100%;
  color: #94a3b8
}

.account-button .account-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  align-items: center
}

.account-button .account-label>span {
  font-size: .875rem;
  font-weight: 600;
  color: #e2e8f0;
  width: 100%;
  text-align: center
}

.account-button .account-label small {
  color: #94a3b8;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.3;
  width: 100%;
  text-align: center
}

.account-button .account-label .usage-info {
  display: inline-block;
  padding: 2px 8px;
  margin-top: 2px;
  border-radius: 12px;
  background: #22c55e;
  color: #fff;
  font-size: .7rem;
  font-weight: 600
}

.account-button .account-label .usage-info--ok {
  background: #22c55e
}

.account-button .account-label .usage-info--warn {
  background: #fbbf24
}

.account-button .account-label .usage-info--limit {
  background: #dc2626
}

.account-button>svg {
  flex: 0 0 16px;
  transition: transform .2s ease
}

.account-button[aria-expanded="true"]>svg {
  transform: rotate(180deg)
}

.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  padding: 6px;
  background: #0b1629;
  border: 1px solid #1f2937;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(2, 6, 23, .55);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 700
}

.account-menu[hidden] {
  display: none
}

.account-menu button,
.account-menu a {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font: inherit;
  font-size: .9rem;
  cursor: pointer
}

.account-menu button:hover,
.account-menu a:hover {
  background: #111827;
  color: #fff
}

.account-menu button:focus-visible,
.account-menu a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.language-selector {
  position: relative;
  width: 100%;
  padding-right: 6px
}

.language-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font: inherit;
  font-size: .9rem;
  cursor: pointer
}

.language-toggle svg {
  flex: 0 0 14px;
  transition: transform .2s ease
}

.language-toggle[aria-expanded=\"true\"] svg {
  transform: rotate(180deg)
}

.language-options {
  position: fixed;
  top: auto;
  left: auto;
  min-width: 180px;
  padding: 6px;
  background: #0f1f38;
  border: 1px solid #1f2937;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, .65);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 9999
}

.language-options[hidden] {
  display: none
}

.language-choice {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font: inherit;
  font-size: .9rem;
  cursor: pointer
}

.language-choice.active,
.language-choice:hover {
  background: #111827;
  color: #fff
}

.content {
  padding: 20px;
  min-height: 100vh;
  overflow: visible
}

.page-title {
  margin: 0 0 12px;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .06);
  padding: 18px
}

.row {
  display: flex;
  gap: 16px;
  align-items: center
}

.grow {
  flex: 1
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: background .2s, color .2s, opacity .2s
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent
}

.btn:hover {
  filter: brightness(.97)
}

.btn:disabled {
  cursor: not-allowed;
  background: #e2e8f0;
  color: #94a3b8;
  border-color: #e2e8f0;
  filter: none;
  opacity: 1
}

.edit-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  padding: 0
}

.edit-link:hover {
  color: var(--accent);
  text-decoration: underline
}

.alerts {
  margin-bottom: 12px
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 6px 0;
  border: 1px solid;
  transition: opacity .3s ease, max-height .3s ease;
  overflow: hidden
}

.alert.warn {
  background: #fef3c7;
  color: var(--warn);
  border-color: #fde68a
}

.alert.error {
  background: #fee2e2;
  color: var(--error);
  border-color: #fecaca
}

.alert.success {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac
}

.alert.fade-out {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0
}

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top
}

th {
  background: #f1f5f9
}

.muted {
  color: var(--muted)
}

.similarity-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  margin-top: 4px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #0f172a
}

.similarity-badge.high {
  background: #dcfce7;
  color: #15803d
}

.similarity-badge.mid {
  background: #fef3c7;
  color: #b45309
}

.similarity-badge.low {
  background: #fee2e2;
  color: #b91c1c
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  position: relative
}

/* Simple modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50
}

.modal-backdrop.show {
  display: flex
}

.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(2, 6, 23, .25);
  width: 520px;
  max-width: 95vw;
  padding: 16px
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit
}

textarea {
  min-height: 88px;
  resize: vertical
}


/* Source: templates/home.html */
.home-actions {
  margin-bottom: 20px;
  align-items: flex-start
}

.home-actions .muted {
  margin-top: 4px;
  font-size: 0.95rem
}

.processor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(336px, 1fr));
  gap: 18px
}

@media (min-width:1280px) {
  .processor-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr))
  }
}

.processor-card {
  width: 100%;
  min-height: 240px;
  padding: 20px 20px 24px;
  position: relative
}

.processor-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .18)
}

.processor-card__status {
  position: absolute;
  top: 16px;
  left: 20px;
  background: rgba(37, 99, 235, .12);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600
}

.processor-card__title {
  font-size: 1.52rem;
  font-weight: 700;
  margin: 32px 0 12px;
  text-align: center
}

.processor-card__desc {
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 44px;
  margin-bottom: 16px;
  text-align: center
}

.processor-card__meta {
  font-size: 0.95rem;
  margin-bottom: 12px;
  text-align: center
}

.processor-card__meta div {
  margin-bottom: 4px
}

.processor-card__meta-label {
  font-weight: 600
}

.processor-card__last {
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 18px
}

.processor-card__actions {
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center
}

.processor-card__actions .btn {
  flex: 1 1 100%;
  justify-content: center
}

.processor-card__actions.is-archived {
  flex-direction: column;
  font-size: 0.9rem;
  color: var(--muted)
}

.card-menu {
  position: absolute;
  top: 16px;
  right: 16px
}

.card-menu__trigger {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  height: 32px;
  width: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer
}

.card-menu__trigger:hover {
  background: rgba(15, 23, 42, .08);
  color: var(--accent)
}

.card-menu__trigger:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.card-menu__list {
  position: absolute;
  top: 36px;
  right: 0;
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
  border-radius: 10px;
  min-width: 150px;
  padding: 6px 0;
  z-index: 30
}

.card-menu__item {
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text)
}

.card-menu__item:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--accent)
}

.card-menu.is-open .card-menu__list {
  display: flex
}

.processor-card.is-archived {
  opacity: 0.9
}

.processor-card__status--archived {
  background: rgba(148, 163, 184, .28);
  color: #475569
}

#btnArchiveToggle {
  margin-right: 12px
}

#btnArchiveToggle.is-active {
  background: #e0e7ff;
  color: var(--accent);
  border-color: rgba(37, 99, 235, .32)
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px
}

.empty-state.is-hidden {
  display: none !important
}

.empty-state__title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text)
}

.empty-state__subtitle {
  font-size: 0.95rem
}

.modal .form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.alert.success {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border)
}

.btn.ghost:hover {
  color: var(--accent)
}


/* Source: templates/mailbox.html */
/* Importar: dropzone + estados */
.import-header {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  width: 100%;
}

.import-header .import-title {
  display: flex;
  align-items: center;
  text-align: left;
  min-width: 0;
}

.import-header .import-title-heading {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.2;
  color: #0f172a;
}

.import-header .status-strip {
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  min-width: 260px;
  margin-left: auto;
  padding-left: 32px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.status-item {
  flex: 1 1 210px;
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  position: relative;
  transition: box-shadow .15s ease, transform .15s ease;
}

.status-item.is-clickable {
  cursor: pointer;
}

.status-item.is-clickable:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.status-item.is-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status-item .status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
}

.status-item[data-kind="pending"] .status-icon {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.status-item[data-kind="errors"] .status-icon {
  background: rgba(220, 38, 38, 0.12);
  color: var(--error);
}

.status-item[data-kind="processing"] .status-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #0f766e;
}

.status-item .status-icon svg {
  width: 26px;
  height: 26px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.status-label .status-count {
  font-size: 1.2rem;
  font-weight: 700;
}

.status-label .status-text {
  font-size: 1.14rem;
  line-height: 1;
  color: #1e293b;
  font-weight: 500;
}

@media (max-width:900px) {
  .import-header .status-strip {
    flex: 1 1 100%;
  }
}

@media (max-width:720px) {
  .status-item {
    flex: 1 1 100%;
    min-width: 100%;
  }
}

.status-popover {
  position: fixed;
  z-index: 4600;
  min-width: 0;
  max-width: none;
  width: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 16px;
  display: none;
}

.status-popover.show {
  display: block;
}

.status-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.status-popover-title {
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
}

.status-popover-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}

.status-popover-close:hover {
  color: var(--text);
}

.status-popover-body {
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-popover-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.status-popover-item .item-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.status-popover-item .item-name {
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.status-popover-item .item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.status-popover-item .item-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
  font-weight: 600;
}

.status-popover-item .item-count {
  font-weight: 600;
  color: #0f172a;
}

.status-popover-item .item-detail {
  font-size: .9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.status-popover-item .item-action {
  flex-shrink: 0;
  margin-left: auto;
  background: #16a34a;
  color: #fff;
  border: 1px solid #16a34a;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}

.status-popover-item .item-action:hover {
  background: #15803d;
  border-color: #15803d;
}

.status-popover-empty {
  color: var(--muted);
  font-size: .9rem;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 0;
  text-align: center;
  color: #64748b;
  transition: .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone.drag {
  background: #eef2ff;
  border-color: #93c5fd
}

.dropzone .dz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dropzone .dz-title {
  font-weight: 600;
  color: #0f172a;
  transition: opacity .2s ease, visibility .2s ease;
  text-align: center;
}

.dropzone .dz-sub {
  font-size: .9rem;
  transition: opacity .2s ease, visibility .2s ease;
  text-align: center;
}

.dropzone.has-files {
  padding: 16px 26px 26px;
  text-align: left;
}

.dropzone.has-files .dz-title,
.dropzone.has-files .dz-sub {
  opacity: 0;
  visibility: hidden;
}

.dropzone .dz-selected {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
  max-height: none;
}

.dropzone .dz-selected.has-files {
  display: block;
}

.dropzone .dz-selected li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: .9rem;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}

.dropzone .dz-selected li:first-child {
  margin-top: 0;
}

.dropzone .dz-selected .dz-file-info {
  flex: 1 1 auto;
  min-width: 0;
}

.dropzone .dz-selected .dz-file-title {
  word-break: break-word;
}

.dropzone .dz-selected .dz-meta {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 4px;
}

.dropzone .dz-remove {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--danger);
  font-weight: 600;
  font-size: .8rem;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  min-height: 32px;
}

.dropzone .dz-remove:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn[disabled] {
  background: #cbd5e1 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed
}

.toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease
}

.toggle .tick {
  display: none
}

.toggle.on {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a
}

.toggle.on .tick {
  display: inline
}

.toggle.static {
  cursor: default;
  pointer-events: none
}

.toggle.required {
  border: 4px solid #0f172a;
  background: #16a34a;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.15)
}

.toggle.required .tick {
  display: inline;
  color: #fff
}

.toggle.required.on {
  background: #16a34a;
  color: #fff;
  border-color: #0f172a
}

.sidepanel {
  --pages-pane-width: 60px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100vw;
  max-width: 100vw;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 24px rgba(15, 23, 42, .08);
  transition: transform .25s ease;
  transform: translateX(100%);
  z-index: 4000;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.sidepanel.open {
  transform: translateX(0)
}

.close-top-left {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5
}

.pages-pane {
  flex: 0 0 var(--pages-pane-width);
  background: #f1f5f9;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 64px 12px 16px;
  gap: 12px
}

@media (max-width: 1200px) {
  .pages-pane {
    display: none;
  }
}

.pages-list {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.pages-list .muted.small {
  font-size: .8rem;
  color: var(--muted)
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #1f2937;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s
}

.page-btn:hover {
  background: #e2e8f0
}

.page-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb
}

.pdf-pane {
  flex: 65 1 0;
  min-width: 0;
  height: 100%;
  border-right: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 0;
  position: relative;
  padding: 0 32px;
  box-sizing: border-box
}

.pdf-pane iframe {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  background: #fff;
  border: 0
}

.drawer {
  flex: 35 1 0;
  min-width: 0;
  height: 100%;
  background: #fff;
  padding: 20px 28px 20px 32px;
  overflow: auto;
  z-index: 1;
  border-left: 1px solid var(--border);
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box
}

.drawer-feedback {
  display: none;
  margin-bottom: 12px;
  color: var(--error);
  font-size: .95rem
}

.drawer-feedback[data-visible="1"] {
  display: block
}

@media (max-width: 1260px) {
  .pdf-pane {
    padding: 0 20px
  }

  .drawer {
    padding: 20px
  }
}

.sidepanel.no-pdf .pdf-pane {
  display: none
}

.sidepanel.no-pdf .drawer {
  flex: 1 1 auto;
  max-width: 100%
}

.sidepanel.contact-mode {
  left: auto;
  right: 0;
  width: min(624px, 58vw);
  max-width: 624px;
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.16);
  flex-direction: column
}

.sidepanel.contact-mode .pages-pane,
.sidepanel.contact-mode .pdf-pane {
  display: none
}

.sidepanel.contact-mode .drawer {
  flex: 1 1 auto;
  max-width: 100%;
  width: 100%;
  overflow: auto;
  padding: 24px 28px 24px 48px
}

.sidepanel.contact-mode .drawer .drawer-header {
  margin-left: 36px
}

.sidepanel.contact-mode .close-top-left {
  top: 22px;
  left: 28px
}

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

.drawer-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a
}

.drawer-meta {
  font-size: .9rem;
  color: var(--muted)
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px
}

.btn-create {
  transform: scale(1.1);
  transform-origin: center right
}

.drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 4px
}

.section.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0 0 12px
}

.section.meta .kv-row {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  flex-direction: column
}

.section.meta .kv-key {
  width: auto;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em
}

.section.meta .kv-val {
  width: auto;
  font-size: 1rem;
  font-weight: 600
}

.kv-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border)
}

.kv-key {
  width: 160px;
  color: var(--muted)
}

.kv-val {
  flex: 1
}

.kv-row.ok {
  background: #ecfdf5
}

.kv-row.fail {
  background: #fef2f2
}

.section {
  margin: 10px 0
}

.item-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0
}

.btn.success {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a
}

.btn.danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626
}

.btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c
}

.kv-val input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px
}

.kv-val .type-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-weight: 600;
  font-size: .95rem;
  color: #0f172a;
  transition: border-color .15s ease, box-shadow .15s ease
}

.kv-val .type-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18)
}

.btn.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e
}

.btn.warning:hover {
  background: #fde68a;
  border-color: #f59e0b;
  color: #92400e
}

.contact-section {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.operation-section .kv-key {
  text-transform: uppercase;
  font-size: .85rem;
  letter-spacing: .04em
}

.contact-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: box-shadow .2s ease, transform .2s ease;
  cursor: pointer
}

.contact-card.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
  cursor: default
}

.contact-card.pending {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
  cursor: pointer
}

.contact-card.pending:hover,
.contact-card.pending:focus {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.4);
  outline: none
}

.contact-card .contact-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0
}

.contact-card .contact-name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.contact-card .contact-tax {
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.contact-card .contact-status {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em
}

.contact-card.attention {
  animation: contactPulse .6s ease-in-out 2
}

.contact-help {
  font-size: .85rem
}

.contact-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px
}

.contact-editor[hidden] {
  display: none
}

.contact-editor.open {
  display: flex
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.contact-field-label {
  font-size: .85rem;
  color: var(--muted)
}

.contact-field input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px
}

.contact-suggestions {
  border: 1px dashed #fbbf24;
  border-radius: 12px;
  padding: 12px;
  background: #fff8eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #7c2d12
}

.contact-suggestions[hidden] {
  display: none
}

.contact-suggestions-title {
  font-weight: 600;
  font-size: .9rem
}

.contact-suggestions-help {
  font-size: .8rem;
  color: #92400e
}

.contact-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto
}

.contact-suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #facc15;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease
}

.contact-suggestion:hover,
.contact-suggestion:focus {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  outline: none
}

.contact-suggestion-name {
  font-weight: 600;
  color: #7c2d12;
  white-space: normal
}

.contact-suggestion-tax {
  font-size: .85rem;
  font-weight: 500;
  color: #9a3412
}

.contact-suggestion-extra {
  font-size: .78rem;
  color: #a16207
}

.contact-error {
  color: #dc2626;
  font-size: .85rem
}

.contact-quick-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 6px
}

.contact-quick-actions .btn {
  flex: 1
}

.contact-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end
}

@keyframes contactPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.35);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.btn.icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  line-height: 1
}

.btn.icon:hover {
  background: #eef2ff;
  border-color: #93c5fd;
  color: #1d4ed8
}

.btn.save {
  border: 1px solid var(--border);
  background: #fff;
  color: #0f172a;
  font-weight: 400;
  font-size: 1rem;
  font-family: inherit;
  padding: 10px 14px;
  line-height: 1
}

.btn.save:hover {
  background: #f8fafc;
  border-color: #2563eb;
  color: #1d4ed8
}

.btn.loading {
  opacity: .6;
  pointer-events: none
}

.badge-new {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #2563eb;
  border-radius: 999px;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
  font-size: .72rem;
  font-weight: 600;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: .02em
}

.doc-label {
  font-weight: 500
}

#contacts-table td.contact-name-cell {
  font-weight: 600
}

.contact-meta {
  font-size: .82rem;
  color: var(--muted)
}

.col-id {
  width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted)
}

th.col-id {
  text-align: center
}

#pending-wrapper {
  overflow: auto
}

#pending-wrapper table {
  width: 100%;
  border-collapse: collapse
}

#pending-wrapper th,
#pending-wrapper td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top
}

#pending-wrapper th.actions-col {
  text-align: center
}

#pending-wrapper td.actions-cell {
  text-align: center;
  padding-right: 0
}

.actions-stack {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center
}

.action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease
}

.action-btn svg {
  width: 20px;
  height: 20px
}

.action-btn.action-delete svg {
  width: 22px;
  height: 22px
}

.action-btn:hover {
  background: #eef2ff
}

.action-btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px
}

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

#docs-table th,
#docs-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top
}

#docs-table th {
  text-align: left
}

#docs-table th.col-id {
  text-align: center
}

#docs-table th.actions-col {
  text-align: center
}

#docs-table td.actions-cell {
  text-align: center;
  padding-right: 0
}

.docs-load-more {
  display: flex;
  justify-content: center;
  margin: 16px 0
}

.load-more-btn {
  min-width: 160px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  transition: background .15s ease, border-color .15s ease, transform .15s ease
}

.load-more-btn:hover {
  background: #eef2ff;
  border-color: #93c5fd;
  transform: translateY(-1px)
}

.load-more-btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px
}

.load-more-btn[disabled] {
  opacity: .6;
  pointer-events: none
}

.action-btn.action-edit {
  color: #64748b;
  border-color: #64748b
}

.action-btn.action-edit:hover {
  background: #f8fafc;
  border-color: #475569;
  color: #475569
}

.action-btn.action-delete {
  color: #dc2626;
  border-color: #dc2626
}

.action-btn.action-delete:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #b91c1c
}

.action-btn.action-archive {
  color: #2563eb;
  border-color: #2563eb
}

.action-btn.action-archive:hover {
  background: #dbeafe;
  border-color: #1d4ed8;
  color: #1d4ed8
}

.action-btn.action-restore {
  color: #16a34a;
  border-color: #16a34a
}

.action-btn.action-restore:hover {
  background: #dcfce7;
  border-color: #15803d;
  color: #166534
}

.contacts-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 16px
}

.contacts-archived {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 16px;
  display: none
}

.contacts-archived:not([hidden]) {
  display: block
}

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

.contacts-archived__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a
}

.contacts-archived__subtitle {
  margin: 4px 0 0;
  font-size: .85rem;
  color: var(--muted)
}

.contacts-archived__body {
  overflow: auto
}

#contacts-archived-table {
  width: 100%;
  border-collapse: collapse
}

#contacts-archived-table th,
#contacts-archived-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left
}

#contacts-archived-table th.actions-col,
#contacts-archived-table td.actions-cell {
  text-align: center
}

.contacts-archived-note {
  margin: 8px 0 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: right
}

.action-btn.action-reprocess {
  color: #2563eb;
  border-color: #2563eb
}

.action-btn.action-reprocess:hover {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1d4ed8
}

#pending-empty {
  margin-top: 12px
}

.import-feedback {
  display: none
}

.contact-lines {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.contact-line {
  display: grid;
  gap: 12px
}

.contact-line.split {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))
}

.contact-line[data-line="address"] {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.contact-line[data-line="address"] .contact-field-block[data-field="address"] {
  grid-column: span 2
}

.contact-line[data-line="location"] {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.contact-field-block {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.contact-field-block>label {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 500
}

.contact-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .95rem;
  font-family: inherit
}

.contact-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px
}

.contact-field-static {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  padding: 8px 0
}

.sidepanel.contact-mode .contact-detail {
  margin-top: 0
}

.sidepanel.contact-mode .contact-lines {
  padding-left: 0
}

@media(max-width:720px) {
  .sidepanel.contact-mode {
    width: 100vw;
    max-width: 100vw
  }

  .sidepanel.contact-mode .contact-line[data-line="address"],
  .sidepanel.contact-mode .contact-line[data-line="location"] {
    grid-template-columns: 1fr
  }

  .sidepanel.contact-mode .contact-line[data-line="address"] .contact-field-block[data-field="address"] {
    grid-column: auto
  }
}

#export-customize-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(2, 6, 23, .6);
  z-index: 80
}

#export-customize-modal.show {
  display: flex
}

.export-modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  width: 100vw;
  max-width: 100vw;
  max-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative
}

.export-modal__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px
}

.export-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text)
}

.export-modal__subtitle {
  color: var(--muted);
  font-size: .95rem
}

.export-modal__body {
  padding: 16px 24px;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative
}

.export-modal__body.loading .export-table-wrap {
  display: none
}

.export-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  flex: 1 1 auto;
  background: #fff
}

#export-columns-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0
}

#export-columns-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1
}

#export-columns-group-head th {
  background: #f1f5f9;
  font-weight: 800;
  font-size: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: #0f172a
}

#export-columns-group-head th[data-group="invoice_items"] {
  background: #fff7ed
}

.export-group-header__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  min-height: 42px;
  padding: 4px 12px;
  padding-right: 72px
}

.export-group-header[data-group="invoices"] .export-group-header__inner,
.export-group-header[data-group="invoice_items"] .export-group-header__inner {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-right: 12px
}

.export-group-title {
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center
}

.export-group-remove {
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: #dc2626;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%)
}

.export-group-header[data-group="invoices"] .export-group-remove,
.export-group-header[data-group="invoice_items"] .export-group-remove {
  position: static;
  right: auto;
  top: auto;
  transform: none;
  margin-top: 2px
}

.export-group-remove:hover {
  background: none;
  color: #b91c1c
}

#export-columns-table th,
#export-columns-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 140px;
  vertical-align: top;
  background: #fff
}

#export-columns-table th:last-child,
#export-columns-table td:last-child {
  border-right: none
}

#export-columns-table th {
  font-weight: 600;
  font-size: .9rem;
  background: #f1f5f9;
  text-align: left;
  cursor: move;
  position: relative
}

.export-header--grouped {
  background: #f8fafc
}

#export-columns-table th[data-group="invoice_items"] {
  background: #fff7ed
}

#export-columns-table th[data-group="invoice_items"] .export-header-remove {
  color: #c05621
}

#export-columns-table th[data-group="invoice_items"] .export-header-remove:hover {
  color: #9c4221
}

#export-columns-table th.dragging {
  opacity: .6
}

#export-columns-table th .export-header-label {
  display: flex;
  align-items: center;
  gap: 6px
}

#export-columns-table th .export-header-hint {
  display: block;
  font-size: .7rem;
  color: var(--muted);
  font-weight: 400
}

#export-columns-table th button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px
}

#export-columns-table th button:hover {
  background: #e2e8f0;
  color: #1e293b
}

#export-columns-table th .export-header-remove {
  color: #dc2626;
  font-weight: 600
}

#export-columns-table th .export-header-remove:hover {
  color: #b91c1c;
  background: none
}

#export-columns-table td {
  font-size: .9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #0f172a
}

#export-columns-table th[data-drop-position="before"] {
  box-shadow: inset 3px 0 0 #6366f1
}

#export-columns-table th[data-drop-position="after"] {
  box-shadow: inset -3px 0 0 #6366f1
}

.export-header-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem
}

.export-repeat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  color: var(--text)
}

.export-repeat-toggle input {
  transform: scale(1.05)
}

.export-add-column-header {
  width: 72px;
  min-width: 72px;
  text-align: center;
  background: #f1f5f9;
  cursor: default
}

.export-add-column-button {
  width: 100%;
  height: 100%;
  min-height: 44px;
  border: none;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #2563eb;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center
}

.export-add-column-button:hover {
  background: #e2e8f0;
  color: #1d4ed8
}

.export-add-column-cell {
  background: #f8fafc
}

.export-column-picker {
  position: absolute;
  min-width: 220px;
  max-width: 320px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .2);
  z-index: 130;
  display: none;
  flex-direction: column;
  gap: 4px
}

.export-column-picker.show {
  display: flex
}

.export-column-picker button {
  border: none;
  background: none;
  padding: 8px 10px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  color: #0f172a;
  font-size: .9rem
}

.export-column-picker button:hover {
  background: #e2e8f0
}

.export-column-picker__restore {
  background: #eef2ff;
  font-weight: 600
}

.export-column-picker__restore:hover {
  background: #e0e7ff
}

.export-column-picker__empty {
  padding: 4px 0;
  color: var(--muted);
  font-size: .85rem
}

.export-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap
}

.export-footer-left {
  display: flex;
  align-items: center;
  gap: 12px
}

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

.btn.ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted)
}

.btn.ghost:hover {
  background: #f8fafc;
  color: #1e293b
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px
}

.panel-heading__title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 600;
}

.panel-heading__icon {
  padding: 6px;
  border-radius: 8px;
  line-height: 0
}

.panel-heading__icon svg {
  width: 20px;
  height: 20px
}

.panel-heading__icon:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--accent)
}

.manual-pdf-section {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  margin: 12px 0
}

.manual-pdf-info {
  font-size: .9rem;
  color: #475569
}

.manual-pdf-info.muted {
  color: #94a3b8
}

.manual-pdf-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px
}

.export-feedback {
  min-height: 22px;
  font-size: .9rem;
  color: var(--muted)
}

.export-modal__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  color: var(--muted)
}

.export-modal__status .spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin .8s linear infinite
}

.export-empty {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
  background: #fff
}

.export-error {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #b91c1c;
  font-size: .9rem
}

.export-toast {
  position: absolute;
  top: 16px;
  right: 24px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 600;
  font-size: .85rem;
  display: none
}

.export-toast.show {
  display: block
}

.export-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px
}

.export-required-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  color: #475569
}

.export-column-ghost {
  position: absolute;
  pointer-events: none;
  border: 1px dashed #93c5fd;
  background: rgba(147, 197, 253, .25);
  border-radius: 6px;
  z-index: 120;
  display: none
}

.export-modal__body.dragging .export-column-ghost {
  display: block
}

.row-recent {
  animation: rowRecentFlash 1.6s ease-in-out;
  background: rgba(59, 130, 246, .12)
}

@keyframes rowRecentFlash {
  0% {
    background: rgba(59, 130, 246, .35)
  }

  60% {
    background: rgba(59, 130, 246, .12)
  }

  100% {
    background: transparent
  }
}

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

.section[data-validation-state="loading"]>h3::after,
.section.meta[data-validation-state="loading"]::after {
  content: var(--validation-loading-label, ' · Validating...');
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
  margin-left: 6px;
}

/* ------------------------------------------------------
   Responsive layout overrides & new primitives
------------------------------------------------------- */
:root {
  --sidebar-width: 244px;
  --sidebar-width-lg: 264px;
  --content-max-width: 1440px;
  --content-padding: clamp(16px, 2vw, 32px);
  --stack-gap: clamp(16px, 2vw, 24px);
  --validation-loading-label: ' · Validating...';
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

body.sidebar-open {
  overflow: hidden;
  height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: relative;
  background: #193352;
}

.sidebar-inner {
  height: 100%;
}

.sidebar-scroll {
  padding: 20px 16px;
  position: relative;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content {
  padding: var(--content-padding) clamp(12px, 1vw, 20px);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  max-width: none;
  margin: 0;
}

.alerts {
  margin-bottom: var(--stack-gap);
}

.page-title {
  margin: 0 0 clamp(12px, 1.8vw, 20px);
  font-size: clamp(1.4rem, 1.8vw, 2rem);
  line-height: 1.2;
}

.panel {
  padding: clamp(16px, 2vw, 28px);
}

.row {
  display: flex;
  gap: var(--stack-gap);
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  min-height: 44px;
  padding: .65rem 1.1rem;
}

@media (max-width:640px) {
  .row .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.sidebar-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 16px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 45;
}

.sidebar-scrim.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width:1440px) {
  .content {
    padding: clamp(24px, 2vw, 48px) clamp(16px, 1.2vw, 24px);
  }
}

/* Tablets and smaller - sidebar becomes overlay with toggle button */
@media (max-width:1279px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    max-width: min(var(--sidebar-width-lg), 82vw);
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
    z-index: 680;
    min-height: 100vh;
  }

  .sidebar-scroll {
    position: relative;
    height: 100%;
  }

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

  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-scrim {
    z-index: 40;
  }
}

@media (max-width:768px) {
  .content {
    padding: clamp(16px, 4vw, 24px) clamp(12px, 2vw, 16px);
  }
}

/* ----------------- Home: processor grid ---------------- */
.home-actions {
  align-items: flex-start;
  margin-bottom: var(--stack-gap);
  gap: var(--stack-gap);
}

.home-actions .muted {
  margin-top: 4px;
  font-size: .95rem;
  max-width: 560px;
}

/* Resized processors (approx 30% smaller) */
.processor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(294px, 1fr));
  gap: clamp(12px, 1.5vw, 20px);
  margin: 0;
  max-width: none;
  width: 100%;
  justify-items: start;
  justify-content: flex-start;
}

.processor-card {
  width: 100%;
  min-height: 182px;
  /* Reduced from 260px */
  display: flex;
  flex-direction: column;
  padding: 16px;
  /* Slightly reduced padding */
}

.processor-card__title {
  font-size: 1.25rem;
  /* Reduced font size */
  margin: 20px 0 8px;
}

.processor-card__desc {
  font-size: 0.85rem;
  min-height: 36px;
  margin-bottom: 12px;
}

.processor-card__meta {
  font-size: 0.85rem;
}

.processor-card__last {
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.processor-card__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.processor-card__actions .btn {
  flex: auto;
  justify-content: center;
  padding: 6px 10px;
  font-size: 0.9rem;
  min-height: 36px;
}

.processor-card__actions.is-archived {
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin-top: var(--stack-gap);
  padding: clamp(24px, 3vw, 40px);
}

/* ----------------- Mailbox / Import ------------------- */
.import-header {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--stack-gap);
  align-items: center;
  width: 100%;
  margin-bottom: var(--stack-gap);
}

.import-header .import-title {
  flex: 0 0 auto;
}

.import-header .status-strip {
  padding-left: 0;
  margin: 0;
  display: flex;
  gap: 12px;
  flex: 1 1 auto;
  justify-content: flex-end;
}

@media (max-width:900px) {
  .import-header {
    flex-wrap: wrap;
  }

  .import-header .status-strip {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.status-strip {
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.status-item {
  flex: 1 1 0;
  min-width: max-content;
  align-items: center;
}

.status-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.status-label .status-text {
  line-height: 1.2;
}

@media (max-width:640px) {
  .status-item {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .status-label {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
}

.dropzone {
  min-height: clamp(120px, 20vh, 180px);
  border-radius: 16px;
  padding: clamp(20px, 2.5vw, 28px);
}

.dz-selected {
  max-height: 180px;
  overflow-y: auto;
}

#import-form {
  flex-wrap: wrap;
}

.panel>table,
#pending-wrapper table,
#processed-wrapper table,
.contacts-archived__body table,
.drawer table {
  width: 100%;
}

@media (max-width:900px) {

  #pending-wrapper,
  #processed-wrapper,
  .contacts-archived__body,
  .panel {
    overflow-x: auto;
  }

  #pending-wrapper table,
  #processed-wrapper table,
  .contacts-archived__body table,
  .drawer table,
  .panel>table {
    min-width: 640px;
  }
}

@media (max-width: 920px) {
  .sidepanel {
    width: 100vw;
    max-width: 100vw;
    right: 0;
    left: 0;
  }

  /* Mobile view: hide pages and pdf, show drawer full width */
  .sidepanel .pages-pane,
  .sidepanel .pdf-pane {
    display: none !important;
  }

  .sidepanel .drawer {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    padding: 16px;
  }

  .sidepanel .close-top-left {
    top: 12px;
    left: 12px;
  }

  .drawer-header {
    margin-left: 32px;
    /* Space for close button */
  }

  .mobile-pdf-btn {
    display: inline-flex !important;
  }
}

.mobile-pdf-btn {
  display: none;
}

.modal {
  width: min(520px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ----------------- Profile: Account ------------------- */
.account-page__header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--stack-gap)
}

.account-page__description {
  color: var(--muted);
  max-width: 760px
}

.account-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--stack-gap);
  align-items: flex-start;
  margin-bottom: var(--stack-gap)
}

.account-summary__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px
}

.account-summary__item {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.account-summary__label {
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600
}

.account-summary__value {
  font-size: 1.05rem;
  font-weight: 600
}

.account-summary__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .12);
  color: var(--accent);
  font-weight: 600
}

.account-forms {
  display: grid;
  gap: var(--stack-gap)
}

.account-panel__title {
  margin: 0 0 6px;
  font-size: 1.18rem
}

.account-panel__description {
  margin: 0 0 16px;
  color: var(--muted)
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.form-field label {
  font-weight: 600
}

.form-field input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit
}

.password-field {
  position: relative
}

.password-field input {
  width: 100%;
  padding-right: 44px
}

.password-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, color .2s ease
}

.password-field:focus-within .password-eye {
  opacity: 1;
  pointer-events: auto
}

.password-eye:hover {
  color: var(--text)
}

.password-eye svg {
  width: 20px;
  height: 20px
}

.password-eye .eye-hidden {
  display: none
}

.password-eye.is-visible .eye-hidden {
  display: block
}

.password-eye.is-visible .eye-visible {
  display: none
}

.form-errors {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 12px;
  font-size: .95rem
}

.form-errors ul {
  margin: 0;
  padding-left: 18px
}

.recover-footer {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.recover-footer .btn {
  width: fit-content
}

.muted-small {
  color: var(--muted);
  font-size: .9rem
}

/* ----------------- Profile: Feedback ------------------ */
.feedback-page {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
  width: 100%
}

.feedback-page__header {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.feedback-page__description {
  color: var(--muted);
  max-width: 720px
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.feedback-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  resize: vertical;
  background: #fff;
  color: var(--text)
}

.feedback-counter {
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  justify-content: flex-end
}

.feedback-errors {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 10px;
  padding: 12px
}

.feedback-errors ul {
  margin: 0;
  padding-left: 18px
}

.feedback-history {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.feedback-history__list {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.feedback-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fff
}

.feedback-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: .9rem;
  color: var(--muted)
}

.feedback-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em
}

.feedback-status--received {
  background: rgba(37, 99, 235, .12);
  color: #2563eb
}

.feedback-status--in_review {
  background: rgba(251, 146, 60, .2);
  color: #c2410c
}

.feedback-status--implemented {
  background: rgba(34, 197, 94, .15);
  color: #15803d
}

.feedback-status--rejected {
  background: rgba(239, 68, 68, .15);
  color: #b91c1c
}

.feedback-item__text {
  white-space: pre-wrap;
  line-height: 1.45
}

.feedback-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: var(--muted)
}

.contact-section {
  background: var(--surface-secondary, #f9fafb)
}

.contact-description {
  color: var(--muted);
  margin-bottom: 20px
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.contact-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted)
}

.contact-value {
  color: var(--brand-primary, #2563eb);
  text-decoration: none;
  font-size: 1.05rem;
  transition: opacity .2s ease
}

.contact-value:hover {
  opacity: .8;
  text-decoration: underline
}

@media (min-width: 640px) {
  .contact-info {
    flex-direction: row;
    gap: 32px
  }
}

@media (max-width:640px) {
  .feedback-page {
    padding-bottom: 40px
  }
}

/* --------------- Profile: Subscription ---------------- */
.subscription-page {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap)
}

.subscription-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--stack-gap)
}

.subscription-description {
  color: var(--muted);
  max-width: 780px
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--stack-gap);
  margin-bottom: var(--stack-gap)
}

.subscription-summary {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.summary-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: .08em;
  font-weight: 600;
  margin: 0
}

.summary-price {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 4px 0
}

.summary-limit {
  color: var(--muted);
  margin: 0 0 12px
}

.usage-panel {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.usage-header h3 {
  margin: 0
}

.usage-period {
  color: var(--muted);
  font-size: .9rem
}

.usage-label {
  margin: 0;
  font-weight: 600
}

.usage-progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden
}

.usage-progress__fill {
  height: 100%;
  border-radius: 999px;
  transition: width .3s ease
}

.usage-progress__fill--ok {
  background: #22c55e
}

.usage-progress__fill--warn {
  background: #fbbf24
}

.usage-progress__fill--limit {
  background: #dc2626
}

.usage-message {
  margin: 0;
  font-weight: 600
}

.usage-message--warn {
  color: #b45309
}

.usage-message--limit {
  color: #b91c1c
}

.usage-unlimited {
  padding: 8px 10px;
  border-radius: 8px;
  background: #ecfccb;
  color: #3f6212;
  font-weight: 600
}

.plans-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(220px, 320px);
  gap: 28px;
  align-items: stretch;
  margin-bottom: var(--stack-gap);
  width: 100%
}

.plans-table {
  min-width: 0;
  margin-bottom: 0
}

.plans-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px
}

.plans-note {
  margin: 0;
  font-size: .9rem
}

.plans-note--warning {
  color: #b91c1c;
  font-weight: 600
}

.plans-warning {
  margin: 0;
  color: #b45309;
  font-size: .9rem
}

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

.plans-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0
}

.plans-table th,
.plans-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left
}

.plans-table__cell--center {
  text-align: center
}

.plans-table tbody tr:last-child td {
  border-bottom: none
}

.plan-row {
  cursor: pointer;
  transition: background .2s
}

.plan-row--selected {
  background: #eef2ff
}

.plan-row--current {
  font-weight: 600
}

.plan-selector {
  width: 48px;
  text-align: center
}

.plan-selector__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff
}

.plan-row--selected .plan-selector__dot {
  border-color: #1d4ed8;
  background: #1d4ed8
}

.plan-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  align-self: stretch;
  height: 100%
}

.plan-detail__status {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em
}

.plan-detail__name {
  margin: 0;
  font-size: 1.3rem
}

.plan-detail__meta {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px
}

.plan-detail__meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border)
}

.plan-detail__meta div:last-child {
  border-bottom: none;
  padding-bottom: 0
}

.plan-detail__meta dt {
  font-size: .8rem;
  text-transform: uppercase;
  color: var(--muted)
}

.plan-detail__meta dd {
  margin: 0;
  font-weight: 600
}

.plan-detail__helper {
  margin: 0;
  font-size: .95rem
}

.plan-detail--current {
  background: #eff6ff;
  border-color: #1d4ed8
}

.plan-detail--current .plan-detail__status {
  color: #1d4ed8
}

.plan-detail--upgrade {
  background: #f0fdf4;
  border-color: #15803d
}

.plan-detail--upgrade .plan-detail__status {
  color: #15803d
}

.plan-detail--scheduled {
  background: #fff7ed;
  border-color: #fb923c
}

.plan-detail--scheduled .plan-detail__status {
  color: #c2410c
}

.plan-detail__button[hidden] {
  display: none
}

.plan-detail__button {
  margin-top: auto
}

@media (max-width:960px) {
  .plans-layout {
    grid-template-columns: 1fr
  }

  .plan-detail {
    min-width: 0;
    width: 100%
  }
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px
}

.history-item__label {
  font-weight: 600
}

.history-item--current {
  border-color: #2563eb;
  background: #eff6ff
}

.history-item--current .history-item__label {
  color: #1d4ed8
}

/* ==========================================
   Responsive Fixes (Re-applied)
   ========================================== */

/* Sidebar overlap fix removed - now handled by unified media query at 1199px */

/* 2. Mobile View Optimization */
@media (max-width: 768px) {
  .sidepanel {
    width: 100vw !important;
    max-width: 100vw !important;
    right: 0 !important;
    left: 0 !important;
  }

  .sidepanel .pages-pane,
  .sidepanel .pdf-pane {
    display: none !important;
  }

  .sidepanel .drawer {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 16px !important;
  }

  .sidepanel .close-top-left {
    top: 12px !important;
    left: 12px !important;
  }

  .drawer-header {
    margin-left: 32px !important;
  }

  .mobile-pdf-btn {
    display: inline-flex !important;
  }
}

.mobile-pdf-btn {
  display: none;
}

/* 3. Processor Resizing */
.processor-grid {
  grid-template-columns: repeat(auto-fill, minmax(294px, 1fr)) !important;
  gap: clamp(12px, 1.5vw, 20px) !important;
}

.processor-card {
  min-height: 182px !important;
  padding: 16px !important;
}

.processor-card__title {
  font-size: 1.25rem !important;
  margin: 20px 0 8px !important;
}

.processor-card__desc {
  font-size: 0.85rem !important;
  min-height: 36px !important;
  margin-bottom: 12px !important;
}

.processor-card__meta {
  font-size: 0.85rem !important;
}

.processor-card__last {
  font-size: 0.8rem !important;
  margin-bottom: 12px !important;
}

.processor-card__actions {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 8px !important;
}

.processor-card__actions .btn {
  padding: 6px 10px !important;
  font-size: 0.9rem !important;
  min-height: 36px !important;
}
