* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, 'Segoe UI', Roboto, sans-serif; }

body { background: linear-gradient(145deg, #eef3fb 0%, #dde7f3 100%); min-height: 100vh; color: #1a2a3a; }

/* LOGIN */
.pagina-login { display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(145deg, #1e2b3c 0%, #0f1a26 100%); }
.login-card { background: white; border-radius: 28px; padding: 40px 36px; width: 100%; max-width: 440px; box-shadow: 0 40px 80px -20px rgba(0,0,0,.5); }
.login-card .logo { font-size: 2.6rem; text-align: center; margin-bottom: 12px; }
.login-card h1 { font-size: 1.25rem; text-align: center; margin-bottom: 6px; }
.login-card .subtitulo { text-align: center; color: #7a8b9c; font-size: .88rem; margin-bottom: 28px; }
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: .85rem; font-weight: 500; color: #4a5e72; margin-bottom: 6px; }
.campo input { width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid #cbd8e6; font-size: .95rem; outline: none; transition: border .15s, box-shadow .15s; }
.campo input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.btn-entrar { width: 100%; padding: 14px; border-radius: 14px; border: none; background: #1e2b3c; color: white; font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .15s; margin-top: 8px; }
.btn-entrar:hover { background: #0f1a26; }
.btn-entrar:disabled { background: #7a8b9c; cursor: not-allowed; }
.erro { color: #e11d48; font-size: .85rem; text-align: center; margin-top: 12px; min-height: 20px; font-weight: 500; }
.rodape-login { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eef2f6; }
.rodape-login a { color: #1d4ed8; font-size: .85rem; font-weight: 600; text-decoration: none; padding: 8px 14px; border-radius: 8px; transition: background .15s; display: inline-block; }
.rodape-login a:hover { background: #eff6ff; }
.dica { background: #f0f6ff; border: 1px solid #d3e2f5; border-radius: 14px; padding: 14px 16px; margin-top: 20px; font-size: .78rem; color: #4a5e72; line-height: 1.6; }
.dica strong { color: #1e2b3c; display: block; margin-bottom: 6px; }
.dica code { background: white; padding: 1px 6px; border-radius: 4px; font-size: .76rem; color: #1d4ed8; font-weight: 600; }

/* KANBAN */
.pagina-kanban { padding: 0 20px 40px; }
/* ============================================================ */
/* HEADER FIXO                                                    */
/* ============================================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    max-width: none;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    background: #ffffffcc;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px 24px;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 8px 24px -12px rgba(0, 30, 50, 0.25);
    transition: transform 0.3s ease, box-shadow 0.2s ease;
}

/* Legenda da equipe também pode ficar logo abaixo do header fixo */
.team-legend {
    position: sticky;
    top: 130px;
    z-index: 40;
    background: linear-gradient(180deg, #eef3fbdd 0%, #eef3fb 100%);
    padding: 10px 4px;
    margin: 0 auto 24px;
    backdrop-filter: blur(6px);
}

@media (max-width: 900px) {
    .team-legend { top: 200px; }
}

@media (max-width: 600px) {
    .team-legend { top: 260px; }
}

/* Quando a página rola um pouco, o header ganha mais destaque */
.app-header.rolado {
    box-shadow: 0 12px 30px -14px rgba(0, 30, 50, 0.35);
    background: #ffffffdd;
}

/* Quando o usuário rola para BAIXO, esconde o header */
.app-header.oculto {
    transform: translateY(-100%);
}

/* Espaço reservado para o header fixo — evita que o conteúdo fique por baixo */
.pagina-kanban {
    padding-top: 130px; /* ajuste se o header for mais alto em telas pequenas */
}

@media (max-width: 900px) {
    .pagina-kanban {
        padding-top: 200px; /* em telas pequenas o header quebra em duas linhas */
    }
}

@media (max-width: 600px) {
    .pagina-kanban {
        padding-top: 260px;
    }
}

.app-header h1 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secretaria-badge { display: inline-block; color: white; font-size: .78rem; font-weight: 600; padding: 4px 12px; border-radius: 20px; margin-top: 4px; }
.user-info { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; background: #f5f8fc; border-radius: 40px; border: 1px solid #e6edf5; }
.user-info .avatar { width: 30px; height: 30px; border-radius: 50%; color: white; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-info .user-name { font-size: .85rem; font-weight: 600; }
.user-info .user-role { font-size: .72rem; color: #7a8b9c; }
.btn-manage, .btn-logout { padding: 10px 16px; border-radius: 12px; font-size: .85rem; font-weight: 500; cursor: pointer; font-family: inherit; }
.btn-manage { background: #1e2b3c; color: white; border: none; }
.btn-logout { background: white; color: #c0392b; border: 1px solid #f0d5d5; }
.btn-logout:hover { background: #fff5f5; }
.filter-section { display: flex; align-items: center; gap: 8px; }
.filter-section select { padding: 10px 14px; border-radius: 12px; border: 1px solid #cbd8e6; background: white; font-size: .88rem; cursor: pointer; }

.team-legend { max-width: 1600px; margin: 0 auto 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.team-legend .member-chip { background: white; padding: 6px 14px 6px 6px; border-radius: 40px; font-size: .85rem; display: flex; align-items: center; gap: 8px; border: 1px solid #e6edf5; }
.team-legend .avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: .68rem; }

.kanban { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; max-width: 1600px; margin: 0 auto; }
.column { background: #ffffffdd; backdrop-filter: blur(8px); border-radius: 28px; padding: 20px 16px; width: 300px; min-width: 260px; flex: 1 1 260px; box-shadow: 0 18px 35px -12px rgba(0,20,30,.25); }
.column-header { display: flex; justify-content: space-between; margin-bottom: 18px; padding: 0 6px; }
.column-header h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.column-header .count { background: #1e2b3c; color: white; font-size: .75rem; padding: 2px 10px; border-radius: 30px; }
.pendente h2 { color: #b91c1c; }
.todo h2 { color: #b45309; }
.doing h2 { color: #1d4ed8; }
.done h2 { color: #0f7b3a; }

.task-list { min-height: 180px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.task-card { background: white; border-radius: 18px; padding: 14px; box-shadow: 0 6px 14px rgba(0,0,0,.03); border: 1px solid #eef2f6; border-left: 5px solid transparent; cursor: grab; display: flex; flex-direction: column; gap: 10px; transition: transform .2s, box-shadow .2s; }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 18px 25px -12px rgba(0,20,30,.2); }
.pendente .task-card { border-left-color: #ef4444; }
.todo .task-card { border-left-color: #f59e0b; }
.doing .task-card { border-left-color: #3b82f6; }
.done .task-card { border-left-color: #10b981; }
.task-protocol { font-size: .72rem; font-weight: 700; color: #5a6e82; background: #eef3fb; padding: 3px 8px; border-radius: 6px; width: fit-content; font-family: monospace; }
.task-text { font-size: .98rem; font-weight: 500; }
.task-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid #f0f4f8; }
.assignee-badge { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; background: #f5f8fc; border-radius: 40px; font-size: .8rem; cursor: pointer; border: 1px solid #e6edf5; }
.task-actions { display: flex; gap: 4px; opacity: .6; }
.task-actions button { background: none; border: none; cursor: pointer; padding: 4px 7px; border-radius: 30px; font-size: 1rem; }
.task-actions button:hover { background: #ecf1f7; }
.add-task-btn { width: 100%; padding: 14px; border: 2px dashed #b9c8da; border-radius: 18px; background: rgba(255,255,255,.7); font-size: .95rem; color: #3b4e62; cursor: pointer; font-family: inherit; }
.add-task-btn:hover { background: white; border-color: #8da3bb; }
.task-list:empty::after { content: "Nenhuma tarefa"; color: #9aaebb; font-size: .9rem; text-align: center; padding: 30px 10px; display: block; font-style: italic; background: #f8fafd; border-radius: 16px; border: 1px dashed #cbd6e3; }

/* MODAIS */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,25,40,.55); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 24px; padding: 28px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 18px; }
.modal label { display: block; font-size: .85rem; font-weight: 500; color: #4a5e72; margin-bottom: 6px; }
.modal label .hint { font-weight: 400; color: #9aaebb; font-size: .75rem; }
.modal input[type=text], .modal input[type=password], .modal select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #cbd8e6; font-size: .95rem; margin-bottom: 16px; font-family: inherit; }
.modal input:focus, .modal select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.protocol-wrap { position: relative; margin-bottom: 8px; }
.protocol-wrap input { margin-bottom: 0 !important; font-family: monospace; font-weight: 700; color: #1d4ed8; padding-right: 90px; }
.protocol-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #eff6ff; border: 1px solid #d3e2f5; color: #1d4ed8; padding: 5px 10px; border-radius: 8px; font-size: .7rem; font-weight: 600; cursor: pointer; }
.protocol-hint { font-size: .72rem; color: #8b9cae; margin-bottom: 16px; }
.protocol-hint code { background: #eef3fb; padding: 1px 6px; border-radius: 4px; font-family: monospace; }
.member-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; margin-bottom: 20px; }
.member-select-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; border: 2px solid #eef2f6; cursor: pointer; background: #fafcfe; }
.member-select-item.selected { border-color: #3b82f6; background: #eff6ff; }
.member-select-item .avatar { width: 26px; height: 26px; border-radius: 50%; color: white; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .68rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-primary { background: #1e2b3c; color: white; border: none; padding: 10px 20px; border-radius: 12px; font-size: .9rem; font-weight: 500; cursor: pointer; font-family: inherit; }
.btn-secondary { background: #eef2f6; color: #3b4e62; border: none; padding: 10px 20px; border-radius: 12px; font-size: .9rem; font-weight: 500; cursor: pointer; font-family: inherit; }

/* FORM EQUIPE */
.form-equipe { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px; background: #f8fafd; border-radius: 16px; }
.form-equipe input[type=text] { flex: 2; min-width: 140px; margin-bottom: 0; }
.form-equipe select { flex: 2; min-width: 140px; margin-bottom: 0; }
.form-equipe input[type=color] { width: 50px; height: 42px; padding: 2px; border-radius: 10px; border: 1px solid #cbd8e6; cursor: pointer; }

/* LISTAS ADMIN */
.lista { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.lista .item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fafcfe; border: 1px solid #eef2f6; }
.lista .item .swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,.15); flex-shrink: 0; }
.lista .item .info { flex: 1; min-width: 0; }
.lista .item .info .nome { font-weight: 600; font-size: .95rem; }
.lista .item .info .sub { font-size: .78rem; color: #7a8b9c; }
.lista .item .stats { font-size: .75rem; background: #eef3fb; padding: 3px 10px; border-radius: 20px; }
.lista .item .acoes { display: flex; gap: 4px; }
.lista .item .acoes button { background: none; border: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: .95rem; }
.lista .item .acoes button:hover { background: #ecf1f7; }
.lista .vazio { text-align: center; padding: 30px; color: #8b9cae; font-style: italic; background: #f8fafd; border-radius: 14px; border: 1px dashed #cbd6e3; }

/* ADMIN */
.pagina-admin { padding: 24px 20px; }
.admin-container { max-width: 1200px; margin: 0 auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; background: white; padding: 18px 24px; border-radius: 20px; margin-bottom: 24px; box-shadow: 0 12px 30px -14px rgba(0,30,50,.15); }
.admin-header > div { display: flex; align-items: center; gap: 10px; }
.admin-header a { padding: 8px 14px; border-radius: 10px; text-decoration: none; font-size: .85rem; font-weight: 500; }
.admin-login-card { max-width: 400px; margin: 60px auto; background: white; padding: 32px; border-radius: 20px; box-shadow: 0 12px 30px -14px rgba(0,30,50,.15); }
.admin-login-card h3 { margin-bottom: 12px; }
.admin-login-card p { color: #7a8b9c; font-size: .85rem; margin-bottom: 20px; }
.admin-login-card input { width: 100%; padding: 12px 14px; border: 1px solid #cbd8e6; border-radius: 10px; margin-bottom: 12px; font-family: inherit; }
.admin-login-card button { width: 100%; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 22px; background: #eef3fb; padding: 4px; border-radius: 14px; max-width: 700px; }
.admin-tab { flex: 1; padding: 10px 12px; border: none; background: transparent; border-radius: 10px; font-size: .85rem; font-weight: 500; cursor: pointer; color: #5a6e82; }
.admin-tab.active { background: white; color: #1a2a3a; box-shadow: 0 2px 6px rgba(0,20,40,.08); }
.tab-content { display: none; background: white; padding: 24px; border-radius: 20px; box-shadow: 0 12px 30px -14px rgba(0,30,50,.15); }
.tab-content.active { display: block; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; padding: 16px; background: #f8fafd; border-radius: 16px; }
.form-inline input[type=text], .form-inline input[type=password], .form-inline select { flex: 1; min-width: 140px; padding: 10px 12px; border: 1px solid #cbd8e6; border-radius: 10px; font-family: inherit; }
.form-inline input[type=color] { width: 50px; height: 42px; padding: 2px; border-radius: 10px; border: 1px solid #cbd8e6; cursor: pointer; }
/* Botão/link para alterar senha no cabeçalho */
.btn-manage[href],
a.btn-manage {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Feedback de sucesso na página de alterar senha */
#sucesso {
    min-height: 20px;
    transition: opacity .3s;
}

/* Ícone de bloqueio no formulário */
.login-card .logo {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.15));
}

/* Melhora o espaçamento dos campos de senha */
#form-senha .campo input:focus {
    border-color: #1d4ed8;
}

/* Responsividade do cabeçalho com o novo botão */
@media (max-width: 900px) {
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Suporte a links estilizados como botões */
a.btn-manage,
a.btn-manage:visited {
    text-decoration: none;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
a.btn-manage:hover { opacity: .9; }

/* ============================================================ */
/* OBSERVAÇÃO NA TAREFA                                          */
/* ============================================================ */
.task-observacao {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f97316;
    border-radius: 8px;
    font-size: .8rem;
    color: #7c2d12;
    line-height: 1.4;
}

.task-observacao .icone {
    flex-shrink: 0;
    font-size: .9rem;
}

.task-observacao .texto {
    flex: 1;
    word-break: break-word;
}

/* Ajuste visual quando a tarefa está pendente */
.pendente .task-card {
    background: #fffbf5;
}

.pendente .task-observacao {
    background: #fff7ed;
}

/* Botão para editar observação no cartão */
.btn-obs {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    color: #ea580c;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background .15s;
}

.btn-obs:hover {
    background: #ffedd5;
}

/* ============================================================ */
/* MODAL DE OBSERVAÇÃO                                           */
/* ============================================================ */
.modal-observacao {
    max-width: 520px;
}

.modal-observacao .aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: .85rem;
    color: #7c2d12;
}

.modal-observacao .aviso .emoji {
    font-size: 1.4rem;
}

.modal-observacao .aviso .texto {
    flex: 1;
    line-height: 1.4;
}

.modal-observacao textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #cbd8e6;
    font-family: inherit;
    font-size: .95rem;
    resize: vertical;
    outline: none;
    transition: border .15s, box-shadow .15s;
    margin-bottom: 8px;
}

.modal-observacao textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.modal-observacao .contador {
    text-align: right;
    font-size: .72rem;
    color: #8b9cae;
    margin-bottom: 16px;
}

.modal-observacao .contador.alerta {
    color: #ea580c;
    font-weight: 600;
}

/* ============================================================ */
/* OBSERVAÇÃO NA TAREFA                                          */
/* ============================================================ */
.task-observacao {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f97316;
    border-radius: 8px;
    font-size: .8rem;
    color: #7c2d12;
    line-height: 1.4;
    cursor: pointer;
    transition: background .15s;
}

.task-observacao:hover {
    background: #ffedd5;
}

.task-observacao.vazia {
    background: #f8fafd;
    border-color: #e6edf5;
    border-left-color: #cbd8e6;
    color: #8b9cae;
    font-style: italic;
}

.task-observacao .icone {
    flex-shrink: 0;
    font-size: .9rem;
}

.task-observacao .texto {
    flex: 1;
    word-break: break-word;
}

.pendente .task-card {
    background: #fffbf5;
}

/* ============================================================ */
/* MODAL DE OBSERVAÇÃO                                           */
/* ============================================================ */
.modal-observacao {
    max-width: 520px;
}

.modal-observacao .aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: .85rem;
    color: #7c2d12;
}

.modal-observacao .aviso .emoji {
    font-size: 1.4rem;
}

.modal-observacao .aviso .texto {
    flex: 1;
    line-height: 1.4;
}

.modal-observacao textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #cbd8e6;
    font-family: inherit;
    font-size: .95rem;
    resize: vertical;
    outline: none;
    transition: border .15s, box-shadow .15s;
    margin-bottom: 8px;
}

.modal-observacao textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.modal-observacao .contador {
    text-align: right;
    font-size: .72rem;
    color: #8b9cae;
    margin-bottom: 16px;
}

.modal-observacao .contador.alerta {
    color: #ea580c;
    font-weight: 600;
}

/* ============================================================ */
/* TAGS DE VÍNCULO (múltiplas secretarias por usuário)           */
/* ============================================================ */
.vinc-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    max-width: 380px;
}

.vinc-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all .15s;
    cursor: pointer;
    border: 1px solid transparent;
}

.vinc-tag:hover {
    filter: brightness(.95);
    border-color: rgba(0,0,0,.1);
}

.vinc-tag.principal {
    box-shadow: 0 0 0 2px white, 0 0 0 3px currentColor;
}

.vinc-tag .vinc-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    margin-left: 2px;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    font-weight: 700;
    opacity: .6;
    transition: opacity .15s;
}

.vinc-tag .vinc-remove:hover {
    opacity: 1;
}

/* Seletor de secretaria no cabeçalho */
#seletor-secretaria {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #cbd8e6;
    background: white;
    font-size: .88rem;
    font-family: inherit;
    color: #1a2a3a;
    cursor: pointer;
    outline: none;
    transition: border .15s;
    max-width: 220px;
    font-weight: 500;
}

#seletor-secretaria:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ============================================================ */
/* CAMPO DE FUNÇÃO (input livre com datalist)                    */
/* ============================================================ */
.form-equipe input[type="text"] {
    flex: 2;
    min-width: 160px;
    padding: 10px 12px;
    border: 1px solid #cbd8e6;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    outline: none;
    transition: border .15s, box-shadow .15s;
    background: white;
    color: #1a2a3a;
}

.form-equipe input[type="text"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* Datalist - aparência nativa do navegador, sem estilo customizado */