/* ============================================================
   Quanthum · Central de Serviços — Layout Gentelella-like
   ============================================================ */

:root {
    --sidebar-w: 230px;
    --sidebar-collapsed-w: 70px;
    --topbar-h: 57px;
    --bg: #1a2332;
    --bg-body: #141b27;
    --sidebar-bg: #2a3f54;
    --sidebar-hover: #1b2e3f;
    --sidebar-active: #172a3a;
    --topbar-bg: #ededed;
    --topbar-text: #5a5a5a;
    --surface: #2a3f54;
    --surface-2: #243447;
    --border: #355068;
    --border-light: #ddd;
    --text: #e8ecf6;
    --text-dark: #73879C;
    --muted: #8a95b2;
    --primary: #1abb9c;
    --primary-dark: #169f85;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --success: #26B99A;
    --warning: #f0ad4e;
    --info: #3498db;
    --radius: 4px;
    --radius-sm: 3px;
    --shadow: 0 2px 4px rgba(0,0,0,.2);
    --font: 'Inter', 'Helvetica Neue', Roboto, Arial, sans-serif;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f0f3f6;
    --bg-body: #e9ecef;
    --sidebar-bg: #2a3f54;
    --sidebar-hover: #1b2e3f;
    --sidebar-active: #172a3a;
    --topbar-bg: #ffffff;
    --topbar-text: #5a5a5a;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --border: #d9dee4;
    --border-light: #e0e4e8;
    --text: #2a3f54;
    --text-dark: #73879C;
    --muted: #7b8a9e;
}
[data-theme="light"] code {
    background: rgba(0,0,0,.07);
    color: #476582;
}
[data-theme="light"] .panel,
[data-theme="light"] .profile-card {
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="light"] .form input[type=text],
[data-theme="light"] .form input[type=email],
[data-theme="light"] .form input[type=password],
[data-theme="light"] .form input[type=tel],
[data-theme="light"] .form input[type=url],
[data-theme="light"] .form input[type=number],
[data-theme="light"] .form input[type=search],
[data-theme="light"] .form input[type=date],
[data-theme="light"] .form input[type=time],
[data-theme="light"] .form input[type=month],
[data-theme="light"] .form input[type=week],
[data-theme="light"] .form input[type=datetime-local],
[data-theme="light"] .form select,
[data-theme="light"] .form textarea {
    background: #fff;
    border-color: #d1d5db;
    color: #333;
}
[data-theme="light"] .table th {
    background: #f5f7fa;
    color: #5a5a5a;
}
[data-theme="light"] .table td {
    border-color: #e8ecf0;
    color: #333;
}
[data-theme="light"] .table tr:hover td {
    background: #f0f4f7;
}
[data-theme="light"] .stat-card {
    background: #fff;
    border-color: #d9dee4;
}
[data-theme="light"] .alert--error {
    background: #fef2f2;
    border-left-color: var(--danger);
    color: #991b1b;
}
[data-theme="light"] .alert--success {
    background: #f0fdf4;
    border-left-color: var(--success);
    color: #166534;
}
[data-theme="light"] .modal {
    background: #fff;
    border-color: #d9dee4;
}
[data-theme="light"] .modal__header {
    border-color: #e8ecf0;
    color: #333;
}
[data-theme="light"] .btn--cancel {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    display: flow-root; /* contém o margin-top do .app-body (evita margin-collapse p/ o html e scroll fantasma de 57px) */
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: rgba(0,0,0,.25);
    padding: 2px 6px; border-radius: 3px;
    font-size: .92em; color: #b8c7db;
}

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .25s ease;

    /* Barra de rolagem: reservada sempre (sem reflow), mas transparente até o hover. */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-button { display: none; height: 0; }
/* Sem transition: o Chrome não anima pseudo-elementos de scrollbar e a
   troca de cor pode ficar sem repaint até a próxima interação. */
.sidebar::-webkit-scrollbar-thumb {
    background-color: transparent;
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 4px;
}
.sidebar:hover { scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar:hover::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.22); }
.sidebar:hover::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }

/* Collapsed sidebar */
.sidebar--collapsed, html.sidebar-is-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
.sidebar--collapsed .sidebar__profile, html.sidebar-is-collapsed .sidebar__profile { padding: 16px 8px 12px; }
.sidebar--collapsed .sidebar__name, html.sidebar-is-collapsed .sidebar__name,
.sidebar--collapsed .sidebar__role, html.sidebar-is-collapsed .sidebar__role { display: none; }
.sidebar--collapsed .sidebar__heading, html.sidebar-is-collapsed .sidebar__heading { display: none; }
.sidebar--collapsed .sidebar__link, html.sidebar-is-collapsed .sidebar__link {
    justify-content: center; padding: 11px 0; gap: 0; border-left-width: 0;
}
.sidebar--collapsed .sidebar__link span, html.sidebar-is-collapsed .sidebar__link span,
.sidebar--collapsed .sidebar__link-text, html.sidebar-is-collapsed .sidebar__link-text { display: none; }
.sidebar--collapsed .sidebar__link svg, html.sidebar-is-collapsed .sidebar__link svg { width: 22px; height: 22px; }
.sidebar--collapsed .sidebar__footer, html.sidebar-is-collapsed .sidebar__footer { justify-content: center; padding: 14px 8px; }
.sidebar--collapsed .sidebar__footer span, html.sidebar-is-collapsed .sidebar__footer span { display: none; }
.sidebar--collapsed .sidebar__footer-link svg, html.sidebar-is-collapsed .sidebar__footer-link svg { width: 20px; height: 20px; }
.sidebar--collapsed + .topbar,
html.sidebar-is-collapsed .topbar { left: var(--sidebar-collapsed-w); }
.sidebar--collapsed ~ .app-body,
html.sidebar-is-collapsed .app-body { margin-left: var(--sidebar-collapsed-w); }
html.sidebar-is-collapsed .sidebar,
html.sidebar-is-collapsed .topbar,
html.sidebar-is-collapsed .app-body { transition: none; }

/* Profile */
.sidebar__profile {
    padding: 16px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: center;
}
.sidebar__avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    font-size: 22px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--primary), #169f85);
    border: 2px solid rgba(255,255,255,.2);
    margin-bottom: 8px;
}
.sidebar__avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
/* Com imagem: sem gradiente verde para não "piscar" enquanto o base64 decodifica no reload */
.sidebar__avatar--has-img { background: transparent; border-color: rgba(255,255,255,.2); }
.sidebar__name { font-size: 14px; font-weight: 600; color: #fff; display: block; }
.sidebar__role { font-size: 11px; color: rgba(255,255,255,.5); display: block; margin-top: 2px; }

/* Nav */
.sidebar__nav { flex: 1; padding: 12px 0; }
.sidebar__heading {
    padding: 10px 18px 6px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .8px;
    color: rgba(255,255,255,.35);
}
.sidebar__link {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 18px;
    color: rgba(255,255,255,.75);
    font-size: 13px; font-weight: 500;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar__link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar__link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
}
.sidebar__link svg {
    width: 18px; height: 18px; flex-shrink: 0;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar__badge {
    margin-left: auto;
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 10px;
    background: var(--primary); color: #fff;
}

/* Footer */
.sidebar__footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px; color: rgba(255,255,255,.35);
    display: flex; align-items: center;
    position: relative;
}
.sidebar__footer span {
    flex: 1; text-align: center;
}
.sidebar__footer-link {
    color: rgba(255,255,255,.4);
    transition: color .2s;
    display: flex; align-items: center;
}
.sidebar__footer-link:hover { color: rgba(255,255,255,.85); }

/* ════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════ */
.sidebar-toggle {
    width: 36px; height: 36px; display: grid; place-items: center;
    border: none; background: none; cursor: pointer; border-radius: var(--radius);
    color: var(--topbar-text); transition: background .15s;
}
.sidebar-toggle:hover { background: rgba(0,0,0,.08); }
.sidebar-toggle svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    transition: left .25s ease;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 90;
}
.topbar__left {
    display: flex; align-items: center; gap: 14px;
}
.topbar__logo-link { display: flex; align-items: center; }
.topbar__logo { height: 30px; width: auto; }
.topbar__env {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    padding: 4px 10px; border-radius: 3px;
}
.topbar__env--hml { background: #f0ad4e; color: #fff; }
.topbar__env--prd { background: var(--success); color: #fff; }
.topbar__title {
    font-size: 15px; font-weight: 500; color: var(--topbar-text);
}
.topbar__right {
    display: flex; align-items: center; gap: 6px;
}
.topbar__icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: none; background: none;
    color: var(--topbar-text); font-size: 16px;
    cursor: pointer; border-radius: 50%;
    transition: background .15s;
    position: relative;
}
.topbar__icon-btn:hover { background: rgba(0,0,0,.08); }
.topbar__icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar__dot {
    position: absolute; top: 5px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--danger);
}

/* Theme toggle */
.theme-toggle {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 2px solid transparent;
    background: transparent;
    color: var(--topbar-text);
    cursor: pointer;
    border-radius: 8px;
    transition: border-color .2s, background .2s, color .2s;
}
.theme-toggle:hover {
    border-color: var(--primary);
    background: rgba(26,187,156,.1);
    color: var(--primary);
}
[data-theme="dark"] .theme-toggle__icon--sun { display: block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
[data-theme="light"] .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: block; }

/* Notification bell */
.notif-bell { position: relative; }
.notif-bell__btn {
    width: 36px; height: 36px; display: grid; place-items: center;
    border: 2px solid transparent; background: none; cursor: pointer; border-radius: 50%;
    color: var(--topbar-text); transition: background .15s, border-color .15s;
    position: relative;
}
.notif-bell__btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-bell__badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* Notification dropdown */
.notif-dropdown {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    width: 380px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
    z-index: 200; overflow: hidden;
}
.notif-bell.open .notif-dropdown { display: block; }
.notif-dropdown__header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notif-dropdown__title { font-size: 15px; font-weight: 700; color: var(--text); }
.notif-dropdown__count {
    font-size: 12px; font-weight: 600; color: var(--primary);
}
.notif-dropdown__mark-all {
    margin-left: auto; background: none; border: 1px solid var(--primary);
    color: var(--primary); font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: var(--radius); cursor: pointer;
    transition: background .15s, color .15s;
}
.notif-dropdown__mark-all:hover { background: var(--primary); color: #fff; }
.notif-dropdown__list { max-height: 360px; overflow-y: auto; }
.notif-dropdown__item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-dropdown__item:last-child { border-bottom: none; }
.notif-dropdown__item:hover { background: var(--surface-2); }
.notif-dropdown__item--unread { background: rgba(26,187,156,.04); }
.notif-dropdown__item-dot {
    width: 8px; flex-shrink: 0; padding-top: 6px;
}
.notif-dropdown__item-dot span {
    display: block; width: 8px; height: 8px;
    border-radius: 50%; background: var(--primary);
}
.notif-dropdown__item-icon { flex-shrink: 0; padding-top: 2px; }
.notif-icon {
    width: 22px; height: 22px; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; fill: none;
}
.notif-icon--info   { stroke: var(--info); }
.notif-icon--success { stroke: var(--success); }
.notif-icon--warning { stroke: var(--warning); }
.notif-icon--danger  { stroke: var(--danger); }
.notif-dropdown__item-body { flex: 1; min-width: 0; }
.notif-dropdown__item-body strong { font-size: 13px; color: var(--text); display: block; }
.notif-dropdown__item-body p { font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; }
.notif-dropdown__item-time {
    flex-shrink: 0; font-size: 11px; color: var(--muted); padding-top: 2px; white-space: nowrap;
}
.notif-dropdown__footer {
    padding: 10px 16px; text-align: center;
    border-top: 1px solid var(--border);
}
.notif-dropdown__footer a {
    color: var(--primary); font-size: 13px; text-decoration: none; font-weight: 500;
}
.notif-dropdown__footer a:hover { text-decoration: underline; }

/* Full notification list page */
.notif-full-list { }
.notif-full-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-full-item:last-child { border-bottom: none; }
.notif-full-item:hover { background: var(--surface-2); }
.notif-full-item--unread { background: rgba(26,187,156,.04); }
.notif-full-item__icon { flex-shrink: 0; padding-top: 2px; }
.notif-full-item__body { flex: 1; min-width: 0; }
.notif-full-item__body strong { font-size: 14px; color: var(--text); display: block; }
.notif-full-item__body p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.notif-full-item__meta {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.notif-full-item__time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* User dropdown */
.user-menu { position: relative; }
.user-menu__trigger {
    width: 34px; height: 34px;
    border-radius: 50%; border: none;
    display: grid; place-items: center;
    font-size: 14px; font-weight: 700; color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: box-shadow .15s;
}
.user-menu__trigger:hover { box-shadow: 0 0 0 3px rgba(26,187,156,.3); }
/* Com avatar: sem fundo verde para não "piscar" enquanto a imagem base64 decodifica no reload */
.user-menu__trigger--has-avatar { background: transparent; }
.user-menu__avatar {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.user-menu__dropdown {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 200px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
    overflow: hidden;
    z-index: 200;
}
.user-menu.open .user-menu__dropdown { display: block; }
.user-menu__item {
    display: block;
    padding: 11px 16px;
    font-size: 13px; color: rgba(255,255,255,.8);
    transition: background .15s;
    border: none; background: none;
    width: 100%; text-align: left;
    font-family: inherit; cursor: pointer;
}
.user-menu__item:hover { background: var(--sidebar-hover); color: #fff; }
.user-menu__item--sep { border-top: 1px solid rgba(255,255,255,.1); }
.user-menu__item--danger { color: var(--danger); }
.user-menu__item--danger:hover { background: rgba(231,76,60,.15); }

/* ════════════════════════════════════════
   CAMPO DE SENHA (exibir/ocultar)
   ════════════════════════════════════════ */
/* Uso: .input-password envolvendo o <input type="password"> + um
   <button class="input-password__toggle" data-password-toggle="idDoInput">.
   O handler é delegado no layout.php — não precisa de JS por página. */
.input-password { position: relative; width: 100%; }
.input-password > input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.input-password__toggle {
    position: absolute; right: 1px; top: 1px; bottom: 1px; width: 42px;
    background: transparent; border: none; cursor: pointer;
    color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    transition: color .15s;
}
.input-password__toggle:hover { color: var(--text); }
.input-password__toggle svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════ */
.app-body {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
    display: flex; flex-direction: column;
    transition: margin-left .25s ease;
}
.main { flex: 1; padding: 24px 24px 40px; }

/* Page header */
.page-header {
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.page-header p { color: var(--muted); margin: 0; font-size: 13px; }

/* ════════════════════════════════════════
   MODAL (Sign out confirmation)
   ════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 500;
    place-items: center;
}
.modal-overlay.open { display: grid; }
.modal {
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 420px; max-width: 92vw;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    overflow: hidden;
}
/* Modal largo (formulários com seletor lateral). O conteúdo cabe sem rolagem;
   o max-height é só uma salvaguarda para telas muito baixas. */
.modal--wide { width: 1060px; max-width: 94vw; }
.modal--wide .modal__body { max-height: 76vh; overflow-y: auto; }
.modal--wide .modal__body::-webkit-scrollbar { width: 6px; }
.modal--wide .modal__body::-webkit-scrollbar-track { background: transparent; }
.modal--wide .modal__body::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); border-radius: 3px; }
.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal__header h3 { font-size: 16px; margin: 0; }
.modal__close {
    width: 28px; height: 28px; display: grid; place-items: center;
    background: none; border: none; color: var(--muted);
    font-size: 20px; cursor: pointer; border-radius: 4px;
}
.modal__close:hover { background: rgba(255,255,255,.1); color: #fff; }
.modal__body { padding: 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal__footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ════════════════════════════════════════
   GRID DE SERVIÇOS (Home)
   ════════════════════════════════════════ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}
.card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:not(.card--disabled):hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(26,187,156,.2);
}
.card--disabled { opacity: .5; }
.card__icon {
    width: 48px; height: 48px;
    display: grid; place-items: center;
    border-radius: 8px;
    margin-bottom: 14px;
    background: rgba(26,187,156,.15);
    color: var(--primary);
}
.card__icon svg { width: 24px; height: 24px; }
.card__icon--audit { background: rgba(52,152,219,.15); color: var(--info); }
.card__icon--database { background: rgba(155,89,182,.15); color: #9b59b6; }
.card__icon--soon { background: rgba(138,149,178,.12); color: var(--muted); }
.card__tag {
    display: inline-block;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--primary); background: rgba(26,187,156,.1);
    padding: 3px 8px; border-radius: 3px;
    margin-bottom: 8px;
}
.card__title { margin: 0 0 6px; font-size: 16px; }
.card__desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: break-word; word-break: break-all; }
.card__desc code { word-break: break-all; }
.card__cta { margin-top: 14px; font-weight: 600; color: var(--primary); font-size: 13px; }
.card__cta--muted { color: var(--muted); }

/* ════════════════════════════════════════
   PANELS
   ════════════════════════════════════════ */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.panel--narrow { max-width: 540px; margin: 0 auto; }
.panel.center { text-align: center; }
.panel__head { margin-bottom: 18px; }
.panel__head h2 { margin: 0 0 4px; font-size: 18px; }
.panel__head p { margin: 0; color: var(--muted); font-size: 13px; }
.panel__head--row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }

/* ════════════════════════════════════════
   BREADCRUMB
   ════════════════════════════════════════ */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    color: var(--muted); font-size: 13px; margin-bottom: 18px;
}
.breadcrumb a { color: var(--muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb strong { color: var(--text); font-weight: 600; }
.breadcrumb span { opacity: .4; }

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.form__row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { font-size: 12px; font-weight: 600; color: #99afc0; text-transform: uppercase; letter-spacing: .3px; }
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=tel],
.form input[type=url],
.form input[type=number],
.form input[type=search],
.form input[type=date],
.form input[type=time],
.form input[type=month],
.form input[type=week],
.form input[type=datetime-local],
.form select,
.form textarea {
    background: rgba(0,0,0,.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-size: 13px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    width: 100%; box-sizing: border-box;
}
.form select { cursor: pointer; appearance: auto; }
/* Widgets nativos (calendário/relógio/setas) seguem o tema em vez do padrão do browser. */
.form input[type=number],
.form input[type=date],
.form input[type=time],
.form input[type=month],
.form input[type=week],
.form input[type=datetime-local] { color-scheme: dark; }
[data-theme="light"] .form input[type=number],
[data-theme="light"] .form input[type=date],
[data-theme="light"] .form input[type=time],
[data-theme="light"] .form input[type=month],
[data-theme="light"] .form input[type=week],
[data-theme="light"] .form input[type=datetime-local] { color-scheme: light; }
.form select option { background: var(--surface); color: var(--text); }
.form textarea { resize: vertical; min-height: 60px; }
.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,187,156,.18);
}
.form small { color: var(--muted); font-size: 11px; }
.checkbox {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--muted); margin: 4px 0 18px;
    cursor: pointer; font-weight: 500;
}
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); }
.form__actions { display: flex; gap: 10px; }

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: background .15s, border-color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-dark); }
.btn--danger-outline { background: transparent; border-color: rgba(231,76,60,.4); color: var(--danger); }
.btn--danger-outline:hover { background: var(--danger); color: #fff; }
.btn--cancel { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--border); }
.btn--cancel:hover { background: rgba(255,255,255,.14); }
.btn--block { width: 100%; }
.btn--outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }

/* Badge */
.btn--disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge--success { background: rgba(38,166,91,.15); color: #26a65b; }
.badge--danger { background: rgba(231,76,60,.15); color: #e74c3c; }
.badge--info { background: rgba(52,152,219,.15); color: #3498db; }
.badge--warning { background: rgba(240,173,78,.15); color: #d68910; }

/* ════════════════════════════════════════
   TABLE
   ════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    text-align: left;
    color: var(--muted); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .4px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}
.table tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(53,80,104,.5); }
.table tbody tr:hover { background: rgba(26,187,156,.04); }
.table .num { text-align: right; white-space: nowrap; }
.table .actions-col { text-align: right; white-space: nowrap; }
.row-link { color: var(--text); font-weight: 500; transition: color .15s; }
.row-link:hover { color: var(--primary); }
.ic { display: inline-block; width: 16px; opacity: .7; margin-right: 3px; }
.ic--folder { color: #f0ad4e; }
.ic--file { color: var(--muted); }
.ic--up { color: var(--primary); }
.inline { display: inline; margin-left: 5px; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.muted { color: var(--muted); }

/* ════════════════════════════════════════
   BULK SELECT (S3)
   ════════════════════════════════════════ */
.check-col { width: 34px; text-align: center; padding-right: 0 !important; }
.check-col input[type=checkbox], .row-check {
    width: 15px; height: 15px; accent-color: var(--primary);
    cursor: pointer; vertical-align: middle;
}
.bulk-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 12px; padding: 10px 14px;
    background: rgba(26,187,156,.1);
    border: 1px solid rgba(26,187,156,.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.bulk-bar__count strong { color: var(--primary); }
.bulk-bar [type=submit] { margin-left: auto; }

/* ════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 18px;
    font-size: 13px; border-left: 4px solid;
}
.alert ul { margin: 0; padding-left: 16px; }
.alert--error { background: rgba(231,76,60,.12); border-color: var(--danger); color: #f1a9a0; }
.alert--success { background: rgba(38,185,154,.12); border-color: var(--success); color: #a3d9cc; }
.alert--info { background: rgba(52,152,219,.12); border-color: var(--info); color: #93c6e8; }

/* ════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════ */
.footer {
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    color: var(--muted);
    font-size: 12px;
    display: flex; justify-content: space-between;
}

/* ════════════════════════════════════════
   AUDIT: stat cards
   ════════════════════════════════════════ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px; text-align: center;
}
.stat-card__value { display: block; font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-card__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; }
.stat-card--success .stat-card__value { color: var(--success); }
.stat-card--danger  .stat-card__value { color: var(--danger); }
.stat-card--warning .stat-card__value { color: var(--warning); }

/* ════════════════════════════════════════
   AUDIT: summary bars
   ════════════════════════════════════════ */
.summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.summary-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.summary-block h4 { margin: 0 0 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.summary-bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.bar-track { flex: 1; height: 6px; background: rgba(0,0,0,.3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 3px; min-width: 3px; }
.bar-value { width: 30px; text-align: right; font-weight: 600; color: var(--muted); font-size: 11px; }

/* ════════════════════════════════════════
   AUDIT: filters
   ════════════════════════════════════════ */
.audit-filters { padding: 0; }
.af-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.af-field { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.af-field label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.af-field input, .af-field select {
    background: rgba(0,0,0,.2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    padding: 8px 10px; font-size: 12px; font-family: inherit;
}
.af-field input:focus, .af-field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,187,156,.18); }
.af-field select { cursor: pointer; color-scheme: dark; }
.af-field--btn { flex-direction: row; gap: 6px; align-items: flex-end; }

/* ════════════════════════════════════════
   AUDIT: event table
   ════════════════════════════════════════ */
.audit-table { font-size: 12px; }
.audit-table th { font-size: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.outcome-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px;
    padding: 2px 8px; border-radius: 3px;
}
.outcome-badge--success { background: rgba(38,185,154,.2); color: var(--success); }
.outcome-badge--failure { background: rgba(231,76,60,.2); color: var(--danger); }
.sev-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    margin-right: 4px; vertical-align: middle;
}
.event-label { font-weight: 500; }
.detail-reason {
    max-width: 160px; display: inline-block; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
    color: var(--muted); cursor: default;
}
.row--failure { background: rgba(231,76,60,.04); }
.row--failure:hover { background: rgba(231,76,60,.08) !important; }

/* ════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════ */
body.login-page {
    background: #f7f7f7;
    display: grid; place-items: center;
    min-height: 100vh;
}
.login-wrap {
    width: 100%; max-width: 430px;
    padding: 0 20px;
}
.login-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    overflow: hidden;
}
.login-card__top {
    background: var(--sidebar-bg);
    padding: 30px 32px 24px;
    text-align: center;
    color: #fff;
}
.login-card__logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 16px;
}
.login-card__top h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.login-card__top p { margin: 0; font-size: 13px; color: rgba(255,255,255,.6); }
.login-card__body { padding: 28px 32px 32px; }
.login-card__body .form__row label { color: #888; }
.login-card__body .form input {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 3px;
}
.login-card__body .form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,187,156,.15);
}
.login-card__body .btn--primary {
    margin-top: 6px;
    padding: 12px;
    font-size: 15px;
}
.login-card__footer {
    text-align: center; padding: 14px;
    border-top: 1px solid #eee;
    font-size: 12px; color: #aaa;
}
.login-card__footer strong { color: var(--warning); }

/* ════════════════════════════════════════
   PROFILE PAGE
   ════════════════════════════════════════ */

/* Row layout */
.profile-row {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}
.profile-row--bottom {
    grid-template-columns: 1fr 1fr;
}
.profile-col-left, .profile-col-right, .profile-col-half { display: flex; }
.profile-col-left > *, .profile-col-right > *, .profile-col-half > * { flex: 1; }

/* Left card */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 24px;
    text-align: center;
}
.profile-card__avatar-wrap {
    width: 110px; height: 110px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border);
}
.profile-card__avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.profile-card__avatar-placeholder {
    width: 100%; height: 100%;
    background: var(--primary);
    color: #fff;
    font-size: 44px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.profile-card__name {
    font-size: 17px; font-weight: 600;
    color: var(--text); margin: 0 0 4px;
}
.profile-card__email {
    font-size: 13px; color: var(--muted); margin: 0 0 16px;
}
.profile-card__actions { margin-bottom: 0; }
.profile-card__divider {
    border: none; border-top: 1px solid var(--border);
    margin: 22px 0;
}
.toggle-switch {
    position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch__slider {
    position: absolute; inset: 0; background: var(--border, #4b5563); border-radius: 24px; transition: background .2s;
}
.toggle-switch__slider::before {
    content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-switch__slider { background: var(--success, #22c55e); }
.toggle-switch input:checked + .toggle-switch__slider::before { transform: translateX(20px); }
.profile-card__section-title {
    font-size: 14px; font-weight: 600;
    color: var(--text); margin: 0 0 14px;
    text-align: left;
}
.profile-card__password-form .form__row { text-align: left; }
.profile-card__password-form .form__row label { font-size: 12px; }
.profile-card__password-form .form__row input { font-size: 13px; }

/* Form Grid (2-col) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

/* Notification list */
.notification-list { display: flex; flex-direction: column; }
.notification-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.notification-item:last-child { border-bottom: none; }
.notification-item__info { flex: 1; }
.notification-item__info strong { font-size: 14px; color: var(--text); display: block; margin-bottom: 2px; }
.notification-item__info p { font-size: 12px; color: var(--muted); margin: 0; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute; inset: 0;
    background: #4a5568; border-radius: 24px;
    cursor: pointer; transition: background .3s;
}
.toggle__slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: transform .3s;
}
.toggle input:checked + .toggle__slider { background: var(--primary); }
.toggle input:checked + .toggle__slider::before { transform: translateX(20px); }
.toggle input:disabled + .toggle__slider { opacity: .5; cursor: not-allowed; }

/* Sessions table */
.table--sessions { font-size: 13px; }
.table--sessions th { font-size: 10px; letter-spacing: .5px; }
.table--sessions td { vertical-align: middle; }

/* ════════════════════════════════════════
   AGENDA — abas, grade semanal e horários
   ════════════════════════════════════════ */
.ag-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.ag-tab {
    padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
    display: flex; align-items: center; gap: 6px;
}
.ag-tab:hover { color: var(--text); }
.ag-tab--active { color: var(--primary); border-bottom-color: var(--primary); }

.ag-day {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.ag-day:last-of-type { border-bottom: none; }
.ag-day__label { width: 90px; font-size: 13px; font-weight: 600; color: var(--text); flex-shrink: 0; }
.ag-day__ranges { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.ag-range { display: flex; align-items: center; gap: 6px; }
.ag-range input[type=time] {
    /* Mais compacto que o padrão do .form, e lado a lado em vez de 100% da linha. */
    width: auto; padding: 6px 8px; font-size: 13px;
}
.ag-range__remove {
    background: none; border: none; color: var(--danger); font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 4px;
}

/* Modal "Marcar reunião": calendário | horários | dados, lado a lado,
   para o conteúdo caber sem rolagem vertical no modal. */
.mk-picker {
    display: grid;
    grid-template-columns: 236px minmax(168px, .8fr) minmax(250px, 1.15fr);
    gap: 22px; align-items: start;
}
.mk-dados { min-width: 0; }
.mk-dados .pub-chosen { margin-bottom: 14px; padding: 8px 12px; font-size: 13px; }
.mk-picker .pub-month { width: 236px; }
.mk-picker .pub-month__day { line-height: 30px; height: 30px; border: none; background: none; font-family: inherit; cursor: default; }
.mk-picker button.pub-month__day { cursor: pointer; }
.mk-horarios { flex: 1; min-width: 200px; }
.mk-horarios__head {
    font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 12px;
}
.mk-horarios__list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px; max-height: 268px; overflow-y: auto; padding-right: 4px;
}
.mk-horarios__list::-webkit-scrollbar { width: 6px; }
.mk-horarios__list::-webkit-scrollbar-track { background: transparent; }
.mk-horarios__list::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); border-radius: 3px; }

/* Campo somente-leitura que exibe o link público da agenda.
   Cresce com o espaço disponível para caber endereços longos. */
.link-field {
    flex: 1; min-width: 0; width: 100%;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius); padding: 7px 10px;
    font-size: 12px; font-family: inherit; text-overflow: ellipsis;
}
.link-field:focus { outline: none; border-color: var(--primary); }

.ag-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ag-month {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2); font-size: 13px; color: var(--text);
    transition: border-color .15s, background .15s;
}
.ag-month:hover { border-color: var(--primary); }
.ag-month input { width: 16px; height: 16px; accent-color: var(--primary); }
.ag-month:has(input:checked) { border-color: var(--primary); background: rgba(26,187,156,.12); }
.ag-month small { margin-left: auto; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.ag-month--past { opacity: .6; }

.ag-request {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.ag-request:last-child { border-bottom: none; }
.ag-request__when {
    width: 62px; flex-shrink: 0; text-align: center; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0;
}
.ag-request__when strong { display: block; font-size: 15px; color: var(--text); }
.ag-request__when span { display: block; font-size: 12px; color: var(--muted); }
.ag-request__body { flex: 1; min-width: 180px; }
.ag-request__body p { margin: 2px 0 0; font-size: 12px; }
.ag-request__actions { display: flex; gap: 6px; }

/* Grade de 7 dias (padrão do painel público e do calendário interno) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; flex: 1; min-width: 0; }
.cal-col { min-width: 0; }
.cal-col__head { text-align: center; padding-bottom: 10px; }
.cal-col__dow { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cal-col__day { display: block; font-size: 20px; font-weight: 500; color: var(--text); margin-top: 2px; }
.cal-col__head--today .cal-col__day {
    background: var(--primary); color: #fff; border-radius: 999px;
    width: 34px; height: 34px; line-height: 34px; margin: 2px auto 0;
}
.cal-col__slots { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.cal-slot {
    display: block; width: 100%; padding: 9px 4px; border-radius: 999px; text-align: center;
    border: 1px solid var(--border); background: transparent; color: var(--primary);
    font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.cal-slot:hover { border-color: var(--primary); background: rgba(26,187,156,.12); }
.cal-slot--static { cursor: default; color: var(--text); }
.cal-slot--static:hover { border-color: var(--border); background: transparent; }
/* Horário escolhido no modal "Marcar reunião". */
.cal-slot--sel { border-color: var(--primary); background: var(--primary); color: #fff; }
.cal-slot--sel:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.cal-empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ════════════════════════════════════════
   AGENDA — páginas públicas (sem login)
   ════════════════════════════════════════ */
.pub-body { background: var(--bg-body); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
.pub-topbar {
    background: var(--topbar-bg); color: var(--topbar-text); height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; box-shadow: var(--shadow);
}
.pub-topbar__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pub-topbar__logo { height: 30px; width: auto; flex-shrink: 0; }
.pub-topbar__title {
    font-size: 15px; font-weight: 600; color: var(--topbar-text);
    padding-left: 14px; border-left: 1px solid rgba(0,0,0,.12);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* O padding inferior reserva espaço para a barra de seleção fixa. */
.pub-main { flex: 1; padding: 24px 16px 96px; }
.pub-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 16px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
}
.pub-footer a { color: var(--primary); }
.pub-footer a:hover { text-decoration: underline; }

.pub-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; max-width: 1180px; margin: 0 auto 16px; box-shadow: var(--shadow);
}
.pub-card--narrow { max-width: 520px; margin-top: 40px; }
.pub-card__head { display: flex; gap: 28px; flex-wrap: wrap; }
.pub-card__owner { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.pub-card__owner strong { display: block; font-size: 15px; color: var(--text); }
.pub-card__owner span { display: block; font-size: 12px; color: var(--muted); }
.pub-card__avatar {
    width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.pub-card__info { flex: 1; min-width: 240px; }
.pub-card__manage {
    align-self: flex-start; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.pub-card__manage svg { stroke: currentColor; }
.pub-card__info h1 { font-size: 20px; font-weight: 600; margin: 0 0 10px; }
.pub-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.pub-meta svg { flex-shrink: 0; stroke: var(--muted); }
.pub-meta--warn { color: var(--warning); }
.pub-meta--warn svg { stroke: var(--warning); }
.pub-desc { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }

.pub-picker__head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 18px;
}
.pub-picker__head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.pub-picker__head .muted { font-size: 12px; }
.pub-picker { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }

.pub-month { width: 260px; flex-shrink: 0; }
.pub-month__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; }
.pub-month__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.pub-month__dow { font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.pub-month__day {
    display: block; line-height: 30px; height: 30px; border-radius: 50%;
    font-size: 13px; color: var(--muted);
}
.pub-month__day--free { color: var(--primary); background: rgba(26,187,156,.12); font-weight: 600; }
.pub-month__day--free:hover { background: rgba(26,187,156,.28); }
.pub-month__day--active { background: var(--primary); color: #fff; }
.pub-month__day--off { text-decoration: line-through; opacity: .45; }

.pub-week { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 300px; }
.pub-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; color: var(--muted); font-size: 18px;
    /* Serve tanto para <a> (painel público) quanto para <button> (modal interno). */
    background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.pub-nav:hover { background: var(--surface-2); color: var(--primary); }
.pub-nav--side { margin-top: 18px; flex-shrink: 0; }

.pub-chosen {
    background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: var(--radius);
    padding: 10px 14px; margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--text);
    display: flex; flex-wrap: wrap; gap: 6px 14px;
}

/* Barra fixa com os horários já escolhidos (seleção múltipla). */
.pub-selecao {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(0,0,0,.25);
    transform: translateY(110%); transition: transform .2s ease;
}
.pub-selecao--visivel { transform: translateY(0); }
.pub-selecao__inner {
    max-width: 1180px; margin: 0 auto; padding: 12px 24px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.pub-selecao__lista {
    flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; font-size: 13px; color: var(--text); max-height: 84px; overflow-y: auto;
}
.pub-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(26,187,156,.14); border: 1px solid var(--primary); color: var(--primary);
    border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 600;
}
.pub-chip button {
    background: none; border: none; color: inherit; cursor: pointer;
    font-size: 15px; line-height: 1; padding: 0 4px;
}
.pub-chip button:hover { color: var(--danger); }
.pub-check {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
}
.pub-check--ok { background: rgba(38,166,91,.15); color: var(--success); }
.pub-check--wait { background: rgba(240,173,78,.15); color: var(--warning); }
.pub-check--err { background: rgba(231,76,60,.15); color: var(--danger); }

.pub-summary { text-align: left; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pub-summary > div {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.pub-summary > div:last-child { border-bottom: none; }
.pub-summary span { color: var(--muted); }
.pub-summary strong { color: var(--text); text-align: right; }

/* Botões "adicionar à minha agenda" (Google, Outlook, .ics). */
.pub-exportar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pub-exportar__label { font-size: 12px; color: var(--muted); }
.pub-exportar .btn { display: inline-flex; align-items: center; gap: 6px; }
.pub-exportar .btn svg { stroke: currentColor; }
.pub-card--narrow .pub-exportar { justify-content: center; margin-top: 20px; }

.pub-list { display: flex; flex-direction: column; }
.pub-item {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }
.pub-item--off { opacity: .6; }
.pub-item__date {
    width: 62px; flex-shrink: 0; text-align: center; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0;
}
.pub-item__date strong { display: block; font-size: 15px; color: var(--text); }
.pub-item__date span { display: block; font-size: 12px; color: var(--muted); }
.pub-item__body { flex: 1; min-width: 180px; }
.pub-item__body p { margin: 2px 0 0; font-size: 12px; }
.pub-item__actions { display: flex; gap: 8px; align-items: center; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 1080px) {
    /* Sem largura para as três colunas: dados descem para baixo do seletor. */
    .mk-picker { grid-template-columns: 236px minmax(168px, 1fr); }
    .mk-dados { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .mk-picker { grid-template-columns: 1fr; }
    .mk-picker .pub-month { width: 100%; }
}
@media (max-width: 900px) {
    .pub-picker { flex-direction: column; }
    .pub-month { width: 100%; }
    .cal-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .cal-grid { grid-template-columns: repeat(3, 1fr); }
    .ag-day__label { width: 100%; }
    .ag-months { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 0; overflow: hidden; }
    .topbar { left: 0; }
    .app-body { margin-left: 0; }
    .summary-row { grid-template-columns: 1fr; }
    .af-row { flex-direction: column; }
    .af-field { min-width: 100%; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form__grid { grid-template-columns: 1fr; }
    .profile-row { grid-template-columns: 1fr; }
    .profile-row--bottom { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
