:root {
  --bg: #f5f8f8;
  --card: #ffffff;
  --panel: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --primary: #2cc4f6;
  --primary-dark: #0aa7dc;
  --primary-soft: rgba(44, 196, 246, 0.12);
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --success-line: #9ae6b4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.app-loading .page {
  opacity: 0;
  pointer-events: none;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
  display: grid;
  gap: 16px;
  /* В iframe Bitrix24 нельзя завязывать высоту на 100vh:
     вместе с BX24.fitWindow() это может запускать цикл,
     когда каждый пересчет увеличивает контейнер еще сильнее. */
  min-height: 100%;
}

.shell {
  width: 100%;
  min-height: 0;
}

.card-compact {
  max-width: 600px;
  margin: 0 auto;
}

.card-wide {
  max-width: min(1680px, calc(100vw - 32px));
  margin: 0 auto;
}

.card {
  width: 100%;
  min-height: 0;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}

.hero,
.manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.hero {
  justify-content: flex-start;
  align-items: flex-start;
  padding: 24px;
}

.hero-title {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.hero-icon,
.button-icon,
.icon-button,
.edit-icon,
.tree-icon,
.file-icon,
.table-action,
.message-icon,
.message-link-icon,
.message-close {
  font-family: "Material Symbols Outlined", sans-serif;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.hero-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 28px;
  flex-shrink: 0;
}

.manager-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.manager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.subtle {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.button {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  color: white;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-primary {
  background: var(--primary);
}

.button-secondary {
  background: #e2f7ff;
  color: var(--primary-dark);
}

.button-secondary:hover {
  background: #c8f0fe;
}

.button-link {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  padding: 8px 10px;
  min-height: 40px;
  font-weight: 600;
}

.button-attach {
  box-shadow: none;
  background: #ffffff;
  border: 1px solid #d7dee8;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  padding: 10px 18px;
  gap: 10px;
}

.button-attach .button-icon {
  font-size: 18px;
}

.button-attach:hover {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.button-link:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-large {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(44, 196, 246, 0.2);
}

.button-compact {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.button-header-action {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

.button:disabled,
.icon-button:disabled,
.inline-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card-content {
  display: grid;
  gap: 24px;
  padding: 24px;
}

.card-content-compact {
  gap: 24px;
}

.message-host {
  min-height: 0;
}

.manager-message-host {
  padding: 24px 24px 0;
}

.details {
  padding: 20px;
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--line-soft);
}

.row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
}

.row + .row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.row-label {
  color: var(--muted);
  font-size: 14px;
}

.row-label.top {
  align-self: start;
  padding-top: 2px;
}

.row-value {
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.inline-button {
  padding: 0;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  width: 100%;
  text-align: left;
}

.inline-button .row-value {
  white-space: normal;
  line-height: 1.3;
}

.inline-input,
.search-input,
.select-input {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  padding: 12px 14px;
  border-radius: 12px;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.inline-input {
  background: transparent;
  border: none;
  padding: 0;
  font-weight: 600;
}

.edit-icon,
.icon-button,
.table-action,
.message-close {
  color: #94a3b8;
  font-size: 18px;
}

.icon-button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
}

.icon-button-round {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.icon-button-round:hover,
.icon-button:hover,
.table-action:hover {
  background: #f1f5f9;
  color: var(--primary-dark);
}

.tree {
  display: grid;
  gap: 8px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 14px;
}

.tree-node-child {
  padding-left: 18px;
}

.tree-node-leaf {
  padding-left: 36px;
  color: var(--primary-dark);
  font-weight: 700;
}

.tree-node-direct-child {
  padding-left: 18px;
}

.tree-icon {
  font-size: 20px;
}

.tree-arrow {
  color: #cbd5e1;
}

.card-footer,
.manager-footer {
  padding: 0;
  display: flex;
  justify-content: center;
}

.manager-footer {
  justify-content: center;
  padding: 24px 24px 28px;
  background: var(--panel);
  border-top: 1px solid var(--line-soft);
}

.create-actions,
.manager-upload-actions {
  display: grid;
  gap: 16px;
  width: 100%;
  justify-items: center;
}

.create-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-content: center;
}

.manager-upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  max-width: 760px;
  justify-content: center;
  margin: 0 auto;
}

.create-actions .button {
  min-height: 48px;
}

.manager-upload-actions .button {
  min-height: 48px;
  flex: 1 1 280px;
  width: 100%;
  min-width: min(280px, 100%);
  max-width: 340px;
  padding-inline: 32px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(44, 196, 246, 0.18);
}

.manager-upload-actions .button-secondary {
  box-shadow: none;
}

.table-panel {
  padding: 24px;
}

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

.muted-badge {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}

.breadcrumb {
  border: none;
  background: transparent;
  color: var(--primary-dark);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  font-size: 15px;
}

.breadcrumb:hover,
.breadcrumb:focus-visible {
  background: transparent;
  color: var(--primary);
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
  cursor: default;
}

.breadcrumb-separator {
  color: #94a3b8;
  font-size: 18px;
}

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  overflow: hidden;
  background: white;
}

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

.file-table thead {
  background: var(--panel);
}

.file-table th,
.file-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.file-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-row:hover {
  background: var(--panel);
}

.file-open-button {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.file-open-button:hover {
  color: var(--primary-dark);
}

.file-icon {
  font-size: 20px;
  color: var(--primary);
}

.file-icon.file-pdf {
  color: #ef4444;
}

.file-icon.file-cad {
  color: #3b82f6;
}

.file-icon.file-zip {
  color: #f59e0b;
}

.table-action {
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
}

.align-right {
  text-align: right;
}

.message {
  width: 100%;
  margin: 0;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
  background: #f2f9f2;
  color: #166534;
  box-shadow: none;
}

.message-error {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: #991b1b;
  box-shadow: 0 10px 24px rgba(153, 27, 27, 0.08);
}

.message-content {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.message-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--success);
  line-height: 1;
  margin-top: 1px;
}

.message-error .message-icon {
  color: var(--danger);
}

.message-copy {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.message-text {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
}

.message-link {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.message-link-icon {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 18px;
}

.message-close {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  align-self: center;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

#attachFolderModal {
  align-items: flex-start;
  overflow-y: auto;
  padding: 12px 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.modal-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
  z-index: 1;
}

.modal-card-narrow {
  width: min(420px, calc(100vw - 32px));
}

#attachFolderModal .modal-card-narrow {
  width: min(860px, calc(100vw - 32px));
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  margin: 0 auto;
}

.modal-card-actions {
  width: min(760px, calc(100vw - 32px));
}

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

.modal-header h2 {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

.modal-header .icon-button {
  flex: 0 0 auto;
}

.company-results {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.company-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  text-align: left;
  cursor: pointer;
}

.company-item:hover {
  border-color: var(--primary);
  background: #f0fbff;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-button span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.action-button:hover {
  background: var(--panel);
  border-color: #cbd5e1;
}

.action-icon,
.button-loader {
  font-family: "Material Symbols Outlined", sans-serif;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.action-button-danger {
  color: var(--danger);
}

.button-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-subtle {
  margin-bottom: 16px;
}

#attachFolderModal .modal-subtle {
  max-width: 760px;
}

#attachFolderModal .search-input {
  width: 100%;
}

.available-folders {
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  margin: 12px 0;
  background: white;
}

.attach-folder-breadcrumbs {
  margin-top: 14px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

#attachFolderModal .modal-footer {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  background: white;
}

.folder-tree {
  display: grid;
  gap: 2px;
  padding: 10px;
}

.folder-tree-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 2px 6px;
}

.folder-tree-row-selected {
  background: #effaff;
  border-radius: 12px;
}

.folder-tree-toggle {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 28px;
}

.folder-tree-toggle:hover,
.folder-tree-toggle:focus-visible {
  background: #f1f5f9;
  color: var(--primary-dark);
}

.folder-tree-toggle-hidden {
  visibility: hidden;
  pointer-events: none;
}

.folder-tree-select {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}

.folder-tree-select:hover,
.folder-tree-select:focus-visible {
  background: var(--panel);
  color: var(--primary-dark);
}

.folder-tree-row-selected .folder-tree-select {
  color: var(--primary-dark);
}

.folder-tree-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.folder-tree-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.folder-tree-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.folder-tree-children {
  display: grid;
  gap: 2px;
}

.folder-tree-empty,
.folder-tree-loading,
.folder-tree-error {
  padding: 14px 16px 14px 52px;
  color: var(--muted);
  font-size: 13px;
}

.folder-tree-error {
  color: #991b1b;
}

.upload-queue {
  display: grid;
  gap: 12px;
}

.upload-row {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel);
}

.upload-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-name {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.upload-status {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.upload-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: white;
  overflow: hidden;
  border: 1px solid var(--line);
}

.upload-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.2s ease;
}

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

.manage-content {
  gap: 20px;
}

.manage-summary .row-value {
  font-weight: 500;
}

.manage-panel {
  padding-top: 0;
}

.manage-table-header {
  margin-bottom: 18px;
}

.manage-folder-list {
  display: grid;
  gap: 14px;
}

.manage-folder-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.manage-folder-main {
  display: grid;
  gap: 10px;
}

.manage-folder-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.manage-folder-heading h3 {
  font-size: 18px;
  line-height: 1.25;
}

.manage-folder-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.manage-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.manage-badge-outline {
  border: 1px solid var(--line);
  color: #475569;
  background: #fff;
}

.manage-source-company {
  background: #e8fbff;
  color: #0284c7;
}

.manage-source-deal {
  background: #ecfdf3;
  color: #15803d;
}

.manage-source-unassigned {
  background: #fff7ed;
  color: #c2410c;
}

.manage-folder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.manage-folder-meta a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.manage-folder-meta a:hover {
  text-decoration: underline;
}

.manage-folder-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.manage-field {
  display: grid;
  gap: 6px;
}

.manage-company-id-field.is-hidden {
  display: none;
}

.manage-attach-button {
  min-height: 48px;
  white-space: nowrap;
}

.manage-empty-state {
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.install-log {
  border-radius: 14px;
  border: 1px dashed var(--line);
  padding: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.install-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.install-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(44, 196, 246, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
}

.install-page {
  min-height: 100vh;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 28px 20px 36px;
  display: grid;
  gap: 0;
}

.install-shell {
  width: min(100%, 1040px);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
}

.install-card {
  width: 100%;
  border-radius: 28px;
  overflow: hidden;
  border-color: rgba(226, 232, 240, 0.92);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.12);
}

.install-hero {
  display: grid;
  gap: 16px;
  padding: 32px 32px 20px;
}

.install-eyebrow,
.install-log-eyebrow {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.install-hero h1 {
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.install-hero-subtle {
  margin-top: -2px;
  font-size: 15px;
  line-height: 1.45;
}

.install-benefits {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.install-benefits li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.install-benefits li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
}

.install-content {
  gap: 16px;
  padding: 0 32px 32px;
}

.install-actions-card,
.install-log-card {
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 22px;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.install-actions-card {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.install-actions-copy {
  display: grid;
  gap: 8px;
}

.install-actions-copy h2 {
  font-size: 18px;
  line-height: 1.2;
}

.install-close-button,
.install-bind-button {
  min-height: 50px;
  padding-inline: 22px;
  border-radius: 14px;
  font-size: 15px;
}

.install-bind-button {
  box-shadow: 0 14px 30px rgba(44, 196, 246, 0.22);
}

.install-log-card {
  padding: 18px 24px;
}

.install-log-details {
  display: grid;
  gap: 14px;
}

.install-log-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
}

.install-log-details summary::-webkit-details-marker {
  display: none;
}

.install-log-details summary::after {
  content: "↓";
  display: inline-block;
  margin-left: 8px;
  font-size: 13px;
  transition: transform 0.2s ease;
}

.install-log-details[open] summary::after {
  transform: rotate(180deg);
}

.install-log {
  margin: 0;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
  border-style: solid;
  border-color: rgba(226, 232, 240, 0.92);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.85), rgba(255, 255, 255, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .table-header,
  .manager-header,
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .message-content {
    flex-direction: column;
  }

  .message-close {
    justify-self: end;
  }

  .install-hero,
  .install-actions-card,
  .manage-folder-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .manager-upload-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .create-actions {
    grid-template-columns: 1fr;
  }

  .manage-folder-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 12px;
  }

  .install-page {
    padding: 18px 14px 28px;
  }

  .shell {
    min-height: 0;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .details,
  .table-panel,
  .card-content,
  .hero,
  .manager-header,
  .manager-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .install-hero,
  .install-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .install-actions-card,
  .install-log-card {
    padding: 18px;
  }

  .install-actions {
    width: 100%;
  }

  .install-close-button,
  .install-bind-button {
    width: 100%;
  }

  .details {
    margin: 0;
  }

  .manager-message-host {
    padding: 16px 16px 0;
  }

  .manager-upload-actions {
    max-width: none;
  }

  .manager-upload-actions .button {
    max-width: none;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .manage-folder-form {
    grid-template-columns: 1fr;
  }
}

.marketplace-entity-card {
  max-width: min(1760px, calc(100vw - 32px));
  margin: 0 auto;
}

.marketplace-app-header {
  padding: 28px 28px 22px;
  border-bottom: 1px solid var(--line);
}

.marketplace-toolbar-card,
.marketplace-explorer,
.marketplace-picker-screen {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.marketplace-toolbar-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 24px;
}

.marketplace-toolbar-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.marketplace-current-entity {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.marketplace-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.marketplace-current-folder {
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}

.marketplace-toolbar-actions,
.marketplace-explorer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-button,
.toolbar-link {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid #dbe3ea;
  background: #ffffff;
  color: #4b5563;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.toolbar-button:hover,
.toolbar-link:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.toolbar-button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.toolbar-button-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.toolbar-button-danger {
  color: #b42318;
}

.toolbar-button-danger:hover {
  background: #fff5f4;
  border-color: #f5c2c7;
  color: #912018;
}

.toolbar-link {
  border: none;
  background: transparent;
  padding-inline: 6px;
}

.toolbar-button:disabled,
.toolbar-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.marketplace-explorer,
.marketplace-picker-screen {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.marketplace-explorer-topbar,
.marketplace-picker-screen-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfcfd;
}

.marketplace-picker-controls {
  display: grid;
  grid-template-columns: minmax(240px, 320px) auto;
  gap: 12px;
  align-items: end;
}

.marketplace-field {
  display: grid;
  gap: 8px;
}

.marketplace-field-title {
  color: var(--muted);
  font-size: 13px;
}

.marketplace-picker-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.marketplace-breadcrumbs {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
  color: #64748b;
  font-size: 14px;
}

.marketplace-breadcrumbs span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marketplace-folder-tree {
  display: grid;
  gap: 0;
  min-height: 280px;
  align-content: start;
  padding: 12px 24px 16px;
}

.marketplace-folder-row,
.marketplace-file-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.marketplace-folder-row:hover,
.marketplace-file-row:hover {
  background: #f9fbfc;
}

.marketplace-folder-row-main,
.marketplace-file-row-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.marketplace-folder-row-icon,
.marketplace-file-row-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  font-size: 16px;
}

.marketplace-folder-row-icon {
  background: #f0f9ff;
  color: #0284c7;
}

.marketplace-file-row-folder .marketplace-file-row-icon {
  background: #fff7ed;
  color: #d97706;
}

.marketplace-file-row-file .marketplace-file-row-icon {
  background: #f8fafc;
  color: #64748b;
}

.marketplace-folder-row-text,
.marketplace-file-row-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.marketplace-folder-row-title,
.marketplace-file-row-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marketplace-folder-row-subtitle,
.marketplace-file-row-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.marketplace-folder-row-actions,
.marketplace-file-row-actions,
.marketplace-binding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.marketplace-explorer .marketplace-breadcrumbs {
  margin: 18px 24px 0;
}

.marketplace-file-list {
  display: grid;
  gap: 0;
  padding: 12px 24px 18px;
}

.marketplace-file-list-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.marketplace-inline-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.marketplace-create-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 0 24px 24px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfd;
}

.marketplace-create-inline .marketplace-field {
  padding-top: 18px;
}

.marketplace-create-field {
  min-width: 0;
}

.marketplace-message {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.marketplace-message-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.marketplace-message-success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success);
}

.marketplace-message-error {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.marketplace-manage-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.marketplace-bindings-list {
  display: grid;
  gap: 14px;
}

.marketplace-binding-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.marketplace-binding-main {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.marketplace-status-badge {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #e2e8f0;
  color: #475569;
}

.marketplace-status-active {
  background: var(--success-soft);
  color: var(--success);
}

.marketplace-status-missing_in_disk,
.marketplace-status-entity_deleted {
  background: var(--danger-soft);
  color: var(--danger);
}

.marketplace-status-inaccessible_for_user,
.marketplace-status-archived {
  background: #fff7ed;
  color: #c2410c;
}

.marketplace-binding-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.marketplace-binding-column {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.marketplace-binding-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 1200px) {
  .install-shell {
    width: min(100%, 920px);
  }
}

@media (max-width: 960px) {
  .marketplace-binding-meta,
  .marketplace-picker-controls,
  .marketplace-picker-toolbar,
  .marketplace-create-inline {
    grid-template-columns: 1fr;
  }

  .marketplace-manage-search {
    grid-template-columns: 1fr;
  }

  .marketplace-binding-main,
  .marketplace-toolbar-card,
  .marketplace-explorer-topbar,
  .marketplace-picker-screen-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .marketplace-toolbar-actions,
  .marketplace-explorer-actions,
  .marketplace-folder-row-actions,
  .marketplace-file-row-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .marketplace-folder-row,
  .marketplace-file-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .marketplace-current-entity {
    font-size: 22px;
  }

  .toolbar-button,
  .marketplace-binding-actions .button {
    width: 100%;
  }
}
