/**
 * ClientHub Core - Frontend CSS
 *
 * Layout inicial da área reservada.
 * Isto ainda não é o design final. É só a base funcional.
 */

* {
    box-sizing: border-box;
}

.ch-portal-body,
.ch-login-body {
    margin: 0;
    background: #f5f7fb;
    color: #101828;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ch-app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.ch-sidebar {
    min-height: 100vh;
    padding: 24px;
    background: #071426;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.ch-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.ch-sidebar__logo,
.ch-login__logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #14b8a6;
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
}

.ch-sidebar__name {
    font-size: 20px;
    font-weight: 800;
}

.ch-sidebar__nav {
    display: grid;
    gap: 8px;
}

.ch-nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.ch-nav-link:hover,
.ch-nav-link.is-active {
    background: rgba(20, 184, 166, 0.16);
    color: #ffffff;
}

.ch-sidebar__footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.ch-user-pill {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
}

.ch-logout-link {
    color: #94a3b8;
    font-size: 13px;
    text-decoration: none;
}

.ch-logout-link:hover {
    color: #ffffff;
}

.ch-main {
    min-width: 0;
    padding: 32px;
}

.ch-topbar {
    margin-bottom: 24px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
}

.ch-topbar h1 {
    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.2;
}

.ch-topbar p {
    margin: 0;
    color: #667085;
}

.ch-content {
    display: grid;
    gap: 20px;
}

.ch-grid {
    display: grid;
    gap: 20px;
}

.ch-grid--cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ch-card {
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.04);
}

.ch-card__eyebrow {
    display: block;
    margin-bottom: 8px;
    color: #14b8a6;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ch-card h2 {
    margin: 0 0 8px;
    font-size: 22px;
}

.ch-card p {
    margin: 0;
    color: #667085;
    line-height: 1.6;
}

.ch-table {
    width: 100%;
    border-collapse: collapse;
}

.ch-table th,
.ch-table td {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.ch-table th {
    width: 180px;
    color: #667085;
}

/**
 * Login
 */

.ch-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ch-login__card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.08);
}

.ch-login__brand {
    margin-bottom: 24px;
}

.ch-login__brand h1 {
    margin: 16px 0 6px;
    font-size: 28px;
}

.ch-login__brand p {
    margin: 0;
    color: #667085;
}

.ch-login form p {
    margin-bottom: 16px;
}

.ch-login label {
    display: block;
    margin-bottom: 6px;
    color: #344054;
    font-weight: 600;
}

.ch-login input[type="text"],
.ch-login input[type="password"] {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    font-size: 15px;
}

.ch-login input[type="submit"] {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: #14b8a6;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.ch-login__lost-password {
    margin: 16px 0 0;
    text-align: center;
}

.ch-login__lost-password a {
    color: #0f766e;
    text-decoration: none;
    font-weight: 600;
}

/**
 * Responsive
 */

@media (max-width: 900px) {
    .ch-app {
        display: block;
    }

    .ch-sidebar {
        min-height: auto;
    }

    .ch-sidebar__footer {
        display: none;
    }

    .ch-main {
        padding: 20px;
    }

    .ch-grid--cards {
        grid-template-columns: 1fr;
    }
}





/**
 * Documents frontend
 */

.ch-documents-page {
    display: grid;
    gap: 20px;
}

.ch-documents-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.ch-documents-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ch-documents-search input[type="search"] {
    min-width: 260px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #ffffff;
    color: #101828;
    font-size: 14px;
}

.ch-documents-search button,
.ch-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: #14b8a6;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.ch-documents-search button:hover,
.ch-button:hover {
    background: #0f766e;
    color: #ffffff;
}

.ch-documents-clear {
    color: #667085;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.ch-documents-list {
    display: grid;
    gap: 12px;
}

.ch-document-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ch-document-card__main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ch-document-card__icon {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border-radius: 16px;
    background: #ecfdf3;
    color: #0f766e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
}

.ch-document-card__content {
    min-width: 0;
}

.ch-document-card__content h3 {
    margin: 0 0 8px;
    color: #101828;
    font-size: 17px;
    line-height: 1.3;
}

.ch-document-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: #667085;
    font-size: 13px;
}

.ch-document-card__object {
    margin-top: 8px;
    color: #667085;
    font-size: 12px;
}

.ch-document-card__object code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #f2f4f7;
    color: #344054;
}

.ch-document-card__actions {
    flex: 0 0 auto;
}

.ch-document-card__locked {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f2f4f7;
    color: #667085;
    font-size: 13px;
    font-weight: 700;
}

.ch-empty-state {
    text-align: center;
}

.ch-empty-state h2 {
    margin-bottom: 8px;
}

@media (max-width: 800px) {
    .ch-documents-toolbar,
    .ch-document-card {
        display: block;
    }

    .ch-documents-search {
        margin-top: 18px;
        display: grid;
    }

    .ch-documents-search input[type="search"] {
        min-width: 0;
        width: 100%;
    }

    .ch-document-card__actions {
        margin-top: 18px;
    }

    .ch-document-card__actions .ch-button {
        width: 100%;
    }
}


/**
 * Notifications frontend
 */

.ch-nav-link {
    justify-content: space-between;
    gap: 10px;
}

.ch-nav-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
}

.ch-notifications-page {
    display: grid;
    gap: 20px;
}

.ch-notifications-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ch-notifications-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ch-filter-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f2f4f7;
    color: #344054;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}

.ch-filter-link.is-active,
.ch-filter-link:hover {
    background: #14b8a6;
    color: #ffffff;
}

.ch-button--small {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
}

.ch-button--secondary {
    background: #f2f4f7;
    color: #344054;
}

.ch-button--secondary:hover {
    background: #e4e7ec;
    color: #101828;
}

.ch-notifications-list {
    display: grid;
    gap: 12px;
}

.ch-notification-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ch-notification-card.is-unread {
    border-color: rgba(20, 184, 166, 0.5);
}

.ch-notification-card__main {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ch-notification-card__indicator {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 999px;
    background: #d0d5dd;
    flex: 0 0 12px;
}

.ch-notification-card.is-unread .ch-notification-card__indicator {
    background: #14b8a6;
}

.ch-notification-card h3 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.3;
}

.ch-notification-card p {
    margin: 0;
    color: #667085;
}

.ch-notification-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 10px;
    color: #667085;
    font-size: 12px;
}

.ch-notification-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

@media (max-width: 800px) {
    .ch-notifications-toolbar,
    .ch-notification-card {
        display: block;
    }

    .ch-notifications-actions,
    .ch-notification-card__actions {
        margin-top: 16px;
    }
}


/**
 * Support frontend
 */

.ch-grid {
    display: grid;
    gap: 24px;
}

.ch-grid-2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.ch-form {
    display: grid;
    gap: 16px;
}

.ch-field {
    display: grid;
    gap: 6px;
}

.ch-field label {
    font-weight: 600;
    color: #1f2937;
}

.ch-field input,
.ch-field select,
.ch-field textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 13px;
    font: inherit;
    background: #fff;
}

.ch-ticket-list {
    display: grid;
    gap: 10px;
}

.ch-ticket-item {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.ch-ticket-item:hover {
    border-color: #0f766e;
}

.ch-ticket-item span {
    font-size: 13px;
    color: #0f766e;
    font-weight: 700;
}

.ch-ticket-item small {
    color: #6b7280;
}

.ch-ticket-thread {
    margin-top: 24px;
}

.ch-ticket-thread-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ch-ticket-messages {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
}

.ch-ticket-message {
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.ch-ticket-message.is-admin {
    background: #ecfdf5;
    border-color: #99f6e4;
}

.ch-ticket-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #4b5563;
}

.ch-ticket-message-body p:last-child {
    margin-bottom: 0;
}

.ch-notice {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-weight: 600;
}

.ch-notice-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.ch-notice-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ch-muted {
    color: #6b7280;
}

@media (max-width: 900px) {
    .ch-grid-2 {
        grid-template-columns: 1fr;
    }

    .ch-ticket-message-meta {
        display: grid;
    }
}

/* ==========================================================================
   Support polish
   ========================================================================== */

.ch-ticket-item {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ch-ticket-item:hover,
.ch-ticket-item.is-active {
    border-color: #14b8a6;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.ch-ticket-item__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.ch-ticket-item__top strong {
    line-height: 1.25;
}

.ch-ticket-item__meta {
    color: #64748b;
    font-size: 13px;
}

.ch-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.ch-status-badge.is-open {
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #a5f3fc;
}

.ch-status-badge.is-waiting {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.ch-status-badge.is-closed {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.ch-ticket-thread-header {
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}

.ch-ticket-thread-header h2 {
    margin-bottom: 6px;
}

.ch-ticket-thread-header p {
    margin: 0;
    color: #64748b;
}

.ch-ticket-message {
    position: relative;
}

.ch-ticket-message.is-admin::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 999px;
    background: #14b8a6;
}

.ch-ticket-message.is-client::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 999px;
    background: #cbd5e1;
}

@media (max-width: 700px) {
    .ch-ticket-item__top {
        display: grid;
    }

    .ch-status-badge {
        width: fit-content;
    }

    .ch-ticket-thread-header {
        display: grid;
    }
}


/* ==========================================================================
   Frontend Documents V0.2
   ========================================================================== */

.ch-documents-page {
    display: grid;
    gap: 18px;
}

.ch-documents-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
    gap: 24px;
    align-items: end;
}

.ch-documents-toolbar__content h2 {
    margin-bottom: 6px;
}

.ch-documents-toolbar__content p {
    margin: 0;
    color: #64748b;
}

.ch-documents-search {
    display: grid;
    gap: 12px;
}

.ch-documents-search__fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.6fr);
    gap: 10px;
}

.ch-documents-search__field input,
.ch-documents-search__field select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 10px 13px;
    background: #fff;
    font: inherit;
    color: #0f172a;
}

.ch-documents-search__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ch-documents-list {
    display: grid;
    gap: 14px;
}

.ch-document-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
}

.ch-document-card__main {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    min-width: 0;
}

.ch-document-card__icon {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #047857;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.ch-document-card__content {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.ch-document-card__heading {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ch-document-card__heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    line-height: 1.25;
}

.ch-document-category {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 5px 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
}

.ch-document-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: #64748b;
    font-size: 14px;
}

.ch-document-card__meta span {
    position: relative;
}

.ch-document-card__meta span:not(:last-child)::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    position: absolute;
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
}

.ch-document-card__object {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: #475569;
    font-size: 14px;
}

.ch-document-card__object-label {
    color: #94a3b8;
}

.ch-document-card__object strong {
    color: #334155;
}

.ch-document-card__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.ch-document-card__locked {
    color: #b91c1c;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 1000px) {
    .ch-documents-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .ch-documents-search__actions {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .ch-documents-search__fields {
        grid-template-columns: 1fr;
    }

    .ch-document-card {
        grid-template-columns: 1fr;
    }

    .ch-document-card__actions {
        justify-content: flex-start;
    }

    .ch-document-card__main {
        align-items: flex-start;
    }

    .ch-document-card__icon {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
        border-radius: 16px;
        font-size: 12px;
    }

    .ch-document-card__meta {
        display: grid;
        gap: 4px;
    }

    .ch-document-card__meta span::after {
        display: none;
    }
}