/* =============================================================
   Concurseiro — estilos globais
   ============================================================= */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #0ea5e9;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #2563eb;
    --info-light: #dbeafe;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 4px 14px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 30px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

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

/* ---------------- Topbar ---------------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 16px 0;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 18px;
}

.brand-name {
    font-weight: 800;
    font-size: 20px;
    color: var(--text);
    letter-spacing: -.02em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-exit { color: var(--danger); }
.nav-exit:hover { background: var(--danger-light); color: var(--danger); }

/* ---------------- Layout ---------------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 20px 60px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0;
}

.page-subtitle {
    color: var(--text-muted);
    margin: 6px 0 0;
    font-size: 14px;
}

/* ---------------- Cards ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ---------------- Stat cards ---------------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    background: var(--primary-light);
    color: var(--primary);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border .15s, color .15s, transform .05s;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--bg); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

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

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-link { background: transparent; color: var(--info); padding: 0; border: none; font-weight: 600; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 7px;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

textarea { min-height: 120px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-group { margin-bottom: 0; flex: 1 1 180px; }

.help { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* ---------------- Alerts ---------------- */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-light); color: #15803d; border-color: #bbf7d0; }
.alert-erro, .alert-danger { background: var(--danger-light); color: #b91c1c; border-color: #fecaca; }
.alert-info { background: var(--info-light); color: #1d4ed8; border-color: #bfdbfe; }
.alert-warning { background: var(--warning-light); color: #b45309; border-color: #fde68a; }

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    line-height: 1;
    padding: 0 4px;
}

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }

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

.table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

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

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #15803d; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-danger { background: var(--danger-light); color: #b91c1c; }
.badge-muted { background: var(--bg); color: var(--text-muted); }
.badge-accent { background: #e0f2fe; color: #0369a1; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------------- Progress ---------------- */
.progress {
    height: 8px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width .3s;
}

.meta-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------------- Stars / importância ---------------- */
.stars { color: #f59e0b; font-size: 15px; letter-spacing: 1px; }
.stars-muted { color: #cbd5e1; }

/* ---------------- Timer ---------------- */
.timer {
    text-align: center;
    padding: 26px 20px;
}

.timer-display {
    font-size: 54px;
    font-weight: 800;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    margin: 4px 0 18px;
}

.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.timer-running .timer-display { color: var(--success); }

/* ---------------- Calendar ---------------- */
.calendar {
    width: 100%;
    border-collapse: collapse;
}

.calendar th {
    padding: 10px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    font-weight: 700;
}

.calendar td {
    border: 1px solid var(--border);
    height: 104px;
    width: 14.28%;
    vertical-align: top;
    padding: 6px;
    font-size: 13px;
    background: var(--surface);
}

.calendar td.other { background: #f8fafc; color: #cbd5e1; }
.calendar td.today .day-num { background: var(--primary); color: #fff; }

.day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
}

.cal-event {
    display: block;
    font-size: 11px;
    line-height: 1.25;
    padding: 3px 6px;
    border-radius: 6px;
    margin-top: 4px;
    background: var(--primary-light);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.cal-event.done {
    background: var(--success-light);
    color: #15803d;
    border-left-color: var(--success);
    text-decoration: line-through;
}

a.cal-event { text-decoration: none; cursor: pointer; }
a.cal-event:hover { background: #dbeafe; }
a.cal-event.done:hover { background: var(--success-light); }

/* ---------------- Lists ---------------- */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.list-item:last-child { border-bottom: none; }

.list-main { min-width: 0; flex: 1; }
.list-title { font-weight: 700; }
.list-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.list-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.chip {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    margin: 2px 4px 2px 0;
}

/* ---------------- Auth pages ---------------- */
.auth-wrap {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 18px;
}

.auth-logo .brand-icon { width: 54px; height: 54px; font-size: 25px; border-radius: 14px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 800; margin: 10px 0 4px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-alt a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 34px 16px;
    font-size: 14px;
}

.empty i { font-size: 32px; margin-bottom: 10px; color: #cbd5e1; display: block; }

.footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 18px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.footer p { margin: 0; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1; }

/* ---------------- Notas ricas (HTML) ---------------- */
.note-body {
    margin-top: 8px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}
.note-body p { margin: 0 0 1em; }
.note-body p:last-child, .note-body ul:last-child, .note-body ol:last-child { margin-bottom: 0; }
.note-body ul, .note-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.note-body a { color: var(--info); }
.note-body h1, .note-body h2, .note-body h3, .note-body h4, .note-body h5, .note-body h6 { margin: .6em 0 .4em; line-height: 1.3; }
.note-body blockquote { margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid var(--primary); background: var(--primary-light); border-radius: 6px; }
.note-body table { border-collapse: collapse; margin-bottom: 1em; }
.note-body th, .note-body td { border: 1px solid var(--border); padding: 6px 10px; }
.note-body hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.note-body img { max-width: 100%; height: auto; border-radius: 8px; }

/* TinyMCE */
.tox-tinymce { border: 1px solid var(--border) !important; border-radius: 10px !important; }
.tox .tox-editor-header { border-bottom: 1px solid var(--border) !important; }

@media (max-width: 720px) {
    .form-row, .form-inline { grid-template-columns: 1fr; display: grid; }
    .topbar-inner { justify-content: center; }
    .calendar td { height: 84px; }
    .timer-display { font-size: 42px; }
}
