/* ===================================================================== */
/* Agenda — design system (DESIGN.md §6: Apple-style)                    */
/* Dużo światła, typografia niesie hierarchię, akcent per kontekst jest  */
/* JEDYNYM mocnym kolorem, mikroanimacje 150–250 ms na krzywej spring.   */
/* ===================================================================== */

:root {
    --accent: #0a84ff;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --separator: rgba(0, 0, 0, 0.08);
    --radius-s: 10px;
    --radius-m: 16px;
    --radius-l: 24px;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-float: 0 2px 8px rgba(0, 0, 0, 0.06), 0 18px 48px rgba(0, 0, 0, 0.10);
    --spring: cubic-bezier(0.32, 0.72, 0, 1);
    --fast: 180ms;
    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100dvh;
}

button {
    font: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* ==================== */
/* === Login scene ==== */
/* ==================== */

.login-scene {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%),
        var(--bg);
}

.login-card {
    width: min(400px, 100%);
    background: var(--surface);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-float);
    padding: 56px 40px 48px;
    text-align: center;
    display: grid;
    gap: 14px;
    justify-items: center;
    animation: rise var(--fast) var(--spring) both;
}

.login-logo {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    max-width: 30ch;
    animation: rise 220ms var(--spring) 40ms both;
}

.gis-slot {
    margin-top: 18px;
    min-height: 44px;
    animation: rise 220ms var(--spring) 80ms both;
}

.login-working {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-error {
    color: #d70015;
    font-size: 13px;
}

.login-denied-title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: none; }
}


/* ============== */
/* === Splash === */
/* ============== */

.splash {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    gap: 10px;
    text-align: center;
}

.splash-mark {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    animation: breathe 1.4s ease-in-out infinite alternate;
}

.splash-hint {
    color: var(--text-secondary);
    font-size: 13px;
}

@keyframes breathe {
    from { opacity: 0.45; }
    to { opacity: 1; }
}


/* ============= */
/* === Shell === */
/* ============= */

.shell {
    min-height: 100dvh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px clamp(16px, 4vw, 40px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--separator);
}

.topbar-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 17px;
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--surface);
}


/* ========================= */
/* === Segmented control === */
/* ========================= */

.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
}

.segmented-option {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--fast) var(--spring), background var(--fast) var(--spring),
        box-shadow var(--fast) var(--spring);
}

.segmented-option.selected {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-soft);
}


/* =============== */
/* === Buttons === */
/* =============== */

/* System przycisków (#64): jedna geometria (pigułka, inline-flex, stała
   wysokość), rozmiary S 28 / M 36 (domyślny) / L 44 przez modyfikatory
   .btn-s/.btn-l, role primary/secondary/ghost + wariant destrukcyjny
   .btn-ghost.reject (czerwień działa wszędzie, nie tylko w moderacji). */
.btn-primary,
.btn-secondary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: transform var(--fast) var(--spring), filter var(--fast) var(--spring),
        color var(--fast) var(--spring), background var(--fast) var(--spring);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.btn-ghost {
    padding: 0 12px;
    color: var(--text-secondary);
}

.btn-s {
    height: 28px;
    padding: 0 12px;
    font-size: 13px;
}

.btn-ghost.btn-s {
    padding: 0 8px;
}

.btn-l {
    height: 44px;
    padding: 0 24px;
    font-size: 15px;
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
    transform: scale(0.97);
}

.btn-primary:active {
    filter: brightness(0.94);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

.btn-ghost:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

.btn-ghost.approve {
    color: var(--accent);
}

.btn-ghost.reject {
    color: #d70015;
}

.btn-ghost.reject:hover {
    color: #d70015;
    background: rgba(215, 0, 21, 0.08);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
    opacity: 0.5;
    pointer-events: none;
}


/* ============= */
/* === Pages === */
/* ============= */

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 40px) 80px;
}

.page-title {
    font-size: clamp(28px, 4.5vw, 40px);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-soft);
    padding: 20px;
}

.placeholder-card {
    color: var(--text-secondary);
    text-align: center;
    padding: 48px 20px;
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-heading .page-title {
    margin-bottom: 0;
    margin-right: auto;
}

/* Tytuł edytowalny w miejscu: nagłówek ZAWIJA długie nazwy (pełna widoczność
   przy otwartym panelu i na telefonie), a klik zamienia go w pole. Hover
   zdradza, że da się kliknąć (§6: chrome znika, treść jest bohaterem). */
.page-heading .page-title.title-editable,
.page-heading .page-title.title-field {
    flex: 1 1 auto;
    min-width: 0;
}

.page-heading .page-title.title-editable {
    cursor: text;
    margin-left: -8px;
    padding: 2px 8px;
    border-radius: var(--radius-s);
    transition: background var(--fast) var(--spring);
}

.page-heading .page-title.title-editable:hover {
    background: color-mix(in srgb, var(--text) 5%, transparent);
}

.title-input {
    width: 100%;
    margin-left: -8px;
    padding: 2px 8px;
    font: inherit;
    color: inherit;
    border: 1px solid var(--accent);
    border-radius: var(--radius-s);
    background: var(--surface);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}


/* ================ */
/* === Timeline === */
/* ================ */

.timeline {
    display: grid;
    gap: 12px;
}

.meeting-card {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: transform var(--fast) var(--spring), box-shadow var(--fast) var(--spring);
}

.meeting-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-float);
}

.meeting-card.hero {
    padding: 28px 24px;
    border-left: 4px solid var(--accent);
}

.meeting-card.hero .meeting-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.meeting-card-main {
    display: grid;
    gap: 4px;
    margin-right: auto;
}

.meeting-title {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
}

.meeting-meta {
    color: var(--text-secondary);
    font-size: 13px;
}

.past-meetings {
    margin-top: 28px;
}

.past-meetings > summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    list-style: none;
}

.past-meetings > summary::before {
    content: "▸ ";
    transition: transform var(--fast) var(--spring);
}

.past-meetings[open] > summary::before {
    content: "▾ ";
}

.past-meetings .timeline {
    margin-top: 8px;
}


/* ============= */
/* === Chips === */
/* ============= */

.chip {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.chip-draft {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
}

.chip-published {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

.chip-live {
    background: var(--accent);
    color: #fff;
}

.chip-closed {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    text-decoration: line-through;
}


/* ===================== */
/* === Inline forms ==== */
/* ===================== */

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.input {
    flex: 1;
    font: inherit;
    font-size: 14px;
    padding: 10px 14px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-s);
    background: var(--surface);
    transition: border-color var(--fast) var(--spring), box-shadow var(--fast) var(--spring);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}


/* ===================== */
/* === Meeting detail === */
/* ===================== */

.meeting-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    max-width: 1080px;
}

.meeting-page.with-panel {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.items-list {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.term-recurrence {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.recurrence-input {
    width: 64px;
}

.template-section {
    display: grid;
    gap: 8px;
}

.template-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.template-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

.decisions-search {
    width: 100%;
    margin-bottom: 14px;
}

.decisions-list {
    display: grid;
    gap: 10px;
}

.decision-record {
    display: grid;
    gap: 8px;
}

.decision-record-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.decision-when {
    flex: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.decision-excerpt {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.decision-record-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.followup {
    margin-bottom: 14px;
    padding: 12px 16px;
}

.followup summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.followup-note {
    margin: 8px 0 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.followup-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.followup-entry {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    min-width: 0;
}

.fu-state {
    flex: none;
    width: 18px;
    text-align: center;
}

.fu-done {
    color: #34c759;
}

.meta-chip.actions-complete {
    color: #34c759;
}

.uncarded-row {
    flex-wrap: wrap;
}

.uncarded-warning {
    color: #b25000;
}

.agent-chip {
    background: transparent;
    border: none;
    font-size: 14px;
}

.meeting-summary {
    margin-bottom: 14px;
    display: grid;
    gap: 8px;
}

.meeting-summary h3 {
    margin: 0;
    font-size: 14px;
}

.live-timer {
    margin-left: 10px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 13px;
}

.fu-open {
    color: var(--text-secondary);
}

.fu-unknown {
    color: var(--text-secondary);
    opacity: 0.6;
}

.fu-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.fu-assignee {
    flex: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.fu-link {
    flex: none;
    text-decoration: none;
}

.item-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

.item-row .item-card {
    flex: 1;
    min-width: 0;
}

.reorder-rail {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.reorder-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1;
    min-width: 28px;
    min-height: 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: color var(--fast) var(--spring), background var(--fast) var(--spring);
}

.reorder-btn:hover:not(:disabled) {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.05);
}

.reorder-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1;
    padding: 2px 6px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.item-card {
    display: grid;
    gap: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform var(--fast) var(--spring), box-shadow var(--fast) var(--spring),
        border-color var(--fast) var(--spring);
}

.item-card:hover {
    transform: translateY(-1px);
}

.item-card.selected {
    border-color: var(--accent);
}

.item-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.item-title {
    font-weight: 600;
    font-size: 15px;
}

.item-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
}

/* Punkt bez chipów nie płaci za pusty wiersz (20 px + 10 px odstępu siatki).
   Leptos zostawia tam same komentarze-markery, więc :empty pasuje — a nowy
   chip odsłoni wiersz sam, bez pilnowania warunku w kodzie. */
.item-card-meta:empty {
    display: none;
}

.meta-chip {
    font-size: 12px;
    color: var(--text-secondary);
}

.trello-chip {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.moderation {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.avatar-mini {
    width: 20px;
    height: 20px;
}


/* ================ */
/* === Vote bar === */
/* ================ */

.vote-bar {
    display: flex;
    gap: 3px;
    height: 6px;
    border-radius: 999px;
    overflow: visible;
}

.vote-seg {
    position: relative;
    border-radius: 999px;
    min-width: 14px;
}

.vote-for {
    background: var(--accent);
}

.vote-against {
    background: #d70015;
    opacity: 0.75;
}

.vote-abstain {
    background: rgba(0, 0, 0, 0.18);
}

.vote-voters {
    position: absolute;
    top: 10px;
    left: 0;
    display: none;
    gap: 2px;
    padding: 4px;
    background: var(--surface);
    border-radius: 999px;
    box-shadow: var(--shadow-float);
    z-index: 5;
}

.vote-seg:hover .vote-voters {
    display: flex;
}


/* ================== */
/* === Item panel === */
/* ================== */

.item-panel {
    position: sticky;
    top: 76px;
    align-self: start;
    display: grid;
    gap: 16px;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    animation: rise var(--fast) var(--spring) both;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.panel-section {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--separator);
    padding-top: 14px;
}

.panel-section > h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.decision {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    border-top: none;
}

.vote-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.vote-btn {
    padding: 12px 8px;
    border-radius: var(--radius-s);
    background: rgba(0, 0, 0, 0.04);
    font-weight: 600;
    font-size: 14px;
    transition: transform var(--fast) var(--spring), background var(--fast) var(--spring),
        color var(--fast) var(--spring);
}

.vote-btn:active {
    transform: scale(0.96);
}

.vote-btn.mine {
    background: var(--accent);
    color: #fff;
}

.voters-list,
.links-list,
.comments-list,
.actions-list {
    list-style: none;
    display: grid;
    gap: 8px;
}

.voter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.voter-name {
    margin-right: auto;
}

.voter-value {
    color: var(--text-secondary);
}

.links-list a {
    color: var(--accent);
    font-size: 13px;
    word-break: break-all;
}

.comment-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-body {
    display: grid;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
}

.comment-when {
    color: var(--text-secondary);
    font-size: 12px;
    margin-right: auto;
}

/* Wątki komentarzy (§9.23): odpowiedzi wcięte pod komentarzem najwyższego
   poziomu, jeden poziom głębokości. */
.comment-thread {
    display: grid;
    gap: 6px;
}

.comment-replies {
    display: grid;
    gap: 8px;
    margin-left: 34px;
    padding-left: 12px;
    border-left: 2px solid var(--separator);
}

.comment-replies:empty {
    display: none;
}

.comment-reply {
    justify-self: start;
}

.comment-reply-form {
    margin-left: 34px;
}

.action-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.action-meta {
    color: var(--text-secondary);
}

.markdown {
    font-size: 14px;
    line-height: 1.55;
}

.markdown p + p {
    margin-top: 8px;
}

.markdown a {
    color: var(--accent);
}

.markdown ul,
.markdown ol {
    padding-left: 20px;
    margin: 6px 0;
    display: grid;
    gap: 4px;
}

.markdown code {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 13px;
}

/* Pasek „pole + akcja" jako jedna całość (§6.4): przycisk siedzi WEWNĄTRZ
   wspólnej ramki po prawej, a pierścień fokusa rysuje cały pasek. Reguła
   doboru: JEDNO pole i JEDNA akcja — formularze z anulowaniem albo kilkoma
   polami zostają rozdzielone, bo pigułka „Anuluj" w środku niczego nie łączy. */
.inline-form.merged {
    gap: 0;
    flex-wrap: nowrap;
    padding: 4px;
    border: 1px solid var(--separator);
    border-radius: 999px;
    background: var(--surface);
    transition: border-color var(--fast) var(--spring), box-shadow var(--fast) var(--spring);
}

.inline-form.merged:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.inline-form.merged .input {
    min-width: 0;
    padding: 8px 10px 8px 16px;
    border: none;
    background: transparent;
}

/* Pierścień fokusa rysuje cały pasek — pole w środku już go nie powtarza. */
.inline-form.merged .input:focus {
    box-shadow: none;
}

.inline-form.merged .btn-primary,
.inline-form.merged .btn-secondary {
    flex: none;
    height: 32px;
    padding: 0 16px;
}

.add-item {
    margin-top: 4px;
}


/* ============== */
/* === Search === */
/* ============== */

.search-list {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.search-hit {
    display: grid;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    transition: transform var(--fast) var(--spring), box-shadow var(--fast) var(--spring);
}

.search-hit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-float);
}

.search-hit-ctx {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-hit-sub {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Chip rodzaju trafienia (komentarz/podsumowanie) — treści spoza etykiety wyniku. */
.search-kind {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--surface-sunken, rgba(0, 0, 0, 0.05));
    color: var(--text-secondary);
}

.webhook-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}


/* ======================== */
/* === Protocol (print) === */
/* ======================== */

.protocol-print-page {
    max-width: 800px;
}

.protocol-print-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.protocol-print {
    background: var(--surface);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-soft);
    padding: clamp(24px, 5vw, 48px);
}

.protocol-loading {
    color: var(--text-secondary);
    text-align: center;
    padding: 48px 20px;
}

/* Druk/PDF (§9.14): chrome znika, zostaje sam protokół. Treść jest w normalnym
   flow (nie absolute), więc stronicuje się natywnie na wiele stron. */
@media print {
    .topbar,
    .protocol-print-actions {
        display: none !important;
    }

    .page {
        padding: 0;
        max-width: none;
    }

    .protocol-print {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        color: #000;
    }
}


@media (max-width: 860px) {
    .meeting-page.with-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .item-panel {
        position: fixed;
        inset: 0;
        z-index: 30;
        max-height: none;
        border-radius: 0;
    }
}


/* ================= */
/* === Live mode === */
/* ================= */

.live-scene {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    padding: 16px clamp(16px, 5vw, 56px) 20px;
    background: var(--bg);
}

.live-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.live-counter {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 0.06em;
}

.live-item {
    display: grid;
    gap: 18px;
    align-content: center;
    justify-items: start;
    max-width: 840px;
    margin: 0 auto;
    width: 100%;
    animation: rise 220ms var(--spring) both;
}

.live-title {
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.live-desc {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 60ch;
}

.live-desc ul,
.live-desc ol {
    gap: 6px;
}

.live-decision {
    width: 100%;
}

.live-decision-input {
    min-height: 72px;
    resize: vertical;
    font-size: 15px;
}

/* Notatki prowadzącego (#63) — autosave przy wyjściu z pola. */
.live-notes {
    width: 100%;
}

.live-notes-input {
    min-height: 56px;
    resize: vertical;
    font-size: 14px;
}

/* Zegar po przekroczeniu budżetu czasu punktu. */
.live-timer.overtime {
    color: #ff453a;
    font-weight: 700;
}

/* Suma budżetów czasu nad listą punktów. */
.plan-total {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

/* Pole budżetu czasu w edycji punktu (panel, admin). */
.item-edit-plan {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.item-edit-plan .input {
    width: 90px;
}

.live-decide-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Strzałki nawigacji: okrągły wariant L (44 px) poza rolami pigułek. */
.live-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-size: 22px;
    line-height: 1;
    transition: transform var(--fast) var(--spring), opacity var(--fast) var(--spring);
}

.live-arrow:active {
    transform: scale(0.92);
}

/* Krawędź listy: strzałka bez celu gaśnie zamiast udawać, że działa. */
.live-arrow:disabled {
    opacity: 0.35;
    box-shadow: none;
    pointer-events: none;
}

.live-add {
    display: flex;
    justify-content: center;
    padding-bottom: 8px;
}

.live-add .inline-form.merged {
    width: min(420px, 100%);
}

/* Dolny sticky pasek prowadzenia (#66): nawigacja na krawędziach, statusy
   w środku; nad paskiem rozwija się edytor decyzji. */
.live-bottom {
    position: sticky;
    bottom: 0;
    display: grid;
    gap: 10px;
    padding: 10px 0 4px;
    background: var(--bg);
    border-top: 1px solid var(--separator);
    z-index: 5;
}

.live-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
}

.live-bottom-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.live-decision-editor {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
}

.live-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.live-notes,
.live-actions-saved,
.task-editor {
    display: grid;
    gap: 6px;
    width: 100%;
}

.task-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px auto;
    gap: 8px;
    align-items: center;
}

.task-when {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.task-editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Głosowanie sesyjne (#67): tally + trzy duże przyciski; wybrany „zapada". */
.live-voting {
    display: grid;
    gap: 8px;
    width: 100%;
}

.vote-cta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.vote-cta.selected {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Uzbrojony przycisk destrukcyjny (#68) — drugi klik wykonuje, 4 s i rozbraja. */
.confirm-armed {
    background: #d70015;
}

.live-links {
    display: flex;
    gap: 8px;
}

@media (max-width: 700px) {
    .task-row {
        grid-template-columns: 1fr;
    }
}


/* ==================== */
/* === Close review === */
/* ==================== */

.close-grid {
    display: grid;
    gap: 16px;
    max-width: 720px;
}

.close-section {
    display: grid;
    gap: 12px;
}

.close-section > h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.summary-input {
    min-height: 140px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.5;
}

/* Wiersz checkboxa obecności — obecni domyślnie, odznacza się wyjątki. */
.attendance-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.close-note {
    color: var(--text-secondary);
    font-size: 13px;
}

.action-item-ref {
    color: var(--text-secondary);
    font-weight: 400;
}

.close-cta {
    justify-self: start;
}

.close-confirm {
    max-width: 420px;
    margin: 10vh auto 0;
    text-align: center;
    display: grid;
    gap: 16px;
    justify-items: center;
    padding: 48px 32px;
    animation: rise 260ms var(--spring) both;
}

.confirm-check {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 30px;
    display: grid;
    place-items: center;
    animation: pop 340ms var(--spring) both;
}

@keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
    60% { transform: scale(1.08); }
    to { transform: scale(1); opacity: 1; }
}


/* =================== */
/* === Admin panel === */
/* =================== */

.admin-page {
    max-width: 900px;
}

.admin-tabs {
    margin-bottom: 20px;
}

.admin-grid {
    display: grid;
    gap: 16px;
}

.admin-section {
    display: grid;
    gap: 14px;
}

.admin-section > h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.admin-list {
    list-style: none;
    display: grid;
    gap: 6px;
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-s);
    transition: background var(--fast) var(--spring);
}

.admin-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

.admin-row-main {
    margin-right: auto;
    display: grid;
    gap: 2px;
    font-size: 14px;
    font-weight: 500;
    min-width: 0;
}

.admin-row-sub {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 400;
}

.admin-select {
    flex: 0 0 130px;
    font-size: 13px;
    padding: 7px 10px;
}

.admin-user-row {
    flex-wrap: wrap;
}

.topbar-brand {
    text-decoration: none;
    color: inherit;
}

.context-card-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.context-name-input {
    font-weight: 600;
    font-size: 16px;
    max-width: 260px;
}

.context-card-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.color-field input[type="color"] {
    width: 34px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
}

.trello-chip.connected {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

.token-form {
    display: grid;
    gap: 10px;
}

.scope-checks {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.scope-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.fresh-token {
    display: grid;
    gap: 8px;
    border: 1px dashed var(--accent);
    border-radius: var(--radius-s);
    padding: 12px;
}

.token-code {
    font-size: 13px;
    word-break: break-all;
    user-select: all;
}

.audit-filters {
    display: flex;
    gap: 14px;
}

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

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.audit-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-bottom: 1px solid var(--separator);
}

.audit-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--separator);
    white-space: nowrap;
}

.audit-when {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}


/* ====================== */
/* === Trello connect === */
/* ====================== */

.trello-connect,
.trello-wizard {
    display: grid;
    gap: 10px;
}

.trello-mapping {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--separator);
    padding-top: 12px;
}

.mapping-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.trello-card-preview {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-s);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--fast) var(--spring), transform var(--fast) var(--spring);
}

.trello-card-preview:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.trello-card-name {
    font-weight: 600;
    font-size: 13px;
}

.trello-card-meta {
    color: var(--text-secondary);
    font-size: 12px;
}

.pushed-cards {
    display: grid;
    gap: 8px;
    justify-items: center;
}

/* === Pille kontekstów (Admin → Dostępy) === */

.context-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.ctx-pill {
    border: 1px solid var(--separator);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 150ms var(--spring), color 150ms var(--spring);
}

.ctx-pill:hover {
    border-color: var(--accent);
    color: var(--text);
}

.ctx-pill.on {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-radius: 999px;
    padding: 0;
}

.ctx-pill-name {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 4px 4px 12px;
    cursor: pointer;
}

.ctx-pill-role {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 4px 10px 4px 2px;
    cursor: pointer;
    transition: color 150ms var(--spring);
}

.ctx-pill-role.admin {
    color: var(--accent);
}

/* === Wydarzenie w kalendarzu (widok spotkania) === */

.calendar-slot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calendar-error {
    color: var(--text-secondary);
    font-size: 12px;
}

.admin-flag {
    border: 1px solid var(--separator);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 150ms var(--spring);
}

.admin-flag.on {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

/* === Widok "Wszystkie" — badge kontekstu na karcie === */

.context-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.context-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* === Karty decyzji — konfiguracja sinku (admin) === */

.card-sink {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--separator);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.github-connect {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.github-project-input {
    max-width: 110px;
}


/* === Karty decyzji — live i panel === */

.live-chiprow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.card-link:hover {
    text-decoration: underline;
}

.owner-line {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.card-create-btn {
    align-self: flex-start;
}

.owner-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    max-width: 560px;
}

.owner-picker-prompt {
    margin: 0;
    font-weight: 600;
}

.picker-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.owner-picker-done {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.card-warning {
    margin: 0;
    font-size: 13px;
    color: #b25000;
}

.term-input {
    max-width: 210px;
}


/* === Edycja punktu w panelu === */

.item-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.item-edit-desc {
    min-height: 200px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.item-edit-actions {
    display: flex;
    gap: 8px;
}


/* === Odznaka „po terminie" === */

.chip-overdue {
    background: rgba(255, 149, 0, 0.16);
    color: #b25000;
}


/* ============================== */
/* === Mobile (telefon <700px) === */
/* ============================== */

@media (max-width: 700px) {
    /* Topbar: brand + akcje w pierwszym rzędzie, przełącznik kontekstów
       schodzi do drugiego — pełna szerokość, przewijany poziomo w sobie
       (strona nigdy nie scrolluje w bok). */
    .topbar {
        flex-wrap: wrap;
        gap: 10px 12px;
        padding: 10px 14px;
    }

    .topbar .segmented {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .topbar .segmented::-webkit-scrollbar {
        display: none;
    }

    .segmented-option {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .topbar-user {
        gap: 6px;
    }

    .topbar-user .btn-ghost {
        padding: 0 8px;
    }

    .page {
        padding-bottom: 48px;
    }

    .page-heading {
        gap: 10px;
    }

    .term-input {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .inline-form {
        flex-wrap: wrap;
    }

    .inline-form .input {
        min-width: 0;
        flex: 1 1 180px;
    }

    .item-panel {
        overflow-y: auto;
        padding-bottom: 32px;
    }

    .meeting-card {
        flex-wrap: wrap;
        gap: 8px 10px;
    }

    .live-scene {
        padding: 12px 14px 16px;
    }

    .owner-picker {
        max-width: 100%;
    }
}
