/* ── Reset e base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:     #0a1f6b;
    --primary-dk:  #071650;
    --accent:      #c9a84c;
    --accent-dk:   #a07830;
    --danger:      #d93025;
    --success:     #1e8e3e;
    --warning:     #f9ab00;
    --bg:          #f4f6fb;
    --surface:     #ffffff;
    --border:      #dde2f0;
    --text:        #1a2340;
    --text-soft:   #5a6380;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(10,31,107,.10), 0 1px 2px rgba(10,31,107,.07);
    --shadow-md:   0 4px 16px rgba(10,31,107,.15);
}

body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Utilitários ──────────────────────────────────────────── */
.hidden   { display: none !important; }
.center   { text-align: center; }
.mt-1     { margin-top: .5rem; }
.mt-2     { margin-top: 1rem; }
.mt-3     { margin-top: 1.5rem; }

/* ── Botões ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1.25rem;
    border: none; border-radius: var(--radius);
    font-size: .95rem; font-weight: 600;
    cursor: pointer; transition: background .2s, opacity .2s, box-shadow .2s;
    text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #1a1a1a; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dk); box-shadow: var(--shadow-md); }

.btn-navy     { background: var(--primary); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--primary-dk); }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b0261d; }

.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); color: var(--primary); }

.btn-google {
    background: #fff; border: 1.5px solid var(--border);
    color: var(--text); font-size: 1rem; padding: .75rem 1.5rem;
    box-shadow: var(--shadow);
}
.btn-google:hover { box-shadow: var(--shadow-md); }
.btn-block { width: 100%; justify-content: center; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: var(--primary);
    border-bottom: 3px solid var(--accent);
    padding: .65rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 8px rgba(10,31,107,.25);
}
.navbar-brand {
    display: flex; align-items: center; gap: .65rem;
    font-size: 1.15rem; font-weight: 700;
    color: #fff; text-decoration: none;
}
.navbar-brand img { height: 44px; object-fit: contain; }
.navbar-user {
    display: flex; align-items: center; gap: .75rem;
    font-size: .9rem; color: rgba(255,255,255,.85);
}
.navbar-user img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent); }
.navbar .btn-outline {
    border-color: rgba(255,255,255,.4); color: #fff;
}
.navbar .btn-outline:hover { background: rgba(255,255,255,.1); border-color: var(--accent); color: var(--accent); }

/* ── Tela de login / cadastro ────────────────────────────── */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #1a3a9f 100%);
}
.login-box {
    width: 100%; max-width: 420px;
    text-align: center;
    border-top: 4px solid var(--accent);
}
.login-box .brand-logo {
    max-height: 80px; margin-bottom: 1rem; object-fit: contain;
}
.login-box h1 { font-size: 1.6rem; margin-bottom: .35rem; color: var(--primary); }
.login-box p  { color: var(--text-soft); margin-bottom: 1.5rem; }

/* ── Inputs ───────────────────────────────────────────────── */
.input-field {
    width: 100%; padding: .7rem 1rem;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: .95rem; outline: none;
    transition: border-color .2s, box-shadow .2s;
    background: var(--surface); color: var(--text);
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
.input-field:disabled { background: var(--bg); color: var(--text-soft); cursor: not-allowed; }
.input-label { display: block; font-size: .82rem; color: var(--text-soft); margin-bottom: .25rem; text-align: left; font-weight: 500; }
.input-group { margin-bottom: .75rem; }
.input-row   { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
@media(max-width:480px){ .input-row { grid-template-columns: 1fr; } }

/* ── Alerta ───────────────────────────────────────────────── */
.alert {
    padding: .85rem 1rem; border-radius: var(--radius);
    margin-bottom: 1rem; font-size: .92rem;
}
.alert-error   { background: #fce8e6; color: var(--danger);  border: 1px solid #f5c6c2; }
.alert-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7dfbf; }
.alert-info    { background: #eef1fb; color: var(--primary); border: 1px solid #c5ccf0; }
.alert-warning { background: #fef7e0; color: #8a6200;        border: 1px solid #f5e090; }

/* ── Termo de aceite ──────────────────────────────────────── */
.term-container { max-width: 760px; margin: 2rem auto; padding: 0 1rem; }
.term-box {
    max-height: 420px; overflow-y: auto;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; background: var(--bg);
    font-size: .92rem; line-height: 1.7; color: var(--text-soft);
    margin-bottom: 1.25rem;
}
.term-box h3 { color: var(--primary); margin-bottom: .75rem; }
.term-box p  { margin-bottom: .75rem; }

/* ── Upload de documentos ─────────────────────────────────── */
.upload-container { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem; margin-top: 1rem;
}
.doc-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; flex-direction: column; gap: .75rem;
    transition: box-shadow .2s;
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card-title  { font-weight: 700; font-size: .95rem; color: var(--primary); }
.doc-card-status { font-size: .83rem; font-weight: 600; }
.status-aprovado  { color: var(--success); }
.status-rejeitado { color: var(--danger); }
.status-pendente  { color: var(--warning); }

.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s;
    font-size: .9rem; color: var(--text-soft);
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent); background: #fdf8ee; color: var(--primary);
}

/* ── Senha gerada ─────────────────────────────────────────── */
.password-reveal {
    background: linear-gradient(135deg, #0a1f6b 0%, #1a3a9f 100%);
    color: #fff; border-radius: var(--radius);
    padding: 1.5rem; text-align: center; margin: 1rem 0;
}
.password-reveal .password-value {
    font-size: 2rem; font-weight: 800; letter-spacing: .25rem;
    color: var(--accent); font-family: monospace;
    margin: .75rem 0;
}
.password-reveal p { font-size: .88rem; opacity: .85; }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.25rem; text-align: center;
    border-top: 3px solid var(--border);
}
.stat-card-clickable {
    cursor: pointer; transition: transform .15s, box-shadow .15s;
    border-top-color: var(--accent);
}
.stat-card-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-number { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label  { font-size: .85rem; color: var(--text-soft); margin-top: .25rem; }
.stat-hint { font-size: .72rem; color: var(--accent); margin-top: .25rem; font-weight: 600; }
.text-warning { color: var(--warning) !important; }

.clients-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.clients-table th { background: var(--primary); color: #fff; padding: .85rem 1rem; text-align: left; font-size: .85rem; }
.clients-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr:hover td { background: #f4f6fb; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .65rem;
    border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.badge-success { background: #e6f4ea; color: var(--success); }
.badge-warning { background: #fef7e0; color: #8a6200; }
.badge-danger  { background: #fce8e6; color: var(--danger); }
.badge-navy    { background: #eef1fb; color: var(--primary); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,31,107,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 1rem;
}
.modal {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; padding: 1.5rem;
    border-top: 4px solid var(--accent);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.modal-title  { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.modal-close  { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-soft); line-height: 1; }
.modal-close:hover { color: var(--danger); }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filter badge ─────────────────────────────────────────── */
.filter-badge {
    display: inline-flex; align-items: center; gap: .5rem;
    background: #eef1fb; color: var(--primary);
    border-radius: 999px; padding: .35rem .85rem;
    font-size: .85rem; font-weight: 600; margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.filter-badge button {
    background: none; border: none; cursor: pointer;
    color: var(--primary); font-size: 1rem; line-height: 1; padding: 0;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    padding: .85rem 1.5rem; border-radius: var(--radius);
    box-shadow: var(--shadow-md); font-size: .95rem; font-weight: 600;
    z-index: 2000; min-width: 280px; text-align: center;
}
.toast-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7dfbf; }
.toast-error   { background: #fce8e6; color: var(--danger);  border: 1px solid #f5c6c2; }

/* ── Painel de status do cliente ──────────────────────────── */
.status-panel {
    background: linear-gradient(135deg, var(--primary) 0%, #1a3a9f 100%);
    border-radius: var(--radius); padding: 1.25rem 1.5rem;
    color: #fff; margin-bottom: 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
}
.status-panel .status-greeting { font-size: 1rem; opacity: .9; }
.status-panel .status-name     { font-size: 1.25rem; font-weight: 700; color: var(--accent); }
.status-panel .status-progress { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.status-panel .status-item     { text-align: center; }
.status-panel .status-num      { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.status-panel .status-lbl      { font-size: .75rem; opacity: .8; }

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .doc-grid      { grid-template-columns: 1fr; }
    .stats-grid    { grid-template-columns: repeat(2, 1fr); }
    .clients-table { font-size: .82rem; }
    .clients-table th, .clients-table td { padding: .65rem .75rem; }
    .status-panel  { flex-direction: column; }
}