:root {
    --color-primary: #0aa9a5;
    --color-primary-strong: #04827f;
    --color-surface: #ffffff;
    --color-surface-alt: #f4f7fb;
    --color-surface-muted: #edf1f7;
    --color-border: #d6dde7;
    --color-text: #1f2937;
    --color-text-muted: #4b5563;
    --color-success: #15803d;
    --color-warning: #b45309;
    --color-danger: #b91c1c;
    --radius-sm: 8px;
    --radius-md: 14px;
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.08);
    --layout-width: min(1180px, calc(100vw - 3rem));
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #f7fafc 0%, #eef2f7 100%);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 20%, rgba(10, 169, 165, 0.12), transparent 40%),
                radial-gradient(circle at 80% 10%, rgba(72, 187, 255, 0.1), transparent 45%),
                radial-gradient(circle at 50% 80%, rgba(10, 169, 165, 0.14), transparent 55%);
    z-index: -2;
}

body.theme-dark {
    --color-surface: #1f2937;
    --color-surface-alt: rgba(59, 130, 246, 0.1);
    --color-surface-muted: #273449;
    --color-border: rgba(148, 163, 184, 0.45);
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.45);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.6);
    background: radial-gradient(circle at 20% 20%, rgba(30, 64, 175, 0.32), transparent 45%),
                radial-gradient(circle at 80% 10%, rgba(2, 132, 199, 0.25), transparent 50%),
                linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

body.theme-dark::before {
    background: radial-gradient(circle at 20% 20%, rgba(8, 145, 178, 0.16), transparent 45%),
                radial-gradient(circle at 80% 10%, rgba(59, 130, 246, 0.18), transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(14, 116, 144, 0.24), transparent 55%);
}

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

a:hover {
    color: var(--color-primary-strong);
}

.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    left: 50%;
    top: 1rem;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    z-index: 2000;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

body.theme-dark .app-header {
    background: rgba(15, 23, 42, 0.85);
    border-bottom-color: rgba(148, 163, 184, 0.35);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--color-primary), #06b6d4);
    color: #fff;
    border-radius: 16px;
    font-weight: 700;
    letter-spacing: 1px;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.app-brand-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.app-brand-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: var(--color-surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.menu-toggle:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.menu-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
}

.menu-toggle-line + .menu-toggle-line {
    margin-top: 4px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: start;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
}

.app-navigation {
    position: sticky;
    top: calc(5.25rem);
    align-self: start;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(148, 163, 184, 0.2);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.app-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0.75rem;
}

.app-navigation li + li {
    margin-top: 0.25rem;
}

.app-navigation-theme + li {
    margin-top: 0.75rem;
}

.app-navigation-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    transition: all 0.25s ease;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    appearance: none;
}

.app-navigation-link:hover,
.app-navigation-link:focus-visible {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.app-navigation-theme {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.theme-toggle-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.app-navigation-link.is-active {
    background: linear-gradient(135deg, rgba(10, 169, 165, 0.15), rgba(6, 182, 212, 0.2));
    color: var(--color-primary-strong);
    box-shadow: inset 0 0 0 1px rgba(10, 169, 165, 0.35);
}

.app-navigation-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

body.theme-dark .menu-toggle {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.45);
}

body.theme-dark .menu-toggle-line {
    background: #e2e8f0;
}

body.theme-dark .app-navigation {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

body.theme-dark .app-navigation-theme {
    border-bottom-color: rgba(148, 163, 184, 0.35);
}

body.theme-dark .app-navigation-link {
    color: var(--color-text-muted);
}

body.theme-dark .app-navigation-link:hover,
body.theme-dark .app-navigation-link:focus-visible {
    background: rgba(30, 64, 175, 0.2);
    color: #f8fafc;
}

body.theme-dark .app-navigation-link.is-active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(59, 130, 246, 0.25));
    color: #38bdf8;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.5);
}

body.theme-dark .app-navigation-footer {
    border-top-color: rgba(148, 163, 184, 0.35);
}

.app-main {
    width: 100%;
    max-width: var(--layout-width);
    margin: 0 auto;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
}

.page-header p {
    margin: 0;
    color: var(--color-text-muted);
    max-width: 32rem;
}

.app-section {
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

body.theme-dark .app-section {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.35);
}

.app-section + .app-section {
    margin-top: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    padding: 1.75rem;
    border-radius: var(--radius-md);
    background: linear-gradient(140deg, rgba(10, 169, 165, 0.08), rgba(255, 255, 255, 0.8));
    border: 1px solid rgba(10, 169, 165, 0.15);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

body.theme-dark .dashboard-card {
    background: linear-gradient(140deg, rgba(6, 182, 212, 0.2), rgba(15, 23, 42, 0.95));
    border-color: rgba(56, 189, 248, 0.35);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.dashboard-card span {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.dashboard-card strong {
    font-size: 1.5rem;
    font-weight: 600;
}

.dashboard-card .card-action {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--color-primary-strong);
}

.card-action::after {
    content: '→';
    font-weight: 600;
    transition: transform 0.25s ease;
}

.dashboard-card:hover .card-action::after {
    transform: translateX(4px);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid transparent;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.25);
    color: var(--color-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--color-danger);
}

.alert-info {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--color-primary-strong);
}

body.theme-dark .alert-success {
    background: rgba(22, 163, 74, 0.2);
    border-color: rgba(22, 163, 74, 0.35);
}

body.theme-dark .alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.35);
}

body.theme-dark .alert-info {
    background: rgba(6, 182, 212, 0.22);
    border-color: rgba(6, 182, 212, 0.35);
}

.form-grid {
    display: grid;
    gap: 1.25rem;
}

.form-grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-hint {
    margin: 0.25rem 0 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.indisponibilidade-list {
    display: grid;
    gap: 0.75rem;
}

.indisponibilidade-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.indisponibilidade-row > div {
    flex: 1 1 200px;
}

.indisponibilidade-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.indisponibilidade-actions .btn-link {
    padding: 0.35rem 0.75rem;
}

.indisponibilidade-actions .btn-link.is-disabled,
.indisponibilidade-actions .btn-link[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.indisponibilidade-add {
    margin-top: 0.75rem;
}

.form-control,
.form-select,
input[type="date"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark input[type="date"],
body.theme-dark input[type="text"],
body.theme-dark input[type="email"],
body.theme-dark input[type="password"],
body.theme-dark select {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.45);
    color: var(--color-text);
}

body.theme-dark .form-control::placeholder,
body.theme-dark .form-select::placeholder,
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(10, 169, 165, 0.15);
}

.form-label,
label {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.35rem;
    display: inline-block;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.95);
}

body.theme-dark .checkbox-pill {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.45);
}

.checkbox-pill input {
    width: 16px;
    height: 16px;
}

.button,
button,
.btn-primary,
.btn-outline,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover,
button:hover,
.btn-primary:hover,
.btn-outline:hover,
.btn-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary-strong);
    border: 1px solid rgba(10, 169, 165, 0.4);
}

.btn-link {
    background: transparent;
    color: var(--color-primary-strong);
    padding: 0;
}

body.theme-dark .btn-outline {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.5);
}

body.theme-dark .btn-link {
    color: #38bdf8;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(226, 232, 240, 0.7);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
}

body.theme-dark .table-container {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.35);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

thead {
    background: var(--color-surface-muted);
}

body.theme-dark tbody td {
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}

thead th {
    text-align: left;
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

tbody td {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.12);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

body.theme-dark .badge-success {
    background: rgba(22, 163, 74, 0.22);
}

body.theme-dark .badge-warning {
    background: rgba(217, 119, 6, 0.22);
}

body.theme-dark .badge-danger {
    background: rgba(239, 68, 68, 0.22);
}

.card-list {
    display: grid;
    gap: 1.25rem;
}

.card-list-item {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 1rem;
}

body.theme-dark .card-list-item {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.35);
}

.card-list-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}

.card-list-actions {
    display: flex;
    gap: 0.75rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

body.theme-dark .tag {
    border-color: rgba(148, 163, 184, 0.45);
}

.catalog-grid {
    display: grid;
    gap: 1.25rem;
}

.catalog-card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 1.1rem;
}

body.theme-dark .catalog-card {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.35);
}

.catalog-card.is-scheduled {
    border-color: rgba(10, 169, 165, 0.35);
    box-shadow: 0 20px 40px rgba(10, 169, 165, 0.12);
}

.catalog-card.is-pending {
    border-style: dashed;
}

.catalog-card h3 {
    margin: 0;
    font-size: 1.3rem;
}

.catalog-card .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--color-text-muted);
}

.catalog-card ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--color-text-muted);
}

.catalog-card form {
    display: grid;
    gap: 0.75rem;
}

.catalog-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-bar .filter-field {
    flex: 1 1 220px;
    min-width: 200px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    white-space: nowrap;
    min-height: 2rem;
}

.card-list-header > .status-pill {
    margin-left: auto;
}

.status-pill[data-status="concluido"] {
    background: rgba(22, 163, 74, 0.12);
    color: var(--color-success);
}

.status-pill[data-status="parcial"] {
    background: rgba(217, 119, 6, 0.12);
    color: var(--color-warning);
}

.status-pill[data-status="pendente"] {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

body.theme-dark .status-pill[data-status="concluido"] {
    background: rgba(22, 163, 74, 0.2);
}

body.theme-dark .status-pill[data-status="parcial"] {
    background: rgba(217, 119, 6, 0.2);
}

body.theme-dark .status-pill[data-status="pendente"] {
    background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 640px) {
    .card-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .card-list-header > .status-pill {
        margin-left: 0;
        width: 100%;
    }
}

.app-footer {
    margin: 3rem auto 2rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .app-navigation {
        position: fixed;
        top: 5rem;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: min(420px, calc(100vw - 2.5rem));
        transform: translateY(-20px);
        opacity: 0;
        pointer-events: none;
    }

    .app-navigation.is-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 1rem 1.25rem;
    }

    .app-shell {
        padding: 1.25rem;
    }

    .app-main {
        width: 100%;
    }

    .dashboard-card {
        padding: 1.25rem;
    }

    .filter-bar {
        gap: 0.75rem;
    }

    .filter-bar .filter-field {
        flex: 1 1 100%;
    }
}

.painel-controles {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-end;
}

.area-filtros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    flex: 1 1 480px;
}

.filtro-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.area-acoes {
    display: flex;
    gap: 0.75rem;
}

.cabecalho-relatorio {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.cabecalho-relatorio h2 {
    margin: 0;
}

.resumo-container,
.relatorio-detalhado {
    display: grid;
    gap: 1rem;
}

.relatorio-detalhado {
    margin-top: 2rem;
}

@media print {
    .app-header,
    .app-navigation,
    .app-footer,
    .menu-toggle,
    .area-acoes,
    .skip-link {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .app-shell,
    .app-main,
    .app-section {
        padding: 0;
        margin: 0;
        box-shadow: none;
        background: transparent;
    }
}

.app-navigation-icon {
    width: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
