/* ===================================================
   CORPQUALI SGQ - Design System
   Modern, Clean, Responsive UI
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --cq-primary: #1B3A5C;
    --cq-primary-light: #2A5580;
    --cq-primary-dark: #0F2640;
    --cq-accent: #E8A817;
    --cq-accent-light: #F5C946;
    --cq-accent-dark: #C48E0E;
    --cq-success: #16A34A;
    --cq-danger: #DC2626;
    --cq-warning: #F59E0B;
    --cq-info: #0EA5E9;

    --cq-bg: #F0F2F5;
    --cq-bg-card: #FFFFFF;
    --cq-bg-hover: #F8F9FB;
    --cq-border: #E2E6EC;
    --cq-border-light: #EEF0F4;

    --cq-text: #1A1D26;
    --cq-text-secondary: #5A6272;
    --cq-text-muted: #8B93A1;
    --cq-text-white: #FFFFFF;

    --cq-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --cq-font-heading: 'Plus Jakarta Sans', 'DM Sans', sans-serif;

    --cq-radius-sm: 6px;
    --cq-radius: 10px;
    --cq-radius-lg: 16px;
    --cq-radius-xl: 20px;

    --cq-shadow-sm: 0 1px 3px rgba(27, 58, 92, 0.06);
    --cq-shadow: 0 2px 8px rgba(27, 58, 92, 0.08);
    --cq-shadow-md: 0 4px 16px rgba(27, 58, 92, 0.1);
    --cq-shadow-lg: 0 8px 32px rgba(27, 58, 92, 0.12);

    --cq-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
.cqsgq-app {
    font-family: var(--cq-font-body);
    color: var(--cq-text);
    background: var(--cq-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

.cqsgq-app *,
.cqsgq-app *::before,
.cqsgq-app *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Header ---- */
.cqsgq-header {
    background: linear-gradient(135deg, var(--cq-primary) 0%, var(--cq-primary-dark) 100%);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(15, 38, 64, 0.25);
}

.cqsgq-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.cqsgq-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cqsgq-logo-img-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.cqsgq-logo-img {
    height: 38px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
    /* Logo branco sobre fundo escuro — sem inversão necessária */
}

/* ---- User Chip no header ---- */
.cqsgq-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 40px;
    text-decoration: none;
    transition: var(--cq-transition);
    cursor: pointer;
}

.cqsgq-user-chip:hover {
    background: rgba(255,255,255,0.14);
    border-color: var(--cq-accent);
}

.cqsgq-user-chip .cqsgq-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.cqsgq-user-chip .cqsgq-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cqsgq-edit-icon {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    transition: var(--cq-transition);
}

.cqsgq-user-chip:hover .cqsgq-edit-icon {
    color: var(--cq-accent);
}

.cqsgq-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--cq-radius-sm);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--cq-transition);
    font-size: 16px;
    flex-shrink: 0;
}
.cqsgq-back-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.cqsgq-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cqsgq-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cqsgq-user-avatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    object-fit: cover;
}

.cqsgq-user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cqsgq-user-greeting {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.cqsgq-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.cqsgq-btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--cq-radius-sm);
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--cq-transition);
}
.cqsgq-btn-logout:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.3);
    color: #FCA5A5;
}

/* ---- Main Content ---- */
.cqsgq-main {
    flex: 1;
    padding: 32px 24px;
}

.cqsgq-container {
    max-width: 1280px;
    margin: 0 auto;
}

.cqsgq-container-narrow {
    max-width: 860px;
}

/* ---- Welcome Section ---- */
.cqsgq-welcome {
    background: linear-gradient(135deg, var(--cq-primary) 0%, var(--cq-primary-light) 100%);
    border-radius: var(--cq-radius-lg);
    padding: 36px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
    box-shadow: var(--cq-shadow-md);
    position: relative;
    overflow: hidden;
}
.cqsgq-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: var(--cq-accent);
    border-radius: 50%;
    opacity: 0.06;
}
.cqsgq-welcome::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: 15%;
    width: 200px;
    height: 200px;
    background: var(--cq-accent);
    border-radius: 50%;
    opacity: 0.04;
}

.cqsgq-welcome-content {
    position: relative;
    z-index: 1;
}

.cqsgq-welcome h1 {
    font-family: var(--cq-font-heading);
    font-weight: 700;
    font-size: 26px;
    color: #fff;
    margin-bottom: 8px;
}

.cqsgq-welcome p {
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    max-width: 480px;
}

.cqsgq-welcome-stats {
    display: flex;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.cqsgq-stat {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--cq-radius);
    padding: 18px 28px;
    text-align: center;
    min-width: 100px;
}

.cqsgq-stat-number {
    display: block;
    font-family: var(--cq-font-heading);
    font-weight: 800;
    font-size: 32px;
    color: var(--cq-accent-light);
    line-height: 1;
}

.cqsgq-stat-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ---- Section Title ---- */
.cqsgq-section-title {
    margin-bottom: 20px;
}

.cqsgq-section-title h2 {
    font-family: var(--cq-font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--cq-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cqsgq-section-title h2 i {
    color: var(--cq-accent);
    font-size: 16px;
}

/* ---- Categories Grid ---- */
.cqsgq-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.cqsgq-category-card {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    padding: 24px 18px;
    text-align: center;
    text-decoration: none;
    color: var(--cq-text);
    transition: var(--cq-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.cqsgq-category-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cq-accent);
    transform: scaleX(0);
    transition: var(--cq-transition);
}

.cqsgq-category-card:hover {
    border-color: var(--cq-accent);
    box-shadow: var(--cq-shadow-md);
    transform: translateY(-2px);
    color: var(--cq-text);
}

.cqsgq-category-card:hover::after {
    transform: scaleX(1);
}

.cqsgq-category-card:hover .cqsgq-card-icon {
    background: var(--cq-accent);
    color: var(--cq-primary-dark);
}

.cqsgq-card-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.cqsgq-card-icon {
    width: 48px;
    height: 48px;
    background: var(--cq-bg);
    border-radius: var(--cq-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--cq-primary);
    transition: var(--cq-transition);
}

.cqsgq-card-title {
    font-family: var(--cq-font-heading);
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
}

.cqsgq-card-badge {
    font-size: 11px;
    background: var(--cq-primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.cqsgq-badge-soon {
    background: var(--cq-border);
    color: var(--cq-text-muted);
}

/* ---- Quick Actions ---- */
.cqsgq-quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cqsgq-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--cq-accent);
    color: var(--cq-primary-dark);
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--cq-radius);
    text-decoration: none;
    transition: var(--cq-transition);
    box-shadow: var(--cq-shadow-sm);
}
.cqsgq-quick-btn:hover {
    background: var(--cq-accent-dark);
    color: var(--cq-primary-dark);
    box-shadow: var(--cq-shadow-md);
    transform: translateY(-1px);
}

.cqsgq-quick-secondary {
    background: var(--cq-bg-card);
    color: var(--cq-primary);
    border: 1px solid var(--cq-border);
}
.cqsgq-quick-secondary:hover {
    background: var(--cq-primary);
    color: #fff;
    border-color: var(--cq-primary);
}

/* ---- Page Header ---- */
.cqsgq-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.cqsgq-page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cqsgq-page-title i {
    font-size: 24px;
    color: var(--cq-accent);
}

.cqsgq-page-title h1 {
    font-family: var(--cq-font-heading);
    font-weight: 700;
    font-size: 24px;
    color: var(--cq-text);
}

/* ---- Buttons ---- */
.cqsgq-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--cq-radius-sm);
    font-family: var(--cq-font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--cq-transition);
    white-space: nowrap;
}

.cqsgq-btn-primary {
    background: var(--cq-accent);
    color: var(--cq-primary-dark);
}
.cqsgq-btn-primary:hover {
    background: var(--cq-accent-dark);
    color: var(--cq-primary-dark);
    box-shadow: var(--cq-shadow);
}

.cqsgq-btn-outline {
    background: transparent;
    color: var(--cq-text-secondary);
    border: 1px solid var(--cq-border);
}
.cqsgq-btn-outline:hover {
    background: var(--cq-bg);
    color: var(--cq-text);
    border-color: var(--cq-text-muted);
}

.cqsgq-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.cqsgq-btn-sm.cqsgq-btn-danger {
    color: var(--cq-danger);
}
.cqsgq-btn-sm.cqsgq-btn-danger:hover {
    background: var(--cq-danger);
    color: #fff;
}

/* ---- Filters ---- */
.cqsgq-filters {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--cq-shadow-sm);
}

.cqsgq-filter-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.cqsgq-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.cqsgq-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--cq-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cqsgq-filter-search {
    flex: 1;
    min-width: 240px;
}

.cqsgq-search-wrap {
    display: flex;
    gap: 8px;
}

.cqsgq-search-wrap .cqsgq-input {
    flex: 1;
}

/* ---- Form Elements ---- */
.cqsgq-input,
.cqsgq-select,
.cqsgq-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--cq-border);
    border-radius: var(--cq-radius-sm);
    font-family: var(--cq-font-body);
    font-size: 14px;
    color: var(--cq-text);
    background: var(--cq-bg-card);
    transition: var(--cq-transition);
    outline: none;
}

.cqsgq-input:focus,
.cqsgq-select:focus,
.cqsgq-textarea:focus {
    border-color: var(--cq-accent);
    box-shadow: 0 0 0 3px rgba(232, 168, 23, 0.15);
}

.cqsgq-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235A6272' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- Results ---- */
.cqsgq-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--cq-text-muted);
    font-weight: 500;
}

/* ---- Table ---- */
.cqsgq-table-wrap {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    overflow: hidden;
    box-shadow: var(--cq-shadow-sm);
}

.cqsgq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cqsgq-table thead {
    background: var(--cq-primary);
}

.cqsgq-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.cqsgq-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cq-border-light);
    vertical-align: middle;
}

.cqsgq-table tbody tr {
    transition: var(--cq-transition);
}

.cqsgq-table tbody tr:hover {
    background: var(--cq-bg-hover);
}

.cqsgq-table tbody tr:last-child td {
    border-bottom: none;
}

.cqsgq-badge-cliente {
    display: inline-block;
    background: var(--cq-primary);
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cqsgq-doc-link {
    color: var(--cq-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--cq-transition);
}
.cqsgq-doc-link:hover {
    color: var(--cq-accent-dark);
    text-decoration: underline;
}

.cqsgq-text-muted {
    color: var(--cq-text-muted);
}

.cqsgq-btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--cq-success);
    color: #fff;
    border-radius: var(--cq-radius-sm);
    text-decoration: none;
    transition: var(--cq-transition);
    font-size: 14px;
}
.cqsgq-btn-download:hover {
    background: #15803D;
    transform: scale(1.05);
    color: #fff;
}

.cqsgq-btn-download-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--cq-success);
    color: #fff;
    border-radius: var(--cq-radius-sm);
    text-decoration: none;
    font-size: 12px;
}

.cqsgq-th-actions {
    width: 100px;
    text-align: center;
}

.cqsgq-td-actions {
    text-align: center;
    white-space: nowrap;
}

.cqsgq-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius-sm);
    background: transparent;
    color: var(--cq-text-secondary);
    cursor: pointer;
    transition: var(--cq-transition);
    text-decoration: none;
    font-size: 13px;
}
.cqsgq-action-edit:hover {
    background: var(--cq-info);
    color: #fff;
    border-color: var(--cq-info);
}
.cqsgq-action-delete:hover {
    background: var(--cq-danger);
    color: #fff;
    border-color: var(--cq-danger);
}

/* ---- Empty State ---- */
.cqsgq-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--cq-text-muted);
}

.cqsgq-empty-state i {
    font-size: 48px;
    color: var(--cq-border);
    margin-bottom: 16px;
    display: block;
}

.cqsgq-empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* ---- Mobile Cards ---- */
.cqsgq-cards-mobile {
    display: none;
}

.cqsgq-doc-card {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--cq-shadow-sm);
}

.cqsgq-doc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cqsgq-doc-card-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: var(--cq-primary);
    text-decoration: none;
    margin-bottom: 10px;
    line-height: 1.4;
}
.cqsgq-doc-card-title:hover {
    color: var(--cq-accent-dark);
}

.cqsgq-doc-card-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--cq-text-secondary);
    margin-bottom: 8px;
}

.cqsgq-doc-card-meta i {
    color: var(--cq-text-muted);
    margin-right: 4px;
}

.cqsgq-doc-card-people {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--cq-text-secondary);
    margin-bottom: 12px;
}

.cqsgq-doc-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--cq-border-light);
}

.cqsgq-doc-card-actions .cqsgq-action-btn {
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
    gap: 6px;
}

/* ---- Form Card ---- */
.cqsgq-form-card {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius-lg);
    padding: 32px;
    box-shadow: var(--cq-shadow);
    margin-bottom: 24px;
}

.cqsgq-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cqsgq-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cqsgq-field label {
    font-weight: 600;
    font-size: 13px;
    color: var(--cq-text-secondary);
}

.cqsgq-field-full {
    grid-column: 1 / -1;
}

.cqsgq-required {
    color: var(--cq-danger);
}

/* ---- File Upload ---- */
.cqsgq-file-upload {
    width: 100%;
}

.cqsgq-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    border: 2px dashed var(--cq-border);
    border-radius: var(--cq-radius);
    background: var(--cq-bg);
    cursor: pointer;
    transition: var(--cq-transition);
    text-align: center;
}
.cqsgq-file-dropzone:hover,
.cqsgq-file-dropzone.dragover {
    border-color: var(--cq-accent);
    background: rgba(232, 168, 23, 0.04);
}

.cqsgq-file-dropzone i {
    font-size: 36px;
    color: var(--cq-text-muted);
    margin-bottom: 12px;
}

.cqsgq-file-dropzone p {
    color: var(--cq-text-secondary);
    font-size: 14px;
}

.cqsgq-file-browse {
    color: var(--cq-accent-dark);
    font-weight: 600;
    text-decoration: underline;
}

.cqsgq-file-dropzone small {
    color: var(--cq-text-muted);
    font-size: 12px;
    margin-top: 6px;
}

.cqsgq-file-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--cq-bg);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius-sm);
    margin-bottom: 10px;
}

.cqsgq-file-current i {
    color: var(--cq-primary);
    font-size: 18px;
}

.cqsgq-file-current span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

/* ---- Progress ---- */
.cqsgq-progress-bar {
    height: 6px;
    background: var(--cq-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.cqsgq-progress-fill {
    height: 100%;
    background: var(--cq-accent);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

/* ---- Revision ---- */
.cqsgq-revision-section {
    padding-top: 20px;
    border-top: 1px solid var(--cq-border-light);
    margin-top: 4px;
}

.cqsgq-revision-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.cqsgq-revision-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cqsgq-revision-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--cq-bg);
    border-radius: var(--cq-radius-sm);
    border-left: 3px solid var(--cq-accent);
}

.cqsgq-revision-number {
    font-family: var(--cq-font-heading);
    font-weight: 700;
    font-size: 13px;
    color: var(--cq-accent-dark);
    white-space: nowrap;
    min-width: 50px;
}

.cqsgq-revision-info p {
    font-size: 14px;
    color: var(--cq-text);
    margin-bottom: 6px;
}

.cqsgq-revision-info small {
    font-size: 12px;
    color: var(--cq-text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- Form Actions ---- */
.cqsgq-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--cq-border-light);
}

/* ---- Detail Card ---- */
.cqsgq-detail-card {
    background: var(--cq-bg-card);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius-lg);
    overflow: hidden;
    box-shadow: var(--cq-shadow);
    margin-bottom: 24px;
}

.cqsgq-detail-section {
    padding: 24px 32px;
    border-bottom: 1px solid var(--cq-border-light);
}
.cqsgq-detail-section:last-child {
    border-bottom: none;
}

.cqsgq-detail-section h3 {
    font-family: var(--cq-font-heading);
    font-weight: 600;
    font-size: 15px;
    color: var(--cq-text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.cqsgq-detail-section h3 i {
    color: var(--cq-accent);
}

.cqsgq-detail-badge {
    margin-bottom: 4px;
}

.cqsgq-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 24px 32px;
    border-bottom: 1px solid var(--cq-border-light);
}

.cqsgq-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cqsgq-detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--cq-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cqsgq-detail-label i {
    color: var(--cq-text-muted);
}

.cqsgq-detail-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--cq-text);
}

.cqsgq-detail-text {
    font-size: 14px;
    color: var(--cq-text-secondary);
    line-height: 1.7;
}

.cqsgq-btn-download-lg {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--cq-success);
    color: #fff;
    border-radius: var(--cq-radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--cq-transition);
}
.cqsgq-btn-download-lg:hover {
    background: #15803D;
    color: #fff;
    box-shadow: var(--cq-shadow);
}

.cqsgq-detail-footer-actions {
    margin-bottom: 40px;
}

/* ---- Alerts ---- */
.cqsgq-alert {
    padding: 14px 20px;
    border-radius: var(--cq-radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.cqsgq-alert-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.cqsgq-alert-danger {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* ---- Footer ---- */
.cqsgq-footer {
    text-align: center;
    padding: 20px 24px;
    border-top: 1px solid var(--cq-border);
    background: var(--cq-bg-card);
}

.cqsgq-footer p {
    font-size: 13px;
    color: var(--cq-text-muted);
}

/* ===================================================
   RESPONSIVE
   =================================================== */

@media (max-width: 768px) {
    .cqsgq-header {
        padding: 0 16px;
    }
    .cqsgq-header-inner {
        height: 56px;
    }
    .cqsgq-logo-text {
        display: none;
    }
    .cqsgq-user-details,
    .cqsgq-user-name,
    .cqsgq-btn-logout span {
        display: none;
    }
    .cqsgq-btn-logout {
        padding: 8px;
    }

    .cqsgq-main {
        padding: 20px 16px;
    }

    .cqsgq-welcome {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
    }
    .cqsgq-welcome h1 {
        font-size: 20px;
    }
    .cqsgq-welcome-stats {
        width: 100%;
    }
    .cqsgq-stat {
        flex: 1;
        padding: 14px;
    }
    .cqsgq-stat-number {
        font-size: 24px;
    }

    .cqsgq-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .cqsgq-category-card {
        padding: 18px 12px;
    }
    .cqsgq-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .cqsgq-card-title {
        font-size: 12px;
    }

    .cqsgq-quick-actions {
        flex-direction: column;
    }
    .cqsgq-quick-btn {
        justify-content: center;
    }

    /* Hide table, show cards */
    .cqsgq-table-wrap {
        display: none;
    }
    .cqsgq-cards-mobile {
        display: block;
    }

    .cqsgq-filter-row {
        flex-direction: column;
    }
    .cqsgq-filter-group {
        min-width: unset;
        width: 100%;
    }
    .cqsgq-search-wrap {
        flex-direction: column;
    }

    .cqsgq-form-card {
        padding: 20px;
    }
    .cqsgq-form-grid {
        grid-template-columns: 1fr;
    }
    .cqsgq-form-actions {
        flex-direction: column-reverse;
    }
    .cqsgq-form-actions .cqsgq-btn {
        justify-content: center;
    }

    .cqsgq-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .cqsgq-page-title h1 {
        font-size: 20px;
    }

    .cqsgq-detail-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .cqsgq-detail-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .cqsgq-categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .cqsgq-category-card {
        padding: 14px 10px;
    }
}

/* ---- Hide WP admin bar for SGQ users ---- */
body.logged-in.admin-bar .cqsgq-header {
    top: 32px;
}
@media (max-width: 782px) {
    body.logged-in.admin-bar .cqsgq-header {
        top: 46px;
    }
}

/* ---- View Document Button ---- */
.cqsgq-btn-view-doc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--cq-primary);
    color: #fff;
    border-radius: var(--cq-radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--cq-transition);
}
.cqsgq-btn-view-doc:hover {
    background: var(--cq-primary-light);
    color: #fff;
}

/* ---- Form Section Title ---- */
.cqsgq-form-section-title {
    font-family: var(--cq-font-heading);
    font-weight: 600;
    font-size: 15px;
    color: var(--cq-text);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cq-border-light);
}

.cqsgq-form-section-title i {
    color: var(--cq-accent);
}

/* ---- Password Toggle ---- */
.cqsgq-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cqsgq-password-wrap .cqsgq-input {
    padding-right: 44px;
}

.cqsgq-toggle-pass {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--cq-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: var(--cq-transition);
}
.cqsgq-toggle-pass:hover {
    color: var(--cq-text);
}

/* ---- Login Status Badges ---- */
.cqsgq-login-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--cq-radius-sm);
    font-size: 14px;
}

.cqsgq-login-exists {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.cqsgq-login-exists i {
    font-size: 20px;
    color: var(--cq-success);
}

.cqsgq-badge-login-ok {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--cq-success);
    font-weight: 600;
}

.cqsgq-badge-login-no {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--cq-text-muted);
    font-weight: 500;
}

/* ---- PDF Preview ---- */
.cqsgq-pdf-preview {
    margin-bottom: 8px;
}

.cqsgq-pdf-preview iframe {
    background: #fff;
}

.cqsgq-anexo-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}


/* ===================================================
   PERFIL - Avatar, Logo, Senha
   =================================================== */

.cqsgq-avatar-section {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.cqsgq-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--cq-accent);
    flex-shrink: 0;
    background: var(--cq-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cqsgq-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cqsgq-avatar-info {
    flex: 1;
    min-width: 200px;
}

.cqsgq-avatar-info p {
    font-size: 14px;
    color: var(--cq-text);
    margin-bottom: 4px;
}

.cqsgq-avatar-info small {
    font-size: 12px;
    color: var(--cq-text-muted);
}

.cqsgq-logo-preview-box {
    width: 160px;
    height: 80px;
    border: 1.5px solid var(--cq-border);
    border-radius: var(--cq-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cq-bg);
    padding: 8px;
    flex-shrink: 0;
}

/* Header user link */
.cqsgq-user-link {
    text-decoration: none;
    color: inherit;
    transition: var(--cq-transition);
}

.cqsgq-user-link:hover .cqsgq-user-name {
    color: var(--cq-accent-light);
}

.cqsgq-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    object-fit: cover;
}

.cqsgq-header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--cq-radius-sm);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--cq-transition);
    font-size: 15px;
}
.cqsgq-header-icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--cq-accent-light);
}

/* Filter cliente locked (for cqsgq_cliente role) */
.cqsgq-cliente-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cq-primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--cq-radius-sm);
    font-size: 14px;
    font-weight: 600;
}

.cqsgq-cliente-tag i {
    color: var(--cq-accent);
}
