:root {
  --ink: #17202f;
  --muted: #667085;
  --line: #d0d5dd;
  --panel: #ffffff;
  --soft: #eef2f6;
  --field: #ffffff;
  --accent: #0f766e;
  --accent-dark: #075e54;
  --accent-soft: #e6f4f1;
  --highlight: #b54708;
  --danger: #b42318;
  --success: #027a48;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--soft); font-family: "Segoe UI", Arial, sans-serif; }
.has-client-banner { --client-banner-height: 42px; padding-top: var(--client-banner-height); }
.has-client-banner .sidebar { top: var(--client-banner-height); }
.client-connection-banner { position: fixed; inset: 0 0 auto; z-index: 1100; padding: 10px 20px; background: #075e54; color: #fff; font-size: 14px; line-height: 22px; overflow-wrap: anywhere; box-shadow: 0 1px 4px #0002; }
.client-connection-error { background: #9a3412; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 30px; }
h2 { margin-bottom: 8px; font-size: 18px; }
button, input, select { min-height: 42px; border-radius: 8px; font: inherit; }
button { border: 0; padding: 0 18px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-dark); }
button:disabled { cursor: wait; opacity: .58; }
input, select { width: 100%; border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow { margin-bottom: 4px; color: var(--highlight); font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; padding: 20px 12px; background: #17212b; color: #eaf0f6; }
.brand { display: block; margin: 0 8px 28px; color: #fff; font-size: 21px; font-weight: 700; text-decoration: none; }
.brand-subtitle { display: block; margin-top: 3px; margin-left: 14px; color: #8bd6c8; font-size: 12px; line-height: 1.4; font-weight: 500; }
.sidebar p { margin: 0 10px 8px; color: #9aabba; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.sidebar a:not(.brand) { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 7px; color: #d7e1eb; font-size: 14px; text-decoration: none; }
.sidebar a.active { background: #23483f; color: #fff; }
.sidebar a span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 5px; background: rgba(255,255,255,.1); font-size: 10px; font-weight: 700; }
.admin-shell { min-height: 100vh; margin-left: 236px; padding: 28px; }
.topbar, .top-actions, .admin-actions { display: flex; align-items: center; }
.topbar { justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.top-actions, .admin-actions { gap: 10px; }
.secondary-button { border: 1px solid var(--line); background: var(--field); color: var(--muted); }
.secondary-button:hover { background: #f8fafc; color: var(--ink); }
.info-panel, .panel { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 18px; }
.info-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.info-panel h2 { margin-bottom: 5px; }
.info-panel p { margin-bottom: 0; }
.status { padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.pending { background: #fff4e5; color: #9a4d00; }
.status.success { background: #ecfdf3; color: var(--success); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr); gap: 18px; align-items: start; }
.primary-connection { margin-bottom: 18px; }
.primary-connection summary { cursor: pointer; font-size: 18px; font-weight: 700; }
.primary-connection > p { margin: 12px 0 0; }
.users-grid { grid-template-columns: minmax(430px, .95fr) minmax(540px, 1.05fr); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.single-column { grid-template-columns: 1fr; }
.check-label { display: flex; align-items: center; gap: 8px; padding-top: 22px; }
.check-label input { width: 18px; min-height: 18px; height: 18px; }
.form-error { min-height: 20px; margin-bottom: 14px; color: var(--danger); font-size: 13px; }
.form-error.success-text { color: var(--success); }
.result { display: grid; gap: 0; margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.result div { display: grid; grid-template-columns: 42% 58%; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.result div:last-child { border-bottom: 0; }
.result span { color: var(--muted); }
.result strong { overflow-wrap: anywhere; }
.result.empty { display: block; padding: 13px; color: var(--muted); font-size: 13px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { background: #f3f6f9; color: var(--muted); font-size: 12px; }
.admin-actions-cell { white-space: nowrap; }
.table-button { min-height: 33px; margin: 0 4px 4px 0; padding: 0 9px; font-size: 12px; }
.danger-button { background: var(--danger); }
.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 410px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 28px; box-shadow: 0 12px 32px rgba(15, 23, 42, .09); }
.login-card form { display: grid; gap: 14px; margin-top: 22px; }
.login-card .form-error { margin: 0; }
.empty-home { max-width: 700px; }
.empty-home p { margin-bottom: 0; }
.article-filters { margin-bottom: 18px; }
.article-filter-grid { grid-template-columns: 1fr 2fr 1fr 1fr; }
.article-results-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.article-pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
#articles-table th, #articles-table td { padding: 4px; }
#articles-table td { white-space: pre-line; overflow-wrap: anywhere; }
#articles-table th:first-child { width: 36px; }
#articles-table th:nth-child(2) { width: 18%; }
#articles-table th:nth-child(4) { width: 18%; }
#articles-table th.code-column { width: 25%; }
#articles-table th[data-variant-column] { width: 8%; }
#articles-table.has-variants th:nth-child(2), #articles-table.has-variants th:nth-child(4) { width: 12%; }
#articles-table.has-variants th.code-column { width: 18%; }
#articles-table th:last-child { width: 68px; }
#articles-table .selection-cell { text-align: center; vertical-align: middle; }
#articles-table .article-select { width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
#articles-table tr.is-selected { background: var(--accent-soft); }
#articles-table .image-cell { text-align: center; vertical-align: middle; }
#articles-table .image-placeholder { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 16px; min-height: 16px; padding: 0; border-radius: 3px; vertical-align: middle; background: transparent; color: var(--accent); }
#articles-table .image-placeholder:hover { background: var(--accent-soft); }
#articles-table .image-placeholder:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#articles-table .image-placeholder:disabled { color: var(--muted); opacity: .35; cursor: default; }
.image-preview { position: fixed; z-index: 1000; width: min(280px, calc(100vw - 16px)); padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 28px rgba(15, 23, 42, .18); }
.image-preview-content { display: grid; place-items: center; height: min(250px, calc(100vh - 90px)); min-height: 40px; }
.image-preview-content img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.image-preview p { margin: 8px 0 0; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.catalog-section { margin-bottom: 18px; }
.catalog-table-wrap { margin-top: 14px; }
.compact-table th, .compact-table td { padding: 4px; overflow-wrap: anywhere; }
.compact-table td { max-width: 430px; }
.compact-table .table-button { margin: 2px 4px 2px 0; }
.table-link { display: inline-block; padding: 6px 2px; margin-right: 8px; color: var(--accent); font-size: 13px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 14px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.upload-line { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.upload-line label { flex: 1; min-width: 220px; }
.upload-line input { padding: 8px; }
.catalog-notes { color: var(--muted); font-size: 13px; padding-left: 20px; line-height: 1.6; }
.catalog-check { padding: 0; margin: 18px 0; }
.catalog-check input { flex-shrink: 0; }
.cell-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.catalog-warning { color: var(--highlight); font-size: 13px; }
#template-detail details { margin-top: 18px; }
#template-detail summary { cursor: pointer; font-weight: 600; }
#mapping-node { max-width: 100%; }
.top-actions { flex-wrap: wrap; }
.field-add-row { display: grid; grid-template-columns: 1fr 2fr auto; align-items: end; gap: 14px; margin: 18px 0; }
#field-rules-table { min-width: 1020px; }
.field-schema-scroll { max-height: 650px; overflow: auto; }
.field-schema-scroll th { position: sticky; top: 0; z-index: 1; }
#field-rules-table th:first-child { width: 28%; }
#field-rules-table th:nth-child(2) { width: 15%; }
#field-rules-table th:nth-child(3) { width: 29%; }
#field-rules-table th:nth-child(4) { width: 21%; }
#field-rules-table select, #field-rules-table textarea { width: 100%; min-height: 36px; padding: 5px 7px; margin: 2px 0; font: inherit; }
#field-rules-table textarea { resize: vertical; border: 1px solid var(--line); border-radius: 7px; background: var(--field); color: var(--ink); }
.field-preview-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.requirements-panel { margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.requirements-panel > label { max-width: 340px; }
.requirements-table { margin-top: 12px; max-height: 360px; overflow: auto; }
.requirements-table th { position: sticky; top: 0; z-index: 1; }
.requirement-label { display: block; margin-top: 4px; font-size: 12px; }
.requirement-required { color: #a12323; }
.requirement-done { color: #167345; font-weight: 600; }
.requirement-unknown { color: #865a08; }
.requirement-not_required { color: var(--muted); }
.requirement-details { margin: 4px 0; font-size: 12px; }
.requirement-details summary { cursor: pointer; color: var(--accent); }
.requirement-details p { max-width: 550px; line-height: 1.5; white-space: normal; }
.field-preview-table th:nth-child(2) { width: 55%; }
@media (max-width: 900px) {
  .sidebar { width: 68px; padding: 18px 8px; }
  .brand { margin: 0 0 28px; font-size: 0; text-align: center; }
  .brand::after { content: "O"; font-size: 21px; }
  .brand-subtitle { display: none; }
  .sidebar p, .sidebar a:not(.brand) { font-size: 0; justify-content: center; }
  .sidebar a:not(.brand) { padding: 8px; }
  .admin-shell { margin-left: 68px; padding: 20px; }
}
@media (max-width: 700px) {
  .admin-shell { padding: 16px; }
  .topbar, .info-panel { align-items: flex-start; flex-direction: column; }
  .admin-grid, .form-grid, .field-add-row { grid-template-columns: 1fr; }
  .check-label { padding-top: 0; }
}
.logistics-options { display: flex; flex-wrap: wrap; gap: 12px 24px; max-height: 220px; overflow: auto; }
#logistics-picker { margin-bottom: 18px; }
.logistics-options .check-label { display: flex; align-items: center; gap: 8px; padding-top: 0; }
