/* lms-sync – screens of this area (see lms.css for shared pieces) */

/* status band of the sync centre */
.sync-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sync-fact { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-inline-end: 1px solid var(--row-line); border-bottom: 1px solid var(--row-line); min-width: 0; }
.sync-fact-label { color: var(--muted); font-size: 12px; text-transform: none; }
.sync-fact-value { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sync-fact-value.big { font-family: var(--mono); font-size: 22px; letter-spacing: -.02em; }
.sync-fact .small { overflow-wrap: anywhere; }

/* "Sync now" panel: what will happen + the big button */
.sync-now { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.sync-now h2 { margin: 0; }
.sync-steps { margin: 8px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
.sync-steps li { line-height: 1.45; }
.sync-now-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 220px; }
.btn.sync-big { font-size: 16px; padding: 14px 22px; justify-content: center; }
.sync-running { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 600; }
.sync-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: sync-spin .8s linear infinite; flex: none; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-spin { animation: none; } }

/* result tiles after a run */
.sync-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.sync-tile { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.sync-tile b { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.sync-tile span { color: var(--muted); font-size: 12px; }
.sync-tile.warn { background: var(--amber-bg); color: var(--amber-fg); border-color: transparent; }
.sync-tile.bad { background: var(--red-bg); color: var(--red-fg); border-color: transparent; }
.sync-tile.warn span, .sync-tile.bad span { color: inherit; }

/* conflict review */
.sync-conflict tr.is-conflict td { background: var(--amber-bg); }
.sync-conflict tr.is-conflict td:first-child { box-shadow: inset 3px 0 0 var(--amber-fg); }
[dir="rtl"] .sync-conflict tr.is-conflict td:first-child { box-shadow: inset -3px 0 0 var(--amber-fg); }
.sync-conflict td { vertical-align: top; overflow-wrap: anywhere; }
.sync-pick { display: flex; gap: 12px; flex-wrap: wrap; }
.sync-pick label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.sync-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; }

/* radio cards (sync mode) */
.sync-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.sync-mode { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: var(--surface); }
.sync-mode:hover { border-color: var(--primary); }
.sync-mode.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.sync-mode input { margin-top: 3px; flex: none; }
.sync-mode b { display: block; margin-bottom: 4px; }
.sync-mode p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.sync-mode.disabled { opacity: .6; cursor: default; }

/* settings sections */
.sync-section { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.sync-section + .sync-section { border-top: 1px solid var(--row-line); padding-top: 16px; }
.sync-section h3 { margin: 0; font-size: 15px; }
.sync-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sync-option { display: flex; flex-direction: column; gap: 2px; }
.sync-option .sync-hint { padding-inline-start: 26px; }
.sync-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; max-height: 220px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sync-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-inline input[type=number] { width: 90px; }

/* message & rule tables */
.sync-excerpt { max-width: 340px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sync-channel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync-hidden { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; }
.sync-rule-checks { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.sync-rule-checks .check { min-height: 26px; font-size: 13px; }
.sync-placeholders { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.sync-placeholders code, .sync-code { font-family: var(--mono); background: var(--gray-bg); color: var(--text); border-radius: 4px; padding: 1px 5px; }
pre.sync-code { display: block; padding: 10px 12px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
tr.sync-off td { color: var(--muted); }

.sync-side { flex: 0 0 340px; display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 100%; }
.sync-side dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; } .sync-side dd { margin: 0; }
@media (max-width: 1100px) { .sync-side { flex: 1 1 100%; } }

.sync-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* per-channel chips */
.sync-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* clickable log rows */
table.grid tr.sync-pickable { cursor: pointer; }
table.grid tr.sync-pickable:hover td { background: var(--gray-bg); }
table.grid tr.sync-picked td { background: var(--blue-bg); }

@media (max-width: 700px) {
    .sync-now { grid-template-columns: 1fr; }
    .sync-now-actions { min-width: 0; }
    .sync-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
