@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css');

:root {
    --bg: #f3f6f8;
    --bg-soft: #f8fafc;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-muted: #eef4f7;
    --ink: #102033;
    --text: #243244;
    --text-soft: #64748b;
    --text-muted: #8190a3;
    --text-on-dark: #ffffff;
    --line: #dde5ed;
    --line-strong: #c4ced9;
    --primary: #1f5f8b;
    --primary-strong: #123d5c;
    --primary-soft: #e8f2f8;
    --teal: #1f9d83;
    --teal-strong: #147461;
    --teal-soft: #e4f7f2;
    --success: #07865f;
    --success-soft: #daf8ea;
    --warning: #a15c05;
    --warning-soft: #fff4cc;
    --danger: #bf2b2b;
    --danger-soft: #ffe5e5;
    --info: #285ec7;
    --info-soft: #e8eeff;
    --shadow-xs: 0 1px 2px rgba(15, 32, 51, 0.06);
    --shadow-sm: 0 10px 24px rgba(15, 32, 51, 0.08);
    --shadow-md: 0 18px 42px rgba(15, 32, 51, 0.13);
    --radius: 8px;
    --radius-sm: 6px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes topbarFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

@keyframes topbarGlow {
    0%,
    100% {
        opacity: 0.58;
        transform: translateX(-8%);
    }

    50% {
        opacity: 0.92;
        transform: translateX(8%);
    }
}

@keyframes brandPulse {
    0%,
    100% {
        box-shadow: inset 0 0 0 1px rgba(16, 32, 51, 0.08), 0 10px 22px rgba(0, 0, 0, 0.18);
    }

    50% {
        box-shadow: inset 0 0 0 1px rgba(16, 32, 51, 0.08), 0 12px 26px rgba(31, 157, 131, 0.28);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        linear-gradient(180deg, #f9fbfc 0%, var(--bg) 44%, #eef5f3 100%);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

code {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 7px;
    border: 1px solid #c9d9e6;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
    font-weight: 700;
}

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

@keyframes surfacePulse {
    50% {
        box-shadow: 0 0 0 5px rgba(31, 95, 139, 0.16);
    }
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.narrow-container {
    width: min(960px, calc(100% - 32px));
}

.app-page,
.login-page {
    min-height: 100vh;
}

.app-page {
    display: flex;
    flex-direction: column;
}

.app-page .page-wrap {
    flex: 1 0 auto;
}

.page-wrap {
    padding: 24px 0 46px;
}

.skip-link {
    position: absolute;
    top: 10px;
    left: -999px;
    z-index: 999;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.skip-link:focus,
.skip-link:active {
    left: 12px;
}

.page-loader {
    --loader-progress: 0%;
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 200;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s var(--ease);
}

.page-loader.is-active {
    opacity: 1;
}

.page-loader__bar,
.page-loader__glow {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--loader-progress);
    height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--primary));
    transition: width 0.22s var(--ease);
}

.page-loader__glow {
    height: 6px;
    opacity: 0.45;
    filter: blur(6px);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(90deg, rgba(31, 157, 131, 0.18), transparent 36%),
        #10263a;
    color: var(--text-on-dark);
    box-shadow: 0 10px 26px rgba(15, 32, 51, 0.18);
}

.topbar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.08) 42%, transparent 72%);
    opacity: 0.55;
    pointer-events: none;
    animation: topbarGlow 7s var(--ease) infinite;
}

.topbar::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--teal), #7dd3fc, var(--primary));
    background-size: 200% 100%;
    animation: topbarFlow 5.8s linear infinite;
}

.topbar.is-scrolled {
    box-shadow: 0 14px 34px rgba(15, 32, 51, 0.24);
}

.topbar .container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 66px;
}

.brand {
    display: flex;
    align-items: center;
    flex: 0 1 320px;
    min-width: 0;
    gap: 12px;
}

.brand > div:last-child {
    min-width: 0;
}

.brand-mark,
.login-brandmark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(16, 32, 51, 0.08), 0 10px 22px rgba(0, 0, 0, 0.18);
}

.topbar .brand-mark {
    animation: brandPulse 4.8s var(--ease) infinite;
}

.brand-mark i,
.login-brandmark i {
    font-size: 1.08rem;
    line-height: 1;
}

.brand-mark img,
.login-brandmark img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.brand strong {
    display: block;
    overflow: hidden;
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-eyebrow,
.section-eyebrow,
.status-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
    text-transform: uppercase;
}

.brand-eyebrow {
    margin-bottom: 3px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.64rem;
}

.user-strip {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    flex-wrap: nowrap;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    flex: 0 1 260px;
    gap: 7px;
    min-width: 0;
    min-height: 34px;
    max-width: 260px;
    padding: 0 11px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    font-weight: 700;
}

.user-chip i {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, 0.74);
}

.user-chip__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip__role {
    flex: 0 0 auto;
    padding-left: 7px;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.76rem;
    font-weight: 800;
}

.topbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
}

.topbar-nav {
    display: none;
}

.topbar-nav[hidden] {
    display: none !important;
}

.hero-card,
.card,
.login-showcase,
.login-card,
.stat-card,
.info-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    gap: 22px;
    overflow: hidden;
    padding: 30px;
    border-color: rgba(16, 32, 51, 0.14);
    background: linear-gradient(135deg, #0f2a44 0%, #1f5f8b 58%, #1f9d83 100%);
    color: var(--text-on-dark);
    box-shadow: var(--shadow-md);
}

.hero-card h1,
.card h1,
.card h2,
.login-showcase h1,
.login-card h2 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 1.82rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.18;
}

.hero-card h1,
.login-showcase h1 {
    color: #ffffff;
}

.card h2 {
    font-size: 1.2rem;
}

.login-showcase h1 {
    font-size: 2.25rem;
    line-height: 1.08;
}

.login-card h2 {
    font-size: 1.8rem;
}

.hero-lead,
.card-text,
.login-card p,
.login-showcase p {
    margin: 0;
    color: var(--text-soft);
}

.hero-card .hero-lead,
.login-showcase .hero-lead,
.login-showcase p {
    color: rgba(255, 255, 255, 0.82);
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 12px;
    padding: 0 10px;
    border: 1px solid rgba(31, 95, 139, 0.2);
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-card .hero-pill,
.login-showcase .hero-pill {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.hero-summary {
    display: grid;
    gap: 10px;
}

.summary-item,
.login-highlight-card,
.login-status-card,
.login-credential-card,
.mini-stat {
    border-radius: var(--radius);
}

.summary-item {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.summary-item span,
.mini-stat span,
.login-highlight-card span {
    display: block;
}

.summary-item span {
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    font-weight: 600;
}

.summary-item strong {
    display: block;
    color: #ffffff;
    font-size: 1.24rem;
    font-weight: 800;
    line-height: 1.2;
}

.summary-item i {
    margin-right: 7px;
    color: rgba(255, 255, 255, 0.82);
}

.dashboard-page .container {
    display: grid;
    gap: 18px;
}

.dashboard-page .alert {
    margin-bottom: 0;
}

.dashboard-hero {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.82fr);
    align-items: center;
    gap: 30px;
    min-height: auto;
    padding: 30px;
    background:
        radial-gradient(circle at 92% 18%, rgba(255, 255, 255, 0.18), transparent 28%),
        linear-gradient(135deg, #0e2438 0%, #174e76 56%, #159078 100%);
}

.dashboard-hero::before {
    content: "";
    position: absolute;
    inset: 18px 18px auto auto;
    width: 170px;
    height: 170px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    pointer-events: none;
}

.dashboard-hero > * {
    position: relative;
    z-index: 1;
}

.dashboard-hero h1 {
    max-width: 760px;
    font-size: 2.08rem;
}

.dashboard-hero .hero-lead {
    max-width: 740px;
    font-size: 1rem;
}

.dashboard-hero .hero-summary {
    align-content: stretch;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-hero-side {
    display: grid;
    grid-template-rows: 180px auto;
    gap: 12px;
    min-width: 0;
}

.dashboard-hero .summary-item {
    display: grid;
    align-content: center;
    min-height: 74px;
    padding: 13px;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(10px);
}

.dashboard-hero .summary-item span {
    display: flex;
    align-items: center;
}

.dashboard-hero .summary-item strong {
    font-size: 1.25rem;
}

.dashboard-insight-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.insight-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 15px;
    border: 1px solid #d8e3ec;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
    box-shadow: 0 8px 22px rgba(15, 32, 51, 0.06);
}

.insight-card i {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--teal-soft);
    color: var(--teal-strong);
}

.insight-card span,
.insight-card strong {
    display: block;
}

.insight-card span {
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 850;
    text-transform: uppercase;
}

.insight-card strong {
    color: var(--ink);
    font-size: 1.08rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.quick-actions,
.filter-actions,
.form-actions,
.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-actions {
    margin-top: 20px;
    gap: 10px;
}

.kpi-grid,
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.stat-card,
.info-card,
.card {
    position: relative;
    padding: 20px;
}

.stat-card,
.info-card {
    overflow: hidden;
}

.stat-card::before,
.info-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--teal));
}

.card,
.stat-card,
.info-card {
    box-shadow: 0 8px 22px rgba(15, 32, 51, 0.07);
}

.stat-card:hover,
.info-card:hover,
.card:hover,
.login-card:hover {
    border-color: var(--line-strong);
    box-shadow: 0 14px 34px rgba(15, 32, 51, 0.1);
}

.stat-card span,
.info-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-card strong,
.info-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.stat-card small,
.info-card small {
    color: var(--text-muted);
}

.dashboard-kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-top: 0;
}

.kpi-card {
    display: grid;
    min-height: 158px;
    padding: 18px;
    align-content: space-between;
    border-color: #d8e3ec;
    background:
        linear-gradient(180deg, #ffffff, #f9fcfd);
}

.kpi-card::before {
    display: none;
}

.kpi-card::after {
    content: "";
    position: absolute;
    inset: auto 18px 16px 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0.75;
}

.kpi-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 1.05rem;
}

.kpi-card span {
    margin-bottom: 6px;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.kpi-card strong {
    margin-bottom: 4px;
    font-size: 2.15rem;
}

.kpi-card small {
    display: block;
    min-height: 36px;
}

.kpi-card-success .kpi-icon {
    background: var(--success-soft);
    color: var(--success);
}

.kpi-card-success::after {
    background: var(--success);
}

.kpi-card-warning .kpi-icon {
    background: var(--warning-soft);
    color: var(--warning);
}

.kpi-card-warning::after {
    background: #d89a14;
}

.kpi-card-info .kpi-icon {
    background: var(--info-soft);
    color: var(--info);
}

.kpi-card-info::after {
    background: var(--info);
}

.section-grid,
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: 16px;
    margin-top: 18px;
}

.dashboard-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 0;
}

.dashboard-ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
    gap: 18px;
}

.dashboard-panel {
    padding: 0;
    overflow: hidden;
}

.dashboard-panel .card-header {
    align-items: center;
    margin: 0;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fbfc;
}

.dashboard-panel .card-header h2 {
    margin-bottom: 0;
}

.dashboard-panel .card-header .btn {
    min-height: 36px;
}

.dashboard-panel .list-stack,
.dashboard-panel .empty-state {
    margin: 16px;
}

.dashboard-panel .list-stack {
    gap: 8px;
}

.dashboard-panel .list-row {
    position: relative;
    padding: 14px 14px 14px 18px;
    border-color: #e0e8ef;
    background: #ffffff;
}

.dashboard-panel .list-row::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--primary);
}

.dashboard-panel .list-row:hover {
    transform: translateY(-1px);
}

.dashboard-panel .list-row-meta span:first-child {
    color: var(--ink);
    font-weight: 750;
}

.panel-warning .section-eyebrow {
    color: var(--warning);
}

.panel-warning .list-row::before {
    background: #d89a14;
}

.panel-info .section-eyebrow {
    color: var(--primary);
}

.panel-info .list-row::before {
    background: var(--primary);
}

.panel-forecast .section-eyebrow {
    color: var(--teal-strong);
}

.panel-movement .section-eyebrow {
    color: var(--primary);
}

.forecast-list,
.movement-list {
    display: grid;
    gap: 8px;
    margin: 16px;
}

.forecast-row,
.movement-row {
    display: grid;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px 14px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #ffffff;
}

.forecast-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.movement-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
}

.forecast-row:hover,
.movement-row:hover {
    border-color: #c7d8e4;
    background: #f8fbfc;
}

.forecast-row strong,
.movement-row strong {
    display: block;
    color: var(--ink);
    font-weight: 850;
}

.forecast-row span,
.movement-row span {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.forecast-row__meta {
    min-width: 80px;
    text-align: right;
}

.forecast-row__meta span {
    display: block;
    color: var(--teal-strong);
    font-size: 1.18rem;
    font-weight: 900;
}

.forecast-row__meta small,
.movement-row small {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.movement-row__type {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.movement-row__type.is-in {
    background: var(--success-soft);
    color: var(--success);
}

.movement-row__type.is-out {
    background: var(--warning-soft);
    color: var(--warning);
}

.movement-row small {
    color: var(--ink);
    white-space: nowrap;
}

.dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-chart-wide {
    grid-column: 1 / -1;
}

.dashboard-chart-card {
    overflow: hidden;
}

.dashboard-chart-card .card-header {
    margin: -20px -20px 18px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fbfc;
}

.bar-list {
    display: grid;
    gap: 14px;
}

.bar-row {
    display: grid;
    gap: 8px;
}

.bar-row__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-soft);
}

.bar-row__label strong {
    color: var(--ink);
    font-size: 0.95rem;
}

.bar-row__label span {
    font-weight: 800;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8f0f5;
}

.bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--teal));
}

.expiry-bars {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    min-height: 210px;
}

.expiry-bar {
    display: grid;
    justify-items: center;
    gap: 7px;
    min-width: 0;
    text-align: center;
}

.expiry-bar__column {
    display: flex;
    align-items: end;
    width: 100%;
    height: 128px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f4f8fb;
}

.expiry-bar__column span {
    display: block;
    width: 100%;
    min-height: 10px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #f5c96b, var(--warning));
}

.expiry-bar:nth-child(5) .expiry-bar__column span {
    background: linear-gradient(180deg, #7ddfbd, var(--success));
}

.expiry-bar strong {
    color: var(--ink);
    font-size: 1.08rem;
}

.expiry-bar small {
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 800;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.metric-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 600;
}

.metric-pill strong {
    margin-left: 4px;
    color: var(--ink);
    font-weight: 800;
}

.user-admin-card {
    padding: 24px;
}

.user-admin-card .card-header {
    align-items: center;
    margin: -4px -4px 20px;
    padding: 4px 4px 18px;
    border-bottom: 1px solid var(--line);
}

.user-admin-card .section-eyebrow {
    color: var(--primary);
}

.user-admin-card h1 {
    font-size: 2rem;
}

.user-admin-card .card-text {
    max-width: 720px;
}

.user-admin-card .metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.user-admin-card .metric-pill {
    min-height: 58px;
    justify-content: space-between;
    padding: 0 16px;
    border-color: #cfdae5;
    background:
        linear-gradient(180deg, #ffffff, #f7fbfc);
    color: var(--text-soft);
    box-shadow: 0 6px 18px rgba(15, 32, 51, 0.05);
}

.user-admin-card .metric-pill strong {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    margin-left: 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 1rem;
}

.list-stack {
    display: grid;
    gap: 10px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-subtle);
}

.list-row:hover {
    border-color: var(--line-strong);
    background: #f1f7fa;
    box-shadow: var(--shadow-xs);
}

.list-row strong {
    display: block;
    margin-bottom: 3px;
    color: var(--ink);
    font-weight: 800;
}

.list-row span {
    color: var(--text-soft);
}

.list-row-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
    text-align: right;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    transition:
        background-color 0.15s var(--ease),
        border-color 0.15s var(--ease),
        color 0.15s var(--ease),
        box-shadow 0.15s var(--ease),
        transform 0.15s var(--ease);
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn i,
.btn .fa,
.btn .fa-solid {
    flex: 0 0 auto;
    margin-right: 8px;
    font-size: 0.95em;
    line-height: 1;
}

.btn-primary {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary), var(--primary-strong));
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(31, 95, 139, 0.2);
}

.btn-primary:hover {
    border-color: var(--primary-strong);
    background: linear-gradient(180deg, #1a547d, #0f2f49);
}

.btn-secondary {
    border-color: var(--line-strong);
    background: #ffffff;
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

.btn-danger {
    border-color: #f0aaaa;
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-danger:hover {
    background: #ffd2d2;
}

.btn-ghost {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.topbar .btn-ghost {
    min-height: 36px;
    padding: 0 11px;
    border-color: transparent;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.84);
    box-shadow: none;
}

.topbar .btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: none;
}

.topbar-link {
    flex: 0 0 auto;
    gap: 7px;
}

.topbar-link i {
    margin-right: 0;
    color: rgba(255, 255, 255, 0.62);
}

.topbar-link span {
    white-space: nowrap;
}

.topbar-link.is-active {
    border-color: rgba(255, 255, 255, 0.92);
    background: #ffffff;
    color: #0f2a44;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.topbar-link.is-active i {
    color: var(--teal-strong);
}

.topbar-link-exit {
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.7);
}

.topbar-link-exit:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.btn-light {
    border-color: #ffffff;
    background: #ffffff;
    color: var(--primary-strong);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.btn-light:hover {
    background: var(--primary-soft);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-block {
    width: 100%;
}

.btn-small {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.86rem;
}

.table .btn-secondary {
    border-color: #cfd9e4;
    background: #ffffff;
}

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

.table .btn-primary {
    box-shadow: 0 8px 18px rgba(18, 61, 92, 0.18);
}

.table .btn-danger {
    border-color: #f1b4b4;
    background: #fff0f0;
}

.btn.is-loading,
.btn:disabled {
    cursor: wait;
    opacity: 0.86;
}

.btn.is-loading {
    pointer-events: none;
}

.btn.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: spinnerRotate 0.72s linear infinite;
}

:focus-visible {
    outline: 3px solid rgba(31, 157, 131, 0.34);
    outline-offset: 2px;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.15;
}

.badge-success {
    border-color: #9ee2bf;
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    border-color: #efd383;
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    border-color: #f4b6b6;
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info {
    border-color: #cbd8ff;
    background: var(--info-soft);
    color: var(--info);
}

.badge-neutral,
.badge-soft {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text-soft);
}

.alert {
    margin-bottom: 16px;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 700;
}

.alert-success {
    border-color: #9ee2bf;
    background: var(--success-soft);
    color: var(--success);
}

.alert-error {
    border-color: #f4b6b6;
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-warning {
    border-color: #efd383;
    background: var(--warning-soft);
    color: var(--warning);
}

.alert.is-hiding {
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.empty-state {
    padding: 26px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-subtle);
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 5px;
    color: var(--ink);
}

.empty-state p {
    margin: 0;
    color: var(--text-soft);
}

.filter-grid,
.form-grid,
.form-stack {
    display: grid;
    gap: 14px;
}

.filter-grid {
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
    align-items: end;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, #ffffff, #f8fbfc);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-stack {
    margin-top: 20px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span,
.checkbox-field span {
    color: var(--text);
    font-weight: 700;
}

.field.is-focused span {
    color: var(--primary-strong);
}

.field input,
.field select,
.field textarea,
.password-field input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    transition:
        border-color 0.15s var(--ease),
        box-shadow 0.15s var(--ease),
        background-color 0.15s var(--ease);
}

.field select {
    cursor: pointer;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #8b98a8;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.password-field input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 95, 139, 0.14);
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.field-full {
    grid-column: 1 / -1;
}

.medicine-form-card {
    overflow: hidden;
}

.medicine-form-card > .card-header {
    margin: -20px -20px 20px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(31, 95, 139, 0.08), rgba(31, 157, 131, 0.06)),
        #ffffff;
}

.medicine-form {
    gap: 16px;
}

.form-section-title {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbfc;
}

.form-section-title:first-of-type {
    margin-top: 0;
}

.form-section-title i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.form-section-title strong,
.form-section-title span {
    display: block;
}

.form-section-title strong {
    color: var(--ink);
    font-size: 1rem;
}

.form-section-title span {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}

.checkbox-field input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.stock-preview {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-weight: 700;
}

.stock-preview.preview-warning {
    border-color: #efd383;
    background: var(--warning-soft);
    color: var(--warning);
}

.stock-preview.preview-success {
    border-color: #9ee2bf;
    background: var(--success-soft);
    color: var(--success);
}

.form-is-submitting {
    position: relative;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 88px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--primary-strong);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 800;
    transform: translateY(-50%);
}

.password-toggle:hover {
    border-color: var(--line);
    background: var(--primary-soft);
}

.lookup-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.lookup-field .btn {
    min-height: 44px;
}

.field-hint {
    color: var(--text-soft);
    font-size: 0.86rem;
}

.field-hint.hint-success {
    color: var(--success);
}

.field-hint.hint-warning {
    color: var(--warning);
}

.movement-form {
    margin-top: 8px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(15, 32, 51, 0.06);
}

.table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    background: #ffffff;
}

.table th,
.table td {
    padding: 16px 16px;
    border-bottom: 1px solid #e7edf3;
    text-align: left;
    vertical-align: middle;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #edf4f8;
    color: #52657b;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.table tbody tr:nth-child(even) {
    background: #f8fbfd;
}

.table tbody tr:hover {
    background: #eef7f8;
}

.table tbody tr[data-priority="1"] {
    box-shadow: inset 4px 0 0 var(--danger);
}

.table tbody tr[data-priority="2"] {
    box-shadow: inset 4px 0 0 #d89a14;
}

.table-title {
    margin-bottom: 5px;
    color: var(--ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.table-subtitle {
    color: #536983;
    font-size: 0.9rem;
}

.table-meds th.col-id,
.table-meds td.col-id {
    width: 68px;
    white-space: nowrap;
}

.table-meds th.col-priority,
.table-meds td.col-priority {
    width: 118px;
}

.table-meds th.col-name,
.table-meds td.col-name {
    min-width: 260px;
}

.table-meds th.col-lote,
.table-meds td.col-lote {
    min-width: 220px;
}

.table-meds th.col-stock,
.table-meds td.col-stock {
    width: 175px;
    text-align: right;
}

.table-meds td.col-stock .table-subtitle {
    text-align: right;
}

.table-meds th.col-price,
.table-meds td.col-price {
    width: 110px;
    text-align: right;
}

.table-meds th.col-status,
.table-meds td.col-status {
    width: 92px;
    min-width: 92px;
}

.table-meds th.col-actions,
.table-meds td.col-actions {
    width: 190px;
    text-align: right;
}

.table-meds td.numeric {
    font-weight: 800;
}

.priority-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.priority-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 999px;
    background: currentColor;
}

.priority-critical {
    border-color: #f0a7a7;
    background: #fff0f0;
    color: var(--danger);
}

.priority-warning {
    border-color: #efd383;
    background: var(--warning-soft);
    color: var(--warning);
}

.priority-regular {
    border-color: #9ee2bf;
    background: var(--success-soft);
    color: var(--success);
}

.table tbody tr.is-filtered-out {
    display: none;
}

.table-users {
    min-width: 780px;
}

.table-users th,
.table-users td {
    padding: 18px 18px;
}

.table-users th:first-child,
.table-users td:first-child {
    width: 80px;
    color: var(--primary-strong);
    white-space: nowrap;
}

.table-users th:nth-child(2),
.table-users td:nth-child(2) {
    min-width: 260px;
}

.table-users th:nth-child(3),
.table-users td:nth-child(3),
.table-users th:nth-child(4),
.table-users td:nth-child(4) {
    width: 150px;
}

.table-users th:nth-child(5),
.table-users td:nth-child(5) {
    width: 210px;
}

.table-users th:last-child,
.table-users td:last-child {
    width: 170px;
    text-align: right;
}

.table-users .table-title {
    font-size: 0.98rem;
}

.table-users .table-subtitle {
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
    color: var(--text-soft);
}

.table-users .table-subtitle::before {
    content: "@";
    margin-right: 2px;
    color: var(--text-muted);
}

.action-group {
    display: inline-flex;
    justify-content: flex-end;
    gap: 7px;
    max-width: 190px;
}

.table .action-group .btn {
    min-width: 0;
    border-radius: var(--radius-sm);
}

.table .action-group .btn i,
.table .action-group .btn .fa,
.table .action-group .btn .fa-solid {
    margin-right: 7px;
}

.inline-form {
    margin: 0;
}

.medicine-identity {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.medicine-detail-page .container {
    display: grid;
    gap: 18px;
}

.medicine-profile-card {
    overflow: hidden;
    border-color: rgba(16, 32, 51, 0.14);
    background:
        linear-gradient(135deg, rgba(15, 42, 68, 0.96), rgba(31, 95, 139, 0.92), rgba(31, 157, 131, 0.9));
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.medicine-profile-card h1,
.medicine-profile-card .section-eyebrow,
.medicine-profile-card .card-text {
    color: #ffffff;
}

.medicine-profile-card .card-text {
    opacity: 0.82;
}

.medicine-profile-card .medicine-identity {
    align-items: center;
}

.medicine-profile-card .badge {
    border-color: rgba(255, 255, 255, 0.22);
}

.medicine-profile-status {
    display: grid;
    min-width: 170px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.12);
    text-align: center;
}

.medicine-profile-status span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.medicine-profile-status strong {
    color: #ffffff;
    font-size: 2.2rem;
    font-weight: 850;
    line-height: 1;
}

.medicine-profile-status small {
    color: rgba(255, 255, 255, 0.76);
}

.medicine-profile-card .btn-secondary {
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.medicine-profile-card .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.medicine-detail-page {
    background:
        linear-gradient(180deg, rgba(15, 42, 68, 0.04), transparent 240px),
        linear-gradient(180deg, #f7fafc 0%, #eef4f7 100%);
}

.medicine-detail-page .container {
    width: min(1320px, calc(100% - 36px));
}

.medicine-profile-card {
    padding: 28px;
    border: 0;
    border-radius: 12px;
    background:
        radial-gradient(circle at 86% 16%, rgba(255, 255, 255, 0.2), transparent 30%),
        linear-gradient(135deg, #0f2a44 0%, #1f5f8b 56%, #2fae8f 100%);
}

.medicine-profile-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 36%),
        linear-gradient(180deg, transparent, rgba(15, 42, 68, 0.18));
    pointer-events: none;
}

.medicine-profile-card > * {
    position: relative;
    z-index: 1;
}

.medicine-profile-card h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 3.1vw, 3.15rem);
    line-height: 1.02;
}

.medicine-profile-card .section-eyebrow {
    color: rgba(255, 255, 255, 0.82);
}

.medicine-profile-card .badge-row {
    margin-top: 16px;
}

.medicine-profile-card .badge {
    min-height: 30px;
    padding: 0 12px;
    border: 0;
    box-shadow: 0 8px 20px rgba(15, 42, 68, 0.16);
}

.medicine-profile-card .medicine-identity {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 220px minmax(260px, 0.8fr);
    gap: 24px;
}

.medicine-profile-status {
    align-self: stretch;
    min-width: 0;
    align-content: center;
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
}

.medicine-profile-status strong {
    margin: 7px 0;
    font-size: 2.55rem;
}

.medicine-profile-card .quick-actions {
    align-content: center;
    align-items: stretch;
    margin-top: 0;
}

.medicine-profile-card .quick-actions .btn {
    justify-content: center;
    min-height: 48px;
    border-radius: 8px;
    font-weight: 850;
}

.medicine-profile-card .btn-primary {
    border-color: rgba(15, 42, 68, 0.18);
    background: #0f4f79;
    box-shadow: 0 12px 26px rgba(15, 42, 68, 0.18);
}

.medicine-profile-card .btn-primary:hover {
    background: #0f2a44;
}

.medicine-info-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-top: 0;
}

.medicine-info-card {
    display: grid;
    grid-column: span 2;
    align-content: start;
    min-height: 184px;
    padding: 22px;
    border-color: #d8e3ec;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff, #f9fcfd);
    box-shadow: 0 12px 30px rgba(15, 42, 68, 0.08);
}

.medicine-info-card::before {
    height: 4px;
    background: linear-gradient(90deg, #1f5f8b, #2fae8f);
}

.medicine-info-card > i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: #e8f2f8;
    color: #1f5f8b;
    font-size: 1rem;
}

.medicine-info-card span {
    margin-bottom: 8px;
    color: #5d6b7d;
    font-size: 0.83rem;
    font-weight: 850;
    text-transform: uppercase;
}

.medicine-info-card strong {
    max-width: 100%;
    margin-bottom: 8px;
    color: #071d33;
    font-size: clamp(1.75rem, 2.5vw, 2.45rem);
    line-height: 1.05;
    overflow-wrap: normal;
    word-break: normal;
}

.medicine-info-card small {
    color: #6b7280;
    font-size: 0.93rem;
}

.medicine-info-card .value-date {
    font-size: clamp(1.7rem, 2.2vw, 2.2rem);
    white-space: nowrap;
}

.medicine-info-card .value-place {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.1;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.medicine-info-card-wide {
    grid-column: span 2;
}

.medicine-detail-page .detail-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
    margin-top: 0;
}

.medicine-detail-page .card:not(.medicine-profile-card) {
    border-radius: 10px;
    border-color: #d8e3ec;
    box-shadow: 0 12px 30px rgba(15, 42, 68, 0.07);
}

.medicine-detail-page .card-header {
    margin: -20px -20px 18px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fbfc;
}

.medicine-detail-page .card-header h2 {
    margin-bottom: 0;
}

.medicine-detail-page .detail-list div {
    min-height: 46px;
    align-items: center;
}

.medicine-detail-page .table-wrap {
    box-shadow: none;
}

.about-page .container {
    display: grid;
    gap: 20px;
}

.about-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
    gap: 24px;
    align-items: stretch;
    overflow: hidden;
    padding: 34px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.2), transparent 30%),
        linear-gradient(135deg, #0f2a44 0%, #1f5f8b 55%, #2fae8f 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.about-hero__content {
    display: grid;
    align-content: center;
}

.about-hero h1 {
    margin: 0 0 12px;
    color: #ffffff;
    font-size: 3.25rem;
    font-weight: 900;
    line-height: 1.04;
}

.about-hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 1.04rem;
}

.about-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.about-hero__panel {
    display: grid;
    gap: 10px;
    align-content: center;
}

.about-hero__panel div {
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(12px);
}

.about-hero__panel span,
.about-hero__panel strong {
    display: block;
}

.about-hero__panel span {
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.74rem;
    font-weight: 850;
    text-transform: uppercase;
}

.about-hero__panel strong {
    color: #ffffff;
    line-height: 1.25;
}

.about-section {
    padding: 24px;
    border: 1px solid #d8e3ec;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 42, 68, 0.07);
}

.about-section-intro {
    overflow: hidden;
}

.about-section__header {
    max-width: 860px;
    margin-bottom: 20px;
}

.about-section__header h2,
.about-card h2,
.about-timeline-card h2 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.55rem;
    line-height: 1.15;
}

.about-section__header p,
.about-card p {
    margin: 0;
    color: var(--text-soft);
}

.about-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.about-feature-card {
    display: grid;
    align-content: start;
    min-height: 210px;
    padding: 18px;
    border: 1px solid #dfe8ef;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
}

.about-feature-card i {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.about-feature-card h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.02rem;
}

.about-feature-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.about-workflow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.about-workflow__item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    border: 1px solid #dfe8ef;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
}

.about-workflow__item > span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 900;
}

.about-workflow__item h3,
.about-module-card h3,
.about-api-card h3 {
    margin: 0 0 7px;
    color: var(--ink);
    font-size: 1rem;
}

.about-workflow__item p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.about-module-grid,
.about-api-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.about-module-card,
.about-api-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #dfe8ef;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
}

.about-module-card ul,
.about-api-card ul,
.about-check-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.about-module-card li,
.about-api-card li,
.about-check-list li {
    position: relative;
    padding-left: 20px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.about-module-card li::before,
.about-api-card li::before,
.about-check-list li::before {
    content: "";
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--teal);
}

.about-api-card li {
    padding-left: 0;
}

.about-api-card li::before {
    display: none;
}

.about-api-card code {
    display: flex;
    width: 100%;
    min-height: 30px;
    justify-content: flex-start;
    overflow-wrap: anywhere;
    white-space: normal;
}

.about-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.about-card {
    display: grid;
    align-content: start;
    gap: 12px;
    border-radius: 12px;
    border-color: #d8e3ec;
}

.about-card-accent {
    background:
        linear-gradient(90deg, rgba(31, 95, 139, 0.06), rgba(31, 157, 131, 0.05)),
        #ffffff;
}

.about-data-list,
.about-profile-list,
.about-tech-grid {
    display: grid;
    gap: 10px;
}

.about-data-list div,
.about-profile-list div,
.about-tech-grid div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius-sm);
    background: #f8fbfc;
}

.about-data-list strong,
.about-profile-list strong,
.about-tech-grid strong {
    color: var(--ink);
    overflow-wrap: anywhere;
}

.about-data-list span,
.about-profile-list span,
.about-tech-grid span {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.about-tech-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about-check-list li {
    padding: 10px 10px 10px 34px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius-sm);
    background: #f8fbfc;
}

.about-check-list li::before {
    top: 15px;
    left: 14px;
    background: var(--success);
}

.about-check-list-warning li::before {
    background: var(--warning);
}

.about-doc-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.about-doc-actions .btn {
    justify-content: center;
}

.palette-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.palette-row span {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(15, 42, 68, 0.12);
    border-radius: 12px;
    background: var(--swatch);
    box-shadow: 0 8px 18px rgba(15, 42, 68, 0.08);
}

.about-timeline-card {
    border-radius: 12px;
    border-color: #d8e3ec;
}

.about-timeline {
    display: grid;
    gap: 14px;
}

.about-timeline__item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
    position: relative;
}

.about-timeline__item > span {
    width: 14px;
    height: 14px;
    margin-top: 5px;
    border: 3px solid var(--teal);
    border-radius: 999px;
    background: #ffffff;
}

.about-timeline__item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 23px;
    left: 6px;
    bottom: -15px;
    width: 2px;
    background: #d8e8e4;
}

.about-timeline__item strong {
    display: block;
    color: var(--ink);
}

.about-timeline__item p {
    margin: 3px 0 0;
    color: var(--text-soft);
}

.detail-list {
    display: grid;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e7edf3;
}

.detail-list div:first-child {
    padding-top: 0;
}

.detail-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.detail-list span {
    color: var(--text-soft);
}

.detail-list strong {
    color: var(--ink);
    text-align: right;
    overflow-wrap: anywhere;
}

.description-box {
    margin: 0;
    min-height: 128px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-subtle);
    color: var(--text);
}

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 28px 0 0;
    background:
        linear-gradient(135deg, rgba(31, 157, 131, 0.12), rgba(31, 95, 139, 0.08)),
        var(--bg);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
    align-items: stretch;
    gap: 18px;
    width: min(1180px, calc(100% - 32px));
    margin: 24px 0;
}

.login-showcase,
.login-card {
    padding: 28px;
}

.login-showcase {
    display: grid;
    align-content: space-between;
    gap: 22px;
    border-color: rgba(16, 32, 51, 0.14);
    background: linear-gradient(135deg, #0f2a44 0%, #1f5f8b 58%, #1f9d83 100%);
    color: var(--text-on-dark);
    box-shadow: var(--shadow-md);
}

.login-showcase-top {
    display: grid;
    gap: 14px;
}

.login-brandbar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 14px;
}

.login-highlight-grid,
.login-credentials {
    display: grid;
    gap: 10px;
}

.login-highlight-card,
.login-status-card {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
}

.login-highlight-card strong,
.login-status-card strong {
    display: block;
    margin-bottom: 5px;
    color: #ffffff;
}

.login-showcase-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.login-status-card .status-label {
    color: rgba(255, 255, 255, 0.68);
}

.login-card {
    border-top: 4px solid var(--teal);
    box-shadow: var(--shadow-md);
}

.login-card-header {
    margin-bottom: 8px;
}

.login-credentials {
    margin-top: 20px;
}

.login-credential-card {
    padding: 14px;
    border: 1px solid var(--line);
    background: var(--surface-subtle);
}

.login-credential-card strong {
    display: block;
    margin-bottom: 5px;
}

.login-credential-card p {
    margin: 0;
}

.login-footer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 22px;
}

.mini-stat {
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--surface-subtle);
    text-align: center;
}

.mini-stat strong {
    display: block;
    margin-bottom: 3px;
    color: var(--ink);
    font-size: 0.96rem;
}

.page-footer {
    width: 100%;
    margin-top: 34px;
    padding: 18px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(90deg, rgba(31, 157, 131, 0.16), transparent 42%),
        #10263a;
    color: var(--text-on-dark);
    box-shadow: 0 -10px 28px rgba(15, 32, 51, 0.12);
}

.login-page .page-footer {
    margin-top: 0;
}

.page-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.footer-left::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(31, 157, 131, 0.22);
}

.footer-right {
    justify-content: flex-end;
}

.page-footer small {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 650;
}

.page-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 800;
}

.page-footer a:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.14);
}

body.motion-ui .reveal-item {
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 0.32s var(--ease),
        transform 0.32s var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}

body.motion-ui .reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.is-updating {
    animation: surfacePulse 0.42s var(--ease);
}

@media (max-width: 1080px) {
    .topbar .container {
        gap: 12px;
    }

    .brand {
        flex-basis: 260px;
    }

    .user-chip {
        flex-basis: 190px;
        max-width: 190px;
    }

    .user-chip__role {
        display: none;
    }

    .topbar .btn-ghost {
        padding: 0 9px;
    }

    .about-feature-grid,
    .about-workflow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-module-grid,
    .about-api-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-insight-strip {
        grid-template-columns: 1fr;
    }

    .user-admin-card .metric-strip {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

    .login-showcase-footer {
        grid-template-columns: 1fr;
    }

    .medicine-profile-card .medicine-identity {
        grid-template-columns: 1fr 200px;
    }

    .medicine-profile-card .quick-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .medicine-info-card,
    .medicine-info-card-wide {
        grid-column: span 3;
    }
}

@media (max-width: 980px) {
    .brand-eyebrow {
        display: none;
    }

    .user-chip {
        display: none;
    }

    .hero-card,
    .section-grid,
    .detail-grid,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .medicine-identity,
    .card-header,
    .list-row {
        flex-direction: column;
        align-items: stretch;
    }

    .list-row-meta {
        justify-items: start;
        text-align: left;
    }

    .login-card {
        order: -1;
    }

    .login-showcase h1 {
        font-size: 2rem;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    .dashboard-ops-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }

    .about-hero,
    .about-feature-grid,
    .about-workflow,
    .about-module-grid,
    .about-api-grid,
    .about-split {
        grid-template-columns: 1fr;
    }

    .dashboard-hero h1 {
        font-size: 1.9rem;
    }

    .medicine-detail-page .detail-grid {
        grid-template-columns: 1fr;
    }

    .user-admin-card .card-header {
        align-items: stretch;
    }
}

@media (max-width: 900px) {
    .table {
        min-width: 720px;
    }

    .table-meds th.col-actions,
    .table-meds td.col-actions {
        width: 180px;
    }
}

@media (max-width: 760px) {
    .container,
    .narrow-container,
    .login-shell {
        width: min(100%, calc(100% - 20px));
    }

    .page-wrap {
        padding: 16px 0 34px;
    }

    .topbar .container {
        min-height: 64px;
    }

    .brand {
        flex-basis: auto;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .brand strong {
        font-size: 1.02rem;
    }

    .topbar .user-strip {
        display: none;
    }

    .topbar-toggle {
        display: inline-flex;
    }

    .topbar-nav {
        position: absolute;
        top: calc(100% + 8px);
        right: 10px;
        z-index: 60;
        display: none;
        width: min(300px, calc(100% - 20px));
        padding: 10px;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius);
        background: var(--surface);
        color: var(--text);
        box-shadow: var(--shadow-md);
    }

    .topbar.is-open .topbar-nav {
        display: block;
    }

    .topbar-nav ul {
        display: grid;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .topbar-nav a.btn {
        width: 100%;
        justify-content: flex-start;
        border-color: var(--line);
        border-radius: var(--radius-sm);
        background: var(--surface-subtle);
        color: var(--text);
    }

    .topbar-nav a.topbar-link i {
        color: var(--text-soft);
    }

    .topbar-nav a.topbar-link.is-active {
        border-color: var(--primary);
        background: var(--primary-soft);
        color: var(--primary-strong);
        box-shadow: none;
    }

    .topbar-nav a.topbar-link.is-active i {
        color: var(--primary-strong);
    }

    .topbar-nav a.topbar-link-exit {
        border-color: #f1b4b4;
        background: #fff0f0;
        color: var(--danger);
    }

    .topbar-nav a.topbar-link-exit i {
        color: var(--danger);
    }

    .topbar-nav a.btn:hover {
        border-color: var(--primary);
        background: var(--primary-soft);
        color: var(--primary-strong);
    }

    .topbar-nav a.topbar-link-exit:hover {
        border-color: #f1b4b4;
        background: #ffdede;
        color: var(--danger);
    }

    .hero-card,
    .card,
    .login-showcase,
    .login-card,
    .stat-card,
    .info-card {
        padding: 16px;
    }

    .hero-card h1,
    .card h1 {
        font-size: 1.5rem;
    }

    .user-admin-card h1 {
        font-size: 1.55rem;
    }

    .card h2 {
        font-size: 1.08rem;
    }

    .login-showcase h1,
    .login-card h2 {
        font-size: 1.58rem;
    }

    .login-brandbar,
    .form-grid,
    .filter-grid,
    .login-footer,
    .info-grid,
    .kpi-grid,
    .lookup-field {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        min-height: auto;
    }

    .dashboard-hero::before {
        display: none;
    }

    .dashboard-hero-side {
        grid-template-rows: minmax(160px, auto) auto;
    }

    .dashboard-hero .hero-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-panel .card-header {
        align-items: stretch;
    }

    .about-hero {
        padding: 22px;
    }

    .about-hero h1 {
        font-size: 2.1rem;
    }

    .about-hero__actions,
    .about-doc-actions,
    .about-tech-grid {
        grid-template-columns: 1fr;
    }

    .about-feature-card {
        min-height: 0;
    }

    .about-section {
        padding: 18px;
    }

    .about-workflow__item {
        grid-template-columns: 1fr;
    }

    .about-workflow__item > span {
        width: 36px;
        height: 36px;
    }

    .medicine-form-card > .card-header {
        margin: -16px -16px 18px;
        padding: 18px 16px 16px;
    }

    .form-section-title {
        grid-template-columns: 1fr;
    }

    .medicine-profile-status {
        text-align: left;
    }

    .medicine-detail-page .container {
        width: min(100%, calc(100% - 20px));
    }

    .medicine-profile-card {
        padding: 18px;
    }

    .medicine-profile-card .medicine-identity,
    .medicine-profile-card .quick-actions,
    .medicine-info-grid {
        grid-template-columns: 1fr;
    }

    .medicine-info-card,
    .medicine-info-card-wide {
        grid-column: auto;
        min-height: 0;
    }

    .medicine-info-card strong {
        font-size: 1.85rem;
    }

    .medicine-info-card .value-place {
        font-size: 1.55rem;
    }

    .medicine-detail-page .card-header {
        margin: -16px -16px 16px;
        padding: 16px;
    }

    .expiry-bars {
        grid-template-columns: repeat(5, minmax(70px, 1fr));
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .filter-actions {
        grid-column: auto;
    }

    .quick-actions,
    .filter-actions,
    .form-actions,
    .action-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    .btn-small {
        width: 100%;
        white-space: normal;
    }

    .detail-list div {
        display: grid;
        gap: 4px;
    }

    .detail-list strong {
        text-align: left;
    }

    .page-footer__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
}

/* Navegacao expandida */
.topbar-link {
    position: relative;
}

.topbar-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1;
}

.theme-toggle {
    font-family: inherit;
}

@media (min-width: 761px) and (max-width: 1500px) {
    .topbar .brand {
        flex-basis: 220px;
    }

    .topbar .user-chip {
        display: none;
    }

    .topbar .btn-ghost {
        width: 38px;
        padding: 0;
    }

    .topbar-link span {
        display: none;
    }

    .topbar-count {
        position: absolute;
        top: -3px;
        right: -4px;
        min-width: 17px;
        height: 17px;
        font-size: 0.62rem;
    }
}

@media (max-width: 760px) {
    .topbar-nav .theme-toggle {
        width: 100%;
        justify-content: flex-start;
        border-color: var(--line);
        background: var(--surface-subtle);
        color: var(--text);
    }

    .topbar-nav .theme-toggle i {
        color: var(--text-soft);
    }
}

/* Pacientes */
.patient-detail-shell,
.alerts-shell {
    display: grid;
    gap: 18px;
}

.patient-list-card,
.patient-form-card,
.patient-medication-form-card,
.patient-medication-history {
    overflow: hidden;
}

.patient-filter-grid {
    grid-template-columns: minmax(240px, 1.5fr) minmax(160px, 0.6fr) auto;
}

.patient-profile {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 22px;
    border: 1px solid #d8e3ec;
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(31, 95, 139, 0.06), rgba(47, 174, 143, 0.05)),
        #ffffff;
    box-shadow: 0 12px 28px rgba(15, 32, 51, 0.07);
}

.patient-profile h1 {
    margin: 0 0 5px;
    color: #071d33;
    font-size: 1.75rem;
    font-weight: 900;
}

.patient-profile p {
    margin: 0;
    color: var(--text-soft);
}

.patient-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 1.55rem;
}

.patient-profile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.patient-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.patient-data-list {
    display: grid;
    gap: 0;
    margin: 14px 0 0;
}

.patient-data-list div {
    display: grid;
    grid-template-columns: minmax(110px, 0.38fr) minmax(0, 1fr);
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid #e5ecf2;
}

.patient-data-list div:last-child {
    border-bottom: 0;
}

.patient-data-list dt {
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 850;
    text-transform: uppercase;
}

.patient-data-list dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.patient-status-form {
    display: flex;
    align-items: center;
    gap: 7px;
}

.patient-status-form select {
    min-height: 36px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.table-patients,
.table-patient-medicines {
    min-width: 960px;
}

/* Alertas e notificacoes */
.alerts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px;
    border: 1px solid #d8e3ec;
    border-left: 5px solid #d89a14;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 32, 51, 0.06);
}

.alerts-header h1 {
    margin: 0 0 7px;
    color: #071d33;
    font-size: 1.9rem;
    font-weight: 900;
}

.alerts-header p {
    margin: 0;
    color: var(--text-soft);
}

.alerts-total {
    display: grid;
    min-width: 130px;
    padding: 13px 16px;
    border: 1px solid #efd383;
    border-radius: var(--radius);
    background: var(--warning-soft);
    color: var(--warning);
    text-align: center;
}

.alerts-total strong {
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
}

.alerts-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.alerts-summary a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 68px;
    padding: 14px 16px;
    border: 1px solid #d8e3ec;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 32, 51, 0.05);
}

.alerts-summary a:hover,
.alerts-summary a.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.alerts-summary span {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 900;
}

.alerts-summary strong {
    color: #071d33;
    font-size: 1.55rem;
    font-weight: 900;
}

.alerts-list {
    display: grid;
    gap: 10px;
}

.alert-notification {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-height: 72px;
    padding: 13px 15px;
    border: 1px solid #e0e8ef;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    background: #fbfdfe;
}

.alert-notification:hover {
    border-color: #c5d8e6;
    background: #f4f9fb;
}

.alert-notification > i {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.alert-notification strong,
.alert-notification small {
    display: block;
}

.alert-notification strong {
    color: #071d33;
    font-weight: 900;
}

.alert-notification small {
    color: var(--text-soft);
}

.alert-notification b {
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 900;
}

.alert-notification-vencido {
    border-left-color: var(--danger);
}

.alert-notification-estoque,
.alert-notification-validade {
    border-left-color: #d89a14;
}

.alert-notification-controlado {
    border-left-color: var(--info);
}

@media (max-width: 980px) {
    .patient-filter-grid,
    .patient-profile,
    .patient-info-grid {
        grid-template-columns: 1fr;
    }

    .patient-profile-actions {
        justify-content: flex-start;
    }

    .alerts-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .alerts-header,
    .alert-notification,
    .patient-data-list div,
    .patient-status-form {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .alerts-total {
        width: 100%;
    }

    .alerts-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .alert-notification > i {
        display: none;
    }

    .table-patients,
    .table-patient-medicines {
        min-width: 0;
    }

    .table-patients td::before,
    .table-patient-medicines td::before {
        content: attr(data-label);
    }
}

/* Tema escuro */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1722;
    --bg-soft: #111e2b;
    --surface: #152433;
    --surface-subtle: #182a3a;
    --surface-muted: #203446;
    --ink: #f4f8fb;
    --text: #dbe7ef;
    --text-soft: #a7bac9;
    --text-muted: #8197aa;
    --line: #2d4355;
    --line-strong: #3c566a;
    --primary: #4f9bd1;
    --primary-strong: #c7e7ff;
    --primary-soft: #183a52;
    --teal: #46c5a8;
    --teal-strong: #8de2cf;
    --teal-soft: #153d38;
    --success: #76ddb7;
    --success-soft: #153d31;
    --warning: #ffd166;
    --warning-soft: #443719;
    --danger: #ff8d8d;
    --danger-soft: #4b2429;
    --info: #91b4ff;
    --info-soft: #23365f;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .dashboard-page,
html[data-theme="dark"] .report-page,
html[data-theme="dark"] .central-page {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        #0d1722;
    background-size: 32px 32px, 32px 32px, auto;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .report-header,
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .report-metric,
html[data-theme="dark"] .central-hero,
html[data-theme="dark"] .central-card,
html[data-theme="dark"] .central-metrics article,
html[data-theme="dark"] .patient-profile,
html[data-theme="dark"] .alerts-header,
html[data-theme="dark"] .alerts-summary a,
html[data-theme="dark"] .table,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .empty-state {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .card h1,
html[data-theme="dark"] .card h2,
html[data-theme="dark"] .report-title-block h1,
html[data-theme="dark"] .report-card-header h2,
html[data-theme="dark"] .report-metric strong,
html[data-theme="dark"] .report-summary-grid strong,
html[data-theme="dark"] .central-hero h1,
html[data-theme="dark"] .central-card-header h2,
html[data-theme="dark"] .central-metrics strong,
html[data-theme="dark"] .central-table-list strong,
html[data-theme="dark"] .central-audit-list strong,
html[data-theme="dark"] .central-unit strong,
html[data-theme="dark"] .patient-profile h1,
html[data-theme="dark"] .alerts-header h1,
html[data-theme="dark"] .alerts-summary strong,
html[data-theme="dark"] .alert-notification strong {
    color: var(--ink);
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .report-data-table th {
    background: #203446;
    color: #b8cad8;
}

html[data-theme="dark"] .table tbody tr:nth-child(even),
html[data-theme="dark"] .table tbody tr:hover {
    background: #182a3a;
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .password-field input,
html[data-theme="dark"] .patient-status-form select {
    border-color: var(--line-strong);
    background: #101d29;
    color: var(--text);
}

html[data-theme="dark"] .list-row,
html[data-theme="dark"] .forecast-row,
html[data-theme="dark"] .movement-row,
html[data-theme="dark"] .report-consumption-row,
html[data-theme="dark"] .report-alert-list a,
html[data-theme="dark"] .report-compact-list a,
html[data-theme="dark"] .central-table-list div,
html[data-theme="dark"] .central-setting-list div,
html[data-theme="dark"] .central-audit-list div,
html[data-theme="dark"] .central-endpoint-list a,
html[data-theme="dark"] .central-integration-grid article,
html[data-theme="dark"] .alert-notification {
    border-color: var(--line);
    background: var(--surface-subtle);
}

html[data-theme="dark"] code {
    border-color: var(--line-strong);
    background: #183a52;
    color: #c7e7ff;
}

html[data-theme="dark"] .btn-secondary {
    border-color: var(--line-strong);
    background: #203446;
    color: var(--text);
}

html[data-theme="dark"] .btn-secondary:hover {
    border-color: var(--primary);
    background: #29475d;
    color: #ffffff;
}

/* Integracoes externas */
.integrations-shell {
    display: grid;
    gap: 18px;
}

.integrations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px;
    border: 1px solid #d8e3ec;
    border-left: 5px solid var(--info);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 32, 51, 0.06);
}

.integrations-header h1 {
    margin: 0 0 7px;
    color: #071d33;
    font-size: 1.9rem;
    font-weight: 900;
}

.integrations-header p,
.integration-hint {
    margin: 0;
    color: var(--text-soft);
}

.integration-search-form {
    display: grid;
    grid-template-columns: minmax(180px, 0.5fr) minmax(260px, 1.5fr) auto;
    align-items: end;
    gap: 12px;
}

.integration-hint {
    margin-top: 12px;
    font-size: 0.86rem;
}

.integration-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.integration-results article {
    min-height: 136px;
    padding: 15px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.integration-results h3 {
    margin: 7px 0;
    color: #071d33;
    font-size: 1rem;
    font-weight: 900;
}

.integration-results p {
    margin: 0 0 6px;
    color: var(--text-soft);
}

.integration-results small {
    color: var(--text-muted);
}

.integration-source {
    color: var(--info);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

html[data-theme="dark"] .integrations-header,
html[data-theme="dark"] .integration-results article {
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] .integrations-header h1,
html[data-theme="dark"] .integration-results h3 {
    color: var(--ink);
}

@media (max-width: 760px) {
    .integrations-header,
    .integration-search-form,
    .integration-results {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 430px) {
    .brand-mark,
    .login-brandmark {
        width: 38px;
        height: 38px;
    }

    .brand strong {
        font-size: 0.98rem;
    }

    .brand-eyebrow {
        display: none;
    }

    .table th,
    .table td {
        padding: 11px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dashboard polish - fase final */
.dashboard-page {
    background:
        linear-gradient(90deg, rgba(15, 42, 68, 0.035) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 42, 68, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, #f7fafc 0%, #f2f6f8 46%, #eef7f4 100%);
    background-size: 36px 36px, 36px 36px, auto;
}

.dashboard-page .container {
    gap: 22px;
}

.dashboard-page .card,
.dashboard-page .stat-card,
.dashboard-page .insight-card {
    border-color: #d9e5ee;
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(15, 42, 68, 0.08);
}

.dashboard-page .card:hover,
.dashboard-page .stat-card:hover,
.dashboard-page .insight-card:hover {
    transform: translateY(-1px);
    border-color: #c4d6e4;
    box-shadow: 0 18px 42px rgba(15, 42, 68, 0.11);
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
    gap: 34px;
    padding: clamp(24px, 3.2vw, 42px);
    border: 0;
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(135deg, #0f2a44 0%, #1f5f8b 54%, #2fae8f 100%);
    background-size: 42px 42px, 42px 42px, auto;
    box-shadow: 0 24px 58px rgba(15, 42, 68, 0.24);
}

.dashboard-hero::before {
    display: none;
}

.dashboard-hero h1 {
    max-width: 780px;
    margin-bottom: 14px;
    font-size: 3.4rem;
    font-weight: 900;
    line-height: 1.02;
}

.dashboard-hero .hero-lead {
    max-width: 720px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1.08rem;
    line-height: 1.65;
}

.dashboard-hero .hero-pill {
    min-height: 32px;
    padding: 0 12px;
    border-color: rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.dashboard-hero .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 10px;
    margin-top: 26px;
}

.dashboard-hero .quick-actions .btn {
    justify-content: center;
    min-height: 46px;
    border-radius: 10px;
    font-weight: 900;
}

.dashboard-hero .btn-light {
    color: #0f2a44;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 42, 68, 0.2);
}

.dashboard-hero .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.dashboard-hero .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.18);
}

.dashboard-hero-side {
    grid-template-rows: minmax(210px, 1fr) auto;
    gap: 14px;
}

.dashboard-hero .hero-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-hero .summary-item {
    min-height: 96px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.13);
}

.dashboard-hero .summary-item span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-hero .summary-item strong {
    margin-top: 4px;
    font-size: 1.55rem;
    line-height: 1.05;
}

.dashboard-insight-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.insight-card {
    min-height: 94px;
    padding: 18px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.insight-card i {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #e4f7f2;
    color: #147461;
}

.insight-card span {
    color: #6b7280;
    font-size: 0.76rem;
    letter-spacing: 0;
}

.insight-card strong {
    margin-top: 3px;
    font-size: 1.18rem;
    font-weight: 900;
}

.dashboard-kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    min-height: 180px;
    padding: 20px;
    overflow: hidden;
    border-radius: 14px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f9fcfd 100%);
}

.kpi-card::after {
    inset: auto 20px 18px 20px;
    height: 4px;
    opacity: 1;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
}

.kpi-card span {
    color: #526173;
    font-size: 0.79rem;
    font-weight: 900;
}

.kpi-card strong {
    color: #071d33;
    font-size: 2.7rem;
    font-weight: 900;
}

.kpi-card small {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.35;
}

.dashboard-panels,
.dashboard-ops-grid,
.dashboard-chart-grid {
    gap: 20px;
}

.dashboard-panel,
.dashboard-chart-card {
    border-radius: 14px;
}

.dashboard-panel .card-header,
.dashboard-chart-card .card-header {
    padding: 20px 22px 18px;
    border-bottom-color: #dce8f1;
    background:
        linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
}

.dashboard-panel .card-header h2,
.dashboard-chart-card .card-header h2 {
    color: #071d33;
    font-size: 1.22rem;
    font-weight: 900;
}

.dashboard-panel .section-eyebrow,
.dashboard-chart-card .section-eyebrow {
    margin-bottom: 6px;
    color: #1f5f8b;
    font-size: 0.7rem;
    font-weight: 900;
}

.dashboard-panel .card-header .btn,
.dashboard-chart-card .card-header .btn {
    min-height: 38px;
    border-radius: 9px;
}

.dashboard-panel .list-stack,
.dashboard-panel .empty-state,
.forecast-list,
.movement-list {
    margin: 18px;
}

.dashboard-panel .list-stack,
.forecast-list,
.movement-list {
    gap: 10px;
}

.dashboard-panel .list-row,
.forecast-row,
.movement-row {
    min-height: 76px;
    padding: 15px 16px;
    border-color: #e1ebf3;
    border-radius: 12px;
    background: #ffffff;
}

.dashboard-panel .list-row:hover,
.forecast-row:hover,
.movement-row:hover {
    border-color: #c6d9e7;
    background: #f7fbfd;
}

.dashboard-panel .list-row strong,
.forecast-row strong,
.movement-row strong {
    color: #071d33;
    font-weight: 900;
}

.dashboard-panel .list-row span,
.forecast-row span,
.movement-row span {
    color: #64748b;
}

.forecast-row__meta {
    min-width: 94px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #e4f7f2;
}

.forecast-row__meta span {
    color: #147461;
}

.movement-row__type {
    border-radius: 14px;
}

.dashboard-chart-card {
    padding: 22px;
}

.dashboard-chart-card .card-header {
    margin: -22px -22px 20px;
}

.bar-list {
    gap: 16px;
}

.bar-row__label strong {
    color: #071d33;
    font-weight: 900;
}

.bar-track {
    height: 14px;
    background: #e8f0f5;
}

.bar-track span {
    background: linear-gradient(90deg, #1f5f8b 0%, #2fae8f 100%);
}

.bar-row-consumption .bar-track span {
    background: linear-gradient(90deg, #0f2a44 0%, #1f5f8b 100%);
}

.expiry-bars {
    min-height: 230px;
}

.expiry-bar__column {
    height: 146px;
    border-color: #dce8f1;
    border-radius: 12px;
    background: #f7fbfd;
}

.expiry-bar__column span {
    background: linear-gradient(180deg, #facc15 0%, #a15c05 100%);
}

.expiry-bar:first-child .expiry-bar__column span {
    background: linear-gradient(180deg, #fb7185 0%, #ef4444 100%);
}

.expiry-bar:nth-child(5) .expiry-bar__column span {
    background: linear-gradient(180deg, #34d399 0%, #07865f 100%);
}

.empty-state {
    border-radius: 14px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

@media (max-width: 1180px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-side {
        grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1fr);
        grid-template-rows: auto;
        align-items: stretch;
    }

    .dashboard-hero .hero-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dashboard-insight-strip,
    .dashboard-kpis,
    .dashboard-panels,
    .dashboard-ops-grid,
    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-side {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .dashboard-page .container {
        width: min(100%, calc(100% - 20px));
        gap: 16px;
    }

    .dashboard-hero {
        padding: 22px;
        border-radius: 14px;
    }

    .dashboard-hero h1 {
        font-size: 2rem;
    }

    .dashboard-hero .quick-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-panel .card-header,
    .dashboard-chart-card .card-header {
        display: grid;
        align-items: stretch;
        padding: 18px;
    }

    .dashboard-panel .card-header .btn,
    .dashboard-chart-card .card-header .btn {
        width: 100%;
    }

    .dashboard-panel .list-row,
    .forecast-row,
    .movement-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .movement-row__type {
        display: none;
    }

    .forecast-row__meta {
        width: 100%;
        text-align: left;
    }

    .expiry-bars {
        grid-template-columns: repeat(5, minmax(82px, 1fr));
        overflow-x: auto;
    }
}

/* Dashboard final refinement */
.topbar::before,
.topbar::after {
    animation: none;
}

.topbar .brand-mark {
    animation: none;
}

.btn {
    max-width: 100%;
    min-width: 0;
    text-align: center;
}

.btn i,
.btn .fa,
.btn .fa-solid {
    flex-shrink: 0;
}

.card-header > *,
.field,
.table-title,
.table-subtitle,
.badge,
.metric-pill,
.list-row > *,
.dashboard-command-panel,
.dashboard-hero .summary-item {
    min-width: 0;
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.62fr);
    gap: 30px;
    min-height: 0;
    padding: 30px 34px;
}

.dashboard-hero h1 {
    max-width: 740px;
    font-size: 3rem;
    line-height: 1.08;
}

.dashboard-hero .hero-lead {
    max-width: 720px;
    font-size: 1rem;
    line-height: 1.52;
}

.dashboard-hero-side {
    display: grid;
    grid-template-rows: auto auto;
    gap: 12px;
}

.dashboard-command-panel {
    display: grid;
    gap: 10px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dashboard-command-panel .section-eyebrow {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.72);
}

.dashboard-command-panel strong {
    color: #ffffff;
    font-size: 1.18rem;
    line-height: 1.2;
}

.dashboard-command-panel p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
    line-height: 1.45;
}

.dashboard-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.dashboard-status-row span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.76rem;
    font-weight: 850;
}

.dashboard-hero .hero-summary {
    grid-template-columns: 1fr;
    gap: 10px;
}

.dashboard-hero .summary-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 14px 16px;
}

.dashboard-hero .summary-item span {
    min-width: 0;
    margin: 0;
    font-size: 0.78rem;
}

.dashboard-hero .summary-item strong {
    min-width: 0;
    max-width: 170px;
    margin: 0;
    text-align: right;
    font-size: 1.65rem;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.dashboard-hero .summary-item:nth-child(2) strong {
    max-width: 190px;
    font-size: 1.35rem;
}

.dashboard-hero .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 210px));
    max-width: 440px;
}

.dashboard-insight-strip {
    margin-top: -2px;
}

.insight-card {
    min-height: 82px;
}

.table-wrap {
    scrollbar-color: var(--primary) #e8f0f5;
}

.table-wrap::-webkit-scrollbar {
    height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
    background: #e8f0f5;
}

.table-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--primary);
}

@media (max-width: 1180px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-hero-side {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
        grid-template-rows: auto;
    }

    .dashboard-hero h1 {
        max-width: 760px;
        font-size: 2.65rem;
    }
}

@media (max-width: 900px) {
    .dashboard-hero-side {
        grid-template-columns: 1fr;
    }

    .dashboard-hero .hero-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-hero h1 {
        font-size: 2.35rem;
    }
}

@media (max-width: 760px) {
    .topbar-nav {
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 92px);
        overflow-y: auto;
    }

    .dashboard-hero {
        padding: 22px;
    }

    .dashboard-hero h1 {
        font-size: 1.9rem;
    }

    .dashboard-hero .quick-actions {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .dashboard-command-panel,
    .dashboard-hero .summary-item {
        padding: 14px;
    }

    .dashboard-status-row span {
        width: 100%;
    }

    .dashboard-hero .hero-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-hero .summary-item {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .dashboard-hero .summary-item strong {
        max-width: 100%;
        text-align: left;
    }

    .dashboard-page .card,
    .dashboard-page .stat-card,
    .dashboard-page .insight-card {
        border-radius: var(--radius);
    }

    .metric-strip {
        display: grid;
        grid-template-columns: 1fr;
    }

    .metric-pill {
        justify-content: space-between;
        width: 100%;
    }

    .field-full {
        grid-column: auto;
    }

    .filter-grid {
        padding: 14px;
    }

    .checkbox-field {
        align-items: flex-start;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .table,
    .table-users {
        min-width: 0 !important;
    }

    .table,
    .table thead,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .table tbody tr {
        margin-bottom: 12px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: #ffffff;
        box-shadow: 0 10px 24px rgba(15, 32, 51, 0.07);
    }

    .table tbody tr:nth-child(even),
    .table tbody tr:hover {
        background: #ffffff;
    }

    .table tbody tr[data-priority="1"] {
        box-shadow:
            inset 4px 0 0 var(--danger),
            0 10px 24px rgba(15, 32, 51, 0.07);
    }

    .table tbody tr[data-priority="2"] {
        box-shadow:
            inset 4px 0 0 #d89a14,
            0 10px 24px rgba(15, 32, 51, 0.07);
    }

    .table td {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        gap: 8px 12px;
        align-items: start;
        padding: 13px 14px;
        border-bottom: 1px solid #e7edf3;
        color: var(--text);
        text-align: left !important;
    }

    .table td:last-child {
        border-bottom: 0;
    }

    .table td[colspan] {
        display: block;
    }

    .table td[colspan] .empty-state {
        margin: 0;
    }

    .table td::before {
        color: var(--text-soft);
        font-size: 0.74rem;
        font-weight: 850;
        line-height: 1.25;
        text-transform: uppercase;
    }

    .table-meds td.col-id::before {
        content: "ID";
    }

    .table-meds td.col-priority::before {
        content: "Prioridade";
    }

    .table-meds td.col-name::before {
        content: "Medicamento";
    }

    .table-meds td.col-lote::before {
        content: "Lote / validade";
    }

    .table-meds td.col-stock::before {
        content: "Estoque";
    }

    .table-meds td.col-price::before {
        content: "Preco";
    }

    .table-meds td.col-status::before {
        content: "Status";
    }

    .table-meds td.col-actions::before,
    .table-users td:last-child::before {
        content: "Acoes";
    }

    .table-users td:nth-child(1)::before {
        content: "ID";
    }

    .table-users td:nth-child(2)::before {
        content: "Usuario";
    }

    .table-users td:nth-child(3)::before {
        content: "Perfil";
    }

    .table-users td:nth-child(4)::before {
        content: "Status";
    }

    .table-users td:nth-child(5)::before {
        content: "Criado em";
    }

    .table-meds td.col-name,
    .table-meds td.col-actions,
    .table-users td:nth-child(2),
    .table-users td:last-child {
        grid-template-columns: 1fr;
    }

    .table-meds td.col-stock .table-subtitle,
    .table-meds td.col-price,
    .table-meds td.col-actions,
    .table-users td:last-child {
        text-align: left;
    }

    .table-title,
    .table-subtitle {
        overflow-wrap: anywhere;
    }

    .table .action-group {
        display: grid;
        grid-template-columns: 1fr;
        justify-content: stretch;
        width: 100%;
        max-width: none;
    }

    .table .action-group .btn,
    .table .inline-form,
    .table .inline-form .btn {
        width: 100%;
    }
}

/* Relatorios operacionais - segunda fase */
.report-page {
    background:
        linear-gradient(90deg, rgba(15, 42, 68, 0.025) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 42, 68, 0.025) 1px, transparent 1px),
        #f5f7fa;
    background-size: 28px 28px, 28px 28px, auto;
}

.report-shell {
    display: grid;
    gap: 18px;
}

.report-header,
.report-card,
.report-metric {
    border: 1px solid #d9e3eb;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 32, 51, 0.06);
}

.report-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
    gap: 22px;
    align-items: start;
    padding: 22px 24px;
    border-left: 5px solid var(--primary);
}

.report-title-block h1 {
    margin: 0 0 8px;
    color: #071d33;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.12;
}

.report-title-block p {
    max-width: 720px;
    margin: 0;
    color: var(--text-soft);
}

.report-actions {
    display: grid;
    justify-items: end;
    gap: 12px;
}

.report-period-form,
.report-action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.report-period-button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #cbd8e3;
    border-radius: var(--radius-sm);
    background: #f8fbfd;
    color: #526173;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 900;
    transition:
        background-color 0.15s var(--ease),
        border-color 0.15s var(--ease),
        color 0.15s var(--ease);
}

.report-period-button:hover,
.report-period-button.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.report-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.report-metric {
    display: grid;
    gap: 5px;
    min-height: 112px;
    padding: 16px 18px;
    border-top: 4px solid var(--primary);
}

.report-metric-warning {
    border-top-color: #d89a14;
}

.report-metric span,
.report-summary-grid span,
.report-compact-list small,
.report-consumption-row span {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.report-metric strong {
    color: #071d33;
    font-size: 1.95rem;
    font-weight: 900;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.report-metric small {
    color: var(--text-muted);
}

.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
    align-items: start;
    gap: 18px;
}

.report-main-column,
.report-side-column {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.report-card {
    padding: 18px;
}

.report-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin: -2px 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2eaf1;
}

.report-card-header h2 {
    margin: 0;
    color: #071d33;
    font-size: 1.08rem;
    font-weight: 900;
}

.report-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #d8e3ec;
    border-radius: 999px;
    background: #f8fbfd;
    color: #526173;
    font-size: 0.76rem;
    font-weight: 900;
    white-space: nowrap;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.report-summary-grid div {
    display: grid;
    gap: 5px;
    min-height: 88px;
    padding: 14px;
    border-right: 1px solid #e0e8ef;
    border-bottom: 1px solid #e0e8ef;
}

.report-summary-grid div:nth-child(3n) {
    border-right: 0;
}

.report-summary-grid div:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.report-summary-grid strong {
    color: #071d33;
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1;
}

.report-consumption-list {
    display: grid;
    gap: 11px;
}

.report-consumption-row {
    display: grid;
    grid-template-columns: minmax(190px, 0.9fr) minmax(140px, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 62px;
    padding: 12px 14px;
    border: 1px solid #e2eaf1;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.report-consumption-row strong,
.report-compact-list strong {
    display: block;
    color: #071d33;
    font-weight: 900;
}

.report-consumption-row b,
.report-compact-list b {
    color: var(--primary-strong);
    font-size: 0.92rem;
    font-weight: 900;
    white-space: nowrap;
}

.report-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef5;
}

.report-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--teal));
}

.report-table-wrap {
    box-shadow: none;
}

.report-data-table {
    min-width: 840px;
}

.report-movement-table {
    min-width: 760px;
}

.report-data-table th {
    background: #f1f6fa;
}

.report-data-table td:first-child {
    color: var(--primary-strong);
    font-weight: 900;
}

.report-alert-list,
.report-compact-list {
    display: grid;
    gap: 9px;
}

.report-alert-list a,
.report-compact-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 11px 12px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.report-alert-list a:hover,
.report-compact-list a:hover {
    border-color: #c5d8e6;
    background: #f4f9fb;
}

.report-alert-list span {
    color: var(--text);
    font-weight: 850;
}

.report-alert-list strong {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 900;
}

.report-alert-list a:first-child strong,
.report-alert-list a:nth-child(3) strong {
    background: var(--warning-soft);
    color: var(--warning);
}

.report-compact-list span {
    min-width: 0;
}

@media (max-width: 1080px) {
    .report-header,
    .report-layout {
        grid-template-columns: 1fr;
    }

    .report-actions,
    .report-period-form,
    .report-action-buttons {
        justify-items: start;
        justify-content: flex-start;
    }

    .report-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .report-header,
    .report-card {
        padding: 16px;
    }

    .report-title-block h1 {
        font-size: 1.55rem;
    }

    .report-metric-grid,
    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .report-summary-grid div,
    .report-summary-grid div:nth-child(3n),
    .report-summary-grid div:nth-last-child(-n + 3) {
        border-right: 0;
        border-bottom: 1px solid #e0e8ef;
    }

    .report-summary-grid div:last-child {
        border-bottom: 0;
    }

    .report-action-buttons,
    .report-period-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .report-actions,
    .report-title-block {
        width: 100%;
        min-width: 0;
        justify-items: stretch;
    }

    .report-title-block h1 {
        overflow-wrap: anywhere;
    }

    .report-action-buttons .btn,
    .report-period-button {
        width: 100%;
    }

    .report-card-header,
    .report-consumption-row,
    .report-alert-list a,
    .report-compact-list a {
        display: grid;
        align-items: stretch;
    }

    .report-consumption-row {
        grid-template-columns: 1fr;
    }

    .report-data-table,
    .report-movement-table {
        min-width: 0;
    }

    .report-data-table td::before {
        content: attr(data-label);
    }
}

@media print {
    .topbar,
    .page-footer,
    .report-actions,
    .report-card-header .btn {
        display: none !important;
    }

    .report-page {
        background: #ffffff;
    }

    .report-header,
    .report-card,
    .report-metric {
        box-shadow: none;
    }

    .report-shell {
        width: 100%;
    }
}

/* Central de dados */
.central-page {
    background:
        linear-gradient(90deg, rgba(15, 42, 68, 0.03) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 42, 68, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, #f8fafc 0%, #f1f6f8 100%);
    background-size: 32px 32px, 32px 32px, auto;
}

.central-shell {
    display: grid;
    gap: 18px;
}

.central-hero,
.central-card,
.central-metrics article {
    border: 1px solid #d8e3ec;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(15, 32, 51, 0.07);
}

.central-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
    gap: 20px;
    align-items: center;
    padding: 24px;
    border-left: 5px solid var(--teal);
}

.central-hero h1 {
    margin: 0 0 9px;
    color: #071d33;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.12;
}

.central-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--text-soft);
}

.central-status-card {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 4px 10px;
    align-items: center;
    min-width: 260px;
    padding: 16px;
    border: 1px solid #cfe2dc;
    border-radius: var(--radius);
    background: #f2fbf8;
}

.central-hero-side {
    display: grid;
    gap: 9px;
}

.central-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.central-status-card strong,
.central-status-card small {
    display: block;
}

.central-status-card strong {
    color: #0d4f43;
    font-weight: 900;
}

.central-status-card small {
    grid-column: 2;
    color: #467066;
}

.central-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(7, 134, 95, 0.14);
}

.central-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.central-metrics article {
    display: grid;
    gap: 6px;
    min-height: 102px;
    padding: 16px;
    border-top: 4px solid var(--primary);
}

.central-metrics span,
.central-setting-list strong,
.central-table-list small,
.central-audit-list small,
.central-integration-grid small {
    color: var(--text-soft);
    font-size: 0.77rem;
    font-weight: 850;
    text-transform: uppercase;
}

.central-metrics strong {
    color: #071d33;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.central-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr);
    gap: 18px;
    align-items: start;
}

.central-card {
    padding: 18px;
}

.central-card-wide {
    min-width: 0;
}

.central-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2eaf1;
}

.central-card-header h2 {
    margin: 0;
    color: #071d33;
    font-size: 1.08rem;
    font-weight: 900;
}

.central-table-list,
.central-setting-list,
.central-endpoint-list,
.central-audit-list {
    display: grid;
    gap: 9px;
}

.central-table-list div,
.central-setting-list div,
.central-audit-list div,
.central-endpoint-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 52px;
    padding: 11px 12px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.central-table-list strong,
.central-audit-list strong {
    display: block;
    color: #071d33;
    font-weight: 900;
}

.central-table-list b,
.central-audit-list b {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 32px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 900;
}

.central-unit {
    display: grid;
    gap: 8px;
}

.central-unit strong {
    color: #071d33;
    font-size: 1.1rem;
    font-weight: 900;
}

.central-unit span,
.central-setting-list span {
    color: var(--text-soft);
}

.central-integration-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.central-integration-grid article {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 168px;
    padding: 14px;
    border: 1px solid #e0e8ef;
    border-radius: var(--radius);
    background: #fbfdfe;
}

.central-integration-grid h3 {
    margin: 0;
    color: #071d33;
    font-size: 1rem;
    font-weight: 900;
}

.central-integration-grid p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.45;
}

.central-badge {
    display: inline-flex;
    justify-content: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 900;
}

.central-badge-ativa {
    background: var(--success-soft);
    color: var(--success);
}

.central-badge-planejada {
    background: var(--info-soft);
    color: var(--info);
}

.central-badge-inativa {
    background: var(--danger-soft);
    color: var(--danger);
}

.central-endpoint-list a {
    justify-content: flex-start;
}

.central-endpoint-list a:hover,
.central-table-list div:hover,
.central-audit-list div:hover {
    border-color: #c5d8e6;
    background: #f4f9fb;
}

@media (max-width: 1180px) {
    .central-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .central-integration-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .central-hero,
    .central-grid {
        grid-template-columns: 1fr;
    }

    .central-status-card {
        min-width: 0;
    }
}

@media (max-width: 760px) {
    .central-hero,
    .central-card {
        padding: 16px;
    }

    .central-hero h1 {
        font-size: 1.55rem;
    }

    .central-metrics,
    .central-integration-grid,
    .central-hero-actions {
        grid-template-columns: 1fr;
    }

    .central-card-header,
    .central-table-list div,
    .central-setting-list div,
    .central-audit-list div {
        display: grid;
        align-items: stretch;
    }
}

/* Application shell: desktop sidebar and mobile drawer */
:root {
    --app-sidebar-width: 264px;
    --app-sidebar-collapsed-width: 82px;
}

.app-page {
    display: flex;
    min-height: 100vh;
    padding-left: var(--app-sidebar-width);
    transition: padding-left 0.22s var(--ease);
}

.app-page .page-wrap {
    width: 100%;
}

.page-wrap > .container,
.page-footer > .container {
    width: min(1280px, calc(100% - 40px));
}

.topbar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: var(--app-sidebar-width);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    background:
        linear-gradient(160deg, rgba(31, 157, 131, 0.16), transparent 34%),
        #0d2438;
    box-shadow: 12px 0 30px rgba(15, 32, 51, 0.13);
    transition:
        width 0.22s var(--ease),
        box-shadow 0.22s var(--ease);
}

.topbar::before {
    display: none;
}

.topbar::after {
    inset: 0 0 0 auto;
    width: 3px;
    height: auto;
    background: linear-gradient(180deg, var(--teal), var(--primary), #76c8ba);
}

.topbar .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 18px 14px 14px;
}

.sidebar-collapse {
    position: absolute;
    top: 30px;
    right: -14px;
    z-index: 3;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: #16354d;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(4, 15, 25, 0.24);
    cursor: pointer;
}

.sidebar-collapse:hover {
    border-color: rgba(117, 219, 197, 0.65);
    background: #1d4966;
}

.topbar .brand {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    gap: 11px;
    padding: 2px 5px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: var(--primary-strong);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.topbar .brand strong {
    font-size: 1.02rem;
}

.topbar .brand-eyebrow {
    display: block;
    overflow: hidden;
    max-width: 170px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.sidebar-status {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1px 8px;
    margin: 15px 4px 13px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.055);
}

.sidebar-status__dot {
    grid-row: 1 / span 2;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.12);
}

.sidebar-status span:not(.sidebar-status__dot) {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 800;
}

.sidebar-status small {
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.68rem;
    font-weight: 650;
}

.sidebar-section-label {
    display: block;
    padding: 0 11px 7px;
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar .topbar-nav {
    position: static;
    inset: auto;
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    scrollbar-width: thin;
}

.topbar .topbar-nav ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topbar .topbar-nav li {
    min-width: 0;
}

.topbar .topbar-link {
    position: relative;
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-height: 44px;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.84rem;
    font-weight: 750;
    text-align: left;
    box-shadow: none;
}

.topbar .topbar-link__icon {
    display: inline-grid;
    flex: 0 0 30px;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.065);
}

.topbar .topbar-link__icon i,
.topbar .topbar-link i {
    color: rgba(255, 255, 255, 0.58);
}

.topbar .topbar-link:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.075);
    color: #ffffff;
}

.topbar .topbar-link.is-active {
    border-color: rgba(100, 214, 190, 0.28);
    background: rgba(31, 157, 131, 0.18);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #46c3a8;
}

.topbar .topbar-link.is-active .topbar-link__icon {
    background: rgba(70, 195, 168, 0.18);
}

.topbar .topbar-link.is-active i {
    color: #75dbc5;
}

.topbar .topbar-count {
    position: static;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 6px;
    background: #e5484d;
    font-size: 0.67rem;
}

.sidebar-footer {
    flex: 0 0 auto;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar .sidebar-footer .user-chip {
    display: flex;
    width: 100%;
    min-height: 56px;
    max-width: none;
    padding: 8px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
}

.user-chip__avatar {
    display: inline-grid;
    flex: 0 0 34px;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(117, 219, 197, 0.14);
}

.user-chip__avatar i {
    color: #75dbc5;
}

.user-chip__identity {
    display: grid;
    min-width: 0;
}

.topbar .sidebar-footer .user-chip__name {
    align-self: end;
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.78rem;
}

.topbar .sidebar-footer .user-chip__role {
    align-self: start;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.68rem;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
    gap: 6px;
    margin-top: 7px;
}

.topbar .sidebar-actions .topbar-link {
    justify-content: center;
    min-height: 36px;
    padding: 0 8px;
    border-color: rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
}

.topbar .sidebar-actions .topbar-link-exit {
    margin-left: 0;
    color: #f5b8b8;
}

.topbar-toggle,
.sidebar-backdrop {
    display: none;
}

.page-footer {
    flex: 0 0 auto;
}

html[data-theme="dark"] .topbar {
    background:
        linear-gradient(160deg, rgba(31, 157, 131, 0.13), transparent 34%),
        #071827;
}

@media (min-width: 981px) {
    html:not([data-sidebar="collapsed"]) .topbar .brand > div:last-child {
        display: block;
    }

    html:not([data-sidebar="collapsed"]) .topbar-link > span:not(.topbar-link__icon),
    html:not([data-sidebar="collapsed"]) .sidebar-actions .topbar-link span {
        display: inline;
    }

    html[data-sidebar="collapsed"] .app-page {
        padding-left: var(--app-sidebar-collapsed-width);
    }

    html[data-sidebar="collapsed"] .topbar {
        width: var(--app-sidebar-collapsed-width);
    }

    html[data-sidebar="collapsed"] .topbar .container {
        padding-right: 10px;
        padding-left: 10px;
    }

    html[data-sidebar="collapsed"] .topbar .brand {
        justify-content: center;
        padding-right: 0;
        padding-left: 0;
    }

    html[data-sidebar="collapsed"] .topbar .brand > div:last-child,
    html[data-sidebar="collapsed"] .sidebar-status span:not(.sidebar-status__dot),
    html[data-sidebar="collapsed"] .sidebar-status small,
    html[data-sidebar="collapsed"] .sidebar-section-label,
    html[data-sidebar="collapsed"] .topbar-link > span:not(.topbar-link__icon):not(.btn-label),
    html[data-sidebar="collapsed"] .user-chip__identity,
    html[data-sidebar="collapsed"] .sidebar-actions .topbar-link > span:not(.btn-label),
    html[data-sidebar="collapsed"] .sidebar-actions .topbar-link .btn-label > span {
        display: none;
    }

    html[data-sidebar="collapsed"] .sidebar-status {
        display: grid;
        grid-template-columns: 1fr;
        place-items: center;
        min-height: 44px;
        margin-right: 0;
        margin-left: 0;
        padding: 0;
    }

    html[data-sidebar="collapsed"] .sidebar-status__dot {
        grid-row: auto;
    }

    html[data-sidebar="collapsed"] .topbar .topbar-link {
        justify-content: center;
        padding-right: 5px;
        padding-left: 5px;
    }

    html[data-sidebar="collapsed"] .topbar .topbar-link.is-active {
        box-shadow: inset 3px 0 0 #46c3a8;
    }

    html[data-sidebar="collapsed"] .topbar .topbar-count {
        position: absolute;
        top: 2px;
        right: 1px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        font-size: 0.6rem;
    }

    html[data-sidebar="collapsed"] .topbar .sidebar-footer .user-chip {
        justify-content: center;
        min-height: 48px;
        padding: 6px;
    }

    html[data-sidebar="collapsed"] .sidebar-actions {
        grid-template-columns: 1fr;
    }

    html[data-sidebar="collapsed"] .topbar .sidebar-actions .topbar-link {
        display: grid;
        place-items: center;
        width: 100%;
        min-height: 36px;
        padding: 0;
    }

    html[data-sidebar="collapsed"] .topbar .sidebar-actions .topbar-link .btn-label {
        display: inline-grid;
        place-items: center;
    }

    html[data-sidebar="collapsed"] .sidebar-footer {
        margin-top: 8px;
        padding-top: 9px;
    }
}

@media (max-width: 980px) {
    .app-page {
        padding-left: 0;
    }

    .app-page.sidebar-open {
        overflow: hidden;
    }

    .page-wrap > .container,
    .page-footer > .container {
        width: min(100%, calc(100% - 24px));
    }

    .topbar {
        position: sticky;
        inset: auto;
        top: 0;
        width: 100%;
        height: 64px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 26px rgba(15, 32, 51, 0.16);
    }

    .topbar::after {
        inset: auto 0 0;
        width: auto;
        height: 3px;
        background: linear-gradient(90deg, var(--teal), var(--primary), #76c8ba);
    }

    .topbar .container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: min(100%, calc(100% - 20px));
        height: 64px;
        min-height: 64px;
        margin: 0 auto;
        padding: 0;
    }

    .topbar .brand {
        width: auto;
        padding: 0;
        border: 0;
    }

    .topbar .brand-mark {
        width: 40px;
        height: 40px;
    }

    .topbar .brand-eyebrow {
        max-width: none;
    }

    .topbar-toggle {
        display: inline-flex;
        flex: 0 0 40px;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-panel {
        position: fixed;
        top: 64px;
        bottom: 0;
        left: 0;
        z-index: 85;
        display: flex;
        width: min(320px, calc(100% - 44px));
        padding: 0 14px 14px;
        overflow: hidden;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        background:
            linear-gradient(160deg, rgba(31, 157, 131, 0.15), transparent 34%),
            #0d2438;
        box-shadow: 18px 0 38px rgba(5, 18, 30, 0.28);
        transform: translateX(-105%);
        transition: transform 0.24s var(--ease);
    }

    .topbar.is-open .sidebar-panel {
        transform: translateX(0);
    }

    .topbar .topbar-nav {
        display: block;
    }

    .topbar .topbar-nav a.btn {
        width: 100%;
        justify-content: flex-start;
        border-color: transparent;
        border-radius: var(--radius-sm);
        background: transparent;
        color: rgba(255, 255, 255, 0.72);
    }

    .topbar .topbar-nav a.btn:hover {
        border-color: rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.075);
        color: #ffffff;
    }

    .topbar .topbar-nav a.topbar-link.is-active {
        border-color: rgba(100, 214, 190, 0.28);
        background: rgba(31, 157, 131, 0.18);
        color: #ffffff;
    }

    .topbar .topbar-nav a.topbar-link i,
    .topbar .topbar-nav a.topbar-link.is-active i {
        color: #75dbc5;
    }

    .topbar .sidebar-footer .user-chip {
        display: flex;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 64px 0 0;
        z-index: 70;
        display: block;
        border: 0;
        background: rgba(4, 15, 25, 0.56);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s var(--ease);
    }

    .app-page.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 560px) {
    .topbar .brand-eyebrow {
        display: none;
    }

    .topbar .brand strong {
        font-size: 0.98rem;
    }

    .sidebar-status {
        margin-top: 12px;
    }

    .page-wrap > .container,
    .page-footer > .container {
        width: min(100%, calc(100% - 20px));
    }
}

@media print {
    .app-page {
        display: block;
        padding-left: 0;
    }

    .topbar,
    .sidebar-backdrop {
        display: none !important;
    }
}

/* Dashboard: central, assistencial e API */
.dashboard-platform {
    display: grid;
    gap: 14px;
    padding: 20px;
    border: 1px solid #d7e3ec;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
    box-shadow: 0 12px 30px rgba(15, 42, 68, 0.07);
}

.dashboard-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e0e8ef;
}

.dashboard-section-heading h2 {
    margin: 0;
    color: #071d33;
    font-size: 1.28rem;
    font-weight: 900;
}

.dashboard-section-heading p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 0.86rem;
}

.dashboard-section-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.dashboard-platform-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.platform-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 116px;
    padding: 15px;
    border: 1px solid #dbe6ee;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 42, 68, 0.05);
    transition:
        border-color 0.18s var(--ease),
        box-shadow 0.18s var(--ease),
        transform 0.18s var(--ease);
}

.platform-card:hover {
    border-color: #b9d0df;
    box-shadow: 0 12px 26px rgba(15, 42, 68, 0.1);
    transform: translateY(-1px);
}

.platform-card__icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 1.05rem;
}

.platform-card__content {
    display: grid;
    min-width: 0;
}

.platform-card__content small {
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
}

.platform-card__content strong {
    margin: 3px 0;
    color: #071d33;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
}

.platform-card__content span {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.platform-card__arrow {
    color: #9aabb9;
    font-size: 0.8rem;
}

.platform-card-patient .platform-card__icon {
    background: #e5f4fb;
    color: #17638f;
}

.platform-card-care .platform-card__icon {
    background: var(--success-soft);
    color: var(--success);
}

.platform-card-integration .platform-card__icon {
    background: #f1ecff;
    color: #6e4eb8;
}

.platform-card-api .platform-card__icon {
    background: var(--warning-soft);
    color: var(--warning);
}

@media (max-width: 1180px) {
    .dashboard-platform-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .dashboard-platform,
    .dashboard-section-heading {
        display: grid;
        align-items: stretch;
    }

    .dashboard-section-actions,
    .dashboard-section-actions .btn {
        width: 100%;
    }

    .dashboard-section-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-platform-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark theme fixes after the final dashboard rules */
html[data-theme="dark"] .dashboard-platform,
html[data-theme="dark"] .dashboard-page .insight-card,
html[data-theme="dark"] .dashboard-page .kpi-card,
html[data-theme="dark"] .dashboard-panel .card-header,
html[data-theme="dark"] .dashboard-chart-card .card-header,
html[data-theme="dark"] .dashboard-panel .list-row,
html[data-theme="dark"] .forecast-row,
html[data-theme="dark"] .movement-row,
html[data-theme="dark"] .platform-card {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
}

html[data-theme="dark"] .dashboard-section-heading {
    border-color: var(--line);
}

html[data-theme="dark"] .dashboard-section-heading h2,
html[data-theme="dark"] .platform-card__content strong,
html[data-theme="dark"] .dashboard-page .insight-card strong,
html[data-theme="dark"] .dashboard-page .kpi-card strong,
html[data-theme="dark"] .dashboard-panel .card-header h2,
html[data-theme="dark"] .dashboard-chart-card .card-header h2,
html[data-theme="dark"] .dashboard-panel .list-row strong,
html[data-theme="dark"] .forecast-row strong,
html[data-theme="dark"] .movement-row strong {
    color: var(--ink);
}

html[data-theme="dark"] .dashboard-page .insight-card span,
html[data-theme="dark"] .dashboard-page .kpi-card span,
html[data-theme="dark"] .dashboard-page .kpi-card small,
html[data-theme="dark"] .platform-card__content small,
html[data-theme="dark"] .platform-card__content span {
    color: var(--text-soft);
}

html[data-theme="dark"] .platform-card-integration .platform-card__icon {
    background: #33284d;
    color: #c9b5ff;
}

/* Interface operacional 2026 */
.page-wrap > .container {
    width: min(1280px, calc(100% - 36px));
}

.page-wrap > .container > .card,
.patient-list-card,
.medicine-form-card,
.user-admin-card {
    overflow: hidden;
}

.page-wrap > .container > .card > .card-header,
.patient-list-card > .card-header,
.medicine-form-card > .card-header,
.user-admin-card > .card-header {
    margin: -20px -20px 20px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(31, 95, 139, 0.07), rgba(31, 157, 131, 0.045)),
        var(--surface);
}

.card-header h1 {
    margin-bottom: 6px;
    font-size: clamp(1.55rem, 2.4vw, 2.05rem);
}

.card-header h2 {
    margin-bottom: 0;
}

.section-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
}

.card-text {
    max-width: 760px;
    line-height: 1.6;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.metric-pill {
    justify-content: space-between;
    min-height: 48px;
    padding: 8px 13px;
    border-color: var(--line);
    border-radius: var(--radius);
    background: var(--surface-subtle);
}

.metric-pill strong {
    display: inline-grid;
    place-items: center;
    min-width: 29px;
    min-height: 29px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.filter-grid {
    gap: 12px;
    padding: 16px;
    border-color: var(--line);
    background: var(--surface-subtle);
    box-shadow: none;
}

.field {
    gap: 6px;
}

.field span,
.checkbox-field span {
    font-size: 0.82rem;
    font-weight: 750;
}

.field input,
.field select,
.field textarea,
.password-field input {
    min-height: 46px;
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: inset 0 1px 1px rgba(15, 32, 51, 0.025);
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.password-field input:hover {
    border-color: #9fb1c1;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.password-field input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(31, 157, 131, 0.13);
}

.filter-actions,
.form-actions {
    min-width: 0;
}

.filter-actions .btn {
    flex: 1 1 auto;
}

.btn {
    min-height: 42px;
    border-radius: var(--radius-sm);
}

.btn-small {
    min-height: 36px;
}

.btn-primary {
    background: var(--primary);
    box-shadow: 0 7px 16px rgba(31, 95, 139, 0.16);
}

.btn-primary:hover {
    background: var(--primary-strong);
}

.btn-secondary {
    border-color: var(--line-strong);
    background: var(--surface);
}

.table-wrap {
    border-color: var(--line);
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(15, 32, 51, 0.055);
}

.table {
    background: var(--surface);
}

.table th {
    padding-top: 13px;
    padding-bottom: 13px;
    background: #edf3f7;
    color: #4e6174;
}

.table td {
    padding-top: 14px;
    padding-bottom: 14px;
}

.table tbody tr {
    transition: background-color 0.15s var(--ease);
}

.table tbody tr:nth-child(even) {
    background: #fafcfd;
}

.table tbody tr:hover {
    background: #edf8f6;
}

.table-title {
    font-weight: 800;
}

.table-subtitle {
    line-height: 1.45;
}

.table .action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(74px, max-content));
    align-items: stretch;
    justify-content: start;
    gap: 6px;
    max-width: none;
}

.table .action-group .inline-form {
    display: contents;
}

.table .action-group .btn {
    width: 100%;
    min-height: 34px;
    padding-right: 10px;
    padding-left: 10px;
}

.table-meds {
    min-width: 1120px;
}

.table-meds th.col-actions,
.table-meds td.col-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    width: 210px;
    min-width: 210px;
    background: var(--surface);
    box-shadow: -10px 0 18px rgba(15, 32, 51, 0.07);
}

.table-meds th.col-actions {
    z-index: 3;
    background: #edf3f7;
}

.table-meds tbody tr:nth-child(even) td.col-actions {
    background: #fafcfd;
}

.table-meds tbody tr:hover td.col-actions {
    background: #edf8f6;
}

.table-patients th:last-child,
.table-patients td:last-child {
    width: 210px;
    min-width: 210px;
}

.table-users th:last-child,
.table-users td:last-child {
    width: 230px;
    min-width: 230px;
}

.badge,
.priority-chip {
    border-radius: var(--radius-sm);
}

.empty-state {
    border-radius: var(--radius);
    background: var(--surface-subtle);
}

.dashboard-page .container {
    gap: 16px;
}

.dashboard-hero {
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(132deg, #102a43 0%, #1b5c82 57%, #168c78 100%);
    background-size: 46px 46px, 46px 46px, auto;
}

.dashboard-hero .hero-pill,
.dashboard-command-panel,
.dashboard-status-row span,
.dashboard-hero .summary-item,
.dashboard-hero .quick-actions .btn {
    border-radius: var(--radius);
}

.dashboard-command-panel,
.dashboard-hero .summary-item {
    backdrop-filter: blur(8px);
}

.dashboard-command-panel strong {
    font-size: 1.28rem;
}

.dashboard-page .card,
.dashboard-page .stat-card,
.dashboard-page .insight-card,
.dashboard-platform,
.dashboard-panel,
.dashboard-chart-card,
.platform-card,
.kpi-card,
.insight-card {
    border-radius: var(--radius);
}

.insight-card i,
.kpi-icon,
.platform-card__icon,
.movement-row__type {
    border-radius: var(--radius);
}

.decision-center {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
    gap: 14px;
}

.decision-score-card,
.decision-priorities {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 26px rgba(15, 32, 51, 0.065);
}

.decision-score-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-top: 4px solid var(--teal);
}

.decision-score-card.is-warning {
    border-top-color: #d3911b;
}

.decision-score-card.is-danger {
    border-top-color: var(--danger);
}

.decision-score {
    display: grid;
    place-items: center;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--surface) 61%, transparent 63%),
        conic-gradient(
            var(--teal) calc(var(--operational-score) * 1%),
            var(--surface-muted) 0
        );
}

.decision-score-card.is-warning .decision-score {
    background:
        radial-gradient(circle at center, var(--surface) 61%, transparent 63%),
        conic-gradient(
            #d3911b calc(var(--operational-score) * 1%),
            var(--surface-muted) 0
        );
}

.decision-score-card.is-danger .decision-score {
    background:
        radial-gradient(circle at center, var(--surface) 61%, transparent 63%),
        conic-gradient(
            var(--danger) calc(var(--operational-score) * 1%),
            var(--surface-muted) 0
        );
}

.decision-score > div {
    display: flex;
    align-items: baseline;
}

.decision-score strong {
    color: var(--ink);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.decision-score span {
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 800;
}

.decision-score-copy h2,
.decision-priorities__header h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.22rem;
    font-weight: 900;
}

.decision-score-copy p {
    margin: 7px 0 0;
    color: var(--text-soft);
    font-size: 0.85rem;
    line-height: 1.5;
}

.decision-score-facts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.decision-score-facts span {
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 0.75rem;
    text-align: center;
}

.decision-score-facts strong {
    display: block;
    color: var(--ink);
    font-size: 1rem;
}

.decision-priorities {
    padding: 18px;
}

.decision-priorities__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.priority-list {
    display: grid;
    gap: 8px;
}

.priority-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    background: var(--surface-subtle);
    transition:
        border-color 0.16s var(--ease),
        background-color 0.16s var(--ease),
        transform 0.16s var(--ease);
}

.priority-item:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
    transform: translateX(2px);
}

.priority-item.is-danger {
    border-left-color: var(--danger);
}

.priority-item.is-warning {
    border-left-color: #d3911b;
}

.priority-item.is-success {
    border-left-color: var(--success);
}

.priority-item__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--info-soft);
    color: var(--info);
}

.priority-item.is-danger .priority-item__icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.priority-item.is-warning .priority-item__icon {
    background: var(--warning-soft);
    color: var(--warning);
}

.priority-item.is-success .priority-item__icon {
    background: var(--success-soft);
    color: var(--success);
}

.priority-item__copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.priority-item__copy strong {
    color: var(--ink);
    font-size: 0.88rem;
}

.priority-item__copy small {
    color: var(--text-soft);
    font-size: 0.76rem;
    line-height: 1.4;
}

.priority-item__action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
}

.dashboard-platform {
    padding: 18px;
    background: var(--surface);
}

.dashboard-kpis {
    margin-top: 0;
}

.kpi-card {
    min-height: 164px;
}

.dashboard-panel .card-header,
.dashboard-chart-card .card-header {
    border-radius: var(--radius) var(--radius) 0 0;
}

.dashboard-panel .list-row,
.forecast-row,
.movement-row,
.forecast-row__meta,
.expiry-bar__column {
    border-radius: var(--radius);
}

html[data-theme="dark"] .page-wrap > .container > .card > .card-header,
html[data-theme="dark"] .patient-list-card > .card-header,
html[data-theme="dark"] .medicine-form-card > .card-header,
html[data-theme="dark"] .user-admin-card > .card-header,
html[data-theme="dark"] .filter-grid,
html[data-theme="dark"] .metric-pill,
html[data-theme="dark"] .decision-score-card,
html[data-theme="dark"] .decision-priorities,
html[data-theme="dark"] .priority-item {
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] .metric-pill,
html[data-theme="dark"] .priority-item,
html[data-theme="dark"] .decision-score-facts span {
    background: var(--surface-subtle);
}

html[data-theme="dark"] .table th {
    background: var(--surface-muted);
    color: var(--text-soft);
}

html[data-theme="dark"] .table tbody tr:nth-child(even) {
    background: #172838;
}

html[data-theme="dark"] .table tbody tr:hover {
    background: #1b343d;
}

html[data-theme="dark"] .table-meds th.col-actions {
    background: var(--surface-muted);
}

html[data-theme="dark"] .table-meds td.col-actions {
    background: var(--surface);
    box-shadow: -10px 0 18px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .table-meds tbody tr:nth-child(even) td.col-actions {
    background: #172838;
}

html[data-theme="dark"] .table-meds tbody tr:hover td.col-actions {
    background: #1b343d;
}

html[data-theme="dark"] .field input:hover,
html[data-theme="dark"] .field select:hover,
html[data-theme="dark"] .field textarea:hover,
html[data-theme="dark"] .password-field input:hover {
    border-color: #577187;
}

html[data-theme="dark"] .decision-score-copy h2,
html[data-theme="dark"] .decision-priorities__header h2,
html[data-theme="dark"] .decision-score strong,
html[data-theme="dark"] .decision-score-facts strong,
html[data-theme="dark"] .priority-item__copy strong {
    color: var(--ink);
}

@media (max-width: 1080px) {
    .decision-center {
        grid-template-columns: 1fr;
    }

    .decision-score-card {
        grid-template-columns: 108px minmax(0, 1fr) minmax(300px, 0.8fr);
    }

    .decision-score-facts {
        grid-column: auto;
        padding: 0 0 0 16px;
        border-top: 0;
        border-left: 1px solid var(--line);
    }
}

@media (max-width: 820px) {
    .page-wrap > .container {
        width: min(100%, calc(100% - 24px));
    }

    .card-header,
    .page-wrap > .container > .card > .card-header,
    .patient-list-card > .card-header,
    .medicine-form-card > .card-header,
    .user-admin-card > .card-header {
        display: grid;
        align-items: stretch;
    }

    .card-header .quick-actions,
    .card-header .quick-actions .btn {
        width: 100%;
    }

    .card-header .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .decision-score-card {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .decision-score {
        width: 94px;
        height: 94px;
    }

    .decision-score-facts {
        grid-column: 1 / -1;
        padding: 12px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .priority-item {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .priority-item__action {
        grid-column: 2;
    }
}

@media (max-width: 620px) {
    .page-wrap > .container {
        width: min(100%, calc(100% - 20px));
    }

    .page-wrap > .container > .card > .card-header,
    .patient-list-card > .card-header,
    .medicine-form-card > .card-header,
    .user-admin-card > .card-header {
        margin: -20px -20px 18px;
        padding: 19px 18px 16px;
    }

    .card-header .quick-actions {
        grid-template-columns: 1fr;
    }

    .metric-strip,
    .decision-score-facts {
        grid-template-columns: 1fr;
    }

    .decision-score-card {
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 14px;
        padding: 16px;
    }

    .decision-score {
        width: 82px;
        height: 82px;
    }

    .decision-score strong {
        font-size: 1.55rem;
    }

    .decision-priorities {
        padding: 14px;
    }

    .decision-priorities__header {
        display: grid;
        align-items: stretch;
    }

    .decision-priorities__header .btn {
        width: 100%;
    }

    .priority-item {
        align-items: start;
    }

    .priority-item__action {
        white-space: normal;
    }

    .table .action-group {
        grid-template-columns: 1fr;
    }
}

/* Aplicacao responsiva 2.1 */
.topbar-mobile-actions,
.mobile-dock {
    display: none;
}

.sidebar-tools {
    margin: 10px 4px 2px;
}

.sidebar-tool {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.76);
    cursor: pointer;
    text-align: left;
}

.sidebar-tool:hover {
    border-color: rgba(117, 219, 197, 0.25);
    background: rgba(31, 157, 131, 0.12);
    color: #ffffff;
}

.sidebar-tool i {
    color: #75dbc5;
    text-align: center;
}

.sidebar-tool span {
    min-width: 0;
    overflow: hidden;
    font-size: 0.76rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-tool kbd {
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.48);
    font-family: inherit;
    font-size: 0.62rem;
}

.sidebar-status.is-offline .sidebar-status__dot {
    background: #ff8d8d;
    box-shadow: 0 0 0 5px rgba(255, 141, 141, 0.12);
}

.sidebar-actions .install-app {
    grid-column: 1 / -1;
}

.global-search {
    width: min(720px, calc(100% - 32px));
    max-height: min(720px, calc(100dvh - 48px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 30px 80px rgba(4, 20, 34, 0.32);
}

.global-search::backdrop {
    background: rgba(4, 18, 31, 0.68);
    backdrop-filter: blur(4px);
}

.global-search__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.global-search__header h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.22rem;
}

.icon-button {
    display: inline-grid;
    flex: 0 0 40px;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-subtle);
    color: var(--text);
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.global-search__field {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 8px;
    margin: 16px 20px 10px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-subtle);
}

.global-search__field:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(31, 157, 131, 0.13);
}

.global-search__field > i {
    color: var(--text-soft);
}

.global-search__field input {
    width: 100%;
    min-height: 50px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.global-search__body {
    max-height: min(510px, calc(100dvh - 190px));
    padding: 6px 20px 20px;
    overflow-y: auto;
}

.global-search__empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 42px 20px;
    color: var(--text-soft);
    text-align: center;
}

.global-search__empty > i {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
}

.global-search__empty strong {
    color: var(--ink);
}

.global-search__empty span {
    max-width: 430px;
    font-size: 0.85rem;
}

.global-search-group {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.global-search-group h3 {
    margin: 0;
    padding: 4px 2px;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
}

.global-search-result {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-subtle);
}

.global-search-result:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.global-search-result__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
}

.global-search-result.is-paciente .global-search-result__icon {
    background: var(--teal-soft);
    color: var(--teal-strong);
}

.global-search-result__copy {
    display: grid;
    min-width: 0;
}

.global-search-result__copy strong,
.global-search-result__copy small,
.global-search-result__copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result__copy strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.global-search-result__copy small {
    color: var(--text);
    font-size: 0.78rem;
}

.global-search-result__copy span {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.global-search-result__arrow {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.connection-status {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 180;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(360px, calc(100% - 32px));
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
    font-size: 0.82rem;
    font-weight: 750;
}

.connection-status[hidden] {
    display: none;
}

.connection-status.is-online i {
    color: var(--success);
}

.connection-status.is-offline {
    border-color: #efb0b0;
}

.connection-status.is-offline i {
    color: var(--danger);
}

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

.integration-official-grid > a {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.integration-official-grid > a:hover {
    border-color: var(--teal);
    transform: translateY(-1px);
}

.integration-official-grid > a > i:first-child {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--teal-soft);
    color: var(--teal-strong);
}

.integration-official-grid span {
    display: grid;
    min-width: 0;
}

.integration-official-grid strong {
    color: var(--ink);
    font-size: 0.86rem;
}

.integration-official-grid small {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.integration-official-grid > a > i:last-child {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.access-matrix {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.access-matrix > div {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 128px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}

.access-matrix .badge {
    width: fit-content;
}

.access-matrix strong {
    color: var(--ink);
    font-size: 0.88rem;
}

.access-matrix small {
    color: var(--text-soft);
    font-size: 0.75rem;
    line-height: 1.5;
}

.alerts-header-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.scroll-top {
    position: fixed;
    right: 22px;
    bottom: 78px;
    z-index: 70;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.scroll-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

html[data-theme="dark"] .global-search,
html[data-theme="dark"] .global-search__field,
html[data-theme="dark"] .global-search-result,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .connection-status,
html[data-theme="dark"] .scroll-top {
    border-color: var(--line);
    background: var(--surface);
}

@media (min-width: 981px) {
    html[data-sidebar="collapsed"] .sidebar-tools {
        margin-right: 0;
        margin-left: 0;
    }

    html[data-sidebar="collapsed"] .sidebar-tool {
        grid-template-columns: 1fr;
        min-height: 40px;
        padding: 5px;
    }

    html[data-sidebar="collapsed"] .sidebar-tool span,
    html[data-sidebar="collapsed"] .sidebar-tool kbd {
        display: none;
    }
}

@media (max-width: 980px) {
    .topbar-mobile-actions {
        display: flex;
        align-items: center;
        gap: 7px;
    }

    .topbar-search,
    .topbar-toggle {
        display: inline-grid;
        place-items: center;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
        cursor: pointer;
    }

    .sidebar-tools {
        margin-top: 12px;
    }

    .sidebar-tool kbd {
        display: none;
    }
}

@media (max-width: 760px) {
    .integration-official-grid {
        grid-template-columns: 1fr;
    }

    .access-matrix {
        grid-template-columns: 1fr;
    }

    body.app-page {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }

    .sidebar-panel {
        bottom: calc(66px + env(safe-area-inset-bottom));
    }

    .page-wrap {
        padding-top: 16px;
        padding-bottom: 28px;
    }

    .page-footer {
        padding-bottom: 8px;
    }

    .mobile-dock {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 120;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: calc(66px + env(safe-area-inset-bottom));
        padding: 6px 6px env(safe-area-inset-bottom);
        border-top: 1px solid var(--line);
        background: color-mix(in srgb, var(--surface) 94%, transparent);
        box-shadow: 0 -12px 30px rgba(6, 25, 41, 0.12);
        backdrop-filter: blur(16px);
    }

    .mobile-dock__item {
        position: relative;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 3px;
        min-width: 0;
        min-height: 54px;
        padding: 4px 2px;
        border: 0;
        border-radius: var(--radius);
        background: transparent;
        color: var(--text-soft);
        cursor: pointer;
    }

    .mobile-dock__item i {
        font-size: 1rem;
    }

    .mobile-dock__item span {
        max-width: 100%;
        overflow: hidden;
        font-size: 0.62rem;
        font-weight: 750;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-dock__item.is-active {
        background: var(--teal-soft);
        color: var(--teal-strong);
    }

    .mobile-dock__search {
        color: #ffffff;
    }

    .mobile-dock__search::before {
        content: "";
        position: absolute;
        inset: 5px 10px;
        z-index: -1;
        border-radius: var(--radius);
        background: var(--primary);
        box-shadow: 0 8px 18px rgba(31, 95, 139, 0.24);
    }

    .mobile-dock__item b {
        position: absolute;
        top: 3px;
        right: calc(50% - 20px);
        display: grid;
        place-items: center;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border-radius: 9px;
        background: var(--danger);
        color: #ffffff;
        font-size: 0.58rem;
    }

    .connection-status {
        right: 10px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        left: 10px;
        max-width: none;
    }

    .scroll-top {
        right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .global-search {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .global-search__header {
        padding-top: calc(14px + env(safe-area-inset-top));
    }

    .global-search__body {
        max-height: calc(100dvh - 168px - env(safe-area-inset-top));
        padding-right: 14px;
        padding-left: 14px;
    }

    .global-search__field {
        margin-right: 14px;
        margin-left: 14px;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .table {
        display: block;
        min-width: 0;
        background: transparent;
    }

    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .table tbody {
        display: grid;
        gap: 12px;
    }

    .table tbody tr {
        display: grid;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-xs);
    }

    .table tbody tr:nth-child(even),
    .table tbody tr:hover {
        background: var(--surface);
    }

    .table tbody td {
        display: grid;
        grid-template-columns: minmax(92px, 0.38fr) minmax(0, 0.62fr);
        align-items: start;
        gap: 12px;
        width: auto !important;
        min-width: 0 !important;
        padding: 11px 13px;
        border-bottom: 1px solid var(--line);
        background: transparent !important;
        text-align: left !important;
        box-shadow: none !important;
    }

    .table tbody td:last-child {
        border-bottom: 0;
    }

    .table tbody td::before {
        content: attr(data-label);
        color: var(--text-soft);
        font-size: 0.68rem;
        font-weight: 850;
        text-transform: uppercase;
    }

    .table tbody td[colspan] {
        display: block;
    }

    .table tbody td[colspan]::before {
        display: none;
    }

    .table .action-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .table .action-group .btn {
        min-height: 40px;
    }

    .table-meds th.col-actions,
    .table-meds td.col-actions {
        position: static;
    }

    .table-title,
    .table-subtitle,
    .table .badge-row {
        min-width: 0;
    }

    .filter-grid,
    .patient-filter-grid,
    .integration-search-form,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .filter-actions .btn,
    .form-actions .btn {
        width: 100%;
        min-height: 46px;
    }

    .alerts-header,
    .integrations-header,
    .central-hero,
    .report-header,
    .patient-profile {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .alerts-header {
        display: grid;
    }

    .alerts-header-actions,
    .alerts-header-actions .alerts-total,
    .alerts-header-actions .btn {
        width: 100%;
        justify-items: stretch;
    }

    .patient-profile-actions,
    .report-action-buttons,
    .central-hero-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .patient-profile-actions .btn,
    .report-action-buttons .btn,
    .central-hero-actions .btn {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .topbar .container {
        width: calc(100% - 16px);
    }

    .topbar-search,
    .topbar-toggle {
        width: 40px;
        height: 40px;
    }

    .topbar .brand strong {
        max-width: 170px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .global-search__header,
    .global-search__field,
    .global-search__body {
        padding-right: 12px;
        padding-left: 12px;
    }

    .global-search__field {
        margin-right: 12px;
        margin-left: 12px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .global-search-result {
        grid-template-columns: 38px minmax(0, 1fr) 14px;
        padding: 9px;
    }

    .global-search-result__icon {
        width: 36px;
        height: 36px;
    }

    .table tbody td {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .table .action-group {
        grid-template-columns: 1fr;
    }
}
/* Version 2.3: settings, structured addresses, maps and analytical charts */
.field-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
}

.field-action .icon-button {
    width: 42px;
    height: 42px;
}

[data-cep-status] {
    min-height: 18px;
}

[data-cep-status][data-state="success"] {
    color: #0f766e;
}

[data-cep-status][data-state="error"] {
    color: #b91c1c;
}

.coordinate-picker {
    display: grid;
    gap: 12px;
}

.coordinate-picker__header,
.settings-header,
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.coordinate-picker__header > div {
    display: grid;
    gap: 4px;
}

.coordinate-picker__header > div > span {
    font-weight: 800;
    color: var(--text, #17354a);
}

.coordinate-map {
    width: 100%;
    min-height: 320px;
    border: 1px solid var(--border, #d5e1e8);
    border-radius: 8px;
    overflow: hidden;
    background: #dceaf0;
    z-index: 1;
}

.coordinate-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.settings-page,
.map-page {
    padding-bottom: 110px;
}

.settings-header,
.map-header {
    margin-bottom: 22px;
}

.settings-header h1,
.map-header h1 {
    margin: 5px 0 8px;
}

.settings-header p,
.map-header p {
    margin: 0;
    max-width: 760px;
    color: var(--text-muted, #617789);
}

.settings-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.settings-section {
    margin: 0;
}

.settings-section:nth-child(3) {
    grid-row: span 2;
}

.settings-facts {
    display: grid;
    gap: 10px;
}

.permission-grid {
    display: grid;
    gap: 8px;
}

.permission-grid > div {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border-left: 3px solid #0f766e;
    background: rgba(15, 118, 110, 0.06);
}

.permission-grid span {
    color: var(--text-muted, #617789);
    font-size: 0.86rem;
    line-height: 1.45;
}

.settings-facts > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border, #d5e1e8);
}

.settings-facts span {
    color: var(--text-muted, #617789);
}

.settings-savebar {
    position: static;
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(15, 118, 110, 0.26);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface, #fff) 94%, #ccfbf1);
    box-shadow: 0 16px 36px rgba(15, 42, 68, 0.16);
}

.settings-savebar span {
    color: var(--text-muted, #617789);
    font-weight: 700;
}

.map-workspace {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
    gap: 18px;
    min-height: 620px;
}

.map-sidebar {
    align-self: stretch;
    margin: 0;
}

.map-toggle {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--border, #d5e1e8);
    cursor: pointer;
}

.map-toggle__swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.map-toggle__swatch.is-unit {
    background: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
}

.map-privacy-note {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    margin: 18px 0;
    padding: 13px;
    border-left: 3px solid #0f766e;
    background: rgba(15, 118, 110, 0.08);
}

.map-privacy-note p {
    margin: 0;
    color: var(--text-muted, #617789);
    font-size: 0.86rem;
    line-height: 1.5;
}

.map-canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 620px;
    border: 1px solid var(--border, #d5e1e8);
    border-radius: 8px;
    overflow: hidden;
    background: #dceaf0;
}

.operational-map {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.map-empty {
    position: absolute;
    z-index: 2;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    display: grid;
    justify-items: center;
    gap: 8px;
    width: min(360px, calc(100% - 32px));
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: #17354a;
    text-align: center;
    backdrop-filter: blur(8px);
}

.map-popup {
    display: grid;
    gap: 4px;
    min-width: 150px;
}

.map-popup span {
    color: #617789;
}

.map-popup a {
    margin-top: 4px;
    color: #0f766e;
    font-weight: 800;
}

.report-chart-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.report-chart-card {
    margin: 0;
    min-width: 0;
}

.report-chart-wide {
    grid-column: 1 / -1;
}

.chart-canvas {
    position: relative;
    width: 100%;
    height: 330px;
}

.report-chart-wide .chart-canvas {
    height: 360px;
}

.system-notifications-card {
    margin-top: 18px;
}

.system-notification {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.system-notification.is-critico {
    border-left-color: #dc2626;
}

.system-notification.is-aviso {
    border-left-color: #d97706;
}

.system-notification.is-sucesso {
    border-left-color: #0f766e;
}

.legal-consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    color: var(--text-muted, #617789);
    font-size: 0.86rem;
    line-height: 1.45;
}

.legal-consent input {
    margin-top: 3px;
}

.legal-consent a,
.legal-document a {
    color: #0f766e;
    font-weight: 800;
}

.legal-page {
    min-height: 100vh;
    background: #eef5f7;
}

.legal-shell {
    max-width: 920px;
    padding-top: 42px;
    padding-bottom: 42px;
}

.legal-document {
    margin: 0;
}

.legal-document h1 {
    margin: 8px 0 18px;
}

.legal-document h2 {
    margin: 24px 0 8px;
    font-size: 1.08rem;
}

.legal-document p {
    color: var(--text-muted, #617789);
    line-height: 1.7;
}

@media (max-width: 900px) {
    .settings-layout,
    .report-chart-section {
        grid-template-columns: 1fr;
    }

    .settings-section:nth-child(3) {
        grid-row: auto;
    }

    .report-chart-wide {
        grid-column: auto;
    }

    .map-workspace {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .map-canvas-wrap {
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .coordinate-picker__header,
    .settings-header,
    .map-header,
    .settings-savebar {
        align-items: stretch;
        flex-direction: column;
    }

    .coordinate-fields {
        grid-template-columns: 1fr;
    }

    .coordinate-map {
        min-height: 280px;
    }

    .map-canvas-wrap {
        min-height: 460px;
    }

    .chart-canvas,
    .report-chart-wide .chart-canvas {
        height: 290px;
    }

    .system-notification {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .system-notification > b {
        display: none;
    }
}

/* Final visual polish */
.topbar .brand-mark {
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.topbar .brand-mark img {
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    max-width: none;
    margin: -1px;
}

.app-page .card,
.app-page .report-card,
.app-page .report-header,
.app-page .report-metric,
.app-page .patient-profile,
.app-page .alerts-header,
.app-page .alerts-summary a,
.app-page .central-card,
.app-page .central-hero {
    border-color: #d5e1e9;
    box-shadow: 0 8px 22px rgba(15, 42, 68, 0.055);
}

.app-page .card:hover,
.app-page .report-card:hover,
.app-page .central-card:hover {
    border-color: #c6d7e2;
}

.app-page input:not([type="checkbox"]):not([type="radio"]),
.app-page select,
.app-page textarea {
    border-color: #c9d7e1;
    background: var(--surface, #ffffff);
}

.app-page input:not([type="checkbox"]):not([type="radio"]):focus,
.app-page select:focus,
.app-page textarea:focus {
    border-color: #238d9b;
    box-shadow: 0 0 0 3px rgba(35, 141, 155, 0.13);
}

.app-page .table-wrap {
    border-color: #d5e1e9;
    box-shadow: none;
}

.app-page .table tbody tr:hover {
    background: rgba(31, 95, 139, 0.035);
}

.report-layout {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
    isolation: isolate;
}

.report-main-column,
.report-side-column,
.report-main-column > *,
.report-side-column > * {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.report-layout .report-card {
    overflow: hidden;
}

.report-side-column {
    position: relative;
    z-index: 1;
    align-content: start;
}

.report-consumption-row {
    grid-template-columns: minmax(0, 0.9fr) minmax(120px, 1.1fr) max-content;
    overflow: hidden;
}

.report-consumption-row > *,
.report-bar {
    min-width: 0;
}

.report-consumption-row strong,
.report-consumption-row span {
    overflow-wrap: anywhere;
}

body[data-page="relatorios"] .scroll-top {
    display: none !important;
}

@media (max-width: 1180px) {
    .report-layout {
        grid-template-columns: 1fr;
    }

    .report-side-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-side-column > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .report-side-column {
        grid-template-columns: 1fr;
    }

    .report-side-column > :last-child:nth-child(odd) {
        grid-column: auto;
    }

    .report-consumption-row {
        grid-template-columns: 1fr;
    }

    .report-consumption-row b {
        justify-self: start;
    }
}

html[data-theme="dark"] .app-page .card,
html[data-theme="dark"] .app-page .report-card,
html[data-theme="dark"] .app-page .report-header,
html[data-theme="dark"] .app-page .report-metric,
html[data-theme="dark"] .app-page .patient-profile,
html[data-theme="dark"] .app-page .alerts-header,
html[data-theme="dark"] .app-page .alerts-summary a,
html[data-theme="dark"] .app-page .central-card,
html[data-theme="dark"] .app-page .central-hero {
    border-color: var(--line);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Sidebar final refinement */
.topbar {
    border-right-color: rgba(81, 207, 180, 0.32);
    background:
        linear-gradient(180deg, rgba(24, 126, 112, 0.18) 0, transparent 180px),
        #0b2639;
    box-shadow: 10px 0 28px rgba(6, 24, 38, 0.16);
}

.topbar::after {
    width: 2px;
    background: #40c7ad;
}

.topbar .container {
    padding: 16px 13px 12px;
}

.topbar .brand {
    gap: 12px;
    padding: 4px 6px 15px;
}

.topbar .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(3, 16, 27, 0.24);
}

.topbar .brand-eyebrow {
    max-width: 175px;
    margin-bottom: 3px;
    color: rgba(219, 239, 246, 0.68);
    font-size: 0.64rem;
    font-weight: 800;
}

.topbar .brand strong {
    color: #ffffff;
    font-size: 1.04rem;
    line-height: 1.12;
}

.sidebar-collapse {
    top: 27px;
    right: -17px;
    width: 34px;
    height: 34px;
    border-color: rgba(108, 218, 195, 0.42);
    background: #143c55;
    box-shadow: 0 7px 18px rgba(4, 18, 30, 0.28);
    transition:
        border-color 0.18s var(--ease),
        background-color 0.18s var(--ease),
        transform 0.18s var(--ease);
}

.sidebar-collapse:hover {
    border-color: #65d6be;
    background: #1b5269;
    transform: translateX(1px);
}

.sidebar-status {
    min-height: 54px;
    margin: 13px 5px 8px;
    padding: 9px 11px;
    border-color: rgba(123, 205, 190, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 3px 0 0 rgba(63, 198, 171, 0.55);
}

.sidebar-status__dot {
    width: 8px;
    height: 8px;
    box-shadow:
        0 0 0 4px rgba(74, 222, 128, 0.12),
        0 0 12px rgba(74, 222, 128, 0.38);
}

.sidebar-status span:not(.sidebar-status__dot) {
    font-size: 0.76rem;
}

.sidebar-status small {
    color: rgba(218, 232, 240, 0.56);
    font-size: 0.66rem;
}

.sidebar-tools {
    margin: 7px 5px 7px;
}

.sidebar-tool {
    min-height: 40px;
    padding: 5px 8px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(5, 25, 40, 0.28);
}

.sidebar-tool:hover {
    border-color: rgba(87, 211, 185, 0.38);
    background: rgba(34, 152, 132, 0.13);
}

.sidebar-tool i {
    color: #61d3bd;
    font-size: 0.9rem;
}

.sidebar-tool span {
    font-size: 0.74rem;
}

.sidebar-tool kbd {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.52);
}

.sidebar-section-label {
    padding: 1px 10px 5px;
    color: rgba(198, 219, 230, 0.48);
    font-size: 0.61rem;
}

.topbar .topbar-nav {
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(105, 197, 181, 0.28) transparent;
}

.topbar .topbar-nav::-webkit-scrollbar {
    width: 4px;
}

.topbar .topbar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.topbar .topbar-nav::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(105, 197, 181, 0.28);
}

.topbar .topbar-nav ul {
    gap: 2px;
}

.topbar .topbar-link {
    min-height: 39px;
    padding: 4px 8px;
    border-radius: 7px;
    color: rgba(226, 237, 243, 0.72);
    font-size: 0.8rem;
}

.topbar .topbar-link__icon {
    flex-basis: 29px;
    width: 29px;
    height: 29px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
}

.topbar .topbar-link__icon i,
.topbar .topbar-link i {
    color: rgba(205, 224, 234, 0.62);
    font-size: 0.85rem;
}

.topbar .topbar-link:hover {
    border-color: rgba(115, 205, 190, 0.14);
    background: rgba(255, 255, 255, 0.065);
}

.topbar .topbar-link.is-active {
    border-color: rgba(78, 207, 179, 0.42);
    background: #104653;
    box-shadow:
        inset 3px 0 0 #45d2b4,
        0 6px 16px rgba(4, 20, 31, 0.16);
}

.topbar .topbar-link.is-active .topbar-link__icon {
    background: rgba(69, 210, 180, 0.16);
}

.topbar .topbar-link.is-active i {
    color: #70dec7;
}

.sidebar-footer {
    margin-top: 9px;
    padding-top: 9px;
    border-top-color: rgba(255, 255, 255, 0.09);
}

.topbar .sidebar-footer .user-chip {
    min-height: 52px;
    padding: 7px 8px;
    border: 1px solid rgba(119, 204, 189, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

.user-chip__avatar {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: rgba(83, 204, 181, 0.15);
}

.topbar .sidebar-footer .user-chip__name {
    font-size: 0.75rem;
}

.topbar .sidebar-footer .user-chip__role {
    color: rgba(205, 222, 232, 0.52);
    font-size: 0.64rem;
}

.sidebar-actions {
    gap: 5px;
    margin-top: 6px;
}

.topbar .sidebar-actions .topbar-link {
    min-height: 34px;
    border-radius: 7px;
    background: rgba(4, 22, 36, 0.18);
    font-size: 0.7rem;
}

.topbar .sidebar-actions .topbar-link:hover {
    background: rgba(255, 255, 255, 0.07);
}

.topbar .sidebar-actions .topbar-link-exit {
    color: #f1b1b1;
}

@media (min-width: 981px) {
    html[data-sidebar="collapsed"] .topbar .container {
        padding: 14px 9px 11px;
    }

    html[data-sidebar="collapsed"] .topbar .brand-mark {
        width: 44px;
        height: 44px;
    }

    html[data-sidebar="collapsed"] .sidebar-status {
        min-height: 40px;
        margin-top: 11px;
        box-shadow: none;
    }

    html[data-sidebar="collapsed"] .topbar .topbar-link {
        min-height: 39px;
    }
}

@media (max-width: 980px) {
    .topbar .brand-mark {
        width: 40px;
        height: 40px;
    }

    .sidebar-panel {
        padding-right: 12px;
        padding-left: 12px;
        background:
            linear-gradient(180deg, rgba(24, 126, 112, 0.18) 0, transparent 180px),
            #0b2639;
    }

    .sidebar-status {
        margin-top: 11px;
    }
}
