/* ==================================================
   SMM — Sistema de Marcação Municipal
   Secretaria da Mulher · Taboão da Serra
   Design system dos painéis internos (padrão PAV).
   ================================================== */

:root {
    --smm-primary: #7b1f5c;        /* vinho institucional da Secretaria da Mulher */
    --smm-primary-dark: #5c1444;
    --smm-primary-light: #fbeaf4;
    --smm-accent: #0d6efd;
    --smm-text: #1a2b4a;
    --smm-muted: #64748b;
    --smm-border: #e2e8f0;
    --smm-bg: #f7f9fc;

    --smm-ok: #16a34a;
    --smm-warn: #d97706;
    --smm-danger: #dc2626;
    --smm-gray: #64748b;

    --logo-nav-h: 40px;
    --logo-footer-h: 30px;
    --logo-login-h: 78px;
}

body {
    background: var(--smm-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--smm-text);
}

.container-smm { max-width: 1400px; margin: 0 auto; padding: 0 1rem; }

/* ==================================================
   NAVBAR
   ================================================== */
.smm-navbar {
    background: white;
    border-bottom: 1px solid var(--smm-border);
    padding: .75rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.02);
    position: sticky; top: 0; z-index: 1020;
}
.smm-navbar-container {
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0 1.5rem; max-width: 1400px; margin: 0 auto;
}
.smm-nav-brand { display: flex; align-items: center; gap: .875rem; text-decoration: none; flex-shrink: 0; }
.smm-nav-brand img { height: var(--logo-nav-h); width: auto; display: block; object-fit: contain; }
.smm-nav-brand-text {
    display: flex; flex-direction: column; line-height: 1.15;
    padding-left: .875rem; border-left: 1px solid var(--smm-border);
}
.smm-nav-brand-text .title { font-weight: 600; color: var(--smm-text); font-size: .92rem; }
.smm-nav-brand-text .subtitle {
    font-size: .72rem; color: var(--smm-muted);
    text-transform: uppercase; letter-spacing: .04em;
}

.smm-nav-menu { display: flex; gap: .25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.smm-nav-link {
    color: var(--smm-muted); text-decoration: none;
    padding: .5rem .85rem; border-radius: 8px;
    font-size: .88rem; font-weight: 500; transition: all .12s;
    display: inline-flex; align-items: center; gap: .35rem;
    border: 1px solid transparent;
}
.smm-nav-link:hover { background: var(--smm-bg); color: var(--smm-text); }
.smm-nav-link.active { background: var(--smm-primary-light); color: var(--smm-primary); font-weight: 600; }
.smm-nav-link.destaque {
    background: var(--smm-primary); color: #fff; font-weight: 600;
}
.smm-nav-link.destaque:hover { background: var(--smm-primary-dark); color: #fff; }

.smm-nav-user {
    display: flex; align-items: center; gap: .6rem;
    padding-left: 1rem; margin-left: .5rem;
    border-left: 1px solid var(--smm-border);
    font-size: .82rem; color: var(--smm-muted);
}
.smm-nav-user strong { color: var(--smm-text); font-weight: 600; }
.smm-nav-logout {
    color: var(--smm-muted); text-decoration: none;
    padding: .35rem .7rem; border-radius: 6px; font-size: .82rem;
    border: 1px solid var(--smm-border); background: white; transition: all .12s;
}
.smm-nav-logout:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

/* ==================================================
   ALTERNADOR MINHA AGENDA / TODAS
   ================================================== */
.agenda-switch {
    display: flex; align-items: center; gap: .4rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.switch-btn {
    padding: .5rem 1.1rem; border-radius: 10px;
    background: white; border: 1px solid var(--smm-border);
    color: var(--smm-muted); font-weight: 600; font-size: .9rem;
    text-decoration: none; transition: all .12s;
}
.switch-btn:hover { border-color: var(--smm-primary); color: var(--smm-primary); }
.switch-btn.on { background: var(--smm-primary); border-color: var(--smm-primary); color: #fff; }
.agenda-switch select {
    border: 1px solid var(--smm-border); border-radius: 8px;
    padding: .45rem .7rem; font-size: .85rem; background: white; color: var(--smm-text);
    max-width: 280px;
}
.badge-eu {
    display: inline-block; padding: .1rem .5rem; border-radius: 10px;
    background: var(--smm-primary-light); color: var(--smm-primary);
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}

/* ==================================================
   FAIXA DA SEMANA
   ================================================== */
.week-strip {
    display: flex; gap: .45rem; margin-bottom: 1rem;
    overflow-x: auto; padding-bottom: .25rem;
}
.week-day {
    flex: 1 0 108px; background: white; border: 1px solid var(--smm-border);
    border-radius: 10px; padding: .55rem .5rem; text-align: center;
    text-decoration: none; color: var(--smm-text); transition: all .12s;
    display: flex; flex-direction: column; gap: .1rem;
}
.week-day:hover { border-color: var(--smm-primary); }
.week-day .dia {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--smm-muted); font-weight: 700;
}
.week-day .num { font-size: 1rem; font-weight: 700; }
.week-day .qtd { font-size: .7rem; color: var(--smm-muted); }
.week-day .qtd em { font-style: normal; color: var(--smm-ok); }
.week-day.hoje { border-color: var(--smm-primary); }
.week-day.ativo {
    background: var(--smm-primary); border-color: var(--smm-primary); color: #fff;
}
.week-day.ativo .dia, .week-day.ativo .qtd, .week-day.ativo .qtd em { color: rgba(255,255,255,.85); }

/* ==================================================
   PRÓXIMO ATENDIMENTO
   ================================================== */
.proximo-box {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: white; border: 1.5px solid var(--smm-primary);
    border-radius: 12px; padding: .85rem 1.15rem; margin-bottom: 1rem;
}
.proximo-box .rot {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--smm-primary); font-weight: 700;
}
.proximo-box .hora { font-size: 1.35rem; font-weight: 700; color: var(--smm-text); }
.proximo-box .nome { font-size: 1rem; font-weight: 600; color: var(--smm-text); }
.apt-card.proximo { border: 1.5px solid var(--smm-primary); border-left-width: 5px; }

/* ==================================================
   CABEÇALHO DO DIA
   ================================================== */
.day-header {
    background: white; border-radius: 12px;
    padding: 1.25rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 1rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 1rem;
}
.day-header .data-num { font-size: 2.25rem; font-weight: 700; color: var(--smm-primary); line-height: 1; }
.day-header .data-info { color: var(--smm-muted); font-size: .9rem; text-transform: capitalize; }
.day-nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.day-nav .btn-day {
    background: white; border: 1px solid var(--smm-border); color: var(--smm-text);
    width: 40px; height: 40px; border-radius: 8px; font-size: 1.2rem; cursor: pointer;
}
.day-nav .btn-day:hover { border-color: var(--smm-primary); color: var(--smm-primary); }
.day-nav input[type=date], .day-nav select {
    border: 1px solid var(--smm-border); border-radius: 8px;
    padding: .5rem .75rem; font-size: .9rem; background: white; color: var(--smm-text);
}

/* ==================================================
   KPIs
   ================================================== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
.stat-mini {
    background: white; border-radius: 10px; padding: .85rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04); border-left: 4px solid transparent;
}
.stat-mini .stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--smm-text); }
.stat-mini .stat-lbl {
    font-size: .72rem; color: var(--smm-muted);
    text-transform: uppercase; letter-spacing: .05em; margin-top: .3rem;
}
.stat-mini.total { border-color: #94a3b8; }
.stat-mini.livre { border-color: var(--smm-ok); }
.stat-mini.marcado { border-color: var(--smm-warn); }
.stat-mini.presente { border-color: var(--smm-ok); }
.stat-mini.falta { border-color: var(--smm-danger); }
.stat-mini.bloqueado { border-color: var(--smm-gray); }

/* ==================================================
   CHIPS DE FILTRO
   ================================================== */
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .85rem; border-radius: 20px;
    background: white; border: 1px solid var(--smm-border);
    font-size: .85rem; font-weight: 500; color: var(--smm-text);
    text-decoration: none; transition: all .12s;
}
.chip:hover { border-color: var(--smm-primary); color: var(--smm-primary); }
.chip.active { background: var(--smm-primary); color: white; border-color: var(--smm-primary); }
.chip .num { font-size: .75rem; padding: .1rem .5rem; background: rgba(0,0,0,.08); border-radius: 10px; font-weight: 700; }
.chip.active .num { background: rgba(255,255,255,.25); }

/* ==================================================
   CARDS DE ATENDIMENTO (agenda do dia)
   ================================================== */
.apt-list { display: flex; flex-direction: column; gap: .75rem; }
.apt-card {
    background: white; border-radius: 12px; padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: grid; grid-template-columns: 92px 1fr auto; gap: 1.25rem;
    align-items: center; border-left: 5px solid transparent; transition: box-shadow .12s;
}
.apt-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.apt-card.livre { border-left-color: var(--smm-ok); }
.apt-card.marcado { border-left-color: var(--smm-warn); }
.apt-card.presente { border-left-color: var(--smm-ok); background: #fafffb; }
.apt-card.falta { border-left-color: var(--smm-danger); background: #fffafa; }
.apt-card.intervalo { border-left-color: var(--smm-gray); background: #fafbfc; }
.apt-card.atendido { border-left-color: var(--smm-primary); background: #fffafd; }
.status-final.atendido { background: var(--smm-primary-light); color: var(--smm-primary); }

.apt-hora { text-align: center; padding: .5rem; background: #f1f5f9; border-radius: 8px; }
.apt-hora .hora-num { font-size: 1.45rem; font-weight: 700; color: var(--smm-text); line-height: 1; }
.apt-hora .hora-label { font-size: .65rem; color: var(--smm-muted); text-transform: uppercase; margin-top: .2rem; }

.apt-info { min-width: 0; }
.apt-nome { font-size: 1.05rem; font-weight: 600; color: var(--smm-text); margin-bottom: .15rem; }
.apt-nome.vazio { color: var(--smm-muted); font-weight: 500; font-style: italic; }
.apt-meta {
    display: flex; flex-wrap: wrap; gap: .3rem 1rem;
    font-size: .82rem; color: var(--smm-muted); margin-bottom: .35rem;
}
.apt-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.apt-prof {
    font-size: .82rem; color: var(--smm-text);
    background: #f8fafc; border-radius: 6px; padding: .3rem .6rem; display: inline-block;
}
.apt-actions { display: flex; flex-direction: column; align-items: end; gap: .4rem; }

.btn-smm {
    background: var(--smm-primary); color: white; border: none;
    padding: .5rem 1.1rem; border-radius: 8px; font-weight: 600; font-size: .88rem;
    text-decoration: none; display: inline-block;
}
.btn-smm:hover { background: var(--smm-primary-dark); color: white; }
.btn-smm.outline { background: white; color: var(--smm-primary); border: 1px solid var(--smm-primary); }
.btn-smm.outline:hover { background: var(--smm-primary-light); color: var(--smm-primary); }

.btn-discreto {
    background: white; color: var(--smm-muted); border: 1px solid var(--smm-border);
    padding: .35rem .7rem; border-radius: 6px; font-size: .78rem; font-weight: 500;
    cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-discreto:hover { border-color: var(--smm-primary); color: var(--smm-primary); }
.btn-discreto.dropdown-toggle::after { margin-left: .35rem; }

.acoes-menu {
    min-width: 300px; padding: .3rem; border: 1px solid var(--smm-border);
    box-shadow: 0 8px 24px rgba(0,0,0,.1); border-radius: 10px;
}
.acao-form { margin: 0; }
.acao-item {
    display: flex !important; align-items: center; gap: .8rem;
    padding: .7rem .75rem; border-radius: 6px; white-space: normal;
    border: none; background: transparent; width: 100%; text-align: left;
}
.acao-item:hover, .acao-item:focus { background: #f1f5f9; }
.acao-icone {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%; font-size: 1.05rem; font-weight: 700; flex-shrink: 0;
}
.acao-texto { display: flex; flex-direction: column; line-height: 1.25; }
.acao-texto strong { font-size: .92rem; color: var(--smm-text); }
.acao-texto small { font-size: .74rem; color: var(--smm-muted); margin-top: 2px; }
.acao-presente .acao-icone { background: #dcfce7; color: #16a34a; }
.acao-falta .acao-icone { background: #fef3c7; color: #d97706; }
.acao-remover .acao-icone { background: #fee2e2; color: #dc2626; }
.acao-neutro .acao-icone { background: #e0f2fe; color: #0284c7; }
.acao-ficha .acao-icone { background: var(--smm-primary-light); color: var(--smm-primary); }

.status-final {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .8rem; border-radius: 8px; font-weight: 600; font-size: .85rem;
}
.status-final.presente { background: #dcfce7; color: #16a34a; }
.status-final.falta { background: #fee2e2; color: #dc2626; }
.status-final.livre { background: #f0fdf4; color: #16a34a; }
.status-final.intervalo { background: #f1f5f9; color: #475569; }
.status-final .icone-status {
    width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.6);
    display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
}

/* ==================================================
   CARTÕES / PAINÉIS GENÉRICOS
   ================================================== */
.smm-card {
    background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 1rem; overflow: hidden;
}
.smm-card > .head {
    padding: .95rem 1.25rem; border-bottom: 1px solid var(--smm-border);
    font-weight: 600; color: var(--smm-text);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.smm-card > .body { padding: 1.25rem; }
.smm-page-title { font-size: 1.35rem; font-weight: 700; color: var(--smm-text); margin: 0; }
.smm-card.card-destaque { border: 1.5px solid var(--smm-primary); }
.smm-page-sub { color: var(--smm-muted); font-size: .88rem; }

.empty-state { background: white; border-radius: 12px; padding: 3rem 2rem; text-align: center; color: var(--smm-muted); }
.empty-state .icone-empty { font-size: 3rem; margin-bottom: 1rem; opacity: .3; }

/* ==================================================
   GRADE DE HORÁRIOS (agendar / gestão)
   ================================================== */
.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.slot-btn {
    border: 1.5px solid var(--smm-border); border-radius: 10px; padding: .7rem .5rem;
    background: white; text-align: center; cursor: pointer; transition: all .1s;
    display: flex; flex-direction: column; gap: .2rem; align-items: center; text-decoration: none;
}
.slot-btn .h { font-weight: 700; font-size: 1.05rem; color: var(--smm-text); }
.slot-btn .t { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--smm-muted); }
.slot-btn:hover:not(.ocupado):not(.intervalo) { border-color: var(--smm-primary); background: var(--smm-primary-light); }
.slot-btn.selecionado { border-color: var(--smm-primary); background: var(--smm-primary); }
.slot-btn.selecionado .h, .slot-btn.selecionado .t { color: #fff; }
.slot-btn.ocupado { background: #fff7ed; border-color: #fed7aa; cursor: default; }
.slot-btn.ocupado .t { color: #b45309; }
.slot-btn.intervalo { background: #f8fafc; border-color: var(--smm-border); cursor: default; opacity: .7; }

.slot-item {
    border: 1.5px solid var(--smm-border); border-radius: 10px; padding: .75rem;
    display: flex; align-items: center; gap: .65rem; background: white; transition: all .1s;
}
.slot-item:hover { border-color: #94a3b8; }
.slot-item.ocupado { background: #fffbf5; }
.slot-hora { font-weight: 700; font-size: 1.05rem; color: var(--smm-text); min-width: 55px; }
.slot-info { flex: 1; min-width: 0; }
.slot-tag {
    display: inline-block; font-size: .68rem; font-weight: 600;
    padding: .1rem .45rem; border-radius: 10px; text-transform: uppercase; letter-spacing: .02em;
}
.slot-tag.livre { background: #dcfce7; color: #16a34a; }
.slot-tag.ocupado { background: #fef3c7; color: #92400e; }
.slot-tag.intervalo { background: #f1f5f9; color: #475569; }
.slot-nome { font-size: .78rem; color: var(--smm-text); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==================================================
   TABELAS
   ================================================== */
.smm-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.smm-table thead th {
    text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--smm-muted); font-weight: 700; padding: .65rem .75rem; border-bottom: 1px solid var(--smm-border);
}
.smm-table tbody td { padding: .7rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.smm-table tbody tr:hover { background: #fafbfc; }

/* ==================================================
   FICHA
   ================================================== */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fitem { padding: 12px 14px; border: 1px solid var(--smm-border); border-radius: 10px; background: #fbfdff; }
.fitem.full { grid-column: 1/-1; }
.fitem strong { display: block; margin-bottom: 6px; color: var(--smm-primary); border-bottom: 1px solid #eef3f7; padding-bottom: 4px; }
.ftext { white-space: pre-wrap; word-break: break-word; color: #333; line-height: 1.55; }
.fsub { color: var(--smm-primary); font-weight: 700; margin: 18px 0 6px; }

/* ==================================================
   LINHA DO TEMPO (histórico)
   ================================================== */
.smm-timeline { position: relative; padding-left: 1.25rem; }
.smm-timeline::before {
    content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--smm-border);
}
.tl-item { position: relative; padding: .5rem 0 .9rem .75rem; }
.tl-item::before {
    content: ''; position: absolute; left: -1.25rem; top: .9rem;
    width: 12px; height: 12px; border-radius: 50%; background: #94a3b8; border: 2px solid #fff;
}
.tl-item.presente::before { background: var(--smm-ok); }
.tl-item.falta::before { background: var(--smm-danger); }
.tl-date { font-weight: 700; color: var(--smm-text); margin-right: .4rem; }

/* ==================================================
   RODAPÉ
   ================================================== */
.smm-footer {
    background: white; border-top: 1px solid var(--smm-border);
    padding: 1.5rem 0 1.25rem; margin-top: 3rem;
}
.smm-footer .inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.5rem; flex-wrap: wrap; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem;
}
.smm-footer img { height: var(--logo-footer-h); width: auto; object-fit: contain; opacity: .75; }
.smm-footer img:hover { opacity: 1; }
.smm-footer-text { font-size: .75rem; color: var(--smm-muted); margin: 0; }

/* ==================================================
   LOGIN
   ================================================== */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
    background: linear-gradient(135deg, #fbeaf4 0%, #f7f9fc 60%);
}
.login-card {
    background: white; border-radius: 16px; padding: 2.5rem 2.25rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.08); width: 100%; max-width: 420px;
}
.login-card img { height: var(--logo-login-h); display: block; margin: 0 auto 1.25rem; }
.login-card h1 { font-size: 1.25rem; font-weight: 700; text-align: center; margin-bottom: .25rem; }
.login-card .sub { text-align: center; color: var(--smm-muted); font-size: .85rem; margin-bottom: 1.75rem; }
.login-card .form-control { padding: .7rem .9rem; }

/* ==================================================
   IMPRESSÃO
   ================================================== */
.smm-print-header { display: none; }
@media print {
    .smm-navbar, .smm-footer, .no-print, .filter-chips, .day-nav { display: none !important; }
    body { background: white; }
    .smm-print-header {
        display: flex; align-items: center; gap: 1rem;
        border-bottom: 2px solid #000; padding-bottom: .5rem; margin-bottom: 1rem;
    }
    .smm-print-header img { height: 46px; }
    .smm-card, .apt-card { box-shadow: none !important; border: 1px solid #ccc; }
}

/* ==================================================
   RESPONSIVO
   ================================================== */
@media (max-width: 992px) {
    .smm-navbar-container { flex-wrap: wrap; gap: .75rem; }
    .smm-nav-brand-text { display: none; }
    .smm-nav-menu { order: 3; width: 100%; justify-content: flex-start; }
}
@media (max-width: 768px) {
    .apt-card { grid-template-columns: 74px 1fr; grid-template-areas: "hora info" "acoes acoes"; gap: 1rem; }
    .apt-hora { grid-area: hora; }
    .apt-info { grid-area: info; }
    .apt-actions { grid-area: acoes; flex-direction: row; justify-content: flex-end; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .fgrid { grid-template-columns: 1fr; }
}
