:root {
    /* Equilíbrio: teal de cura + petróleo só no texto/acentos */
    --ink: #1b353a;
    --ink-soft: #2a4a50;
    --brand: #16a085;
    --brand-dark: #0e7a66;
    --brand-mid: #1aa085;
    --brand-light: #e6f7f3;
    --brand-soft: #c5ebe2;
    --bg: #f3f7f6;
    --surface: #ffffff;
    --text: #1b353a;
    --muted: #5a6f72;
    --border: #d2e0dd;
    --danger: #c0392b;
    --warning: #d68910;
    --success: #1e8449;
    --shadow: 0 8px 22px rgba(22, 160, 133, 0.12);
    --radius: 14px;
    --header-h: 100px;
    --nav-h: 64px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

body {
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: var(--header-h);
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 45%, var(--brand-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

@media (min-width: 768px) {
    .app-header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand actions"
            "nav nav";
        align-items: center;
        gap: 8px 12px;
        padding: 10px 16px 12px;
        min-height: unset;
        height: auto;
    }

    .brand,
    .brand-btn {
        grid-area: brand;
        justify-self: start;
    }

    .header-actions {
        grid-area: actions;
        justify-self: end;
    }

    .desktop-nav {
        grid-area: nav;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        order: unset;
        flex: unset;
        width: 100%;
        margin: 0;
    }

    .desktop-nav-item {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
}

@media (min-width: 1280px) {
    .desktop-nav-item {
        padding: 6px 11px;
        font-size: 0.8rem;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
}

.brand-logo-header {
    display: block;
    height: 36px;
    width: auto;
    max-width: min(200px, 46vw);
    object-fit: contain;
    object-position: left center;
    background: transparent;
}

.brand-logo-login {
    display: block;
    width: min(280px, 100%);
    height: auto;
    margin: 0 auto 10px;
    object-fit: contain;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.18);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
}

.brand-btn {
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.brand-btn:active { opacity: 0.85; }

.desktop-nav {
    display: none;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 4px;
    order: 3;
}

.desktop-nav-item {
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
}

.desktop-nav-item.active {
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}

.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    z-index: 15;
}

.page-toolbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.back-btn-inline {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
}

.icon-btn:active { transform: scale(0.96); }

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.app-main {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--nav-h) + 16px);
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.clinic-bridge-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin: 0 0 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
    border: 1px solid #f0d9b8;
    border-radius: 10px;
}
.clinic-bridge-banner p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.4;
}
.clinic-bridge-banner a {
    display: inline-block;
    padding: 8px 14px;
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
}
a.icon-btn.bridge-clinic {
    text-decoration: none;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    z-index: 20;
}

.nav-item {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    padding: 4px 2px;
}

.nav-item .nav-icon { font-size: 1.1rem; }

.nav-item.active {
    color: var(--brand);
    font-weight: 600;
}

.nav-item.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-clickable,
.stat-pill-clickable,
.hero-action-clickable,
.action-item-clickable {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.card-clickable:hover,
.stat-pill-clickable:hover,
.hero-action-clickable:hover {
    box-shadow: 0 6px 16px rgba(22, 160, 133, 0.15);
}

.card-clickable:active,
.stat-pill-clickable:active,
.hero-action-clickable:active,
.action-item-clickable:active {
    transform: scale(0.98);
}

.action-item-clickable:hover {
    border-color: var(--brand);
}

.card-title {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.card-sub {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
}

.hero-action {
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 55%, var(--brand-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(14, 122, 102, 0.22);
}

.hero-action-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-action-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 6px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(27, 53, 58, 0.05);
}

.stat-pill .num {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.stat-pill .lbl {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 500;
}

.stat-pill-clickable:hover {
    background: var(--brand-light);
    border-color: var(--brand);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 10px;
}

.section-head h2 {
    font-size: 1rem;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.92rem;
    font-weight: 650;
    cursor: pointer;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 55%, var(--brand-dark) 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(14, 122, 102, 0.25);
}

.btn-secondary {
    background: var(--brand-light);
    color: var(--ink);
    border: 1.5px solid var(--brand-soft);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
}

.btn-ghost {
    background: var(--surface);
    color: var(--brand-dark);
    border: 1.5px solid var(--brand);
    font-weight: 650;
}

.btn-ghost:hover {
    background: var(--brand-light);
}

.btn-block {
    width: 100%;
}

.btn:active { opacity: 0.92; }

/* Atalhos do dashboard — legíveis sem blocos pesados */
.dash-modules {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0 18px;
}

.dash-module-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 55%, var(--brand-dark) 100%);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 650;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(14, 122, 102, 0.28);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.dash-module-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 8px 22px rgba(14, 122, 102, 0.34);
}

.dash-module-btn:active {
    transform: scale(0.985);
}

.dash-module-btn.is-accent,
.dash-module-btn.is-outline {
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 55%, var(--brand-dark) 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 6px 18px rgba(14, 122, 102, 0.28);
}

.dash-module-btn.is-accent:hover,
.dash-module-btn.is-outline:hover {
    filter: brightness(1.05);
    background: linear-gradient(135deg, #1fb396 0%, var(--brand) 55%, var(--brand-dark) 100%);
}

.action-list { list-style: none; }

.action-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.action-item.priority-1 { border-left: 4px solid var(--danger); }
.action-item.priority-2 { border-left: 4px solid var(--warning); }
.action-item.priority-3,
.action-item.priority-4,
.action-item.priority-5 { border-left: 4px solid var(--brand); }

.action-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.action-desc {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 4px;
}

.action-suggest {
    font-size: 0.8rem;
    color: var(--brand-dark);
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}

.empty-state .icon { font-size: 2rem; margin-bottom: 8px; }

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(circle at top right, rgba(22,160,133,0.15), transparent 45%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 18px;
    padding: 28px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo h1 {
    font-size: 1.35rem;
    color: var(--brand-dark);
}

.login-logo p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--muted);
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: #fafcfb;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(22,160,133,0.15);
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.alert-error {
    background: #fdecea;
    color: var(--danger);
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.user-chip {
    font-size: 0.78rem;
    opacity: 0.9;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.notif-item.unread { background: var(--brand-light); margin: 0 -16px; padding: 14px 16px; }

.notif-title { font-weight: 600; font-size: 0.92rem; }

.notif-body {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 4px;
    white-space: pre-line;
}

.notif-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 6px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.coming-soon {
    opacity: 0.55;
    pointer-events: none;
}

@media (min-width: 768px) {
    .desktop-nav { display: flex; }
    .app-main { padding-bottom: calc(var(--nav-h) + 16px); }
    .grid-2 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .app-main { padding-bottom: 24px; }
}

/* Enfermeiros */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.search-input, .select-input, .input-block {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: #fafcfb;
}

.toolbar .search-input { flex: 1 1 160px; }
.toolbar .select-input { flex: 0 1 140px; }

.nurse-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}

.nurse-card:active { background: var(--brand-light); }

.nurse-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nurse-card-meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 6px;
}

.nurse-card-action {
    font-size: 0.8rem;
    color: var(--brand-dark);
    margin-top: 8px;
}

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.tag-brand { background: var(--brand-light); color: var(--brand-dark); }
.tag-success { background: #d5f5e3; color: var(--success); }
.tag-muted { background: #eceff1; color: var(--muted); }
.tag-warning { background: #fdebd0; color: var(--warning); }
.tag-danger { background: #fdecea; color: var(--danger); }

.disclaimer-box {
    background: #fff8e6;
    border: 1px solid #f0d78c;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.82rem;
    color: #7d6608;
    margin-bottom: 14px;
    line-height: 1.4;
}

.checks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.check-item {
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.check-item input { margin-top: 3px; }

textarea.input-block {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.lgpd-box {
    background: var(--brand-light);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.88rem;
}

.lgpd-box input { margin-right: 8px; }

.back-btn { margin-bottom: 12px; }

.detail-card { margin-bottom: 12px; }

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

.detail-head h2 { font-size: 1.1rem; }

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.detail-label { color: var(--muted); }

.doc-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.doc-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.85rem;
}

.checklist-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.checklist-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.checklist-label input { margin-top: 3px; }

.checklist-desc {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 6px;
    padding-left: 24px;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-hint-box {
    background: var(--brand-light);
    border: 1px solid #b8e6dc;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

.action-hint-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-dark);
    margin-bottom: 6px;
}

.action-hint-box p {
    font-size: 0.92rem;
    margin-bottom: 12px;
    color: var(--text);
}

.action-hint-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.evo-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.evo-photo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}

.evo-photo-placeholder {
    min-height: 120px;
    display: grid;
    place-items: center;
    background: #f0f4f3;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    padding: 12px;
}

.evo-photo {
    width: 100%;
    border-radius: 8px;
    display: block;
    max-height: 220px;
    object-fit: cover;
}

.evo-pending {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.evo-pending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}

.evo-pending-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
}

.evo-pending-item span {
    flex: 1;
    font-size: 0.82rem;
}

.progress-bar-wrap {
    height: 10px;
    background: #e6efec;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--brand-dark));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 6px;
}

.progress-summary {
    margin-bottom: 4px;
}

.req-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    background: #fafcfb;
}

.req-item.req-done {
    background: #eefaf4;
    border-color: #c8e6d5;
}

.req-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.audit-json {
    background: #1a2b28;
    color: #e8f8f5;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.75rem;
    overflow: auto;
    max-height: 280px;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-security,
.audit-card-security {
    border-color: #f5c6cb;
    background: #fff5f5;
}

@media (min-width: 768px) {
    .evo-photo-grid { grid-template-columns: repeat(3, 1fr); }
}
