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

html {
    scroll-behavior: smooth;
}

body {
    --page-shell-max-width: 1240px;
    --page-shell-gutter: 32px;
    position: relative;
    font-family: var(--font-family-base), system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-color);
    background:
        radial-gradient(circle at top left, rgba(var(--accent-color-rgb), 0.08), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, var(--background-color) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background: none;
    opacity: 0;
}

body::after {
    background:
        radial-gradient(circle at 88% 12%, rgba(var(--accent-color-rgb), 0.07), transparent 18%);
}

body.workspace-fluid-page {
    --page-shell-max-width: 1840px;
    --page-shell-gutter: 40px;
}

.container {
    width: min(var(--page-shell-max-width), calc(100% - var(--page-shell-gutter)));
    margin: 0 auto;
}

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

img {
    display: block;
    max-width: 100%;
}

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

main {
    position: relative;
    z-index: 1;
    flex-grow: 1;
    padding: 34px 0 48px;
}

body.workspace-fluid-page main {
    padding: 24px 0 40px;
}

header:not(.workspace-topbar) {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 18px 0;
    background: rgba(248, 250, 252, 0.9);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

header:not(.workspace-topbar) .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

header:not(.workspace-topbar) h1,
header:not(.workspace-topbar) h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #0f172a;
    font-family: var(--font-family-display, var(--font-family-base));
    font-size: clamp(1.55rem, 2vw, 2.2rem);
    letter-spacing: -0.04em;
}

header:not(.workspace-topbar) nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

header:not(.workspace-topbar) nav ul li {
    margin: 0;
}

header:not(.workspace-topbar) nav ul li a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.86);
    color: #0f172a;
    font-weight: 700;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

header:not(.workspace-topbar) nav ul li a:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(var(--accent-color-rgb), 0.28);
}

footer:not(.workspace-footer) {
    display: none !important;
}

footer:not(.workspace-footer) p {
    display: none;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: #092418;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(var(--accent-color-rgb), 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 34px rgba(var(--accent-color-rgb), 0.2);
    filter: saturate(1.04);
}

.action-btn.small {
    padding: 10px 14px;
    font-size: 0.92rem;
}

.action-btn.secondary {
    background: rgba(var(--primary-color-rgb), 0.12);
    border-color: rgba(var(--primary-color-rgb), 0.16);
    box-shadow: none;
    color: var(--text-color-dark);
}

.action-btn.ghost {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--border-color);
    box-shadow: none;
    color: var(--text-color-dark);
}

.page-shell {
    padding-top: 14px;
}

body.workspace-fluid-page .page-shell {
    padding-top: 8px;
}

.page-panel {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px);
    box-shadow: var(--box-shadow);
}

body.workspace-fluid-page .page-panel {
    padding: 24px;
    border-radius: 24px;
}

.page-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent);
    pointer-events: none;
}

.panel-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 24px;
}

body.workspace-fluid-page .panel-header {
    margin-bottom: 18px;
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--primary-color);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-header h2 {
    margin: 0;
    color: var(--text-color-dark);
    font-family: var(--font-family-display, var(--font-family-base));
    font-size: clamp(1.5rem, 2vw, 2rem);
    letter-spacing: -0.04em;
}

.panel-header p {
    max-width: 64ch;
    margin-top: 8px;
    color: var(--text-color-light);
}

body.workspace-fluid-page .panel-header p {
    max-width: 82ch;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.empty-state {
    padding: 20px;
    border-radius: 20px;
    border: 1px dashed var(--border-color);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text-color-light);
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid rgba(var(--primary-color-rgb), 0.12);
    border-left-color: var(--secondary-color);
    border-radius: 999px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modais globais injetados por app/Views/_modals.php */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 18, 14, 0.72);
    backdrop-filter: blur(8px);
    z-index: 1100;
}

.modal.show {
    display: flex;
}

.modal .modal-content {
    position: relative;
    width: min(760px, 100%);
    max-height: 84vh;
    overflow: auto;
    padding: 26px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 28px 60px rgba(10, 31, 24, 0.28);
}

.modal .modal-content.large {
    width: min(980px, 100%);
}

.modal .modal-title {
    margin: 0;
    padding-right: 44px;
    color: var(--text-color-dark);
    font-family: var(--font-family-display, var(--font-family-base));
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.modal .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--text-color-dark);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.modal .modal-body {
    margin-top: 16px;
    color: var(--text-color);
    line-height: 1.7;
}

.modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 860px) {
    header:not(.workspace-topbar) .container,
    .panel-header {
        flex-direction: column;
        align-items: start;
    }

    .page-panel {
        padding: 22px;
        border-radius: 24px;
    }
}

@media (max-width: 640px) {
    body,
    body.workspace-fluid-page {
        --page-shell-gutter: 24px;
    }

    body::before {
        background-size: 30px 30px;
    }

    main {
        padding-top: 24px;
    }

    .action-btn,
    .panel-actions {
        width: 100%;
    }

    .panel-actions .action-btn {
        width: 100%;
    }
}
