/* Wspólne mechanizmy czytelności — Lexi AI Prawnik */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(13, 90, 135, 0.1);
  z-index: 100;
  pointer-events: none;
}
.scroll-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(13, 90, 135, 0.25);
  transition: width 0.08s linear;
}

.active-section-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 11px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap;
}
.active-section-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

.reading-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.reading-toolbar .ui-btn.is-active {
  background: var(--accent-soft);
  border-color: #b8d4e8;
  color: var(--accent);
}

/* Kompaktowy widok kart ustaleń */
body.compact-card-mode .item-card .item-card-body {
  display: none;
}
body.compact-card-mode .item-card {
  padding-bottom: 0.65rem;
}
body.compact-card-mode .item-card .item-title {
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.item-card.item-collapsed .item-card-body {
  display: none;
}
.item-card .item-card-toggle {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0;
  margin-left: auto;
  font-family: inherit;
}
.item-card .item-card-toggle:hover {
  text-decoration: underline;
}
.item-header {
  width: 100%;
}

.help-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: help;
  white-space: nowrap;
}
.help-pill.op-replace { background: #f0f7ff; color: #1e4a6f; border-color: #c5d9e8; }
.help-pill.op-delete { background: #fff5f5; color: #8b1a1a; border-color: #f2c7c1; }
.help-pill.op-insert { background: #f4fbf6; color: #1b6b38; border-color: #c8e6c9; }
.help-pill.op-keep { background: var(--bg2); color: var(--muted); }

/* Karty pobrań (inspirowane prezentacją DEV) */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.download-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.download-card:hover {
  background: var(--accent-soft);
  border-color: #b8d4e8;
  box-shadow: 0 6px 20px rgba(13, 90, 135, 0.06);
}
.download-card .download-body {
  min-width: 0;
}
.download-icon-inline {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.download-icon-inline .ic-wrap {
  width: 16px;
  height: 16px;
}
.download-card .download-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  margin: 0 0 4px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.download-card .download-meta,
.download-card .download-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 8px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.download-card .download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.download-card .deliverable-btn {
  font-size: var(--text-xs);
  padding: 6px 12px;
}

.deliverable-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.workflow-step-body .deliverable-card,
.workflow-step-body .download-card {
  margin-bottom: 0;
}
.deliverable-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 4px;
}
.deliverable-head b { font-size: var(--text-lead); }
.workflow-subnum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #e8eef2;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}
.download-title-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 6px;
}
.download-title-row .download-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.deliverable-meta, .deliverable-hint, .download-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 6px 0 10px;
  line-height: 1.45;
}
.deliverable-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.deliverable-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.deliverable-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.deliverable-btn.success,
.deliverable-btn.primary.success {
  background: var(--accept);
  border-color: var(--accept);
  color: #fff;
}
.deliverable-btn.success:hover,
.deliverable-btn.primary.success:hover {
  filter: brightness(0.95);
}
.negotiation-hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.negotiation-hero-action .action-row {
  margin-top: 0;
}
.negotiation-hero-action .deliverable-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}
.file-download-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.file-download-link:hover {
  text-decoration: underline;
}
.profile-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}
.profile-mode-row .profile-mode-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.profile-mode-row .profile-mode-copy b {
  display: block;
  font-size: var(--text-base);
  margin-bottom: 2px;
}
.profile-fields-wrap[hidden] {
  display: none !important;
}
.profile-fields-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
  align-items: center;
}
.share-url {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: var(--text-xs);
  background: #fff;
  font-family: inherit;
}
.btn-copy {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  font-family: inherit;
}

.deliverables-section {
  margin: 24px 0;
}
.deliverables-section > .section-heading {
  margin-bottom: 8px;
}

/* Workflow wyników analizy — sekcje jako nagłówki, karty jedna pod drugą */
.results-workflow {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.workflow-step {
  border: none;
  border-radius: 0;
  padding: 20px 0 0;
  background: transparent;
  border-top: 1px solid var(--line);
}
.results-workflow > .workflow-step:first-child {
  border-top: none;
  padding-top: 0;
}
.workflow-step-hero {
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
}
.workflow-step-hero .workflow-step-head {
  border-left: 4px solid #2e7d32;
  padding-left: 14px;
}
.workflow-step-hero .download-card {
  background: #fff;
  border-color: var(--line);
}
.workflow-step-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.workflow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-step-title {
  margin: 0 0 4px;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}
.workflow-step-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 4px;
}
.workflow-step-title-row .workflow-step-title {
  margin: 0;
  flex: 0 1 auto;
}
.workflow-step-filename {
  flex: 1 1 160px;
  min-width: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  line-height: 1.35;
  color: #9aa3ab;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.workflow-step-lead {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.45;
}
.workflow-step-body {
  margin-left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.workflow-step-hero .workflow-step-body {
  margin-left: 0;
}
.workflow-items-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.workflow-items-grid .download-card {
  height: auto;
  align-items: stretch;
}
.workflow-items-grid .download-card .download-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.workflow-items-grid .download-card .download-hint {
  flex: 1 1 auto;
}
.workflow-items-grid .download-card .card-actions-zone {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-actions-zone .action-row {
  margin-top: 0;
}
.deliverable-card .card-actions-zone {
  margin-top: 12px;
}
.deliverable-actions,
.apply-workflow-actions,
.google-drive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.apply-workflow-actions {
  margin-top: 4px;
}
.workflow-step-hero .workflow-items-grid,
.workflow-step-hero .download-card {
  max-width: 100%;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.action-row + .action-row,
.share-link-block + .action-row,
.action-row + .share-link-block {
  margin-top: 8px;
}

.btn-copy-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  font-family: inherit;
}
.btn-copy-icon:hover {
  background: var(--accent-soft);
  border-color: #b8d4e8;
  color: var(--accent);
}
.btn-copy-icon .copy-feedback {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  white-space: nowrap;
  color: var(--accept, #2e7d32);
  pointer-events: none;
}

.share-link-block {
  margin: 8px 0;
}
.share-link-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.share-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-link-url {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
  text-decoration: none;
  display: block;
}
a.share-link-url:hover {
  color: var(--accent);
  border-color: #b8d4e8;
  background: var(--accent-soft);
}

.workflow-step-collapsed .workflow-step-body {
  opacity: 0.92;
}

/* Nagłówek strony wyników */
.results-header {
  margin-bottom: 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.results-header-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.results-header-date {
  display: block;
  font-size: var(--text-base);
  color: var(--muted);
  margin-bottom: 6px;
}
.results-header-byline {
  margin: 0 0 10px;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.results-header-byline .results-header-date-inline {
  font-size: inherit;
  color: inherit;
}
.results-header-byline .results-header-badge {
  margin: 0;
}
.results-header-title {
  margin: 0 0 6px;
  font-size: var(--text-lg);
  line-height: 1.35;
  font-weight: var(--weight-bold);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.results-header-file {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.results-header-file-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  min-width: 0;
}
.results-header-file-row .file-download-btn {
  flex: 0 0 auto;
  align-self: center;
}
.results-header-file-primary .results-header-file-row .results-header-filename {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
}
.results-header-filename {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-weight: var(--weight-bold);
  color: var(--text);
}
.file-download-btn {
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  padding: 6px 10px;
  white-space: nowrap;
}
.file-download-btn .ic-wrap {
  margin-right: 2px;
}
.results-header-meta {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.results-header-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: 99px;
  background: #e8f5ec;
  color: #1b6b38;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}
.results-header-nav {
  margin: 8px 0 12px;
}

/* Kontekst / informacje o sprawie — rozwijany */
.job-context-toggle {
  margin: 14px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  overflow: hidden;
}
.job-context-toggle-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-xs);
}
.job-context-toggle-summary::-webkit-details-marker { display: none; }
.job-context-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  color: var(--text);
  flex-shrink: 0;
}
.job-context-toggle-preview {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.job-context-toggle-body {
  margin: 0;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--muted);
}
.job-context-line {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: 4px;
}
.job-context-goal {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: 4px;
}
.job-context-detail {
  font-size: var(--text-xs);
  color: var(--muted);
}
.job-context-toggle[open] .job-context-toggle-summary {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

/* E-mail do kontrahenta — widok klienta pocztowego */
.mail-compose-section {
  margin: 0 0 18px;
}
.mail-compose-window {
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(60, 64, 67, 0.12);
  overflow: hidden;
}
.mail-compose-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f1f3f4 0%, #e8eaed 100%);
  color: #3c4043;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.mail-compose-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mail-compose-title .ic-wrap,
.mail-compose-title .ic {
  color: #5f6368;
}
.mail-compose-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mail-compose-win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  opacity: 0.85;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.mail-compose-win-btn:hover {
  background: rgba(60, 64, 67, 0.08);
  opacity: 1;
}
.mail-compose-win-btn .ic {
  color: #5f6368;
}
.mail-compose-window.mail-compose-collapsed > :not(.mail-compose-titlebar) {
  display: none;
}
.mail-compose-staff-hint,
.mail-compose-lead {
  margin: 10px 14px 0;
  font-size: var(--text-xs);
  line-height: 1.45;
}
.mail-compose-lead {
  color: var(--muted);
}
.mail-compose-fields {
  border-bottom: 1px solid #e8eaed;
}
.mail-compose-field {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px 12px;
  padding: 0 14px;
  border-top: 1px solid #e8eaed;
  min-height: 44px;
}
.mail-compose-field:first-child {
  border-top: none;
}
.mail-compose-field.mail-compose-to {
  align-items: start;
  min-height: auto;
  padding-top: 8px;
  padding-bottom: 8px;
}
.mail-compose-to-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}
.mail-compose-recipients-editor {
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 0;
}
.mail-compose-recipients-editor > .ic-wrap {
  flex-shrink: 0;
  align-self: center;
}
.mail-compose-selected-recipients {
  display: contents;
}
.mail-compose-recipient-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 2px 4px 2px 10px;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  background: #e8f0fe;
  color: var(--text, #111827);
  font-size: var(--text-xs);
  line-height: 1.3;
}
.mail-compose-recipient-pill-addr {
  overflow: hidden;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-compose-recipient-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mail-compose-recipient-remove:hover {
  background: #dbeafe;
  color: #1d4ed8;
}
.mail-compose-to-input {
  flex: 1 1 140px;
  min-width: 120px;
}
.mail-compose-label {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: var(--weight-semibold);
}
.mail-compose-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mail-compose-input-wrap .ic-wrap,
.mail-compose-input-wrap .ic {
  color: var(--muted);
  flex-shrink: 0;
}
.mail-compose-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
}
.mail-compose-input:focus {
  outline: none;
}
.mail-compose-input-pending,
.mail-compose-input-pending:focus {
  cursor: default;
  caret-color: transparent;
  color: var(--muted);
}
.mail-compose-input-pending::placeholder {
  color: var(--muted);
  opacity: 1;
}
.mail-compose-from {
  margin: 0 14px 8px;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.45;
}
.mail-compose-body {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 280px;
  margin: 0;
  padding: 16px 14px;
  border: none;
  border-bottom: 1px solid #e8eaed;
  resize: vertical;
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1.55;
  background: #fff;
  color: var(--text);
}
.mail-compose-body:focus {
  outline: none;
}
.mail-compose-footer {
  padding: 12px 14px 14px;
  background: #f8f9fa;
}
.mail-compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mail-compose-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  background: #5f6368;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18);
  transition: background 0.15s, box-shadow 0.15s;
}
.mail-compose-send:hover {
  background: #494c50;
}
.mail-compose-send .ic {
  color: #fff;
}
.mail-compose-send:disabled {
  opacity: 0.65;
  cursor: wait;
}
.mail-compose-send-status {
  margin: 10px 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.mail-compose-send-status.ok {
  color: #1e7e34;
}
.mail-compose-send-status.err {
  color: #b42318;
}
.mail-compose-toolbar-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.mail-compose-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mail-compose-icon-btn:hover:not(.mail-compose-icon-btn-disabled) {
  background: #e8eaed;
  color: var(--text);
}
.mail-compose-icon-btn-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.mail-compose-footnote {
  margin: 10px 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.45;
}
.mail-compose-email-picks {
  padding: 0;
}
.mail-compose-email-picks-label {
  margin: 0 0 6px;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.4;
}
.mail-compose-email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mail-compose-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 999px;
  background: #fff;
  color: var(--text, #111827);
  font-size: var(--text-xs);
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.mail-compose-email-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}
.mail-compose-email-chip.is-active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 1px #2563eb inset;
}
.mail-compose-email-chip.is-suggested {
  border-color: #86efac;
}
.mail-compose-email-chip-addr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-compose-email-chip-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
}
@media (max-width: 640px) {
  .mail-compose-field {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-top: 8px;
    padding-bottom: 4px;
  }
  .mail-compose-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mail-compose-toolbar-icons {
    justify-content: center;
  }
}

.mail-compose-reply-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: var(--text-xs);
  font-weight: 600;
}
.mail-replies-sync-btn {
  opacity: 0.72;
}
.mail-replies-sync-btn:hover {
  opacity: 1;
}
.mail-replies-sync-btn.is-syncing .ic {
  animation: mail-replies-spin 0.9s linear infinite;
}
@keyframes mail-replies-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.mail-replies-panel {
  margin: 0 16px 16px;
  padding: 12px 14px;
  border-top: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
  border-radius: 0 0 10px 10px;
}
.mail-replies-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.mail-replies-count {
  display: inline-flex;
  min-width: 1.5rem;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: var(--text-xs);
  font-weight: 700;
}
.mail-replies-meta {
  margin: 0 0 10px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.mail-reply-item {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
}
.mail-reply-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  font-size: var(--text-sm);
}
.mail-reply-from {
  font-weight: 600;
  color: var(--text);
}
.mail-reply-time {
  color: var(--muted);
  font-size: var(--text-xs);
}
.mail-reply-subject {
  margin: 0 0 6px;
  font-size: var(--text-sm);
  font-weight: 600;
}
.mail-reply-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text);
  max-height: 240px;
  overflow: auto;
}

/* Mapa workflow (skrót etapów) */
.workflow-overview {
  margin: 16px 0 4px;
}
.scroll-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans, inherit);
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.scroll-to-top-btn[hidden] {
  display: none !important;
}
.scroll-to-top-btn:hover {
  background: var(--accent-soft);
  border-color: #b8d4e8;
}
.scroll-to-top-btn .ic-wrap {
  display: inline-flex;
}
.workflow-overview-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.workflow-overview-item {
  margin: 0;
}
.workflow-overview-card {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: visible;
  transition: border-color 0.15s, background 0.15s;
}
.workflow-overview-link {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  text-decoration: none;
  color: inherit;
}
.workflow-overview-link:hover {
  background: var(--accent-soft);
}
.workflow-overview-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  margin: 4px 4px 4px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f8fa;
  flex-shrink: 0;
  align-self: center;
}
.btn-overview-action {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: inherit;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn-overview-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.btn-overview-action:hover {
  border-color: #c5d4e8;
  color: var(--accent);
  background: #fff;
}
.btn-overview-action.has-feedback {
  border-color: #b8d4be;
  background: #eef8f0;
}
.btn-overview-action.has-feedback .btn-overview-action-icon {
  visibility: hidden;
}
.overview-action-feedback {
  position: absolute;
  inset: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 11px;
  font-weight: var(--weight-bold);
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  color: #1b6b38;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
}
.btn-overview-action.has-feedback .overview-action-feedback {
  opacity: 1;
}
.btn-overview-action.has-feedback.feedback-err {
  border-color: #e8c4a8;
  background: #fff8f0;
}
.btn-overview-action.has-feedback.feedback-err .overview-action-feedback {
  color: #9a3412;
}
.workflow-overview-item.is-current .workflow-overview-card {
  border-color: var(--line);
  box-shadow: none;
}
.workflow-overview-item.is-current .workflow-overview-title {
  color: var(--accent);
}
.workflow-overview-item.is-current .workflow-overview-num {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #b8d4e8;
}
.workflow-overview-item.is-done .workflow-overview-num {
  background: #e8f5ec;
  color: #1b6b38;
  border: 1px solid #b8d4be;
}
.workflow-overview-num {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--line);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-overview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.workflow-overview-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}
.workflow-overview-lead {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.4;
}

@media (min-width: 720px) {
  .workflow-overview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
  }
  .workflow-overview-card {
    height: 100%;
  }
}

.google-drive-panel {
  margin-top: 16px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.google-drive-settings {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbf9;
  padding: 0;
}
.google-drive-settings-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.google-drive-settings-summary::-webkit-details-marker { display: none; }
.google-drive-settings-summary::before {
  content: '▸';
  font-size: var(--text-xs);
  color: var(--muted);
  transition: transform 0.15s ease;
}
.google-drive-settings[open] > .google-drive-settings-summary::before {
  transform: rotate(90deg);
}
.google-drive-settings-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.google-drive-settings-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  flex: 1 1 180px;
}
.google-drive-settings-body {
  padding: 0 14px 12px;
  border-top: 1px solid var(--line);
}
.google-drive-panel h3 {
  margin: 0 0 8px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}
.google-drive-status {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 0 0 10px;
}
.google-drive-status.connected { color: #1e7e34; }
.google-drive-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.btn-drive {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.btn-drive.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-drive:disabled { opacity: 0.6; cursor: not-allowed; }
.short-link-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}
.short-link-box label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  margin-bottom: 6px;
  color: var(--muted);
}
.short-link-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.short-link-row input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: var(--text-xs);
}

.apply-pipeline-guide {
  margin: 8px 0 12px;
}
.apply-pipeline-intro {
  margin: 0 0 12px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--muted);
}
.apply-pipeline-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.apply-pipeline-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.apply-pipeline-step.step-done {
  border-color: #b8d4be;
  background: #f8fcf9;
}
.apply-pipeline-step.step-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(13, 90, 135, 0.12);
}
.apply-pipeline-step.step-pending {
  opacity: 0.88;
}
.apply-pipeline-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.apply-pipeline-step-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e8eef2;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.apply-pipeline-step.step-done .apply-pipeline-step-num {
  background: #e8f5ec;
  color: #1b6b38;
}
.apply-pipeline-step.step-current .apply-pipeline-step-num {
  background: var(--accent);
  color: #fff;
}
.apply-pipeline-step-title {
  font-size: var(--text-base);
}
.apply-pipeline-optional-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--muted);
}
.apply-pipeline-step-desc,
.apply-pipeline-step-outcome,
.apply-pipeline-location {
  margin: 0 0 6px;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--muted);
}
.apply-pipeline-outcome-label {
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.apply-pipeline-step-action {
  margin-top: 8px;
}
.apply-pipeline-step-action .deliverable-btn {
  font-size: var(--text-xs);
}
.apply-pipeline-blocked {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff8e6;
  border: 1px solid #e6d48a;
  font-size: 13px;
  color: #6b5a1e;
}
.apply-pipeline-applied-at {
  margin-top: 8px;
}
.round-history-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line, #dde4ea);
  border-radius: 10px;
  background: #f8fafc;
}
.round-history-head {
  margin-bottom: 8px;
}
.round-history-list {
  margin: 0;
  padding-left: 1.2rem;
}
.round-history-item {
  margin-bottom: 10px;
}
.round-history-item-head {
  margin-bottom: 2px;
}
.round-history-links {
  margin: 4px 0;
}
.round-snapshot-preview {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line, #dde4ea);
  border-radius: 8px;
  background: #fff;
}
.apply-decisions-card .apply-decisions-status {
  display: block;
  margin-top: 10px;
  font-size: 12px;
}
.apply-decisions-card .apply-decisions-status.ok {
  color: #1b6b38;
}
.apply-decisions-card .apply-decisions-status.err {
  color: var(--flag);
}

@media (max-width: 640px) {
  .negotiation-hero-actions {
    grid-template-columns: 1fr;
  }
  .workflow-step-body {
    margin-left: 0;
  }
  .workflow-step-head {
    flex-wrap: wrap;
  }
}

.consistency-assist-row {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.consistency-suggestion-panel {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}
.consistency-suggestion-panel .deliverable-btn {
  margin-top: 6px;
}

@media print {
  .scroll-progress,
  .active-section-indicator,
  .reading-toolbar,
  .item-card-toggle,
  .scroll-to-top-btn {
    display: none !important;
  }
  body.compact-card-mode .item-card .item-card-body,
  .item-card.item-collapsed .item-card-body {
    display: block !important;
  }
}
