/* ---------------------------------------------------------------- Alerts */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 12px; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success-border); color: #0d6b3c; }
.alert-danger { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: #a4293a; }
.alert-info { background: #eaf1ff; border-color: #c7dcff; color: #1f4fa3; }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
    font-size: 13px; font-weight: 600; font-family: var(--font-sans); cursor: pointer; text-align: center;
    transition: filter .15s var(--ease-out), box-shadow .18s var(--ease-out), background-color .15s var(--ease-out), border-color .15s var(--ease-out), color .15s var(--ease-out), transform .12s var(--ease-out);
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(.97) translateY(0); }

.btn-secondary {
    background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--color-surface-alt); border-color: var(--color-text-dim); text-decoration: none; }

.btn-danger { background: var(--color-surface); color: var(--color-danger); border-color: var(--color-danger-border); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: var(--color-danger); border-color: var(--color-danger); color: #fff; text-decoration: none; }

.btn-block { width: 100%; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31, 111, 235, .28); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }

/* CTA de "criar" (Novo projeto e afins) — pílula com selo de ícone, ecoa o CTA "Add task" da referência */
.btn-cta { padding: 9px 18px 9px 9px; gap: 10px; border-radius: 999px; }
.btn-cta-icon {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    background: rgba(255, 255, 255, .2);
    display: flex; align-items: center; justify-content: center;
}
.btn-cta-icon svg { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- Forms */
.form { max-width: 480px; display: flex; flex-direction: column; gap: 16px; }
.form-wide { max-width: 620px; }
.form-expanded { max-width: 1100px; }
.panel-form-stack { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 7px; font-weight: 600; font-size: 12.5px; color: var(--color-text); }
.form .field-hint { font-weight: 500; font-size: 11.5px; color: var(--color-text-muted); margin-top: -2px; }
.form .req { color: var(--color-danger); font-weight: 700; }
.form .label-sub { font-weight: 500; color: var(--color-text-dim); text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.form input, .form select, .form textarea {
    font: inherit; padding: 9px 12px; border: 1.5px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-surface-alt); color: var(--color-text); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form input:hover, .form select:hover, .form textarea:hover { border-color: rgba(31, 111, 235, .4); }
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; background: var(--color-surface); border-color: var(--color-blue); box-shadow: 0 0 0 3px rgba(31, 111, 235, .14);
}
.form textarea { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }

.form select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%237d7f99' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}

/* Campo com erro de validação inline */
.form input.is-invalid, .form select.is-invalid, .form textarea.is-invalid { border-color: var(--color-danger); }
.form input.is-invalid:focus, .form select.is-invalid:focus, .form textarea.is-invalid:focus { box-shadow: 0 0 0 3px rgba(214, 57, 74, .14); }
.field-error { display: block; font-size: 11.5px; font-weight: 600; color: var(--color-danger); margin-top: -1px; }

/* Cartão que envolve formulários de página inteira (projeto, colaborador) */
.form-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px 26px; box-shadow: var(--shadow-sm); }

/* Botão com estado de carregamento (evita duplo envio) */
.btn.is-loading { pointer-events: none; opacity: .78; }
.btn.is-loading::after {
    content: ''; width: 13px; height: 13px; margin-left: 8px; flex-shrink: 0;
    border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
    animation: wd-spin .6s linear infinite;
}
@keyframes wd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-loading::after { animation-duration: 1.4s; } }

/* Campo de senha com botão de mostrar/ocultar */
.input-password { position: relative; }
.input-password input { width: 100%; padding-right: 40px; }
.input-password-toggle {
    position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
    width: 30px; height: 30px; border-radius: 7px; border: none; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--color-text-dim);
}
.input-password-toggle:hover { background: var(--color-surface-alt); color: var(--color-text-muted); }
.input-password-toggle svg { width: 16px; height: 16px; }
.input-password-toggle .icon-eye-off { display: none; }
.input-password-toggle.is-visible .icon-eye { display: none; }
.input-password-toggle.is-visible .icon-eye-off { display: block; }

/* Campo monetário com prefixo R$ */
.input-prefix { position: relative; }
.input-prefix span {
    position: absolute; top: 50%; left: 12px; transform: translateY(-50%);
    font-weight: 600; color: var(--color-text-muted); font-size: 13px; pointer-events: none;
}
.input-prefix input { padding-left: 34px; font-variant-numeric: tabular-nums; }

/* Segmented control — alternativa tátil a <select> para poucas opções (status, prioridade, tipo) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.segmented-option { position: relative; cursor: pointer; }
.segmented-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented-option span {
    display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); background: var(--color-surface-alt);
    box-shadow: inset 0 0 0 1px var(--color-border); transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented-option:hover span { box-shadow: inset 0 0 0 1px var(--color-border-strong); }
.segmented-option input:focus-visible + span { outline: 2px solid var(--color-blue); outline-offset: 2px; }
.segmented-option input:checked + span { color: var(--color-text); box-shadow: inset 0 0 0 1.5px var(--color-border-strong); background: var(--color-surface); }

.seg-success input:checked + span { background: var(--color-success-bg); color: #0d6b3c; box-shadow: inset 0 0 0 1.5px var(--color-success-border); }
.seg-danger input:checked + span { background: var(--color-danger-bg); color: #a4293a; box-shadow: inset 0 0 0 1.5px var(--color-danger-border); }
.seg-warning input:checked + span { background: var(--color-warning-bg); color: var(--color-warning); box-shadow: inset 0 0 0 1.5px var(--color-warning); }
.seg-neutral input:checked + span { background: #eef0f7; color: #4b5163; box-shadow: inset 0 0 0 1.5px #d2d5e5; }
.seg-brand input:checked + span { background: linear-gradient(135deg, rgba(31,111,235,.14), rgba(124,78,234,.14)); color: var(--color-violet); box-shadow: inset 0 0 0 1.5px rgba(124,78,234,.35); }
.seg-teal input:checked + span { background: var(--hue-teal-bg); color: var(--hue-teal); box-shadow: inset 0 0 0 1.5px rgba(13,148,136,.35); }

/* ---------------------------------------------------------------- Tables */
.table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.table th { color: var(--color-text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--color-surface-alt); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }
.table-actions { display: flex; gap: 10px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell-name { font-weight: 600; color: var(--color-text); }
.person-cell-email { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }

/* ---------------------------------------------------------------- Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--color-surface-alt); color: var(--color-text-muted); text-transform: capitalize; letter-spacing: .01em; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-muted { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-status-planejamento { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-status-em_andamento { background: rgba(31, 111, 235, .1); color: var(--color-blue); }
.badge-status-pausado { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-status-concluido { background: var(--color-success-bg); color: var(--color-success); }
.badge-priority {
    height: 20px; padding: 0 9px 0 7px; display: inline-flex; align-items: center; gap: 5px;
    letter-spacing: .02em; transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.badge-priority::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-priority-baixa { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-priority-media { background: var(--hue-teal-bg); color: var(--hue-teal); }
.badge-priority-alta { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-priority-urgente { background: var(--color-danger-bg); color: var(--color-danger); }

/* ---------------------------------------------------------------- Grids & stat cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 30px; }
.stat-card { position: relative; overflow: hidden; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: box-shadow .18s ease, transform .18s ease; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient-brand); }
.stat-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center; color: var(--color-violet); margin-bottom: 12px; }
.stat-icon svg { width: 15px; height: 15px; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; font-weight: 700; }
.stat-positive .stat-value { color: var(--color-success); }
.stat-positive::before { background: linear-gradient(135deg, var(--color-success), #59d998); }
.stat-negative .stat-value { color: var(--color-danger); }
.stat-negative::before { background: linear-gradient(135deg, var(--color-danger), #ff8b8b); }
