:root {
    --bg-main: #020617;
    --bg-bubble-assistant: #020617;
    --bg-bubble-user: #0b1120;
    --border-subtle: #1f2937;
    --accent: #38bdf8;
    --accent-strong: #0ea5e9;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #f87171;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, #1d283a 0, transparent 40%),
        radial-gradient(circle at bottom right, #020617 0, transparent 45%),
        #020617;
}

/* TOPBAR */

.topbar {
    
    border-bottom: var(--border-subtle);
    color: #f9fafb;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 55%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 55%),
                rgba(15, 23, 42, 0.9);
}

.topbar-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}


.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidebar-toggle-icon {
    font-size: 13px;
}

.sidebar-toggle:hover {
    background: rgba(30, 64, 175, 0.95);
    border-color: rgba(59, 130, 246, 0.9);
    transform: translateY(-1px);
}

.logo-text {
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.topbar strong {
    font-weight: 600;
    letter-spacing: 0.06em;
    font-size: 14px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar strong::before {
    content: "⚡";
    font-size: 14px;
}

.topbar-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    margin-left: 8px;
    transition: all 0.16s ease;
}

.topbar-links a:hover {
    color: #f9fafb;
    border-color: #1f2937;
    background: rgba(15, 23, 42, 0.9);
}

.topbar-links a.is-active,
.topbar-links a[href*="assistant.php"].is-active {
    color: #f9fafb;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--muted);
}

/* blok z tokenami w headerze */
.topbar-tokens {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    font-size: 11px;
    min-width: 120px;
}

.tokens-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tokens-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    color: var(--muted);
}

.tokens-value {
    font-weight: 600;
    color: var(--accent);
}

.tokens-bar {
    width: 90px;
    height: 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
}

.tokens-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), rgba(56, 189, 248, 0.2));
    border-radius: 999px;
}

.tokens-used {
    font-size: 10px;
    color: var(--muted);
    opacity: 0.9;
}



/* LAYOUT */

.page {
    display: block;
}

.container {
    width: 100%;
    max-width: none;
    padding: 20px 16px 32px;
}


.chat-card {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* === CHAT LAYOUT Z LEWYM PANELEM (HISTORIA CZATÓW) === */

/* Domyślnie: sidebar schowany, czat jako jedna kolumna wycentrowana */
.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: flex-start;
    transition: grid-template-columns 0.22s ease;
}

/* Sidebar jest całkowicie schowany, więc nie zajmuje miejsca */
.chat-sidebar {
    display: none;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
    border-radius: 0 16px 16px 0;
    border: 1px solid rgba(31, 41, 55, 0.95);
    padding: 10px 10px 12px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.8);
    max-height: calc(100vh - 120px);
    flex-direction: column;
}

/* Po otwarciu: lewa kolumna 260px, prawa = czat;
   sidebar się pojawia płynnie */
body.sidebar-open .chat-layout {
    grid-template-columns: 260px minmax(0, 1fr);
}

body.sidebar-open .chat-sidebar {
    display: flex;
    animation: sidebarIn 0.22s ease-out;
}

@keyframes sidebarIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-main {
    min-width: 0;
}

/* Toolbar nad czatem – przycisk "Historia czatów" po lewej */
.chat-main-toolbar {
    max-width: 780px;
    margin: 0 auto 10px;
    display: flex;
    justify-content: flex-start;
}

.sidebar-toggle-chat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidebar-toggle-chat .icon {
    font-size: 13px;
}

.sidebar-toggle-chat:hover {
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(59, 130, 246, 0.9);
    transform: translateY(-1px);
}

/* Lewy panel – przyciski i lista */
.chat-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-new-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: var(--text-main);
    text-decoration: none;
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-new-chat:hover {
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(59, 130, 246, 0.8);
    transform: translateY(-1px);
}

.chat-sidebar-list {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chat-sidebar-list::-webkit-scrollbar {
    width: 6px;
}
.chat-sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(55, 65, 81, 0.9);
    border-radius: 999px;
}

.chat-sidebar-item {
    display: block;
    padding: 6px 8px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 12px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.chat-sidebar-item:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(55, 65, 81, 0.9);
}

.chat-sidebar-item.is-active {
    background: rgba(15, 23, 42, 1);
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.chat-sidebar-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-sidebar-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.chat-sidebar-empty {
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px;
}

/* Mobile / tablet – sidebar nad czatem, zawsze opcjonalny */
@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: minmax(0, 1fr);
        margin-left: 0;
        margin-right: 0;
    }

    /* Na mobile też używamy sidebar-open – jeśli jest, sidebar nad czatem */
    body.sidebar-open .chat-layout {
        display: block;
    }

    body.sidebar-open .chat-sidebar {
        margin: 0 auto 12px;
        max-width: 780px;
        border-radius: 16px;
    }
}


/* PRAWY PANEL (chat) */

.chat-main {
    min-width: 0;
}

.chat-main-toolbar {
    max-width: 780px;
    margin: 0 0 10px;
    display: flex;
    justify-content: flex-start;
}

.sidebar-toggle-chat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidebar-toggle-chat .icon {
    font-size: 13px;
}

.sidebar-toggle-chat:hover {
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(59, 130, 246, 0.9);
    transform: translateY(-1px);
}


/* RESPONSYWNOŚĆ: na węższych ekranach jedna kolumna, sidebar zawsze opcjonalny */

@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: minmax(0, 1fr);
        margin-left: 0;
        margin-right: 0;
    }

    body.sidebar-collapsed .chat-sidebar {
        display: none;
    }

    body:not(.sidebar-collapsed) .chat-layout {
        display: block;
    }

    body:not(.sidebar-collapsed) .chat-sidebar {
        margin-bottom: 12px;
    }
}




/* HEADER BOX */

.chat-header {
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    margin-bottom: 18px;
}

.chat-header h1 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header h1::before {
    content: "";
    width: 8px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    display: inline-block;
}

.subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.subtitle strong {
    color: var(--accent-strong);
    font-weight: 500;
}

/* CHAT LOG */

.chat-log {
    padding: 4px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.msg {
    display: flex;
    max-width: 100%;
    opacity: 0;
    transform: translateY(4px);
    animation: msgIn 0.25s ease-out forwards;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-wrapper {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-label {
    font-size: 11px;
    color: var(--text-muted);
}

.msg-bubble {
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.msg-bubble:hover {
    transform: translateY(-1px);
}

.msg-assistant {
    justify-content: flex-start;
}

.msg-assistant .msg-wrapper {
    align-items: flex-start;
}

.msg-assistant .msg-bubble {
    background: var(--bg-bubble-assistant);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.msg-user {
    justify-content: flex-end;
}

.msg-user .msg-wrapper {
    align-items: flex-end;
}

.msg-user .msg-bubble {
    background: var(--bg-bubble-user);
    border: 1px solid rgba(148, 163, 184, 0.55);
}

/* INTRO BANNER */

.msg-intro .msg-wrapper {
    align-items: stretch;
}

.msg-intro .msg-bubble {
    width: 100%;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.10), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(56, 189, 248, 0.4);
    position: relative;
    overflow: hidden;
}

.msg-intro .msg-bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(148, 163, 184, 0.2), transparent 60%);
    opacity: 0.35;
    pointer-events: none;
}

.msg-intro .msg-bubble:hover {
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(15, 23, 42, 1));
    border-color: rgba(56, 189, 248, 0.75);
}

/* TYPING */

.typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--accent);
    opacity: 0.4;
    animation: typing 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(-3px); opacity: 1; }
}

/* FOOTER (CHAT INPUT) */

.chat-footer {
    padding-top: 10px;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
    margin-top: 8px;
}

.error {
    background: rgba(248, 113, 113, 0.08);
    color: #fecaca;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid rgba(248, 113, 113, 0.7);
    display: none;
    margin-bottom: 10px;
}

.row-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row-input textarea {
    width: 100%;
    min-height: 90px;
    max-height: 280px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid #1f2937;
    background: radial-gradient(circle at top left, #020617, #020617);
    color: var(--text-main);
    padding: 11px 13px;
    font-size: 15px;
    outline: none;
    line-height: 1.55;
}

.row-input textarea:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.row-input textarea::placeholder {
    color: #6b7280;
}

.btn {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #0b1120;
    cursor: pointer;
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.85),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    transition: transform 0.13s ease, box-shadow 0.13s ease, filter 0.13s ease;
    min-width: 140px;
    white-space: nowrap;
}

.btn span.icon {
    margin-right: 6px;
    font-size: 13px;
}

.btn:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(56, 189, 248, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.8),
        0 0 0 1px rgba(56, 189, 248, 0.35);
}

.btn:disabled {
    opacity: 0.7;
    cursor: default;
    transform: none;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.7),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.hint-row {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.hint-row span {
    opacity: 0.9;
}

.shortcuts {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.9;
}

/* FOOTER STRONY */

.site-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.9);
    padding: 10px 18px 18px;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.footer-brand {
    font-weight: 600;
    letter-spacing: 0.08em;
}


.footer-text a{color:#9ca3af; text-decoration:none}
.footer-text a:hover{text-decoration:underline}

/* RESPONSYWNOŚĆ */

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .topbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* Menu linków – klasycznie pod logo, zawijane w kilka linii */
    .topbar-right {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        margin-top: 6px;
    }

    .topbar-links {
        order: 1;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .topbar-links a {
        margin-left: 0;
    }

    /* Większy odstęp od krawędzi ekranu */
    .container {
        padding: 16px 18px 32px;
    }

    .chat-header {
        margin-bottom: 14px;
    }

    .row-input textarea {
        min-height: 80px;
    }

    .btn {
        align-self: stretch;
        justify-content: center;
        min-width: 0;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* PROFIL */

.profile-card {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
}

.profile-header {
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    margin-bottom: 18px;
}

.profile-header h1 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 600;
}

.profile-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(31, 41, 55, 0.9);
    margin-bottom: 18px;
    font-size: 13px;
}

.profile-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}

.profile-value {
    font-size: 13px;
}

.profile-value--tokens {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-strong);
}

.profile-alert {
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.profile-alert--error {
    border: 1px solid rgba(248, 113, 113, 0.7);
    background: rgba(248, 113, 113, 0.1);
    color: #fecaca;
}

.profile-alert--success {
    border: 1px solid rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.profile-field label {
    color: var(--text-muted);
}

.profile-field input[type="text"],
.profile-field input[type="email"] {
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #020617;
    color: var(--text-main);
    padding: 7px 9px;
    font-size: 13px;
    outline: none;
}

.profile-field input:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.profile-field--checkbox {
    margin-top: 6px;
}

.profile-field--checkbox input[type="checkbox"] {
    margin-right: 6px;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .profile-summary {
        flex-direction: column;
    }
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

/* === User dropdown w topbarze (jak w ChatGPT) === */

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--muted);
}

.topbar-user {
    position: relative;
    display: flex;
    align-items: center;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    color: #e5e7eb;
    font-size: 13px;
}

.user-menu-toggle:hover {
    border-color: rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b1120;
    font-weight: 600;
    font-size: 12px;
}

.user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    font-size: 10px;
    opacity: 0.8;
}

/* Dropdown */

.user-menu {
    position: absolute;
    right: 0;
    top: 36px;
    min-width: 220px;
    background: #020617;
    border-radius: 12px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    padding: 8px 0;
    display: none;
    z-index: 40;
}

.user-menu.open {
    display: block;
}

.user-menu-header {
    padding: 8px 12px 6px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.8);
}

.user-menu-name {
    font-size: 13px;
    font-weight: 500;
}

.user-menu-role {
    font-size: 11px;
    color: var(--text-muted);
}

.user-menu-section {
    padding: 4px 0;
}

.user-menu-section a {
    display: block;
    padding: 6px 12px;
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
}

.user-menu-section a:hover {
    background: rgba(15, 23, 42, 0.9);
}
/* === OVERRIDE: chat jako kolumna, historia czatów jako dropdown pod przyciskiem === */

.chat-layout {
    display: block;
    margin-left: 0;
    margin-right: 0;
}

.chat-main {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
}

/* pasek z przyciskiem "Historia czatów" – przyklejony pod górnym headerem */
.chat-main-toolbar {
    position: sticky;
    top: 72px; /* pod topbarem, możesz skorygować np. na 68px */
    z-index: 15;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 12px;
    padding: 4px 0;


}

/* wrapper: przycisk + panel */
.chat-history-wrapper {
    position: relative;
    display: inline-block;
}

/* PRZYCISK – korzystamy z istniejących styli, tylko dopieszczamy */
.sidebar-toggle-chat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.sidebar-toggle-chat .icon {
    font-size: 13px;
    opacity: 0.9;
}

.sidebar-toggle-chat:hover {
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
}

/* PANEL z historią – dropdown pod przyciskiem */
.chat-sidebar {
    position: absolute;
    left: 0;
    top: 38px; /* wprost pod przyciskiem */
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;

    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
    border-radius: 16px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    padding: 10px 10px 12px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.9);

    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

/* otwarcie dropdownu – po klasie na body */
body.sidebar-open .chat-sidebar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* nagłówek w panelu */
.chat-sidebar-header {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 8px;
}

.chat-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* na mobile nic specjalnego – dalej dropdown, tylko pilnujemy marginesów */
@media (max-width: 768px) {
    .chat-main {
        padding: 16px 12px 32px;
    }

    .chat-main-toolbar {
        top: 64px;
    }

    .chat-sidebar {
        width: min(80vw, 280px);
    }
}


/* ===========================
   SUBSCRIPTIONS PAGE FIX
   (centrowanie + porządek)
   =========================== */

/* GŁÓWNY WRAPPER – to on centrował będzie całą stronę subskrypcji */
.subs-wrap{
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 6px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* HERO (status) */
.subs-hero{
  display:flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;

  padding: 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.subs-hero-left h2{
  margin: 0 0 6px 0;
  font-size: 22px;
}
.subs-hero-left p{
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 680px;
}

.subs-hero-right{
  min-width: 260px;
  display:flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  gap: 8px;
}

.subs-badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.55);
}

.subs-badge.is-active{
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.subs-badge.is-inactive{
  opacity: .95;
}

.subs-kv{
  display:flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: baseline;
  font-size: 13px;
}
.subs-k{
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.subs-v{
  color: var(--text-main);
}
.subs-note{
  font-size: 13px;
  color: var(--text-muted);
}

/* SEKCJA (karta) – zamiast używać profile-summary */
.subs-section{
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.subs-section-head{
  margin-bottom: 12px;
}
.subs-section-head h3{
  margin: 0;
  font-size: 16px;
}

/* GRID – twardo centrowany i “produktowy” */
.pricing-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

/* KARTY – troszkę spokojniejsze, w Twoim stylu (bez “glow-overkill”) */
.plan-card{
  position: relative;
  border-radius: 16px;
  padding: 50px 16px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(2, 6, 23, 0.55);
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  display:flex;
  flex-direction: column;
  min-height: 280px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.plan-card:hover{
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}

.plan-card.featured{
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18), 0 18px 46px rgba(0,0,0,.5);
}

.plan-top{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.plan-name{
  font-size: 15px;
  font-weight: 800;
}

.plan-badge{
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e5e7eb;
  background: rgba(56, 189, 248, 0.10);
  white-space: nowrap;
}

.plan-price{
  line-height: 1;
  margin-bottom: 10px;
}
.plan-price-amount{ font-size: 36px; font-weight: 900; }
.plan-price-currency{ font-size: 18px; font-weight: 700; opacity: .9; }
.plan-price-dec{ font-size: 14px; font-weight: 700; opacity: .65; margin-left: 2px; }
.plan-price-sub{ font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.plan-price-sub{
  font-size:12px;
  opacity:.85;
  margin-top:6px;
  text-transform:lowercase;
}
.plan-vat{
  margin-left:6px;
  opacity:.9;
}
.plan-price-gross{
  font-size:12px;
  opacity:.75;
  margin-top:4px;
}

.plan-meta{
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.plan-dot{ margin: 0 6px; opacity: .6; }

.plan-features{
  list-style: none;
  margin: 30px 0 50px;
  padding: 0;
  display:flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.plan-features li{
  position: relative;
  padding-left: 20px;
}
.plan-features li::before{
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 900;
}

/* CTA – jak reszta panelu */
.plan-cta{
  margin-top: auto;
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  font-weight: 700;
}

.plan-footnote{
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* RESPONSYWNOŚĆ */
@media (max-width: 980px){
  .subs-hero{ flex-direction: column; }
  .subs-hero-right{ align-items: flex-start; text-align: left; }
  .subs-kv{ justify-content: flex-start; }
  .pricing-grid{ grid-template-columns: 1fr; }
}

/* Admin forms – consistent look */
.form-card {
  max-width: 720px;
}

.form-grid label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-grid input[type="text"],
.form-grid input[type="number"],
.form-grid input[type="datetime-local"],
.form-grid input:not([type]) {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: inherit;
  outline: none;
}

.form-grid input:focus {
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.checkbox-row{
  display:flex;
  flex-direction: row-reverse;   /* checkbox po prawej */
  align-items:flex-start;
  gap: 10px;
}

.checkbox-row span{
  flex: 1 1 auto;                /* tekst zajmuje resztę miejsca */
}

/* WAŻNE: nadpisuje globalne style input (width:100%, display:block itp.) */
.checkbox-row input[type="checkbox"]{
  width: 18px !important;
  height: 18px !important;
  display: inline-block !important;
  flex: 0 0 auto !important;
  margin-top: 2px;
}


.help-text {
  font-weight: 400;
  opacity: 0.75;
  font-size: 13px;
  margin-top: 6px;
}
/* =========================================
   Landing-like pricing (subscriptions.php)
   Doklejone do style2.css
========================================= */

.pricing2 { padding: 44px 0; }
.pricing2 .wrap { max-width: 1100px; margin: 0 auto; padding: 0 18px; }

.pricing2__top{
  display:flex;
  gap:22px;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom: 18px;
}
.pricing2__top h2{ margin:0 0 10px; font-size: 28px; line-height: 1.15; }
.pricing2__top p{ margin:0; opacity:.85; max-width: 680px; }

.pricing2__status{
  width: 340px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 14px 14px 10px;
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(6px);
}
.p2status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.16);
  margin-bottom: 10px;
}
.p2status--active{ background: rgba(0,255,170,.10); }
.p2status--inactive{ background: rgba(255,255,255,.06); opacity:.9; }

.p2status__kv{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.10);
  font-size: 14px;
}
.p2status__kv .k{ opacity:.75; }
.p2status__kv .v{ text-align:right; }
.p2status__note{ opacity:.78; padding-top: 6px; font-size: 14px; }

.pricing2__title{
  margin: 22px 0 14px;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 16px;
  opacity: .92;
}

.pricing2__grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.p2card{
  position: relative;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(6px);
}
.p2card h3{ margin: 0 0 10px; font-size: 18px; }
.p2card__head{ padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.10); }

.p2badge{
  position:absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0, 153, 255, .12);
}

.p2card--featured{
  border-color: rgba(0,153,255,.45);
  box-shadow: 0 0 0 1px rgba(0,153,255,.20) inset;
  transform: translateY(-2px);
}

.p2price{ display:flex; align-items:flex-end; gap: 6px; margin: 6px 0 0; }
.p2price__main{ font-size: 42px; font-weight: 900; line-height: 1; letter-spacing:-.8px; }
.p2price__zl{ font-size: 16px; font-weight: 800; opacity:.92; margin-bottom: 6px; }
.p2price__gr{ font-size: 16px; font-weight: 800; opacity:.72; margin-bottom: 6px; }

.p2sub{ font-size: 12px; opacity:.70; margin-top: 2px; }
.p2meta{ margin-top: 10px; font-size: 13px; opacity:.86; }

.p2list{
  margin: 14px 0 14px;
  padding-left: 18px;
  display:grid;
  gap: 8px;
  opacity: .92;
}
.p2list li{ line-height: 1.35; }

.p2btn{
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.10);
}
.p2btn:hover{ background: rgba(255,255,255,.14); }

.p2foot{ margin-top: 10px; font-size: 12px; opacity: .68; }

/* RWD */
@media (max-width: 980px){
  .pricing2__top{ flex-direction: column; }
  .pricing2__status{ width: 100%; }
  .pricing2__grid{ grid-template-columns: 1fr; }
  .p2card--featured{ transform: none; }
}
.error a {
    display: inline-block;
    margin-left: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: linear-gradient(135deg, #1e88e5, #42a5f5);
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
	animation: subtlePulse 2s infinite;
}

.error a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(30, 136, 229, 0.4);
}

@keyframes subtlePulse {
    0% { box-shadow: 0 0 0 rgba(30,136,229,0.4); }
    50% { box-shadow: 0 0 12px rgba(30,136,229,0.6); }
    100% { box-shadow: 0 0 0 rgba(30,136,229,0.4); }
}

.checkout-summary{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius:12px;
  padding:12px 12px;
  margin-bottom:12px;
}
.checkout-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:13px;
  opacity:.9;
  padding:6px 0;
}
.checkout-total{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:6px;
  padding-top:10px;
  border-top:1px solid rgba(255,255,255,.12);
  font-size:18px;
  font-weight:700;
}
.checkout-total small{
  font-size:12px;
  font-weight:600;
  opacity:.8;
  margin-left:6px;
}
.plan-price-sub{
  font-size:12px;
  opacity:.85;
  margin-top:6px;
  text-transform:lowercase;
}
.plan-vat{
  margin-left:6px;
  opacity:.9;
}
.plan-price-gross{
  font-size:12px;
  opacity:.75;
  margin-top:4px;
}

/* ===== Admin form controls – spójne, ciemne inputy ===== */
.admin-wrap input[type="text"],
.admin-wrap input[type="email"],
.admin-wrap input[type="password"],
.admin-wrap input[type="number"],
.admin-wrap input[type="date"],
.admin-wrap input[type="datetime-local"],
.admin-wrap input[type="search"],
.admin-wrap select,
.admin-wrap textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
}

/* placeholder */
.admin-wrap input::placeholder,
.admin-wrap textarea::placeholder{
  color: rgba(148,163,184,.65);
}

/* focus */
.admin-wrap input:focus,
.admin-wrap select:focus,
.admin-wrap textarea:focus{
  border-color: rgba(56,189,248,.55);
  box-shadow:
    0 0 0 3px rgba(56,189,248,.18),
    inset 0 0 0 1px rgba(0,0,0,.10);
}

/* select arrow fix + lepszy wygląd */
.admin-wrap select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(148,163,184,.9) 50%),
    linear-gradient(135deg, rgba(148,163,184,.9) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 55%,
    calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* checkbox/radio – żeby nie były "systemowe" */
.admin-wrap input[type="checkbox"],
.admin-wrap input[type="radio"]{
  width: 18px;
  height: 18px;
  accent-color: rgba(56,189,248,.95);
}

/* textarea */
.admin-wrap textarea{
  min-height: 110px;
  resize: vertical;
}

/* mniejsze inputy w inline formach (np. tokeny) */
.admin-wrap .inline-input{
  width: auto !important;
  min-width: 160px;
} 6px; }

/* ===== Admin form controls – spójny dark look ===== */
.admin-wrap input[type="text"],
.admin-wrap input[type="email"],
.admin-wrap input[type="password"],
.admin-wrap input[type="number"],
.admin-wrap input[type="datetime-local"],
.admin-wrap input[type="date"],
.admin-wrap input[type="time"],
.admin-wrap textarea,
.admin-wrap select {
  width: 100%;
  background: rgba(2, 10, 28, .55);
  color: rgba(255,255,255,.92);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}

.admin-wrap input::placeholder,
.admin-wrap textarea::placeholder {
  color: rgba(226,232,240,.55);
}

.admin-wrap input:focus,
.admin-wrap textarea:focus,
.admin-wrap select:focus {
  border-color: rgba(56, 189, 248, .55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .18);
}

.admin-wrap select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(226,232,240,.7) 50%),
                    linear-gradient(135deg, rgba(226,232,240,.7) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.admin-wrap label.small-muted {
  display: grid;
  gap: 6px;
}

.admin-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
}