/* Avallo Szkolenia — wygląd spójny z Proposals i panelem (bordo Avallo). */
:root {
  --avallo-primary: #8B1D3F;
  --avallo-primary-dark: #6e1631;
  --avallo-soft: #fbf3f6;
  --avallo-border: #e8dfe4;
  --avallo-ink: #2d2530;
  --avallo-muted: #7d6f77;
  --avallo-ok: #1f7a4d;
  --avallo-warn: #9a6400;
  --bs-primary: #8B1D3F;
  --bs-link-color: #8B1D3F;
  --bs-link-hover-color: #6e1631;
}
html, body { background: #f6f3f5; color: var(--avallo-ink); }
body { min-height: 100vh; display: flex; flex-direction: column; font-family: "Segoe UI", Arial, Helvetica, sans-serif; }
a { color: var(--avallo-primary); }
.tr-main { flex: 1 0 auto; width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 16px 40px; }
.tr-main--wide { max-width: none; padding-left: 16px; padding-right: 16px; }
.tr-footer { text-align: center; color: var(--avallo-muted); font-size: 12px; padding: 14px 0 20px; }

/* Pasek górny */
.tr-topbar { background: #fff; border-bottom: 1px solid var(--avallo-border); border-top: 5px solid var(--avallo-primary); position: sticky; top: 0; z-index: 1030; }
.tr-topbar__inner { max-width: 1240px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tr-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--avallo-primary); font-weight: 700; letter-spacing: .02em; }
.tr-brand img { height: 22px; width: auto; }
.tr-brand span { border-left: 1px solid var(--avallo-border); padding-left: 10px; font-size: 15px; }
.tr-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.tr-nav a, .tr-nav-btn { color: var(--avallo-ink); text-decoration: none; padding: 7px 10px; border-radius: 8px; font-size: 14px; background: none; border: 0; }
.tr-nav a:hover, .tr-nav-btn:hover { background: var(--avallo-soft); color: var(--avallo-primary); }
.tr-nav a.active { background: var(--avallo-primary); color: #fff; }
.tr-user { color: var(--avallo-muted); font-size: 13px; padding: 0 8px; }
.tr-menu-toggle { display: none; margin-left: auto; border: 1px solid var(--avallo-border); background: #fff; border-radius: 8px; padding: 6px 10px; }
@media (max-width: 860px) {
  .tr-menu-toggle { display: inline-block; }
  .tr-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; }
  .tr-nav.open { display: flex; }
  .tr-nav a, .tr-nav-btn { width: 100%; text-align: left; }
  .tr-user { padding: 6px 10px; }
}
.tr-flashes { margin-bottom: 14px; }

/* Przyciski Avallo */
.btn-avallo { background: var(--avallo-primary); border-color: var(--avallo-primary); color: #fff; }
.btn-avallo:hover, .btn-avallo:focus { background: var(--avallo-primary-dark); border-color: var(--avallo-primary-dark); color: #fff; }
.btn-outline-avallo { border-color: var(--avallo-primary); color: var(--avallo-primary); background: #fff; }
.btn-outline-avallo:hover, .btn-outline-avallo:focus { background: var(--avallo-primary); color: #fff; }
.text-avallo { color: var(--avallo-primary) !important; }
.badge-soft { background: var(--avallo-soft); color: var(--avallo-primary); border: 1px solid var(--avallo-border); font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: #c98aa0; box-shadow: 0 0 0 .2rem rgba(139, 29, 63, .15); }
.form-check-input:checked { background-color: var(--avallo-primary); border-color: var(--avallo-primary); }

/* Karty i nagłówki */
.tr-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tr-page-head h1 { font-size: 1.45rem; margin: 0; color: var(--avallo-primary); font-weight: 700; }
.tr-page-head p { margin: 4px 0 0; color: var(--avallo-muted); }
.tr-card { background: #fff; border: 1px solid var(--avallo-border); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.tr-card h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; }
.tr-muted { color: var(--avallo-muted); }
.tr-crumbs { font-size: 13px; color: var(--avallo-muted); margin-bottom: 8px; }
.tr-crumbs a { text-decoration: none; }
.tr-empty { text-align: center; color: var(--avallo-muted); padding: 26px 10px; }

/* Siatka folderów i szkoleń */
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tr-tile { display: block; background: #fff; border: 1px solid var(--avallo-border); border-radius: 12px; padding: 14px; text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s; min-height: 92px; }
.tr-tile:hover { border-color: #d7b9c5; box-shadow: 0 6px 18px rgba(139, 29, 63, .08); color: inherit; }
.tr-tile__icon { color: var(--avallo-primary); font-size: 20px; }
.tr-tile__title { font-weight: 700; margin-top: 6px; overflow-wrap: anywhere; }
.tr-tile__meta { font-size: 12px; color: var(--avallo-muted); margin-top: 4px; }
.tr-tile--folder { background: var(--avallo-soft); }
.tr-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
@media (max-width: 900px) { .tr-layout { grid-template-columns: 1fr; } }
.tr-tree { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.tr-tree a { display: block; padding: 5px 8px; border-radius: 8px; text-decoration: none; color: var(--avallo-ink); overflow-wrap: anywhere; }
.tr-tree a.active, .tr-tree a:hover { background: var(--avallo-soft); color: var(--avallo-primary); }

/* Materiały */
.tr-materials { list-style: none; padding: 0; margin: 0; }
.tr-material { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #f0e8ec; flex-wrap: wrap; }
.tr-material:last-child { border-bottom: 0; }
.tr-material__icon { width: 34px; height: 34px; border-radius: 9px; background: var(--avallo-soft); color: var(--avallo-primary); display: flex; align-items: center; justify-content: center; flex: none; }
.tr-material__body { flex: 1 1 220px; min-width: 0; }
.tr-material__title { font-weight: 600; overflow-wrap: anywhere; }
.tr-material__meta { font-size: 12px; color: var(--avallo-muted); }
.tr-material__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tr-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.tr-status--done { background: #e7f5ee; color: var(--avallo-ok); }
.tr-status--open { background: #fff5e3; color: var(--avallo-warn); }
.tr-status--new { background: #f1eef0; color: var(--avallo-muted); }
.tr-progress { height: 8px; border-radius: 999px; background: #efe6ea; overflow: hidden; }
.tr-progress > span { display: block; height: 100%; background: var(--avallo-primary); }

/* Tabela postępu */
.tr-matrix { font-size: 13px; }
.tr-matrix th { white-space: nowrap; }
.tr-matrix th.tr-rot { max-width: 150px; white-space: normal; font-weight: 600; vertical-align: bottom; }
.tr-cell { white-space: nowrap; }
.tr-cell--done { color: var(--avallo-ok); }
.tr-cell--open { color: var(--avallo-warn); }
.tr-cell--none { color: #b9adb3; }

/* Logowanie / dostęp */
.tr-auth { max-width: 440px; margin: 40px auto; }
.tr-auth .tr-card { padding: 28px; }
.tr-auth h1 { font-size: 1.35rem; color: var(--avallo-primary); font-weight: 700; }

/* Przeglądarka materiału: znak wodny i ochrona */
.tr-protected { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tr-protected img, .tr-protected video, .tr-protected canvas { -webkit-user-drag: none; user-drag: none; }
.tr-viewer { position: relative; background: #fff; border: 1px solid var(--avallo-border); border-radius: 14px; overflow: hidden; }
.tr-viewer__content { position: relative; }
.tr-watermark { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.tr-watermark svg { width: 100%; height: 100%; display: block; }
.tr-doc { padding: 28px 22px; background: #eceaec; }
.tr-doc .doc-page { background: #fff; max-width: 210mm; min-height: 200px; margin: 0 auto; padding: 20mm 18mm; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); overflow-wrap: anywhere; }
.tr-doc .doc-page img { max-width: 100%; height: auto; }
@media (max-width: 600px) { .tr-doc { padding: 10px 6px; } .tr-doc .doc-page { padding: 14px 12px; } }
.tr-pdf { background: #eceaec; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 240px; }
.tr-pdf__page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); max-width: 100%; }
.tr-pdf__page canvas { display: block; max-width: 100%; height: auto; }
.tr-media { background: #111; display: flex; justify-content: center; align-items: center; position: relative; }
.tr-media img { max-width: 100%; max-height: 80vh; display: block; }
.tr-media video { width: 100%; max-height: 80vh; display: block; background: #000; }
.tr-slides { padding: 12px; background: #f3f0f2; }
.tr-viewer-nav { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tr-ack-inline { margin-top: 16px; text-align: center; }
.tr-ack-done { display: inline-flex; align-items: center; gap: 8px; color: var(--avallo-ok); font-weight: 600; background: #e7f5ee; border-radius: 10px; padding: 10px 14px; }
@media print { body.tr-protected * { visibility: hidden !important; } body.tr-protected::after { content: 'Drukowanie materiałów szkoleniowych jest wyłączone.'; visibility: visible; } }

/* Pływający pasek potwierdzenia (jak karta klienta w Team Points) */
.tr-ack-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97); border-top: 1px solid #e5e7eb; box-shadow: 0 -4px 20px rgba(0, 0, 0, .08); transition: transform .22s ease, opacity .22s ease; }
.tr-ack-sticky--hidden { transform: translateY(100%); opacity: 0; pointer-events: none; }
.tr-ack-sticky form { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tr-ack-sticky__text { flex: 1; min-width: 140px; font-size: 14px; }
.tr-ack-sticky .btn { flex-shrink: 0; min-height: 48px; font-weight: 600; }
body.tr-ack-pad { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (max-width: 576px) { .tr-ack-sticky form { flex-direction: column; align-items: stretch; } .tr-ack-sticky .btn { width: 100%; } }

/* Lista materiałów odbiorcy */
.tr-steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.tr-steps li { counter-increment: step; }
.tr-steps a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--avallo-border); border-radius: 12px; margin-bottom: 8px; text-decoration: none; color: inherit; background: #fff; }
.tr-steps a:hover { border-color: #d7b9c5; }
.tr-steps a::before { content: counter(step); width: 30px; height: 30px; border-radius: 50%; background: var(--avallo-soft); color: var(--avallo-primary); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }

/* Edytory */
.tr-editor-bar { position: sticky; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--avallo-border); padding: 10px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tr-save-status { font-size: 13px; color: var(--avallo-muted); }
.table > :not(caption) > * > * { vertical-align: middle; }
.tr-table-wrap { overflow-x: auto; }
.tr-secret { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 15px; background: var(--avallo-soft); padding: 2px 8px; border-radius: 6px; overflow-wrap: anywhere; }

/* Word / PowerPoint — przyciski i kafelki w kolorach marek */
.btn-word { background: #185abd; border-color: #185abd; color: #fff; }
.btn-word:hover, .btn-word:focus, .btn-word:active { background: #103f91; border-color: #103f91; color: #fff; }
.btn-ppt { background: #c43e1c; border-color: #c43e1c; color: #fff; }
.btn-ppt:hover, .btn-ppt:focus, .btn-ppt:active { background: #a1320f; border-color: #a1320f; color: #fff; }
.tr-ico-word { color: #185abd; }
.tr-ico-ppt { color: #c43e1c; }
.tr-ico-avallo { color: var(--avallo-primary); }
.tr-material__icon--word { background: #e8effa; color: #185abd; }
.tr-material__icon--pptx { background: #fbece7; color: #c43e1c; }
.tr-create-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tr-create-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 150px; padding: 18px 12px; margin: 0; background: #fff; border: 2px dashed var(--avallo-border); border-radius: 14px;
  cursor: pointer; color: inherit; transition: border-color .15s, box-shadow .15s, background .15s; }
.tr-create-tile:hover, .tr-create-tile:focus-visible { border-color: var(--avallo-primary); background: var(--avallo-soft); box-shadow: 0 6px 18px rgba(139, 29, 63, .08); }
.tr-create-tile i { font-size: 38px; }
.tr-create-tile__title { font-weight: 700; font-size: 16px; }
.tr-create-tile__meta { font-size: 12px; color: var(--avallo-muted); }
@media (max-width: 576px) { .tr-create-tile { min-height: 110px; } .tr-material__actions { width: 100%; } }
