/* ============================================================
   Rise — application-specific overrides

   Selektory specyficzne dla domeny Rise (zlecenia, podzlecenia,
   ekrany auth, Quick Actions trigger, Lato Light wordmark).
   Cały reszta design system Rise (tokeny --brand-*/--ink-*/--status-*,
   komponenty .r-*, modale, toasty) żyje w bibliotece
   Standalone/Codli.Design i jest ładowana przez
   _content/Codli.Design/css/codli-design.css w index.html.

   Ten plik definiuje:
   - .rise-qa     — override <QuickActionMenu> (granatowy trigger)
   - .rise-card-* — karty zleceń + wariant podzlecenia z accent rail
   - .rise-row, .rise-pin, .rise-sub-* — utility kart zleceń
   - .auth-*      — shell ekranów logowania/rejestracji/odzyskiwania
   - .rise-wordmark — Lato Light dla nazwy "Rise" (branding invariant)

   v0.4 (2026-05-07): wciągnięte z Codli.Design extras.css:
   - .request-actions, request-details-modal (.r-meta-*, .r-detail-*)
   - .r-table* — tabela zleceń z hierarchią parent/child
   - chipy filtrów statusów + .r-filter-*
   - .r-dashboard-* + selektor wariantów Classic/Kanban/Focus
   - .r-history-* — chat bubbles + event rows historii statusów
   - .request-details-meta-person, .r-table-title-link, .r-details-footer-*
   - .r-compound-* — karta podzlecenia w modalu
   - .r-spec-toggle-* — lista specjalizacji w EditUserModal (Admin)
   - .r-mcp-* — MCP agent switcher (integracje)
   ============================================================ */

/* ============================================================
   QUICK ACTIONS PANEL — wariant Rise dla <QuickActionMenu Class="rise-qa">.
   Mockup: drawer wysuwany z prawej krawędzi, biały panel 320px,
   granatowy trigger 36×56 z błyskawicą, sekcje mono-uppercase,
   akcje z chip-ikoną 28×28, footer ze skrótem klawiszowym.
   ============================================================ */
.rise-qa {
    --blazing-qa-panel-width: 320px;
    --blazing-qa-trigger-width: 36px;
}

.rise-qa .blazing-qa-trigger {
    background: var(--brand-700);
    color: white;
    border-radius: 10px 0 0 10px;
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.35),
                inset 1px 0 0 rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 300ms cubic-bezier(0.32, 0.72, 0.24, 1),
                background var(--d-fast),
                box-shadow var(--d-fast);
}

.rise-qa .blazing-qa-trigger:hover {
    background: var(--brand-600);
    box-shadow: 0 6px 24px rgba(26, 35, 126, 0.45),
                inset 1px 0 0 rgba(255, 255, 255, 0.1);
}

.rise-qa .blazing-qa-trigger:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus-ring),
                0 6px 20px rgba(26, 35, 126, 0.35);
}

.rise-qa .blazing-qa-trigger svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    /* "zap" path leans left in its viewBox — nudge 1px to optically center it */
    transform: translateX(1px);
}

.rise-qa .blazing-qa-panel {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -12px 0 32px rgba(7, 9, 37, 0.08);
    color: var(--text-primary);
}

/* Header */
.r-qa-header {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.r-qa-header-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: var(--brand-700);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.r-qa-header-icon svg { width: 14px; height: 14px; stroke-width: 2; }

.r-qa-header-text { flex: 1; min-width: 0; }

.r-qa-header-title {
    font-size: var(--t-body);
    font-weight: 600;
    letter-spacing: var(--tracking-snug);
    color: var(--text-primary);
}

.r-qa-header-context {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.r-qa-header-context-detail {
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-sans);
}

.r-qa-header-close {
    margin-top: -2px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    border: 0;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background var(--d-fast), color var(--d-fast);
}

.r-qa-header-close:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.r-qa-header-close svg { width: 14px; height: 14px; }

/* Body */
.rise-qa .blazing-qa-panel-body { padding: 4px 0 12px; }

/* Section header */
.r-qa-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 8px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.r-qa-section-header-count { color: var(--ink-400); }

/* Action row (button) */
.r-qa-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 10px 18px;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background var(--d-fast);
    font-family: inherit;
}

.r-qa-action:hover { background: var(--bg-muted); }
.r-qa-action:focus-visible { outline: none; background: var(--bg-muted); box-shadow: inset 3px 0 0 var(--brand-500); }

.r-qa-action.is-danger { color: var(--status-rejected-fg); }

.r-qa-action-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--bg-muted);
    color: var(--brand-700);
}

.r-qa-action-icon svg { width: 14px; height: 14px; stroke-width: 2; }

.r-qa-action.is-primary .r-qa-action-icon {
    background: var(--brand-700);
    color: #fff;
}

.r-qa-action.is-danger .r-qa-action-icon {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-fg);
}

.r-qa-action-body { flex: 1; min-width: 0; }

.r-qa-action-label {
    display: block;
    font-size: var(--t-small);
    font-weight: 500;
    line-height: 1.3;
}

.r-qa-action-hint {
    display: block;
    margin-top: 1px;
    font-size: var(--t-micro);
    color: var(--text-tertiary);
}

.r-qa-action .r-kbd { flex-shrink: 0; }

/* Toggle row */
.r-qa-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 8px 18px;
}

.r-qa-toggle-row.is-child { padding-left: 36px; }

.r-qa-toggle-row-text { flex: 1; min-width: 0; }

.r-qa-toggle-row-label {
    display: block;
    font-size: var(--t-small);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.r-qa-toggle-row-hint {
    display: block;
    margin-top: 1px;
    font-size: var(--t-micro);
    color: var(--text-tertiary);
}

/* Filter pills container */
.r-qa-pills {
    padding: 4px 18px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.r-qa-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-subtle);
    background: #fff;
    color: var(--text-secondary);
    font-size: var(--t-caption);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast);
    font-family: inherit;
}

.r-qa-pill:hover { border-color: var(--border-default); }

.r-qa-pill.is-on {
    border-color: var(--brand-300);
    background: var(--brand-50);
    color: var(--brand-700);
}

.r-qa-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: var(--ink-300);
    flex-shrink: 0;
}

.r-qa-pill.is-on .r-qa-pill-dot { background: var(--brand-500); }

/* Separator */
.r-qa-separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 0;
    border: 0;
}

/* Footer */
.r-qa-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-muted);
    font-size: var(--t-micro);
    color: var(--text-tertiary);
}

.r-qa-footer-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.r-qa-footer-shortcut > span:last-child { margin-left: 4px; }

.r-qa-footer-context { font-family: var(--font-mono); }

/* ============================================================
   KARTA ZLECENIA — kluczowy komponent
   ============================================================ */
.rise-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--d-fast), box-shadow var(--d-fast), transform var(--d-fast);
    display: flex;
    flex-direction: column;
}
.rise-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); }
.rise-card.is-pinned {
    border-color: var(--brand-200);
    box-shadow: 0 0 0 1px var(--brand-100), var(--shadow-xs);
}

.rise-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border-subtle);
    min-width: 0;
}
.rise-card-cat {
    font-size: var(--t-caption);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: var(--tracking-snug);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.rise-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.rise-pin { color: var(--brand-600); display: grid; place-items: center; }

.rise-card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    /* Bez min-width: 0 dziecko (.rise-sub-meta-row) z długim tekstem
       potrafi rozepchać body poza szerokość karty (overflow: hidden tylko
       przycina wizualnie — meta-row idzie poza prawą krawędź). */
    min-width: 0;
}
.rise-card-title {
    font-size: var(--t-body);
    font-weight: 600;
    line-height: var(--lh-snug);
    color: var(--text-primary);
    letter-spacing: var(--tracking-snug);
}
.rise-card-desc {
    margin: 0;
    font-size: var(--t-small);
    color: var(--text-secondary);
    line-height: var(--lh-normal);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}
.rise-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    min-width: 0;
}
.rise-card-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--t-micro);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Stopka akcji wewnątrz karty zlecenia (RequestActionButtons) */
.rise-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin-top: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--border-subtle);
}

/* Wariant podzlecenia */
.rise-card-sub {
    display: flex;
    flex-direction: row;
    padding-left: 0;
}
.rise-card-sub .rise-sub-rail {
    width: 4px;
    background: linear-gradient(180deg, var(--brand-400), var(--brand-700));
    flex-shrink: 0;
}
.rise-card-sub .rise-card-body { padding: 12px 14px; }
.rise-sub-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    min-width: 0;
}
/* Pin button wrapper — nie kurczy się i nie nakłada na meta-text. */
.rise-sub-meta-row > .r-row {
    flex-shrink: 0;
}

.rise-sub-meta {
    /* display: flex (nie inline-flex) — z flex-basis: 0 pozwala na poprawne
       skracanie szerokości w wąskich kartach (inline-flex+auto basis nie
       skracał poniżej max-content nawet z min-width: 0). */
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--t-micro);
    color: var(--brand-700);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}
/* SVG i tekst "PODZLECENIE" nie kurczą się — tylko parent-title (ellipsis). */
.rise-sub-meta > svg,
.rise-sub-meta > span:not(.rise-sub-parent) { flex-shrink: 0; }
.rise-sub-sep { color: var(--ink-300); flex-shrink: 0; }
.rise-sub-parent {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
/* ============================================================
   AUTH SHELL — Login / Register / ForgotPassword / ResetPassword
   Wzór: Codli Design (codli-docs-login.jsx).
   Desktop: dwie kolumny — brand (themed solid + dot pattern) | form.
   Mobile: jedna kolumna — gradient bg + hero + biała karta formularza.
   ============================================================ */
.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    width: 100%;
    min-height: 100vh;
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

/* ── Lewy panel (brand) ── */
.auth-brand {
    position: relative;
    overflow: hidden;
    background: var(--brand-700);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 40px 48px;
}
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 60%, black 0%, transparent 75%);
            mask-image: radial-gradient(ellipse at 30% 60%, black 0%, transparent 75%);
    pointer-events: none;
}
.auth-brand::after {
    content: '';
    position: absolute;
    top: -160px;
    right: -160px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }

.auth-brand-top {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.auth-brand-chip {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: rgba(255,255,255,0.95);
    color: var(--brand-700);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: -0.04em;
    font-family: var(--font-sans);
}

.auth-brand-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: auth-brand-enter 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.auth-brand-logo {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    animation: auth-brand-breathe 7s ease-in-out 1.2s infinite;
    will-change: transform;
}
.auth-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.auth-brand-name {
    font-size: 56px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 32px 0 16px;
    text-wrap: balance;
}

@keyframes auth-brand-enter {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes auth-brand-breathe {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-brand-center,
    .auth-brand-logo { animation: none; }
}
.auth-brand-tagline {
    font-size: 16px;
    color: rgba(255,255,255,0.72);
    line-height: 1.5;
    margin: 0;
    max-width: 360px;
}

.auth-brand-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.auth-brand-foot-dot {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}
.auth-brand-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.auth-brand-status-led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}

/* ── Prawy panel (formularz) ── */
.auth-form {
    position: relative;
    display: flex;
    flex-direction: column;
}
.auth-form-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 48px;
}
.auth-form-eyebrow {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.auth-form-eyebrow strong {
    color: var(--brand-700);
    font-weight: 500;
}

.auth-form-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 48px 48px;
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
}
.auth-form-mobile-hero { display: none; }
.auth-form-mobile-foot { display: none; }
.auth-form-title {
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.auth-form-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 32px;
}
.auth-form-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-form-fields .r-field { gap: 6px; }
.auth-form-fields .r-input {
    width: 100%;
}
.auth-form-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.auth-form .r-btn-primary {
    width: 100%;
    height: 48px;
    margin-top: 8px;
}
.auth-form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: var(--text-tertiary);
    font-size: 11px;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.auth-form-divider::before,
.auth-form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}
.auth-form-sso {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.auth-form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 2px;
}
.auth-form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-700);
}

.auth-form-link {
    font-size: 12px;
    color: var(--brand-700);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}
.auth-form-link:hover { text-decoration: underline; }

.auth-muted-link {
    font-size: 13px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.auth-muted-link:hover { text-decoration: underline; }

/* ── remembered accounts ── */
.auth-account-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    background: var(--bg-surface);
    cursor: pointer;
    margin-bottom: 8px;
    transition: background var(--d-fast, .12s), border-color var(--d-fast, .12s);
}
.auth-account-card:hover {
    background: var(--bg-muted);
    border-color: var(--brand-500);
}
.auth-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--r-pill);
    background: var(--brand-100);
    color: var(--brand-700);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.auth-avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 26px;
    margin: 6px auto 10px;
}
.auth-account-info { display: flex; flex-direction: column; min-width: 0; }
.auth-account-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.auth-account-mail { font-size: 12px; color: var(--text-tertiary); }
.auth-account-tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    flex-shrink: 0;
}
.auth-tag-trust { background: var(--status-done-bg); color: var(--status-done-fg); }
.auth-tag-key   { background: var(--status-acceptance-bg); color: var(--status-acceptance-fg); }
/* Szybki przycisk logowania kluczem na karcie konta — duży, dotykowy target (≥44px). */
.auth-account-key {
    margin-left: auto;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    min-width: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    border: 1px solid var(--border-default);
    background: var(--status-acceptance-bg);
    color: var(--status-acceptance-fg);
    cursor: pointer;
    transition: filter var(--d-fast, .12s), border-color var(--d-fast, .12s), transform var(--d-fast, .12s);
}
.auth-account-key svg { width: 22px; height: 22px; }
.auth-account-key:hover { border-color: var(--status-acceptance-fg); filter: brightness(0.97); }
.auth-account-key:active { transform: scale(0.96); }
.auth-account-key:disabled { opacity: .5; cursor: default; }
.auth-form-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.auth-passkey-prompt {
    text-align: center;
    font-size: 40px;
    margin: 8px 0;
}

.auth-form-bottom {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
    gap: var(--s-3);
    flex-wrap: wrap;
}
.auth-form-bottom a,
.auth-form-bottom .auth-form-link {
    color: var(--brand-700);
    font-weight: 500;
    text-decoration: none;
}
.auth-form-bottom-domain {
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
}

/* Lang switcher (PL / EN) — fixed top-right.
   Desktop: tone "on-light" (osadzony nad białym formularzem).
   Mobile: tone "on-dark" (na gradiencie). */
.auth-lang {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 50;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-xs);
}
.auth-lang-btn {
    border: 0;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
}
.auth-lang-btn.is-active {
    background: var(--bg-surface);
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}
@media (max-width: 960px) {
    .auth-lang {
        top: 18px;
        right: 18px;
        background: rgba(255,255,255,0.1);
        border-color: rgba(255,255,255,0.18);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: none;
    }
    .auth-lang-btn { color: rgba(255,255,255,0.7); }
    .auth-lang-btn.is-active {
        background: rgba(255,255,255,0.95);
        color: var(--brand-700);
    }
}

.auth-form-back {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
}
.auth-form-back a {
    color: var(--brand-700);
    font-weight: 500;
    text-decoration: none;
}
.auth-form-back a:hover { text-decoration: underline; }

.auth-alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    font-size: var(--t-small);
    margin-bottom: var(--s-3);
}
.auth-alert-error {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-fg);
}
.auth-alert-success {
    background: var(--status-done-bg);
    color: var(--status-done-fg);
}

/* Wordmark "Rise" — zawsze Lato Light, niezależnie od kontekstu (sidebar, splash, ekrany auth). */
.rise-wordmark {
    font-family: 'Lato', var(--font-sans), sans-serif !important;
    font-weight: 300 !important;
    letter-spacing: 0.01em;
}
/* ==========================================================================
   PHASE M3 — Auth screens + form modals
   ========================================================================== */

/* M3.1 — Auth screens phone/tablet.
   Brand "kapuza" na górze (themed solid + dot pattern + accent glow),
   biały formularz pod nią. Wzór: codli-docs-login.jsx::ScreenCodliLoginMobile. */
@media (max-width: 960px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        background: var(--bg-app);
        color: var(--text-primary);
        min-height: 100vh;
    }

    .auth-brand {
        padding: 20px 24px 22px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .auth-brand::before {
        background-size: 18px 18px;
        -webkit-mask-image: radial-gradient(ellipse at 30% 100%, black 0%, transparent 75%);
                mask-image: radial-gradient(ellipse at 30% 100%, black 0%, transparent 75%);
    }
    .auth-brand::after {
        top: -120px;
        right: -120px;
        width: 280px;
        height: 280px;
    }
    .auth-brand-center {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    .auth-brand-logo {
        width: 36px;
        height: 36px;
    }
    .auth-brand-logo img { width: 100%; height: 100%; }
    .auth-brand-name {
        font-size: 22px;
        font-weight: 600;
        letter-spacing: -0.02em;
        margin: 0;
    }

    .auth-form {
        background: var(--bg-app);
    }
    .auth-form-top { display: none; }
    .auth-form-inner {
        max-width: 100%;
        margin: 0;
        padding: 28px 24px 16px;
        gap: 16px;
    }
    .auth-form-card {
        background: transparent;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    .auth-form-title { font-size: 28px; line-height: 1.1; margin: 0 0 4px; }
    .auth-form-subtitle { font-size: 13px; margin: 0 0 4px; }
    .auth-form .r-btn-primary { margin-top: 4px; }

    .auth-form-mobile-foot {
        display: flex;
        justify-content: center;
        padding: 16px 0 20px;
        font-size: 11px;
        color: var(--text-tertiary);
        font-family: var(--font-mono);
        letter-spacing: 0.06em;
    }
}

@media (max-width: 480px) {
    .auth-form-title { font-size: 24px; }
}

/* ============================================================
   REQUEST ACTION BUTTONS — kontener przycisków akcji w karcie/tabeli
   ============================================================ */
.request-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* ============================================================
   REQUEST DETAILS MODAL — meta grid, hero, podzlecenia, historia
   ============================================================ */
.request-details {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    flex: 1;
    min-height: 0;
}
.request-details-summary {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    flex-shrink: 0;
}
.request-details-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2) var(--s-3);
}
.request-details-title {
    font-size: var(--t-h2);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--lh-tight);
    margin: 0;
    color: var(--text-primary);
    flex: 1 1 240px;
    min-width: 0;
}
.request-details-idbar {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
    /* Ściągnięcie paska bliżej tytułu — kontener .request-details ma gap --s-4 (16px),
       co dawało za dużą przerwę pod tytułem. */
    margin-top: calc(-1 * var(--s-3));
}
.request-details-id {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    padding: 2px var(--s-2);
    /* Tokeny semantyczne — surowe --ink-* nie adaptują się do motywu (chip był jasny w dark). */
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-sm);
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-size: var(--t-caption);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.request-details-id:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.request-details-desc {
    font-size: var(--t-body);
    line-height: var(--lh-relaxed);
    color: var(--text-primary);
    margin: 0;
    white-space: pre-line;
}
.request-details-parent {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-3);
    background: var(--brand-50);
    border-radius: var(--r-md);
    width: fit-content;
}
.request-details-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
    padding: var(--s-4);
    background: var(--bg-muted);
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
}
@media (max-width: 720px) {
    .request-details-meta { grid-template-columns: repeat(2, 1fr); }
}
.request-details-meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    min-width: 0;
}
.request-details-meta-value {
    font-size: var(--t-body);
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.request-details-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-3);
}
/* --- Kompaktowy nagłówek: hero z akcjami po prawej --- */
.request-details-hero-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-1);
    flex-shrink: 0;
}
/* Meta inline (kategoria · zlecający · wykonawca) — kompaktowa, jeden wiersz z zawijaniem */
.request-details-meta-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-1) var(--s-3);
    font-size: var(--t-small);
    color: var(--text-secondary);
}
.request-details-meta-inline .request-details-meta-person {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--text-primary);
    font-weight: 500;
}
.request-details-meta-inline .r-meta-sep { color: var(--border-strong); }
/* Wiersz drobny: ID + daty — etykiety stonowane (nie-mono), wartości mono */
.request-details-subline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-1) var(--s-3);
    font-size: var(--t-caption);
    color: var(--text-tertiary);
}
.request-details-subline .r-subline-item {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}
.request-details-subline .r-subline-label { color: var(--text-tertiary); }
.request-details-subline .r-subline-val {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}
/* Domyślnie opis jest zwinięty do 3 linii (kompaktowy widok). Po dodaniu
   klasy .is-expanded clamp znika i pokazujemy pełną treść. Przełącznik
   „Pokaż więcej" w RequestDetailsModal pojawia się tylko gdy tekst faktycznie
   się ucina (pomiar przez riseIsTextClamped). */
.request-details-desc:not(.is-expanded) {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Rozwinięty opis nie może zalać całego modala. `.request-details-summary` ma
   flex-shrink:0, więc bez limitu długi opis rozpychał summary ponad wysokość
   modala — zakładki/komentarze znikały, a zamiast zawartości modala przewijała
   się cała strona. Własny max-height + wewnętrzny scroll trzymają opis w ryzach
   i pozostawiają miejsce na resztę modala. */
.request-details-desc.is-expanded {
    max-height: 40vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.request-details-desc-toggle {
    margin-top: var(--s-1);
    padding-inline: 0;
    color: var(--brand-600);
    font-weight: 500;
}
.request-details-desc-toggle:hover {
    color: var(--brand-700);
    text-decoration: underline;
}

/* --- Menu przepełnienia ⋯ (controlled <details>) --- */
.r-overflow-menu { position: relative; }
.r-overflow-menu > summary {
    list-style: none;
    cursor: pointer;
}
.r-overflow-menu > summary::-webkit-details-marker { display: none; }
.r-overflow-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}
.r-overflow-menu-list {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 41;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    padding: var(--s-1);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
}
.r-overflow-menu-list button {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    width: 100%;
    padding: var(--s-2) var(--s-3);
    border: 0;
    background: transparent;
    border-radius: var(--r-sm);
    font: inherit;
    font-size: var(--t-small);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}
.r-overflow-menu-list button:hover { background: var(--bg-muted); }
.r-overflow-menu-list .r-overflow-menu-danger { color: var(--status-rejected-fg); }
.r-overflow-menu-list hr {
    border: 0;
    border-top: 1px solid var(--border-subtle);
    margin: var(--s-1) 0;
}

/* --- Toolbar zakładki Zadania --- */
.request-tasks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.request-details-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    flex: 1;
    min-height: 0;
}
.request-details-tabs .r-tabs-list { flex-shrink: 0; }
.request-details-tabs .r-tabs-list {
    margin: 0;
}
.r-tab-count {
    margin-left: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
}
.request-details-tab-panel {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.request-details-tab-panel .r-section-header { flex-shrink: 0; }

/* --- Mobilny akordeon (≤640px) --- */
.request-details-accordion {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.r-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    width: 100%;
    padding: var(--s-3) var(--s-1);
    border: 0;
    border-top: 1px solid var(--border-subtle);
    background: transparent;
    font: inherit;
    font-size: var(--t-body);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}
.r-accordion-trigger.is-open { color: var(--brand-700); }
.r-accordion-title { display: inline-flex; align-items: center; gap: 6px; }
.r-accordion-chevron { transition: transform var(--d-fast); flex-shrink: 0; }
.r-accordion-trigger.is-open .r-accordion-chevron { transform: rotate(180deg); }
.request-details-accordion > .request-chat-shell,
.request-details-accordion > .request-details-tab-panel {
    flex: 1;
    min-height: 0;
    margin-bottom: var(--s-2);
}
.request-details.is-section-open .request-details-secondary { display: none; }

/* Wariant „link" akordeonu — sekcja otwiera się jako oddzielny modal, nie inline.
   Szewron (▶) wskazuje w prawo zamiast w dół, sygnalizując nawigację. */
.r-accordion-trigger-link .r-accordion-chevron { transform: none; }

/* Pełnoekranowy sub-modal czatu (mobile) — host dla komponentu RequestChat.
   r-modal-flush ustawia .bm-content jako flex column min-height:0 overflow:hidden;
   ten shell wypełnia dostępną wysokość, RequestChat sam zarządza scrollem i composerem. */
.request-chat-modal-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.request-details-history summary {
    list-style: none;
    display: flex;
    align-items: center;
}
.request-details-history summary::-webkit-details-marker { display: none; }
.request-details-history summary::before {
    content: '▸';
    margin-right: var(--s-2);
    color: var(--text-tertiary);
    transition: transform var(--d-fast);
    display: inline-block;
}
.request-details-history[open] summary::before {
    transform: rotate(90deg);
}

/* ============================================================
   TABELA ZLECEŃ (.r-table) — używana w Pages/Requests + Dashboard tables
   ============================================================ */
.r-table-wrap {
    overflow-x: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}
.r-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--t-small);
}
.r-table thead th {
    text-align: left;
    padding: var(--s-3) var(--s-4);
    font-size: var(--t-micro);
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-tertiary);
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.r-table tbody td {
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-primary);
}
.r-table tbody tr:last-child td { border-bottom: 0; }
.r-table tbody tr:hover { background: var(--bg-muted); }
.r-table tbody tr.is-subrequest > td:first-child,
.r-table tbody tr.is-subrequest > td.r-table-pin-col + td {
    padding-left: var(--s-8);
}
.r-table-pin-col { width: 36px; text-align: center; }

.r-table-title-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    min-width: 200px;
}
.r-table-hierarchy-rail {
    position: absolute;
    left: -16px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--brand-300), var(--brand-500));
    border-radius: 999px;
}
.r-table-hierarchy-meta {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    font-size: var(--t-micro);
    color: var(--brand-700);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}
.r-table-hierarchy-parent {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}
.r-table-title {
    font-size: var(--t-body);
    font-weight: 500;
    color: var(--text-primary);
    line-height: var(--lh-snug);
}
.r-table-deadline {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--s-2);
    border-radius: var(--r-sm);
    font-size: var(--t-caption);
}
.r-table-deadline.deadline-failed   { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }
.r-table-deadline.deadline-succeed  { background: var(--status-done-bg); color: var(--status-done-fg); }
.r-table-deadline.deadline-warning  { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.r-table-deadline.deadline-danger   { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }

.r-table-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.r-table-empty {
    padding: var(--s-8);
    text-align: center;
    color: var(--text-tertiary);
    margin-top: var(--s-4);
}
.r-table-empty p { margin: 0; }

/* Modal "Wybierz wykonawcę" — layout treści + lista specjalizacji
   wyświetlana inline (kropka jako separator) zamiast pionowej listy
   z bulletami, żeby kolumna nie rozpychała się przy użytkownikach z
   wieloma specjalizacjami. */
.r-choose-user { display: flex; flex-direction: column; gap: var(--s-3); }
.r-choose-user-specs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    font-size: var(--t-small);
    color: var(--text-secondary);
}
.r-choose-user-specs li::after { content: '·'; margin: 0 8px; color: var(--border-strong); }
.r-choose-user-specs li:last-child::after { content: ''; margin: 0; }

/* Modal "Dodaj dokumentację" — stack flex-column, edytor markdown
   dostaje konkretną wysokość bezpośrednio na hosta (.cm-editor-host).
   NIE używamy min-height na całym .r-document-modal: wcześniejszy
   wariant (72vh) rozjeżdżał wąską kolumnę gdy r-modal-xl nie matchował
   selektora; nawet teraz lepiej kierować wysokość tylko na edytor,
   żeby header i footer modala zostały kompaktowe. */
/* Modal "Dodaj dokumentację" / "Podgląd dokumentu".
   Definiujemy w Rise app.css TYLKO wizualne styling (bg/border/shadow/width),
   NIE layout (display/flex/max-height). Layout pozostaje pod kontrolą
   Codli.Design (overlays.css). Powód: gdy duplikowałem cały blok łącznie
   z `display: flex; max-height` ten override potrafił rozjeżdżać modal
   (override matchował na różnych warstwach niż design-system'owy). Powtarzamy
   tylko to, co MUSI zostać świeże po Rise deploy nawet jeśli Codli.Design
   CSS w cache jest stary (czyli sam fakt że modal ma tło i ramkę). */
.r-modal-xl {
    width: 90vw !important;
    min-width: 720px !important;
    max-width: 1600px !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--r-xl) !important;
    box-shadow: var(--shadow-xl) !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
}

/* Edytor markdown — modal rośnie naturalnie z content. Host ma min-height
   żeby wymusić sensowną wysokość, a wewnętrzny .cm-editor-shell (CMarkdown
   inner) jest `flex: 1`, więc wypełnia całą wysokość hosta zamiast trzymać
   się swojego domyślnego 320px. */
.r-document-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.r-document-modal .cm-editor-host {
    display: flex;
    flex-direction: column;
    min-height: 60vh;
}
.r-document-modal .cm-editor-shell {
    flex: 1;
}

/* Podgląd dokumentu w trybie readonly (.r-document-readonly na root komponentu,
   znika gdy autor wchodzi w edycję) nie potrzebuje 90vw „okna roboczego" — treść
   czyta się w wąskiej kolumnie, a xl zostawiał wielką pustą przestrzeń po prawej
   (zlecenie: „Wyświetlanie dokumentacji (readonly) się rozjechało"). :has() zwęża
   sam box na podstawie stanu wewnętrznego komponentu, bez zmiany klasy modala przy
   otwarciu; gdy marker znika, modal wraca do xl (edytor potrzebuje szerokości).
   820px przy paddingu .bm-content 28px → ~764px tekstu (~75 znaków/linię).
   Specyficzność (0,2,0) > .r-modal-xl (0,1,0) — override wygrywa niezależnie od
   kolejności źródeł (Rise app.css świeży po deployu, Codli.Design bywa z cache). */
.r-modal-xl:has(.r-document-readonly) {
    width: min(820px, 92vw) !important;
    min-width: 0 !important;
    max-width: 820px !important;
}

/* ============================================================
   FILTR ZLECEŃ — chipy statusów + grid filtrów
   ============================================================ */
.requests-filter {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}
.requests-filter-section {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.requests-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}
.requests-filter-chip {
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--bg-muted);
    color: var(--text-secondary);
    transition: opacity var(--d-fast), box-shadow var(--d-fast);
    height: 26px;
    padding: 0 var(--s-3);
    opacity: 0.7;
}
.requests-filter-chip:hover { opacity: 1; }
.requests-filter-chip.is-active {
    opacity: 1;
    box-shadow: var(--shadow-focus-ring);
}
.requests-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-3);
}
.r-field { display: flex; flex-direction: column; gap: 0; }

/* Dwukolumnowy układ dat dla pierwszego ekranu (download requests) */
.requests-date-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-4);
}

/* ============================================================
   DASHBOARD — selektor wariantów + Classic / Kanban / Focus
   ============================================================ */
.dashboard-mode-toolbar {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-6);
    padding: var(--s-2) var(--s-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    width: fit-content;
}
.dashboard-mode-toolbar .r-section-meta { margin-right: var(--s-3); }
.dashboard-mode-toolbar .r-btn.is-active { box-shadow: var(--shadow-xs); }

/* Dashboard mode picker (Personalisation page) */
.dashboard-mode-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-3);
}
@media (max-width: 720px) {
    .dashboard-mode-picker { grid-template-columns: 1fr; }
}
.dashboard-mode-tile {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: var(--s-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--d-fast), box-shadow var(--d-fast);
    font-family: inherit;
    color: var(--text-primary);
}
.dashboard-mode-tile:hover { border-color: var(--brand-300); }
.dashboard-mode-tile.is-active {
    border-color: var(--brand-700);
    box-shadow: var(--shadow-focus-ring);
}
.dashboard-mode-tile-preview {
    background: var(--bg-muted);
    border-radius: var(--r-sm);
    color: var(--brand-600);
    aspect-ratio: 80 / 56;
}
.dashboard-mode-tile-preview svg {
    display: block;
    width: 100%;
    height: 100%;
}
.dashboard-mode-tile-name {
    font-weight: 600;
    font-size: var(--t-body);
    color: var(--text-primary);
}

/* Stat cards (Classic) */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--s-3);
    margin-bottom: var(--s-8);
}
/* Stat-cards responsive breakpoints aligned with mobile system (640/1024).
   Phone (≤640) → 2-col, tablet (641–1023) → 3-col, desktop (≥1024) → 5-col. */
@media (max-width: 1023px) {
    .dashboard-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

.dashboard-stat-card {
    position: relative;
    overflow: hidden;
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}
.dashboard-stat-rail {
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--stat-solid, var(--brand-500));
}
.dashboard-stat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-2);
}
/* Pozwól długim labelom statusu (np. "Oczekiwanie na akceptację") zawijać
   się w dwie linie zamiast wychodzić poza kartę. Badge globalnie ma
   flex-shrink: 0; w stat-card musimy mu pozwolić się zmieścić, żeby nie
   wypchnął ikony poza krawędź karty. */
.dashboard-stat-card .r-badge {
    white-space: normal;
    height: auto;
    min-height: 22px;
    padding: 4px var(--s-2);
    line-height: 1.15;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
.dashboard-stat-icon { color: var(--stat-solid, var(--brand-500)); display: flex; flex-shrink: 0; }
.dashboard-stat-count {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: 1;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Kanban */
.dashboard-kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(260px, 1fr));
    gap: var(--s-3);
    overflow-x: auto;
}
/* Make status badge in kanban header shrink so column number stays visible */
.dashboard-kanban-head .r-badge {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.dashboard-kanban-head .r-badge-text {
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-kanban-col {
    background: var(--bg-muted);
    border-radius: var(--r-lg);
    padding: var(--s-3);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-height: 240px;
    min-width: 0;
}
.dashboard-kanban-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    padding: 0 var(--s-1);
}
.dashboard-kanban-body {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}
.dashboard-kanban-empty {
    padding: var(--s-5) var(--s-3);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--t-caption);
    background: var(--bg-surface);
    border: 1.5px dashed var(--border-default);
    border-radius: var(--r-md);
}

/* Focus */
.dashboard-focus-hero {
    background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
    color: var(--text-on-dark);
    border-radius: var(--r-xl);
    padding: var(--s-8);
    box-shadow: var(--shadow-md);
}
.dashboard-focus-hero-meta {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}
.dashboard-focus-hero-tag {
    font-size: var(--t-micro);
    letter-spacing: var(--tracking-caps);
    color: rgba(255,255,255,0.6);
}
.dashboard-focus-hero-title {
    font-size: var(--t-h1);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--lh-tight);
    margin: 0 0 var(--s-3);
    color: var(--text-on-dark);
}
.dashboard-focus-hero-desc {
    font-size: var(--t-h4);
    color: rgba(255,255,255,0.85);
    line-height: var(--lh-normal);
    margin: 0 0 var(--s-5);
    max-width: 720px;
}
.dashboard-focus-hero-foot {
    display: flex;
    align-items: center;
    gap: var(--s-6);
    flex-wrap: wrap;
    color: rgba(255,255,255,0.85);
    font-size: var(--t-small);
}

.dashboard-focus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-4);
}

/* ============================================================
   HISTORIA ZMIAN ZLECENIA — Messenger-style chat bubbles + event rows.
   Autor wpisu po lewej (rise-500), zalogowany user po prawej (ink-100).
   Konsekutywne wpisy tej samej osoby grupują się — header (avatar + imię
   + rola + data) renderuje się tylko nad pierwszym dymkiem grupy.
   ============================================================ */
.r-history { display: flex; flex-direction: column; gap: var(--s-3); }

.request-chat-shell {
    display: grid;
    grid-template-rows: 1fr auto;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    background: var(--bg-surface);
    overflow: hidden;
}

.request-chat-scroll {
    min-height: 0;
    overflow-y: auto;
    padding: var(--s-4);
    background: var(--bg-surface);
    overscroll-behavior: contain;
}

.request-chat-scroll .r-history {
    min-height: 100%;
    justify-content: flex-end;
}

.request-chat-shell .r-chat-typing {
    margin-top: var(--s-3);
}

.r-chat-live-area {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    margin-top: var(--s-4);
}

.r-chat-typing {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-height: 32px;
}

.r-chat-typing-avatars {
    width: 52px;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.r-chat-typing-avatars .r-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.r-chat-typing-avatars .r-avatar + .r-avatar {
    margin-left: -12px;
}

.r-chat-typing-bubble {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 18px 18px 18px 4px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(7, 9, 37, 0.05);
}

.r-chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.r-chat-typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink-500);
    animation: rTypingDot 1.2s infinite ease-in-out;
}

.r-chat-typing-dots span:nth-child(2) { animation-delay: 120ms; }
.r-chat-typing-dots span:nth-child(3) { animation-delay: 240ms; }

@keyframes rTypingDot {
    0%, 80%, 100% { transform: translateY(0); opacity: .45; }
    40% { transform: translateY(-3px); opacity: 1; }
}

.r-chat-composer {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-3) var(--s-3);
    border: 0;
    border-top: 1px solid var(--border-subtle);
    border-radius: 0;
    background: var(--bg-surface);
}

.r-chat-composer.is-file-drag-over {
    background: var(--brand-50);
}

.r-chat-composer-main {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 36px;
    align-items: end;
    gap: var(--s-2);
}

.r-chat-composer-icon,
.r-chat-composer-send,
.r-chat-composer-remove {
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--d-fast), color var(--d-fast), transform var(--d-fast);
}

.r-chat-composer-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--r-pill);
    align-self: end;
}

.r-chat-composer-icon:hover {
    background: var(--bg-muted);
    color: var(--brand-600);
}

.r-chat-composer-icon input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.r-chat-composer-input {
    min-height: 36px;
    max-height: 136px;
    resize: vertical;
    border: 1px solid var(--border-default);
    border-radius: 18px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-muted);
    outline: none;
}

.r-chat-composer-input:focus {
    border-color: var(--brand-500);
    box-shadow: var(--shadow-focus);
    background: var(--bg-surface);
}

.r-chat-composer-send {
    width: 36px;
    height: 36px;
    border-radius: var(--r-pill);
    background: var(--brand-700);
    color: var(--text-on-brand);
}

.r-chat-composer-send:hover:not(:disabled) {
    background: var(--brand-800);
    transform: translateY(-1px);
}

.r-chat-composer-send:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.r-chat-composer-files {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    max-height: 92px;
    overflow-y: auto;
}

.r-chat-composer-file {
    display: inline-grid;
    grid-template-columns: 22px minmax(0, 1fr) auto 22px;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    background: var(--bg-muted);
}

.r-chat-composer-file-icon {
    width: 22px;
    height: 22px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7e9fb;
    color: var(--brand-600);
}

.r-chat-composer-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
}

.r-chat-composer-file-size {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.r-chat-composer-remove {
    width: 22px;
    height: 22px;
    border-radius: var(--r-pill);
}

.r-chat-composer-remove:hover {
    background: var(--ink-200);
    color: var(--text-primary);
}

.r-spinner-mini {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rSpin 800ms linear infinite;
}

@keyframes rSpin {
    to { transform: rotate(360deg); }
}

.r-chat-pending-row {
    opacity: .94;
}

.r-chat-pending-bubble {
    position: relative;
}

.r-chat-pending-bubble.is-failed {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-fg);
}

.r-chat-pending-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1;
    opacity: .82;
}

.r-chat-pending-status button {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.r-chat-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.r-chat-row.is-right { flex-direction: row-reverse; }

/* Dymki-kontynuacje (ten sam autor/agent w jednym ciągu — IsFirstInGroup == false)
   ściągamy do poprzedniego: flex-gap (var(--s-3)=12px) jest jednolity dla całej
   kolumny, więc niwelujemy go ujemnym margin-top, zostawiając ~4px ciasnego
   odstępu w grupie. Pierwszy dymek grupy (bez .is-grouped) zachowuje pełne 12px
   separacji od poprzedniej grupy. */
.r-chat-row.is-grouped { margin-top: calc(2px - var(--s-3)); }

/* Slot na avatar — w grupie tylko ostatni dymek "trzyma" widoczny avatar,
   pozostałe rzędy mają miejsce zarezerwowane (visibility: hidden) żeby
   bąble pozostały wyrównane. */
.r-chat-avatar-slot {
    /* Stała szerokość = szerokość pary współautorskiej (32px user + 32px agent
       − 12px nałożenia = 52px). Rezerwujemy miejsce na DWA awatary niezależnie
       od tego, czy realnie jest jeden czy dwa — dzięki temu prawa krawędź dymka
       nie skacze między dymkiem zwykłym a dymkiem ze współautorem AI. Stała
       szerokość eliminuje też przeskok dymka przy hoverze (rozsuwaniu pary). */
    width: 52px;
    flex-shrink: 0;
    align-self: flex-end;
    display: flex;
    align-items: flex-end;
}
/* Awatar(y) dosunięte do strony dymka — single zachowuje obecny, ciasny odstęp
   od dymka, a zarezerwowane miejsce na drugi awatar zostaje po stronie
   zewnętrznej, gdzie wystaje logo agenta AI. */
.r-chat-row.is-right .r-chat-avatar-slot { justify-content: flex-start; }
.r-chat-row.is-left  .r-chat-avatar-slot { justify-content: flex-end; }
.r-chat-avatar-slot .r-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

/* ============================================================
   WSPÓŁAUTOR AI — para awatarów (user z przodu, agent z tyłu).
   Hover/focus/touch rozsuwa parę; logo agenta = contain na neutralnym tle.
   ============================================================ */
.r-coauthor {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.r-coauthor-user { position: relative; z-index: 1; }
.r-coauthor-agent {
    position: relative;
    z-index: 0;
    margin-left: -12px;                 /* awatar usera nachodzi na agenta */
    transition: margin-left 160ms ease;
}
.r-coauthor:hover .r-coauthor-agent,
.r-coauthor:focus-within .r-coauthor-agent,
.r-coauthor:active .r-coauthor-agent {
    margin-left: 4px;                   /* rozsunięcie */
}

/* Logo agenta: pełne, wyśrodkowane, na neutralnym tle (bez przycinania). */
.r-avatar.r-avatar-agent {
    /* Białe tło kafelka pod logo marki — znaki agentów (np. czarny ChatGPT na
       przezroczystości) są czytelne na obu motywach; var(--bg-muted) na ciemnym
       motywie chowałby ciemne logotypy. */
    background: #ffffff;
    border: 1px solid var(--border-subtle);
}
.r-avatar.r-avatar-agent > .r-avatar-img { object-fit: contain; }
.r-avatar.r-avatar-agent.is-generic {
    /* Generyczna ikona AI rysuje się przez currentColor — zostaw neutralne,
       motyw-świadome tło, nie biel. */
    background: var(--bg-muted);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
}

/* Para w wierszu zdarzeń (event-row) — drobniejsza, w jednej linii z tekstem. */
.r-history-event .r-coauthor { vertical-align: middle; margin-right: 2px; }
.r-history-event .r-coauthor-agent { margin-left: -8px; }
.r-history-event .r-coauthor:hover .r-coauthor-agent,
.r-history-event .r-coauthor:focus-within .r-coauthor-agent,
.r-history-event .r-coauthor:active .r-coauthor-agent { margin-left: 3px; }

/* Mid-group rows hide their (empty) avatar slot so reserved space still aligns,
   but the LAST-in-group row keeps its avatar visible — that's where Razor
   actually renders <RiseAvatar>. Without :not(.is-last) the avatar of the
   final bubble in a multi-message run silently disappears (e.g. user replies
   twice in a row and neither bubble shows their avatar). */
.r-chat-row.is-grouped:not(.is-last) .r-chat-avatar-slot { visibility: hidden; }

.r-chat-stack {
    display: flex;
    flex-direction: column;
    max-width: 460px;
    min-width: 0;
}
.r-chat-row.is-right .r-chat-stack { align-items: flex-end; }
.r-chat-row.is-left  .r-chat-stack { align-items: flex-start; }

.r-chat-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.r-chat-row.is-left  .r-chat-meta { padding-left: 14px; }
.r-chat-row.is-right .r-chat-meta { padding-right: 14px; }

.r-chat-meta-name {
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 500;
}

.r-chat-roletag {
    font-size: 9.5px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    background: var(--bg-muted);
    color: var(--text-secondary);
}
.r-chat-roletag.is-author     { background: #e7e9fb; color: var(--brand-700); }
.r-chat-roletag.is-assignee   { background: #e8f0e6; color: #3d6b46; }
.r-chat-roletag.is-admin      { background: #fdf1d6; color: #8a6510; }

[data-theme="dark"] .r-chat-roletag.is-author    { background: rgba(125, 139, 217, 0.20); color: #c5cdf0; }
[data-theme="dark"] .r-chat-roletag.is-assignee  { background: rgba( 80, 160,  90, 0.20); color: #a8d4a3; }
[data-theme="dark"] .r-chat-roletag.is-admin     { background: rgba(180, 140,  30, 0.22); color: #f4d99c; }

.r-chat-bubble {
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: 0 1px 2px rgba(7, 9, 37, 0.08);
    word-break: break-word;
    margin-top: 2px;
}
.r-chat-text {
    white-space: pre-line;
}
/* Konwencja kolorów (Messenger / Teams):
   – „inni" po lewej → szary bubble (ink-100 z border-subtle, ciemny tekst)
   – „ja" po prawej → brand color (rise-500, biały tekst, bez bordera) */
.r-chat-row.is-left  .r-chat-bubble {
    background: var(--bg-muted);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 18px 18px 18px 4px;
}
.r-chat-row.is-right .r-chat-bubble {
    background: var(--brand-500);
    color: white;
    border-radius: 18px 18px 4px 18px;
}
/* W grupie consecutive bąbli — zaokrąglamy mniej po stronie autora,
   tail (4px) zostaje tylko na ostatnim dymku grupy. */
.r-chat-row.is-grouped.is-left  .r-chat-bubble { border-radius: 4px 18px 18px 4px; }
.r-chat-row.is-grouped.is-right .r-chat-bubble { border-radius: 18px 4px 4px 18px; }
.r-chat-row.is-grouped.is-last.is-left  .r-chat-bubble { border-radius: 4px 18px 18px 4px; }
.r-chat-row.is-grouped.is-last.is-right .r-chat-bubble { border-radius: 18px 4px 4px 18px; }
.r-chat-row.is-last.is-left  .r-chat-bubble { border-bottom-left-radius: 4px; }
.r-chat-row.is-last.is-right .r-chat-bubble { border-bottom-right-radius: 4px; }

.r-chat-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

/* Inline preview obrazków w dymku (Messenger-style — klikalne miniatury).
   Obraz wypełnia całą szerokość bąbla; CSS przycina wysokość, gdy zdjęcie
   jest bardzo wysokie. Bąbel z obrazkiem rozciąga się do max szerokości
   stacka (`:has()` wybiera tylko bąble z miniaturami). */
.r-chat-bubble:has(.r-chat-images) { width: 100%; }
.r-chat-images {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    width: 100%;
}
.r-chat-image-btn {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    line-height: 0;
    width: 100%;
    max-height: 360px;
    transition: transform var(--d-fast);
}
.r-chat-image-btn:hover { transform: scale(1.02); }
.r-chat-image-btn .codli-api-picture {
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: cover;
    margin: 0;
    display: block;
    border-radius: 12px;
}

/* File chip — kafelek pliku (inside bubble lub poza, np. w modalu uploadu). */
.r-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    max-width: 240px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background var(--d-fast);
}
.r-file-chip:hover { background: var(--ink-200); }
.r-file-chip-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    background: #e7e9fb;
    color: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
}
[data-theme="dark"] .r-file-chip-icon { background: rgba(125, 139, 217, 0.18); }
.r-file-chip-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.r-file-chip-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.r-file-chip-size {
    display: block;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r-file-chip.is-dark {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.18);
}
.r-file-chip.is-dark:hover { background: rgba(255, 255, 255, 0.28); }
.r-file-chip.is-dark .r-file-chip-icon { background: rgba(255, 255, 255, 0.16); color: white; }
.r-file-chip.is-dark .r-file-chip-name  { color: white; }
.r-file-chip.is-dark .r-file-chip-size  { color: rgba(255, 255, 255, 0.7); }

/* Event row — system-message: zmiana statusu, deadline, wykonawcy, utworzenie. */
.r-history-event {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}
.r-history-event-time {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
}
.r-history-event-dot {
    width: 3px;
    height: 3px;
    border-radius: 2px;
    background: var(--ink-200);
    flex-shrink: 0;
}
.r-history-event-actor { color: var(--text-primary); font-weight: 500; }
.r-history-event-pill {
    padding: 2px 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    font-size: 11px;
    font-family: var(--font-mono);
}
.r-history-event-transition {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.r-history-event-transition .r-badge {
    font-size: 10px;
    padding: 2px 7px;
    line-height: 1.4;
}
.r-history-event-arrow {
    display: inline-flex;
    align-items: center;
    color: var(--text-tertiary);
    line-height: 1;
}
.r-history-event-arrow svg { display: block; }

/* ============================================================
   REQUEST DETAILS — meta-cell z awatarem (Zlecający / Wykonawca)
   ============================================================ */
.request-details-meta-person {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
.request-details-meta-person .r-avatar { flex-shrink: 0; }

/* Klikalny tytuł podzlecenia w widoku tabeli (otwiera szczegóły dziecka). */
.r-table-title-link {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--text-primary);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: color var(--d-fast);
}
.r-table-title-link:hover { color: var(--brand-600); text-decoration: underline; }
.r-table-title-link:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); border-radius: 4px; }

/* Footer modala szczegółów — dwie kolumny: pomocnicze (lewa) + zmiany statusu (prawa). */
.r-details-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-4);
    flex-wrap: wrap;
}
.r-details-footer-left,
.r-details-footer-right {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
    align-items: center;
}
.r-details-footer-right { margin-left: auto; }
.r-details-footer-right .codli-task-actions {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* ============================================================
   COMPOUND TASK CARD — karta podzlecenia w modalu szczegółów.
   Klikalny tytuł otwiera szczegóły wybranego podzlecenia.
   ============================================================ */
.r-compound-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.r-compound-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }

.r-compound-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-3);
}
.r-compound-head-left { min-width: 0; flex: 1; }
.r-compound-title {
    appearance: none;
    background: none;
    border: none;
    padding: 2px 0 0;
    margin: 0;
    text-align: left;
    font-size: var(--t-h5);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    cursor: pointer;
    transition: color var(--d-fast);
}
.r-compound-title:hover { color: var(--brand-600); text-decoration: underline; }
.r-compound-title:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); border-radius: 4px; }

.r-compound-spec {
    font-size: var(--t-caption);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}
.r-compound-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--t-small);
}
.r-compound-desc {
    font-size: var(--t-small);
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    white-space: pre-line;
}

/* Modal "Dodaj pliki" — kontener stackuje sekcje pionowo, footer ma sticky-look. */
.r-upload-modal {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.r-upload-help {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.r-upload-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   SPEC TOGGLE LIST — lista specjalizacji w EditUserModal
   ============================================================ */
.r-spec-toggle-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: var(--s-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    background: var(--bg-surface);
}
.r-spec-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    cursor: pointer;
    user-select: none;
}
.r-spec-toggle-label {
    font-size: var(--t-body);
    color: var(--text-primary);
}

/* ============================================================
   MCP AGENT SWITCHER — nowy design (zastępuje legacy .mcp-agent-*)
   ============================================================ */
.r-mcp-switcher {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}
.r-mcp-switcher-header h4 { margin: 0 0 var(--s-1) 0; }
.r-mcp-switcher-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.r-mcp-config-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
}
.r-mcp-config-path {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.r-mcp-config-code {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}
.r-mcp-config-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
}

/* ============================================================
   HISTORIA ZMIAN ZLECENIA — legacy RequestHistoryRecord
   v0.5.x: rename z .codli-request-history-record-* na .r-history-record-*
   z tokenami theme-aware. Komponent docelowo do redesignu na chat
   bubbles z extras.css (.r-history-event-*). To jest interim styling.
   ============================================================ */
.r-history-record {
    padding: var(--s-3);
    margin-bottom: var(--s-3);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    transition: background var(--d-fast), border-color var(--d-fast);
}
.r-history-record-info { font-size: var(--t-body); }
.r-history-record-author { font-size: var(--t-caption); color: var(--text-secondary); }
.r-history-record-content { padding: var(--s-3) 0; }
.r-history-record-content > pre {
    font-size: var(--t-small);
    font-family: var(--font-mono);
    margin: 0;
    white-space: pre-line;
    color: var(--text-primary);
}
.r-history-pictures { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }

/* ============================================================
   AVATAR MANAGER PANEL — Settings & Admin/UserProfile
   ============================================================ */
.r-avatar-manager {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}
.r-avatar-manager-header {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.r-avatar-manager-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.r-avatar-manager-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--t-body);
}
.r-avatar-manager-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2);
}

/* Hidden native <InputFile> wrapped in <label class="r-file-button"> with
   button-styled <span>. Same trick as r-dropzone — input absolutely positioned
   over the visible span so click → file picker. */
.r-file-button {
    position: relative;
    display: inline-flex;
}
.r-file-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.r-file-button .r-btn {
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.r-file-button .r-btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
