:root {
    --color-primary: #D03238;
    --color-primary-dark: #A82328;
    --color-primary-darker: #82181C;
    --color-primary-soft: #FDD2CC;
    --color-primary-muted: #FFF5F5;
    --color-secondary: #0F172A;
    --color-secondary-dark: #020617;
    --color-accent: #3B82F6;
    --color-bg: #F3F5F8;
    --color-surface: #FFFFFF;
    --color-surface-muted: #F8FAFC;
    --color-surface-strong: #EEF2F7;
    --color-border: #E2E8F0;
    --color-border-strong: #CBD5E1;
    --color-text: #1E293B;
    --color-text-muted: #64748B;
    --color-danger: #B91C1C;
    --color-success: #047857;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.10);
    --shadow-focus: 0 0 0 3px rgba(208, 50, 56, 0.18);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", "Plus Jakarta Sans", Inter, Arial, sans-serif;
}

html {
    background: var(--color-bg);
}

body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(243, 245, 248, 0) 280px),
        var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button,
a {
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.app-shell.is-locked,
.is-hidden {
    display: none;
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 245, 245, 0.96) 54%, rgba(238, 242, 247, 0.96) 100%),
        var(--color-bg);
}

.login-screen.is-hidden {
    display: none;
}

.login-screen h1 {
    color: var(--color-secondary);
    margin-bottom: 10px;
}

.login-screen .access-card {
    width: min(440px, 100%);
}

.access-panel.login-panel {
    display: block;
}

.login-heading {
    margin-bottom: 20px;
    text-align: center;
}

.login-heading h1 {
    font-size: clamp(25px, 4vw, 32px);
    font-weight: 800;
    letter-spacing: 0;
}

.config-notice {
    margin: 0 0 14px;
    padding: 11px 12px;
    background: var(--color-surface-muted);
    color: var(--color-secondary);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(300px, 1fr);
    align-items: center;
    gap: 18px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-text);
    padding: 16px 24px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.brand-home-button {
    grid-column: 1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(260px, 100%);
    min-height: 58px;
    padding: 6px 0;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}

.brand-home-button:hover {
    transform: translateY(-1px);
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 240px;
    max-height: 58px;
    object-fit: contain;
    object-position: left center;
}

header::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-soft), var(--color-secondary));
}

header h1 {
    grid-column: 2;
    color: var(--color-primary);
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 800;
    letter-spacing: 0;
}

header .analytics-toolbar {
    grid-column: 3;
    justify-self: end;
    width: min(410px, 100%);
    margin: 0;
    padding: 8px 10px;
    background: var(--color-surface-muted);
    text-align: left;
    border-color: var(--color-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

header .secondary-btn {
    padding: 8px 11px;
    white-space: nowrap;
}

nav {
    background: var(--color-secondary);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--color-secondary-dark);
    box-shadow: var(--shadow-sm);
}

nav button {
    min-height: 42px;
    background: transparent;
    color: #CBD5E1;
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

nav button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: white;
}

nav button.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 7px 18px rgba(208, 50, 56, 0.28);
}

.ui-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: currentColor;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

nav button,
.analytics-tab,
.home-panel-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

nav button .ui-icon {
    color: var(--color-primary-soft);
}

nav button.active .ui-icon,
.home-panel-nav button.active .ui-icon,
.analytics-tab.active .ui-icon {
    color: inherit;
}

.home-panel-nav button .ui-icon,
.analytics-tab .ui-icon {
    color: var(--color-primary);
}

.container {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 28px 18px 40px;
}

.page {
    display: none;
}

.active {
    display: block;
}

nav button.active,
.analytics-tab.active {
    display: inline-flex;
}

.home-panel-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 10px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.home-panel-nav[hidden] {
    display: none;
}

.home-panel-nav button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 9px 14px;
    background: var(--color-surface-muted);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.home-panel-nav button:hover {
    background: white;
    border-color: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.home-panel-nav button.active {
    background: var(--color-secondary);
    color: white;
    border-color: var(--color-secondary);
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.18);
}

.is-home-panel-inactive {
    display: none;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--color-border-strong);
}

h2 {
    color: var(--color-secondary);
    margin-bottom: 12px;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 800;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 10px;
    color: var(--color-secondary);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

table th,
table td {
    border-bottom: 1px solid var(--color-border);
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
}

table th + th,
table td + td {
    border-left: 1px solid var(--color-border);
}

table th {
    background: var(--color-secondary);
    color: white;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

table tbody tr:nth-child(even) {
    background: var(--color-surface-muted);
}

table tbody tr:hover {
    background: var(--color-primary-muted);
}

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

iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-surface);
}

.panel-btn {
    background: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
    padding: 12px 18px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
}

.panel-btn:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 8px 18px rgba(208, 50, 56, 0.22);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
    margin-bottom: 4px;
}

.info-item {
    min-width: 0;
    padding: 16px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.info-item:hover {
    background: white;
    border-color: var(--color-primary-soft);
    box-shadow: var(--shadow-sm);
}

.placeholder-img {
    width: 100%;
    height: 132px;
    background:
        linear-gradient(135deg, rgba(208, 50, 56, 0.12), rgba(15, 23, 42, 0.07)),
        var(--color-primary-muted);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(208, 50, 56, 0.12);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.info-item h3 {
    margin-bottom: 12px;
    color: var(--color-secondary);
    font-size: 15px;
}

.link-list {
    display: grid;
    gap: 8px;
    text-align: left;
}

.resource-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 12px;
    background: white;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 14px;
    font-weight: 750;
}

.resource-link::after {
    content: "\2197";
    color: var(--color-primary);
    font-weight: 800;
}

.resource-link:hover {
    background: var(--color-primary-muted);
    border-color: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.link-list-empty {
    padding: 12px;
    color: var(--color-text-muted);
    background: white;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.sheet-frame {
    width: 100%;
    height: 900px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: white;
}

.section-intro {
    max-width: 760px;
    margin-bottom: 16px;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.analytics-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px auto;
    max-width: 1280px;
    padding: 10px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-weight: 800;
}

.session-profile {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--color-secondary), #334155);
    color: white;
    font-size: 14px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.session-avatar[data-profile="admin"] {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.session-avatar[data-profile="pastoral"] {
    background: linear-gradient(135deg, var(--color-secondary), #334155);
}

.session-avatar[data-profile="colegios"] {
    background: linear-gradient(135deg, #2563EB, #1E40AF);
}

.session-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.session-copy strong {
    color: var(--color-secondary);
    font-size: 15px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.session-user {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.analytics-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.secondary-tabs {
    padding-top: 2px;
    margin-bottom: 16px;
}

.analytics-tab {
    min-height: 38px;
    padding: 9px 14px;
    background: var(--color-surface-muted);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

.analytics-tab:hover {
    background: white;
    border-color: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.analytics-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 7px 18px rgba(208, 50, 56, 0.22);
}

.secondary-tabs .analytics-tab.active {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.18);
}

.improvement-panel {
    display: none;
}

.improvement-panel.active {
    display: block;
}

.static-resource {
    cursor: default;
}

.static-resource::after {
    content: "";
}

.process-toolbar {
    max-width: 420px;
    margin-bottom: 14px;
}

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

.process-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 86px;
    padding: 18px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.process-list-item:nth-child(even) {
    background: var(--color-surface-muted);
}

.process-list-item:hover {
    border-color: var(--color-primary-soft);
}

.process-list-info {
    min-width: 0;
}

.process-list-info h4 {
    margin-bottom: 4px;
    color: var(--color-secondary);
    font-size: 17px;
    font-weight: 800;
}

.process-list-info p {
    color: var(--color-text-muted);
    font-size: 13px;
}

.process-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    min-width: 152px;
    padding: 10px 16px;
    background: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

.process-action:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 8px 18px rgba(208, 50, 56, 0.22);
}

.process-action.is-disabled {
    background: var(--color-surface-strong);
    color: var(--color-text-muted);
    border-color: var(--color-border);
    cursor: default;
    box-shadow: none;
}

.secondary-btn {
    background: white;
    color: var(--color-primary-dark);
    border: 1px solid var(--color-border-strong);
    padding: 9px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

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

.access-card {
    width: min(760px, 100%);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.access-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 28px;
    align-items: start;
}

.access-form {
    display: grid;
    gap: 10px;
}

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

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--color-border);
}

.google-login-panel {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 16px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.google-login-title {
    color: var(--color-secondary);
    font-size: 14px;
    font-weight: 800;
}

.google-signin-button {
    min-height: 44px;
    width: min(360px, 100%);
    display: flex;
    justify-content: center;
}

.login-hint {
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
}

.access-form label,
.search-label {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 800;
}

.access-form input,
.dashboard-search {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    background: white;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 15px;
}

.access-form input:focus,
.dashboard-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.access-message {
    min-height: 18px;
    color: var(--color-danger);
    font-size: 13px;
    font-weight: 800;
}

.empty-dashboard {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    font-weight: 800;
    text-align: center;
}

.empty-dashboard[hidden] {
    display: none;
}

.dashboard-workspace {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
    min-height: 520px;
}

.dashboard-workspace.compact-sidebar {
    grid-template-columns: 300px minmax(0, 1fr);
}

.dashboard-sidebar {
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
}

.dashboard-search {
    margin: 8px 0 12px;
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 640px;
    overflow-y: auto;
    padding-right: 4px;
}

.dashboard-list::-webkit-scrollbar {
    width: 6px;
}

.dashboard-list::-webkit-scrollbar-track {
    background: var(--color-surface-strong);
    border-radius: 999px;
}

.dashboard-list::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 999px;
}

.dashboard-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.dashboard-list-item {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    background: white;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 750;
    text-align: left;
}

.dashboard-list-item:hover {
    background: var(--color-primary-muted);
    border-color: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.dashboard-list-item.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 7px 18px rgba(208, 50, 56, 0.22);
}

.dashboard-list-empty {
    padding: 12px;
    color: var(--color-text-muted);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-viewer {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-surface-muted);
    box-shadow: var(--shadow-sm);
}

.dashboard-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--color-border);
    background: white;
}

.dashboard-viewer-header h3 {
    margin-bottom: 0;
    color: var(--color-secondary);
}

.viewer-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dashboard-frame-grid {
    display: grid;
    gap: 16px;
    padding: 16px;
}

.dashboard-frame {
    min-width: 0;
}

.dashboard-frame h4 {
    margin-bottom: 10px;
    color: var(--color-secondary);
    font-size: 16px;
    font-weight: 800;
}

.dashboard-frame iframe {
    height: 620px;
    background: white;
    border: 1px solid var(--color-border);
}

@media (max-width: 1000px) {
    header {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 12px;
        padding: 15px;
    }

    header h1,
    header .analytics-toolbar {
        grid-column: 1;
    }

    header .analytics-toolbar {
        width: 100%;
        max-width: 520px;
        justify-self: center;
    }
}

@media (max-width: 900px) {
    .access-panel {
        grid-template-columns: 1fr;
    }

    .analytics-toolbar {
        align-items: stretch;
        flex-direction: column;
        margin: 10px;
    }

    .session-profile {
        align-items: flex-start;
    }

    .analytics-header {
        display: block;
    }

    .dashboard-workspace,
    .dashboard-workspace.compact-sidebar {
        grid-template-columns: 1fr;
    }

    .dashboard-list {
        max-height: 260px;
    }

    .dashboard-frame iframe {
        height: 460px;
    }

    .process-list-item {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .process-action {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    header {
        position: relative;
    }

    nav {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 10px 12px;
    }

    nav button {
        flex: 0 0 auto;
        padding: 10px 14px;
    }

    .container {
        padding: 18px 12px 30px;
    }

    .card {
        padding: 16px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    iframe {
        height: 460px;
    }

    .access-card {
        padding: 22px;
    }

    .session-profile {
        width: 100%;
    }

    .secondary-btn {
        width: 100%;
    }
}
