/* =====================================================================
   GTXSign — style.css v3.0
   Design System: Dark mode premium com suporte visual a A1, A3 e Nuvem
   ===================================================================== */

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Paleta principal (Tema Claro) */
    --bg-base:          #f4f4f5; /* Zinc 100 */
    --bg-card:          #ffffff;
    --bg-surface:       #fafafa; /* Zinc 50 */
    --bg-surface-2:     #f4f4f5;
    --bg-hover:         #e4e4e7; /* Zinc 200 */

    /* Destaque primário (Cinza Escuro em vez de Azul) */
    --blue-400:         #71717a; /* Zinc 500 */
    --blue-500:         #3f3f46; /* Zinc 700 */
    --blue-600:         #27272a; /* Zinc 800 */
    --blue-700:         #18181b; /* Zinc 900 */
    --blue-glow:        rgba(63, 63, 70, .15);

    /* Violeta nuvem (Ajustado para claro) */
    --cloud-400:        #8b5cf6;
    --cloud-500:        #7c3aed;
    --cloud-600:        #6d28d9;
    --cloud-glow:       rgba(124, 58, 237, .15);
    --cloud-gradient:   linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);

    /* Âmbar A3 */
    --amber-400:        #f59e0b;
    --amber-500:        #d97706;
    --amber-glow:       rgba(217, 119, 6, .15);

    /* Verde sucesso */
    --green-400:        #22c55e;
    --green-500:        #16a34a;
    --green-glow:       rgba(22, 163, 74, .15);

    /* Vermelho erro */
    --red-400:          #ef4444;
    --red-500:          #dc2626;
    --red-glow:         rgba(220, 38, 38, .15);

    /* Textos (Tema Claro) */
    --text-primary:     #18181b; /* Zinc 900 */
    --text-secondary:   #52525b; /* Zinc 600 */
    --text-muted:       #a1a1aa; /* Zinc 400 */

    /* Bordas */
    --border:           rgba(0,0,0,.08);
    --border-active:    rgba(63, 63, 70, .4);
    --border-cloud:     rgba(124, 58, 237, .4);

    /* Raios e sombras (Suaves para claro) */
    --radius-sm:        8px;
    --radius:           12px;
    --radius-lg:        18px;
    --shadow-card:      0 8px 30px rgba(0,0,0,.06);
    --shadow-glow:      0 0 28px var(--blue-glow);

    /* Transições */
    --transition:       .18s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ----- Layout ----- */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ----- Header ----- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px var(--blue-glow);
}
.logo-icon svg { width: 26px; height: 26px; stroke: #fff; }

.logo-title {
    font-size: 1.6rem; font-weight: 800;
    letter-spacing: -.02em; color: var(--text-primary);
}
.logo-title span { color: var(--blue-400); }
.logo-subtitle { font-size: .8rem; color: var(--text-secondary); }

.header-badges { display: flex; gap: 10px; align-items: center; }

.status-badge {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 14px;
    background: rgba(34,197,94,.08);
    border: 1px solid rgba(34,197,94,.2);
    border-radius: 99px;
    font-size: .75rem; font-weight: 500;
    color: var(--green-400);
}

.status-badge--cloud {
    background: rgba(139,92,246,.1);
    border-color: rgba(139,92,246,.25);
    color: var(--cloud-400);
}

.badge-dot {
    width: 7px; height: 7px;
    background: var(--green-500);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.badge-dot--cloud {
    background: var(--cloud-500);
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    50% { opacity: .7; box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ----- Main Card ----- */
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.form-column { display: flex; flex-direction: column; gap: 20px; }

/* ----- Section Title ----- */
.section-title {
    font-size: .85rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.section-title svg { width: 15px; height: 15px; }

/* ----- Dropzone ----- */
.dropzone {
    position: relative;
    border: 2px dashed rgba(255,255,255,.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    overflow: hidden;
    background: var(--bg-surface);
}
.dropzone:hover { border-color: var(--blue-500); background: rgba(59,130,246,.04); }
.dropzone.dragover { border-color: var(--blue-400); background: rgba(59,130,246,.08); }

.dropzone-content {
    padding: 28px 20px;
    display: flex; flex-direction: column;
    align-items: center; gap: 8px; text-align: center;
}

.icon-box {
    width: 52px; height: 52px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 4px;
}
.icon-box svg { width: 22px; height: 22px; stroke: var(--blue-400); }
.dropzone-content h3 { font-size: .95rem; font-weight: 600; }
.dropzone-content p { font-size: .8rem; color: var(--text-secondary); }
.file-limits {
    font-size: .7rem; color: var(--text-muted);
    background: var(--bg-surface-2);
    padding: 3px 10px; border-radius: 99px;
    border: 1px solid var(--border);
}

.file-input { display: none; }

.file-selected-indicator {
    display: none; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: rgba(34,197,94,.06);
    border-top: 1px solid rgba(34,197,94,.15);
}
.file-selected-indicator svg { width: 18px; height: 18px; stroke: var(--green-400); flex-shrink: 0; }
.file-selected-indicator.visible { display: flex; }
.filename { font-size: .82rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-remove {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px;
    border-radius: 6px; transition: all var(--transition);
    display: flex;
}
.btn-remove:hover { color: var(--red-400); background: rgba(239,68,68,.1); }
.btn-remove svg { width: 16px; height: 16px; }

/* ----- Cert Type Selector ----- */
.cert-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.cert-type-option {
    display: block; cursor: pointer;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    overflow: hidden;
}
.cert-type-option:hover { border-color: rgba(255,255,255,.15); background: var(--bg-surface); }
.cert-type-option.active { border-color: var(--blue-500); background: rgba(59,130,246,.06); }

.cert-type-cloud.active {
    border-color: var(--cloud-500);
    background: rgba(139,92,246,.08);
}

.hidden-radio { display: none; }

.cert-type-content {
    padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
}
.cert-type-content svg { width: 18px; height: 18px; stroke: var(--text-secondary); flex-shrink: 0; }
.cert-type-option.active .cert-type-content svg { stroke: var(--blue-400); }
.cert-type-cloud.active .cert-type-content svg { stroke: var(--cloud-400); }
.cert-type-content span { font-size: .82rem; font-weight: 600; display: block; }
.cert-type-content p { font-size: .7rem; color: var(--text-muted); }

/* ----- Cert Box ----- */
.cert-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; flex-direction: column; gap: 16px;
    animation: fadeIn .2s ease;
}

.cert-box--cloud {
    border-color: rgba(139,92,246,.2);
    background: linear-gradient(160deg, rgba(139,92,246,.04) 0%, var(--bg-surface) 60%);
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ----- Input Groups ----- */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: .78rem; font-weight: 500; color: var(--text-secondary); }

.input-wrapper { position: relative; }

.input-wrapper input,
.select-input,
input[type="text"]:not(.input-wrapper input),
input[type="password"]:not(.input-wrapper input),
input[type="url"]:not(.input-wrapper input) {
    width: 100%;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: .88rem;
    font-family: inherit;
    transition: all var(--transition);
    outline: none;
}

.input-wrapper input { padding-left: 38px; }

.input-wrapper input:focus,
.select-input:focus,
input[type="text"]:not(.input-wrapper input):focus,
input[type="password"]:not(.input-wrapper input):focus,
input[type="url"]:not(.input-wrapper input):focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

.input-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px;
    stroke: var(--text-muted);
    pointer-events: none;
}

.select-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ----- Cert File Row ----- */
.cert-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn-cert-upload {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .8rem; font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-cert-upload:hover { border-color: var(--blue-500); color: var(--blue-400); }
.btn-cert-upload svg { width: 14px; height: 14px; }
.cert-status { font-size: .75rem; color: var(--text-muted); }

/* ----- Token Status ----- */
.token-status-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.token-status-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.token-status-icon svg { width: 18px; height: 18px; stroke: var(--text-muted); }
.token-status-icon.detected { background: rgba(34,197,94,.1); }
.token-status-icon.detected svg { stroke: var(--green-400); }

.token-status-text { flex: 1; }
.token-status-text span { font-size: .85rem; font-weight: 500; display: block; }
.token-status-text p { font-size: .75rem; color: var(--text-secondary); }

.token-cert-select { padding: 4px 0; }

/* ----- Cloud Provider Grid ----- */
.cloud-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.cloud-loading {
    grid-column: 1/-1;
    display: flex; align-items: center; gap: 8px;
    padding: 12px;
    color: var(--text-secondary); font-size: .82rem;
}

.spinner-mini {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--cloud-500);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.provider-card {
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    text-align: center;
    transition: all var(--transition);
    background: var(--bg-surface-2);
    position: relative;
}
.provider-card:hover { border-color: rgba(139,92,246,.35); background: rgba(139,92,246,.06); }
.provider-card.selected { border-color: var(--cloud-500); background: rgba(139,92,246,.1); }
.provider-card.selected::after {
    content: '✓';
    position: absolute; top: 5px; right: 8px;
    font-size: .7rem; color: var(--cloud-400);
    font-weight: 700;
}
.provider-logo { font-size: 1.6rem; line-height: 1; }
.provider-name { font-size: .72rem; font-weight: 600; color: var(--text-secondary); }

/* ----- Cloud Sections ----- */
.cloud-credentials-section,
.cloud-cert-section {
    display: flex; flex-direction: column; gap: 12px;
    padding-top: 4px;
}

.cloud-section-label {
    display: flex; align-items: center; gap: 7px;
    font-size: .75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--cloud-400);
}
.cloud-section-label svg { width: 13px; height: 13px; }

/* ----- Botão Autenticar Cloud ----- */
.btn-cloud-auth {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 11px 20px;
    background: var(--cloud-gradient);
    border: none; border-radius: var(--radius-sm);
    color: #fff; font-size: .88rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 18px rgba(124,58,237,.35);
}
.btn-cloud-auth:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124,58,237,.5); }
.btn-cloud-auth:active { transform: translateY(0); }
.btn-cloud-auth svg { width: 16px; height: 16px; }
.btn-cloud-auth:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.cloud-auth-status {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .8rem;
}
.cloud-auth-status.success {
    background: rgba(34,197,94,.08);
    border: 1px solid rgba(34,197,94,.2);
    color: var(--green-400);
}
.cloud-auth-status.error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    color: var(--red-400);
}

/* ----- Cert Info Card ----- */
.cert-info-card {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: rgba(139,92,246,.08);
    border: 1px solid rgba(139,92,246,.2);
    border-radius: var(--radius-sm);
}
.cert-info-card svg { width: 22px; height: 22px; stroke: var(--cloud-400); flex-shrink: 0; }
.cert-info-card span { font-size: .85rem; font-weight: 600; display: block; }
.cert-info-card p { font-size: .75rem; color: var(--text-secondary); }

/* ----- OTP Section ----- */
.otp-section {
    display: flex; flex-direction: column; gap: 12px;
    animation: fadeIn .2s ease;
}

.otp-alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    background: rgba(245,158,11,.07);
    border: 1px solid rgba(245,158,11,.2);
    border-radius: var(--radius-sm);
}
.otp-alert svg { width: 20px; height: 20px; stroke: var(--amber-400); flex-shrink: 0; margin-top: 1px; }
.otp-alert strong { font-size: .82rem; color: var(--amber-400); display: block; }
.otp-alert p { font-size: .75rem; color: var(--text-secondary); }

.otp-toggle-row { display: flex; justify-content: center; }

.btn-otp-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 1px dashed rgba(139,92,246,.3);
    border-radius: var(--radius-sm);
    color: var(--cloud-400); font-size: .78rem;
    padding: 7px 14px; cursor: pointer;
    transition: all var(--transition);
}
.btn-otp-toggle:hover { background: rgba(139,92,246,.07); border-color: var(--cloud-500); }
.btn-otp-toggle svg { width: 13px; height: 13px; }

/* ----- Cloud Info Card (sidebar) ----- */
.cloud-info-card {
    background: rgba(139,92,246,.06);
    border: 1px solid rgba(139,92,246,.15);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; flex-direction: column; gap: 12px;
    animation: fadeIn .2s ease;
}

.cloud-info-header {
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem;
}
.cloud-info-header svg { width: 16px; height: 16px; stroke: var(--cloud-400); }
.cloud-info-header strong { color: var(--cloud-400); }

.cloud-steps-list {
    padding-left: 18px;
    display: flex; flex-direction: column; gap: 6px;
}
.cloud-steps-list li { font-size: .78rem; color: var(--text-secondary); }

.cloud-security-note {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 12px;
    background: rgba(34,197,94,.05);
    border-radius: var(--radius-sm);
    font-size: .75rem; color: var(--text-secondary);
}
.cloud-security-note svg { width: 13px; height: 13px; stroke: var(--green-400); flex-shrink: 0; }
.cloud-security-note strong { color: var(--green-400); }

/* ----- Destination Grid ----- */
.destination-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.dest-card {
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}
.dest-card:hover { border-color: rgba(255,255,255,.15); }
.dest-card.active { border-color: var(--blue-500); background: rgba(59,130,246,.05); }

.dest-card-content {
    padding: 16px 12px;
    display: flex; flex-direction: column;
    align-items: center; gap: 6px; text-align: center;
}
.dest-card-content svg { width: 22px; height: 22px; stroke: var(--text-secondary); }
.dest-card.active .dest-card-content svg { stroke: var(--blue-400); }
.dest-card-content span { font-size: .82rem; font-weight: 600; }
.dest-card-content p { font-size: .7rem; color: var(--text-muted); }

/* ----- Cloud Settings (Nextcloud/GDrive form) ----- */
.cloud-settings {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: none;
    flex-direction: column;
    gap: 14px;
    animation: fadeIn .2s ease;
}
.cloud-settings.visible { display: flex; }

.cloud-subtitle { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }

.gdrive-info {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px;
    background: rgba(59,130,246,.05);
    border-radius: var(--radius-sm);
    font-size: .8rem; color: var(--text-secondary);
}
.gdrive-info svg { width: 16px; height: 16px; stroke: var(--blue-400); flex-shrink: 0; margin-top: 1px; }

/* ----- Buttons ----- */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 24px;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    border: none; border-radius: var(--radius-sm);
    color: #fff; font-size: .9rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    box-shadow: 0 4px 20px var(--blue-glow);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 28px var(--blue-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: .85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-outline:hover { border-color: rgba(255,255,255,.2); color: var(--text-primary); background: var(--bg-surface); }
.btn-outline svg { width: 15px; height: 15px; }

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

/* ----- Test Conn ----- */
.test-status { font-size: .78rem; }
.test-status.success { color: var(--green-400); }
.test-status.error { color: var(--red-400); }

/* ----- Action Box ----- */
.action-box { margin-top: auto; padding-top: 8px; }
.action-box .btn-primary { width: 100%; font-size: .95rem; padding: 14px; }

/* ----- Progress Overlay ----- */
.overlay-panel {
    display: none;
    position: absolute; inset: 0;
    background: rgba(11,14,23,.97);
    border-radius: var(--radius-lg);
    align-items: center; justify-content: center;
    z-index: 10;
    backdrop-filter: blur(6px);
}
.overlay-panel.visible { display: flex; }

.progress-card {
    width: 100%; max-width: 500px;
    padding: 40px 36px;
    display: flex; flex-direction: column; gap: 18px;
    align-items: center; text-align: center;
}

.progress-header { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* Spinner */
.spinner-box, .success-box, .error-box {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.spinner-classic {
    width: 44px; height: 44px;
    border: 3px solid rgba(59,130,246,.2);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.success-box {
    background: rgba(34,197,94,.1);
    border: 2px solid rgba(34,197,94,.3);
}
.success-box svg { width: 32px; height: 32px; stroke: var(--green-400); }

.error-box {
    background: rgba(239,68,68,.1);
    border: 2px solid rgba(239,68,68,.3);
}
.error-box svg { width: 32px; height: 32px; stroke: var(--red-400); }

#progressTitle { font-size: 1.25rem; font-weight: 700; }
#progressSubtitle { font-size: .85rem; color: var(--text-secondary); max-width: 380px; }

.progress-bar-container {
    width: 100%; height: 8px;
    background: var(--bg-surface-2);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-600), var(--blue-400));
    border-radius: 99px;
    transition: width .4s ease;
}

.progress-percentage {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem; font-weight: 500;
    color: var(--blue-400);
}

.progress-footer { width: 100%; }
.success-actions, .error-actions {
    display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.success-actions .btn-primary, .success-actions .btn-outline { width: 100%; }

/* ----- Footer ----- */
.app-footer {
    text-align: center;
    font-size: .73rem;
    color: var(--text-muted);
    padding: 12px;
}

/* ----- Custom URLs section ----- */
#cloudCustomUrls {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ----- App Nav Tabs ----- */
.app-nav {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow-card);
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    flex: 1;
    justify-content: center;
}
.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}
.nav-tab.active {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
    color: #fff;
    box-shadow: 0 4px 16px var(--blue-glow);
}
.nav-tab svg { width: 16px; height: 16px; }

/* ----- Tab Content ----- */
.tab-content {
    display: none;
    animation: fadeIn .2s ease;
}
.tab-content.active {
    display: block;
}

/* ----- App Main Content ----- */
.app-main-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* ----- Batch Files ----- */
.batch-files-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.batch-files-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(59,130,246,.05);
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    font-weight: 600;
    color: var(--blue-400);
}
.batch-files-header svg { width: 14px; height: 14px; }
.batch-files-list { max-height: 180px; overflow-y: auto; }
.batch-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
}
.batch-file-item:last-child { border-bottom: none; }
.batch-file-item svg { width: 13px; height: 13px; stroke: var(--blue-400); flex-shrink: 0; }
.batch-file-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-file-item small { color: var(--text-muted); white-space: nowrap; }

/* ----- Workflow Cards ----- */
.workflows-list-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 200px;
}
.workflows-list-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px;
    color: var(--text-secondary);
    font-size: .85rem;
}
.workflow-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}
.workflow-empty-state svg { width: 36px; height: 36px; stroke: var(--text-muted); }

.workflow-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color var(--transition);
}
.workflow-card:hover { border-color: rgba(255,255,255,.12); }

.workflow-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.workflow-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
}
.workflow-card-title svg { width: 15px; height: 15px; stroke: var(--blue-400); flex-shrink: 0; }
.workflow-card-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workflow-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.workflow-status-badge svg { width: 11px; height: 11px; }
.wf-pending { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--amber-400); }
.wf-progress { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: var(--blue-400); }
.wf-completed { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2); color: var(--green-400); }

.workflow-progress-bar-wrapper {
    height: 5px;
    background: var(--bg-surface-2);
    border-radius: 99px;
    overflow: hidden;
}
.workflow-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-600), var(--blue-400));
    border-radius: 99px;
    transition: width .5s ease;
}
.workflow-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: .72rem;
    color: var(--text-muted);
}

.workflow-steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.workflow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.workflow-step.completed { border-color: rgba(34,197,94,.2); background: rgba(34,197,94,.04); }
.workflow-step.in_progress { border-color: rgba(59,130,246,.25); background: rgba(59,130,246,.04); }

.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.workflow-step.completed .step-num { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.3); color: var(--green-400); }
.step-detail { display: flex; flex-direction: column; }
.step-detail span { font-size: .8rem; font-weight: 500; }
.step-detail small { font-size: .7rem; color: var(--text-muted); }

.workflow-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ----- Custody Builder ----- */
.custody-builder-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.custody-order-box {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.box-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
}
.box-header-title svg { width: 14px; height: 14px; }
.add-signer-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.add-signer-row .select-input { flex: 1; }

.workflow-builder-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}
.empty-list-indicator {
    font-size: .78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}
.workflow-signer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    animation: fadeIn .15s ease;
}
.signer-order-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.signer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.signer-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); }
.signer-email { font-size: .72rem; color: var(--text-muted); }
.signer-cert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 600;
    margin-top: 2px;
    width: fit-content;
}
.signer-cert-badge svg { width: 10px; height: 10px; }
.signer-cert-badge.ok { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.2); color: var(--green-400); }
.signer-cert-badge.warn { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); color: var(--amber-400); }
.btn-remove-signer {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 6px;
    display: flex;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-remove-signer:hover { color: var(--red-400); background: rgba(239,68,68,.1); }
.btn-remove-signer svg { width: 14px; height: 14px; }

/* ----- Registry Boxes ----- */
.registry-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.registry-list-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: .82rem;
}

/* ----- Overlay Progress Panel (corrigido para cobrir toda a tela) ----- */
.overlay-panel {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,14,23,.97);
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}
.overlay-panel.visible { display: flex; }

/* ----- App Background Glow ----- */
.app-bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 10% -10%, rgba(59,130,246,.07) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 110%, rgba(139,92,246,.06) 0%, transparent 60%);
    z-index: -1;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-2); border-radius: 3px; }

/* ----- Responsive ----- */
@media (max-width: 900px) {
    .grid-layout { grid-template-columns: 1fr; }
    .cert-type-selector { grid-template-columns: 1fr 1fr 1fr; }
    .destination-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 600px) {
    .app-header { flex-direction: column; gap: 14px; }
    .cert-type-selector { grid-template-columns: 1fr 1fr; }
    .destination-grid { grid-template-columns: 1fr 1fr; }
    .app-card { padding: 20px; }
    .cloud-provider-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ----- A1 Mode Selector & Subpanels ----- */
.a1-mode-selector {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; gap: 10px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.mode-tabs {
    display: flex; gap: 4px;
    background: var(--bg-surface-2);
    padding: 3px; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.mode-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; font-size: 0.78rem; font-weight: 500;
    color: var(--text-secondary); background: transparent;
    border: none; border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer; transition: all var(--transition);
}
.mode-tab:hover { color: var(--text-primary); }
.mode-tab.active {
    color: #fff; background: var(--bg-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.mode-tab svg { width: 13px; height: 13px; }

.btn-manage-certs {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; font-size: 0.78rem; font-weight: 500;
    color: var(--blue-400); background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--transition);
}
.btn-manage-certs:hover {
    color: #fff; background: var(--blue-600);
    border-color: var(--blue-500);
}
.btn-manage-certs svg { width: 13px; height: 13px; }

.subpanel-a1 {
    animation: fadeIn 0.2s ease;
}

/* ----- Modal/Overlay Panel Manage Certs ----- */
.manage-certs-card {
    max-width: 760px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    display: flex; flex-direction: column; gap: 0; padding: 0;
    overflow: hidden;
    text-align: left;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    background: var(--bg-surface-2);
    border-bottom: 1px solid var(--border);
}
.modal-header .header-title {
    display: flex; align-items: center; gap: 10px;
}
.modal-header .header-title svg { stroke: var(--blue-400); width: 22px; height: 22px; }
.modal-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0; color: #fff; }

.btn-close-modal {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px; display: flex; align-items: center;
    border-radius: var(--radius-sm); transition: all var(--transition);
}
.btn-close-modal:hover { color: #fff; background: rgba(255,255,255,0.06); }
.btn-close-modal svg { width: 20px; height: 20px; }

.modal-body {
    padding: 24px;
    max-height: 70vh; overflow-y: auto;
}

.add-cert-box {
    background: rgba(255,255,255,0.02);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.add-cert-box h3, .certs-list-box h3 {
    font-size: 0.88rem; font-weight: 600; color: var(--text-primary);
    margin-top: 0; margin-bottom: 15px; display: flex; align-items: center; gap: 8px;
}
.add-cert-box h3 svg, .certs-list-box h3 svg { stroke: var(--blue-400); width: 16px; height: 16px; }

.grid-3-col {
    display: grid; grid-template-columns: 2fr 1fr; gap: 12px;
}

/* ----- Certs Table ----- */
.certs-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface-2);
}
.certs-table {
    width: 100%; border-collapse: collapse; text-align: left;
    font-size: 0.82rem; color: var(--text-secondary);
}
.certs-table th {
    background: rgba(255,255,255,0.02);
    color: var(--text-primary); font-weight: 600;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.certs-table td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.certs-table tr:last-child td { border-bottom: none; }
.certs-table tr:hover td { background: rgba(255,255,255,0.01); }

.btn-delete-cert {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red-400); cursor: pointer; transition: all var(--transition);
}
.btn-delete-cert:hover {
    background: var(--red-600); border-color: var(--red-500); color: #fff;
}

/* =========================================
   DASHBOARD LAYOUT (Novo)
========================================= */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- Sidebar --- */
.app-sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .logo-icon {
    width: 42px; height: 42px;
}

.sidebar-header .logo-title {
    font-size: 1.4rem; font-weight: 800;
}

.sidebar-header .logo-subtitle {
    font-size: 0.75rem; color: var(--text-secondary);
}

.sidebar-status {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    padding-left: 8px;
}

.nav-item, .nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item svg, .nav-item-link svg {
    width: 18px; height: 18px;
    stroke: var(--text-muted);
    transition: stroke var(--transition);
}

.nav-item:hover, .nav-item-link:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.nav-item:hover svg, .nav-item-link:hover svg {
    stroke: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59,130,246,0.1), transparent);
    color: var(--blue-400);
    border-left: 3px solid var(--blue-500);
}

.nav-item.active svg {
    stroke: var(--blue-500);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* --- Main Wrapper --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Evitar que estoure o flexbox */
}

/* --- Topbar --- */
.topbar {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.topbar-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Dashboard / Início --- */
.dashboard-welcome {
    margin-bottom: 32px;
}
.dashboard-welcome h2 {
    font-size: 1.8rem; font-weight: 700; margin-bottom: 8px;
}
.dashboard-welcome p {
    color: var(--text-secondary);
}

.dash-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.dash-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.1);
}

.dash-card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: rgba(59,130,246,0.1);
    color: var(--blue-400);
    display: flex; align-items: center; justify-content: center;
}
.dash-card-icon svg { width: 24px; height: 24px; }

.dash-card-info h3 {
    font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; color: var(--text-primary);
}
.dash-card-info p {
    font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4;
}

/* Override app-main-content para Dashboard Layout */
.app-main-content {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 32px;
}

/* Responsividade Sidebar */
@media (max-width: 900px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .app-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .topbar { display: none; }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .nav-item, .nav-item-link { width: auto; }
}
