/* Qartt Helpdesk - Portal do Cliente */
.qhd-wrap-front {
    max-width: 820px; margin: 0 auto; padding: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1d2327;
}
.qhd-auth-box { max-width: 440px; }

.qhd-card-front {
    background: #fff; border: 1px solid #e3e5e8; border-radius: 14px;
    padding: 28px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.qhd-card-front h2 { margin-top: 0; font-size: 22px; }
.qhd-card-front h3 { margin-top: 0; font-size: 17px; }

.qhd-form { display: flex; flex-direction: column; gap: 14px; }
.qhd-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
.qhd-form input[type=text], .qhd-form input[type=email], .qhd-form input[type=password],
.qhd-form select, .qhd-form textarea {
    width: 100%; padding: 11px 13px; border: 1px solid #c9ccd1; border-radius: 9px;
    font-size: 15px; font-family: inherit; box-sizing: border-box; background: #fff;
}
.qhd-form input:focus, .qhd-form select:focus, .qhd-form textarea:focus {
    border-color: #2271b1; outline: none; box-shadow: 0 0 0 3px rgba(34,113,177,.12);
}
/* Corrige cor da fonte dos selects/options (alguns temas deixam branco) */
.qhd-form select,
.qhd-form select option,
.qhd-wrap-front select,
.qhd-wrap-front select option {
    color: #1d2327 !important;
    background-color: #fff !important;
}
.qhd-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .qhd-form-row { grid-template-columns: 1fr; } }
.qhd-checkbox { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.qhd-form-inline { flex-direction: row; align-items: center; }

.qhd-btn {
    display: inline-block; padding: 11px 22px; border-radius: 9px; border: none;
    font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
    transition: background .15s, opacity .15s;
}
.qhd-btn-primary { background: #2271b1; color: #fff; }
.qhd-btn-primary:hover { background: #185a8d; color: #fff; }
.qhd-btn-secondary { background: #f0f2f4; color: #1d2327; }
.qhd-btn-link { background: none; color: #2271b1; padding: 8px 4px; }
.qhd-btn-link:hover { text-decoration: underline; }

.qhd-links { margin: 12px 0 0; font-size: 14px; }
.qhd-links a { color: #2271b1; text-decoration: none; cursor: pointer; }
.qhd-muted { color: #646970; font-size: 13px; }

.qhd-alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.qhd-alert-success { background: #e5f5e8; color: #007017; border: 1px solid #b8e6c1; }
.qhd-alert-error { background: #fce8e8; color: #b32d2e; border: 1px solid #f1c4c4; }
.qhd-alert-info { background: #e7f0fa; color: #135e96; border: 1px solid #c5d9ed; }

.qhd-portal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.qhd-portal-head h2 { margin: 0; font-size: 22px; }
.qhd-portal-actions { display: flex; align-items: center; gap: 10px; }
.qhd-logout-form { margin: 0; }

.qhd-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.qhd-filter-tabs a {
    padding: 7px 15px; border-radius: 20px; text-decoration: none; font-size: 13px;
    color: #50575e; background: #f0f2f4;
}
.qhd-filter-tabs a.active { background: #2271b1; color: #fff; }

.qhd-ticket-list { display: flex; flex-direction: column; gap: 10px; }
.qhd-ticket-item {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border: 1px solid #e3e5e8; border-radius: 12px; padding: 15px 18px;
    text-decoration: none; color: #1d2327; transition: border-color .15s, box-shadow .15s;
}
.qhd-ticket-item:hover { border-color: #2271b1; box-shadow: 0 2px 8px rgba(34,113,177,.1); }
.qhd-ticket-item-main { display: flex; flex-direction: column; gap: 3px; }
.qhd-ticket-code { font-size: 12px; color: #646970; font-weight: 700; letter-spacing: .3px; }
.qhd-ticket-subject { font-size: 15px; font-weight: 600; }
.qhd-ticket-item-meta { display: flex; align-items: center; gap: 12px; }
.qhd-ticket-date { font-size: 12px; color: #646970; }

.qhd-badge {
    display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.qhd-status-open { background: #fce8e8; color: #b32d2e; }
.qhd-status-in_progress { background: #fcf3e0; color: #996800; }
.qhd-status-waiting { background: #eef0f2; color: #50575e; }
.qhd-status-resolved { background: #e5f5e8; color: #007017; }
.qhd-status-closed { background: #e2e4e7; color: #3c434a; }

.qhd-empty-state { text-align: center; padding: 50px 20px; background: #fff; border: 1px dashed #c9ccd1; border-radius: 14px; }
.qhd-empty-state p { color: #646970; margin-bottom: 18px; }

.qhd-thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.qhd-msg { border: 1px solid #e3e5e8; border-radius: 12px; padding: 16px 18px; background: #fff; }
.qhd-msg-customer { border-left: 4px solid #2271b1; }
.qhd-msg-agent { border-left: 4px solid #00a32a; background: #f8fcf9; }
.qhd-msg-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; flex-wrap: wrap; gap: 4px; }
.qhd-msg-head span { color: #646970; }
.qhd-msg-body { font-size: 15px; line-height: 1.65; }
.qhd-msg-body p { margin: 0 0 10px; }
.qhd-tag-agent { background: #00a32a; color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 10px; margin-left: 6px; }

.qhd-attachments { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.qhd-attach {
    display: inline-flex; align-items: center; gap: 5px; background: #f0f6fc;
    border: 1px solid #c5d9ed; border-radius: 8px; padding: 6px 12px; font-size: 13px;
    text-decoration: none; color: #135e96;
}

.qhd-track { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e3e5e8; }

/* Estrelas CSAT */
.qhd-csat .qhd-stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; margin-bottom: 12px; }
.qhd-stars input { display: none; }
.qhd-stars label { font-size: 32px; color: #d3d6da; cursor: pointer; transition: color .1s; }
.qhd-stars input:checked ~ label,
.qhd-stars label:hover, .qhd-stars label:hover ~ label { color: #f5b301; }

/* ===== Barra fixa do topo (cliente logado) ===== */
.qhd-topbar {
    position: sticky; top: 0; z-index: 99990; width: 100%;
    background: #1d2327; color: #fff; font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.qhd-topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 9px 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.qhd-topbar-brand { font-weight: 600; }
.qhd-topbar-dot { color: #25D366; font-size: 10px; }
.qhd-topbar-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qhd-topbar-link { color: #e2e4e7; text-decoration: none; }
.qhd-topbar-link:hover { color: #fff; text-decoration: underline; }
.qhd-topbar-cta { background: #2271b1; color: #fff; padding: 6px 14px; border-radius: 6px; font-weight: 600; }
.qhd-topbar-cta:hover { background: #185a8d; color: #fff; text-decoration: none; }
.qhd-topbar-user { color: #a7aaad; font-size: 13px; }
.qhd-topbar-logout { color: #f1c4c4; }
@media (max-width: 600px) {
    .qhd-topbar-inner { padding: 8px 12px; }
    .qhd-topbar-brand { width: 100%; }
}

/* ===== Busca e paginação do portal ===== */
.qhd-search-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.qhd-search-bar input[type=search] {
    flex: 1; min-width: 200px; padding: 10px 13px; border: 1px solid #c9ccd1; border-radius: 9px; font-size: 15px;
}
.qhd-front-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.qhd-page-btn {
    padding: 8px 16px; background: #fff; border: 1px solid #c9ccd1; border-radius: 8px;
    text-decoration: none; color: #2271b1; font-size: 14px;
}
.qhd-page-btn:hover { border-color: #2271b1; }
.qhd-page-info { color: #646970; font-size: 14px; }

/* ===== Linha de metadados do chamado ===== */
.qhd-ticket-meta-row {
    display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; margin-bottom: 16px;
    background: #f6f7f9; border-radius: 10px; font-size: 13px; color: #50575e;
}
.qhd-ticket-meta-row strong { color: #1d2327; }

/* ===== Miniaturas de imagem ===== */
.qhd-thumb {
    margin: 0; display: inline-flex; flex-direction: column; align-items: center;
    width: 110px; text-align: center;
}
.qhd-thumb-img {
    width: 110px; height: 90px; object-fit: cover; border-radius: 8px;
    border: 1px solid #c5d9ed; cursor: zoom-in; transition: transform .12s, box-shadow .12s; background: #f0f6fc;
}
.qhd-thumb-img:hover { transform: scale(1.03); box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.qhd-thumb figcaption { font-size: 11px; margin-top: 4px; max-width: 110px; overflow: hidden; }
.qhd-thumb figcaption a { color: #135e96; text-decoration: none; }

/* ===== Modal de imagem ===== */
.qhd-img-modal {
    position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.88);
    display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 30px;
}
.qhd-img-modal-content { max-width: 92%; max-height: 82%; border-radius: 6px; box-shadow: 0 6px 40px rgba(0,0,0,.5); }
.qhd-img-modal-caption { color: #fff; margin-top: 14px; font-size: 14px; }
.qhd-img-modal-close {
    position: absolute; top: 18px; right: 26px; color: #fff; font-size: 40px;
    font-weight: bold; cursor: pointer; line-height: 1;
}
.qhd-img-modal-close:hover { color: #ccc; }

/* ===== Edição de chamado pelo cliente ===== */
.qhd-edit-toggle {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.qhd-edit-toggle h3 { margin: 0; font-size: 16px; color: #50575e; }
.qhd-edit-form-wrap { margin-top: 16px; border-top: 1px solid #e3e5e8; padding-top: 16px; }
.qhd-edit-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Código em destaque pós-abertura de chamado sem login */
.qhd-code-box {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #e7f0fa; border: 2px solid #2271b1; border-radius: 12px;
    padding: 18px 24px; margin: 20px 0; text-align: center;
}
.qhd-code-label { font-size: 13px; color: #135e96; text-transform: uppercase; letter-spacing: .5px; }
.qhd-code-value { font-size: 28px; font-weight: 700; color: #2271b1; letter-spacing: 1px; }
