/* SuppChat customer portal. Reuses the design tokens from app.css (loaded
   first); this file is only the customer-facing layout — calmer and more
   centred than the operator console. One column on the content plane, the
   header on the chrome plane, no cards. */

.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--panel); }

.portal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 0 16px;
    min-height: 48px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.portal-top-links { margin-left: auto; display: flex; gap: 4px; }
.portal-top-right { display: flex; align-items: center; gap: 4px; }
.portal-email { color: var(--muted); font-size: var(--fs-2); margin-right: 4px; }
/* links and the signed-in account group: plain header items on desktop; at
   phone width, once signed in, one fold-out menu behind "Menu" */
.portal-nav { display: contents; }
.portal-menu-toggle { display: none; }

/* one 640px content column for the portal, the help and the new-ticket form,
   so the left edge does not jump between them */
.portal-main { flex: 1; width: 100%; max-width: 688px; margin: 0 auto; padding: 48px 24px 64px; }

.portal-card { background: none; border: 0; padding: 0; }
.portal-card h1 { margin: 0 0 8px; font-size: var(--fs-8); line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }
.portal-lead { color: var(--muted); font-size: var(--fs-5); line-height: 22px; margin: 0 0 24px; }

/* sign-in field label: the same 13px label as the new-ticket form */
.portal-label { display: block; margin: 0 0 6px; font-size: var(--fs-2); line-height: 18px; font-weight: 400; color: var(--text); }

/* fields on the portal are the large size (40px) */
.portal-form { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-form input,
.pubform select,
.pubform textarea,
.portal-reply textarea,
.portal-rating textarea {
    width: 100%;
    height: var(--ctl-h-lg);
    padding: 0 12px;
    background: var(--field);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-s);
    font-family: inherit;
    font-size: var(--fs-5);
    line-height: 22px;
    transition: var(--t-colors);
}
.portal-form input { flex: 1; min-width: 220px; width: auto; }
.portal-form input:hover, .pubform select:hover, .pubform textarea:hover,
.portal-reply textarea:hover, .portal-rating textarea:hover { border-color: var(--border-hover); }
.portal-form .btn { height: var(--ctl-h-lg); padding: 0 16px; }
/* the dot sits on the first line when the note wraps (phone width) */
.portal-note { display: flex; align-items: flex-start; gap: 8px; color: var(--text); margin: 16px 0 0; font-size: var(--fs-3); line-height: 20px; }
.portal-note::before { content: ""; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; flex: none; background: var(--success-dot); }

/* ---------- ticket list: hairline rows ---------- */
.portal-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.portal-list-head h1 { margin: 0; font-size: var(--fs-8); line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }
/* hairlines live on the rows only, so top and bottom lines have the same width */
.portal-tickets { display: flex; flex-direction: column; }

.ptix {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: 0 -12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--t-colors);
}
.ptix:first-child { border-top: 1px solid var(--border); }
.ptix:hover { background: var(--hover); }
.ptix-main { flex: 1; min-width: 0; }
.ptix-subj { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptix-meta { color: var(--muted); font-size: var(--fs-1); line-height: 16px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.portal-empty { color: var(--muted); font-size: var(--fs-2); text-align: center; padding: 48px 24px; }

/* ---------- thread ---------- */
.portal-back { margin: 0 0 16px -10px; }
.portal-thread-head { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 24px; }
.portal-thread-head h2 { margin: 0 0 4px; font-size: var(--fs-7); line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.portal-thread-meta { color: var(--muted); font-size: var(--fs-2); display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }

.portal-messages { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.pmsg { max-width: min(720px, 80%); }
.pmsg-in { align-self: flex-start; }            /* from support */
.pmsg-out { align-self: flex-end; }             /* from the customer */
.pmsg .bubble { padding: 10px 14px; border-radius: var(--r-m); font-size: var(--fs-5); line-height: 22px; white-space: pre-wrap; word-wrap: break-word; }
.pmsg-in .bubble { background: var(--panel-2); color: var(--text); }
/* the customer's own message: a neutral step darker than support, like the console's outgoing
   bubble. A red fill (or the light red tint) reads as an error while the accent is red (D1);
   when D1 goes blue this returns to the solid chat-convention fill of 01_SMER 5.3. */
.pmsg-out .bubble { background: var(--bubble-out); color: var(--bubble-out-fg); }
/* AI Act art. 50: the assistant's reply is labelled on its first line */
.pmsg-ai { display: block; margin: 0 0 6px; font-size: var(--fs-1); line-height: 16px; font-weight: 500; color: var(--muted); white-space: normal; }
.pmsg-time { font-size: var(--fs-1); line-height: 16px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.pmsg-out .pmsg-time { text-align: right; }

.portal-reply textarea, .portal-rating textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.portal-reply-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.portal-reply-actions #reply-send { margin-left: auto; }
.portal-attach { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.portal-attach-label { color: var(--muted); font-size: var(--fs-1); }

/* ---------- CSAT ---------- */
.portal-rating { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 24px; }
.portal-rating-q { font-weight: 600; margin: 0 0 8px; }
.portal-stars { display: flex; gap: 4px; margin-bottom: 12px; }
.portal-stars button {
    background: none;
    border: 0;
    border-radius: var(--r-xs);
    font-size: var(--fs-7);
    line-height: 28px;
    width: 28px;
    color: var(--faint);
    cursor: pointer;
    padding: 0;
    transition: color var(--dur) var(--ease);
}
.portal-stars button.on, .portal-stars button.hover { color: var(--warn); }
.portal-rating textarea { min-height: 64px; margin-bottom: 8px; }

@media (max-width: 560px) {
    .portal-main { padding: 32px 16px 48px; }
    .pmsg { max-width: 92%; }
    .portal-top { position: relative; padding: 6px 12px; }
    .portal-top-links { margin-left: 0; }
    /* signed in: the e-mail and "Odhlásit" used to wrap into a second row */
    .portal-top:has(#portal-top-right:not([hidden])) { flex-wrap: nowrap; }
    .portal-top:has(#portal-top-right:not([hidden])) .portal-menu-toggle { display: inline-flex; margin-left: auto; }
    .portal-top:has(#portal-top-right:not([hidden])) .portal-nav {
        display: none;
        position: absolute;
        top: 100%;
        right: 8px;
        z-index: 45;
        flex-direction: column;
        gap: 4px;
        width: 248px;
        margin-top: 4px;
        padding: 4px;
        background: var(--panel);
        border: 1px solid var(--border-float);
        border-radius: var(--r-m);
        box-shadow: var(--elev);
        animation: fade-in var(--dur) var(--ease);
    }
    .portal-top:has(#portal-top-right:not([hidden])) .portal-nav.open { display: flex; }
    .portal-nav.open .portal-top-links, .portal-nav.open .portal-top-right { flex-direction: column; align-items: stretch; gap: 2px; margin: 0; }
    .portal-nav.open .portal-top-right { padding-top: 4px; border-top: 1px solid var(--border); }
    .portal-nav.open .btn { justify-content: flex-start; width: 100%; color: var(--text); }
    .portal-nav.open .portal-email { margin: 0; padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* --- Public "submit a ticket" form (/portal/novy) --- */
/* the form takes the full 640px column like every other portal page */
.pubform-card { max-width: none; }
.pubform { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.pubfield { display: flex; flex-direction: column; gap: 6px; }
.pubfield > span, .pubfield-label { font-size: var(--fs-2); font-weight: 400; color: var(--text); }
.pubfield em, .pubfield-label em { color: var(--danger); font-style: normal; }
.pubform input[type="text"],
.pubform input[type="email"],
.pubform-captcha input { width: 100%; min-width: 0; flex: none; }
.pubform textarea { height: auto; min-height: 144px; padding: 10px 12px; resize: vertical; }
.pubform select { padding: 0 8px; }
/* attachments: a Czech button over the hidden native input, file names beside it */
.pubform-files { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pubform-files .btn { flex: none; }
.pubform-files-names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-2); }
.pubform .btn-primary { align-self: flex-start; }
.pubform-error {
    padding: 10px 12px;
    border-radius: var(--r-s);
    background: var(--danger-bg);
    color: var(--text);
    font-size: var(--fs-3);
}
.pubform-captcha { display: flex; flex-direction: column; gap: 6px; }
.pubform-captcha-row { display: flex; align-items: center; gap: 8px; }
.pubform-captcha-img {
    height: 60px;
    border-radius: var(--r-s);
    border: 1px solid var(--border);
    display: block;
}.pubform-done {
    padding: 12px 14px;
    border-radius: var(--r-s);
    background: var(--success-bg);
    color: var(--text);
    margin-top: 8px;
}
.pubform-done p { margin: 0; }
.pubform-done .pubform-done-title { font-weight: 600; margin: 0 0 4px; }
/* Honeypot: kept in the DOM for bots, pushed off-screen for humans + AT. */
.pubform-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
