:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #687386;
    --line: #dce3ec;
    --blue: #2563eb;
    --green: #0f766e;
    --amber: #b7791f;
    --red: #b42318;
}

body {
    background:
        radial-gradient(circle at 12% 8%, rgba(37, 99, 235, .10), transparent 28%),
        radial-gradient(circle at 88% 16%, rgba(15, 118, 110, .10), transparent 26%),
        var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(17, 24, 39, .96);
    color: #fff;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand small,
.subject-row small,
.meta-box span,
.file-row small {
    display: block;
    color: var(--muted);
}

.sidebar .brand small {
    color: #b8c2d4;
}

.brand-mark {
    align-items: center;
    background: #e0f2fe;
    border-radius: 8px;
    color: #075985;
    display: inline-flex;
    font-weight: 800;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.nav-link {
    border-radius: 8px;
    color: #d9e2ef;
    padding: 10px 12px;
    white-space: normal;
}

.nav-link:hover {
    background: #243044;
    color: #fff;
}

.main-panel {
    padding: 26px;
}

.topbar,
.page-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1,
.page-heading h2 {
    font-size: clamp(1.35rem, 3vw, 2rem);
    margin: 0;
}

.page-heading p {
    color: var(--muted);
    margin: 4px 0 0;
}

.role-pill,
.status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 700;
    padding: 5px 10px;
}

.role-pill {
    background: #e8eef7;
    color: #344256;
}

.panel,
.metric-card,
.subject-row,
.ie-column,
.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.panel {
    padding: 18px;
}

.panel h3 {
    font-size: 1rem;
    margin-bottom: 14px;
}

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

.metric-card {
    padding: 18px;
}

.metric-card span {
    color: var(--muted);
    display: block;
}

.metric-card strong {
    font-size: 2rem;
}

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

.subject-row {
    align-items: center;
    color: inherit;
    display: flex;
    justify-content: space-between;
    padding: 18px;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.subject-row:hover {
    border-color: #9bb5e9;
    box-shadow: 0 20px 44px rgba(37, 99, 235, .12);
    transform: translateY(-2px);
}

.subject-row h2 {
    font-size: 1.1rem;
    margin: 0 0 4px;
}

.subject-row p {
    color: var(--muted);
    margin: 0;
}

.ie-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.ie-column {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 251, 255, .98));
    min-height: 520px;
    padding: 16px;
}

.ie-column:nth-child(1) {
    border-top: 5px solid #2563eb;
}

.ie-column:nth-child(2) {
    border-top: 5px solid #0f766e;
}

.ie-column:nth-child(3) {
    border-top: 5px solid #be123c;
}

.cell-title {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 800;
    outline: 0;
    padding: 4px 0 12px;
    width: 100%;
}

.editor-toolbar {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 10px;
    padding: 8px;
}

.tool-btn,
.color-dot {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    font-size: .86rem;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    min-width: 38px;
}

.tool-btn {
    background: #fff;
    color: #253044;
}

.tool-btn:hover {
    background: #eef6ff;
    border-color: #bfdbfe;
}

.color-dot {
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    width: 38px;
}

.color-sky {
    background: #075985;
}

.color-mint {
    background: #047857;
}

.color-rose {
    background: #be123c;
}

.color-sun {
    background: #fef3c7;
}

.rich-editor {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.55;
    min-height: 330px;
    outline: 0;
    overflow-wrap: anywhere;
    padding: 14px;
}

.rich-editor:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(147, 197, 253, .24);
}

.rich-editor h3,
.rich-editor h4 {
    font-size: 1.08rem;
    margin: 0 0 10px;
}

.rich-editor p,
.rich-editor ul,
.rich-editor ol {
    margin-bottom: 10px;
}

.generic-editor {
    min-height: 380px;
}

.meta-box {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 14px;
    padding: 10px;
}

.lock-note {
    color: var(--muted);
    font-size: .82rem;
}

.status-pendiente {
    background: #fff7ed;
    color: var(--amber);
}

.status-en_desarrollo {
    background: #eff6ff;
    color: var(--blue);
}

.status-actualizado {
    background: #ecfdf5;
    color: var(--green);
}

.status-revisado {
    background: #f0fdf4;
    color: #166534;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    border-left: 3px solid #93c5fd;
    padding-left: 12px;
}

.timeline-item span {
    color: var(--muted);
    display: block;
    font-size: .82rem;
}

.timeline-item p {
    margin: 4px 0 0;
}

.file-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 10px;
    padding: 10px 0;
}

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

.wide-panel {
    grid-column: 1 / -1;
}

.guest-body {
    background: linear-gradient(135deg, #eef6ff, #f7fbf5);
}

.login-wrap {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    max-width: 440px;
    padding: 28px;
    width: 100%;
}

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

    .sidebar {
        height: auto;
        position: static;
        padding: 16px;
    }

    .sidebar .nav {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(160px, 1fr);
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .dashboard-grid,
    .ie-board,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .page-heading,
    .subject-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-panel {
        padding: 16px;
    }

    .ie-column {
        min-height: auto;
    }

    .rich-editor {
        min-height: 260px;
    }
}

@media (max-width: 575px) {
    .brand {
        margin-bottom: 12px;
    }

    .topbar {
        background: rgba(255, 255, 255, .82);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 12px;
    }

    .role-pill {
        display: none;
    }

    .panel,
    .subject-row,
    .ie-column,
    .login-card {
        box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
    }

    .editor-toolbar {
        gap: 6px;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .tool-btn,
    .color-dot {
        height: 42px;
        min-width: 42px;
    }

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

@media print {
    .sidebar,
    .topbar,
    .btn,
    input[type="file"] {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .main-panel {
        padding: 0;
    }
}

/* Tactical login */
.guest-body {
    background:
        linear-gradient(135deg, rgba(3, 7, 18, .86), rgba(15, 23, 42, .72)),
        repeating-linear-gradient(45deg, rgba(132, 204, 22, .10) 0 14px, transparent 14px 34px),
        radial-gradient(circle at 18% 18%, rgba(132, 204, 22, .18), transparent 24%),
        radial-gradient(circle at 82% 8%, rgba(6, 182, 212, .14), transparent 25%),
        #12180f;
}

.military-login {
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.military-login::before {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
    opacity: .35;
    pointer-events: none;
    position: absolute;
}

.military-login::after {
    border: 1px solid rgba(132, 204, 22, .18);
    border-radius: 50%;
    box-shadow:
        0 0 0 90px rgba(132, 204, 22, .035),
        0 0 0 180px rgba(132, 204, 22, .025);
    content: "";
    height: 520px;
    position: absolute;
    right: -180px;
    top: -160px;
    width: 520px;
}

.military-card {
    background: rgba(10, 18, 31, .86);
    border: 1px solid rgba(203, 213, 225, .18);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
    color: #e5edf7;
    max-width: 460px;
    position: relative;
    z-index: 1;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.login-brand strong {
    color: #fff;
    display: block;
    font-size: 1.25rem;
    letter-spacing: .04em;
}

.login-brand small,
.login-heading p {
    color: #a8b3c4;
}

.military-mark {
    align-items: center;
    background: linear-gradient(135deg, #84cc16, #0f766e);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(132, 204, 22, .18);
    color: #06100b;
    display: inline-flex;
    font-size: 1.45rem;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.login-heading {
    margin-bottom: 22px;
}

.login-heading h1 {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 900;
    margin: 4px 0 6px;
}

.military-card .form-label {
    color: #d9e4f2;
    font-weight: 800;
}

.tactical-input {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(203, 213, 225, .22);
    color: #fff;
}

.tactical-input:focus {
    background: rgba(255, 255, 255, .11);
    border-color: #84cc16;
    box-shadow: 0 0 0 4px rgba(132, 204, 22, .18);
    color: #fff;
}

.password-field {
    position: relative;
}

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

.password-toggle {
    align-items: center;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(203, 213, 225, .18);
    border-radius: 8px;
    color: #dce7f7;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
}

.password-toggle:hover {
    background: rgba(132, 204, 22, .18);
    color: #fff;
}

.tactical-submit {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #0f766e);
    border: 0;
    display: inline-flex;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
}

.login-footer {
    border-top: 1px solid rgba(203, 213, 225, .16);
    margin-top: 22px;
    padding-top: 16px;
    text-align: center;
}

.login-footer a {
    color: #a3e635;
    font-weight: 800;
    text-decoration: none;
}

.login-footer a:hover {
    color: #d9f99d;
}

/* Modern workspace refresh */
:root {
    --surface: rgba(255, 255, 255, .86);
    --surface-strong: #ffffff;
    --nav: #0e1728;
    --nav-soft: #18243a;
    --cyan: #06b6d4;
    --lime: #84cc16;
    --pink: #e11d48;
    --violet: #7c3aed;
}

body {
    background:
        linear-gradient(135deg, rgba(6, 182, 212, .12), transparent 34%),
        linear-gradient(315deg, rgba(124, 58, 237, .11), transparent 30%),
        #eef3f8;
}

.app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
    transition: grid-template-columns .22s ease;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(14, 23, 40, .98), rgba(17, 31, 55, .98));
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 18px 0 45px rgba(15, 23, 42, .16);
    overflow-y: auto;
    transition: transform .22s ease, opacity .22s ease;
    z-index: 5;
}

.sidebar-toggle,
.sidebar-close {
    align-items: center;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
}

.sidebar-toggle {
    background: #0e1728;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .18);
    color: #fff;
    display: none;
    height: 44px;
    left: 14px;
    position: fixed;
    top: 14px;
    transition: background .18s ease;
    width: 44px;
    z-index: 40;
}

.sidebar-toggle:hover {
    background: #1d2b45;
}

.sidebar-close {
    background: rgba(255, 255, 255, .10);
    color: #fff;
    height: 34px;
    margin-left: auto;
    width: 34px;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, .18);
}

.sidebar-backdrop {
    background: rgba(15, 23, 42, .46);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity .2s ease;
    z-index: 30;
}

body.sidebar-hidden .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-hidden .sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}

body.sidebar-hidden .main-panel {
    padding-left: 76px;
}

body.sidebar-hidden .sidebar-toggle {
    display: inline-flex;
    left: 14px;
}

.brand {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 12px;
}

.brand strong {
    color: #fff;
    display: block;
    font-size: 1.05rem;
}

.brand-mark {
    background: linear-gradient(135deg, var(--cyan), var(--lime));
    box-shadow: 0 10px 28px rgba(6, 182, 212, .32);
    color: #07111f;
}

.sidebar-label {
    color: #8ea0ba;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    margin: 18px 8px 8px;
    text-transform: uppercase;
}

.sidebar .nav-link {
    align-items: center;
    border: 1px solid transparent;
    color: #dce7f7;
    display: flex;
    gap: 10px;
    min-height: 46px;
    padding: 11px 12px;
}

.sidebar .nav-link i {
    align-items: center;
    background: rgba(255, 255, 255, .10);
    border-radius: 8px;
    display: inline-flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, .11);
    border-color: rgba(125, 211, 252, .28);
    color: #fff;
}

.sidebar .nav-link.active i {
    background: linear-gradient(135deg, #38bdf8, #a3e635);
    color: #08111f;
}

.main-panel {
    padding: 28px;
}

.topbar {
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    margin-bottom: 22px;
    padding: 16px 18px;
}

.eyebrow,
.back-link {
    color: #2563eb;
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}

.workspace-hero {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .95), rgba(6, 182, 212, .82)),
        #2563eb;
    border-radius: 8px;
    box-shadow: 0 14px 32px rgba(37, 99, 235, .18);
    color: #fff;
    margin-bottom: 14px;
    padding: 12px 16px;
}

.workspace-hero h2 {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.2;
}

.workspace-hero p,
.workspace-hero .back-link {
    color: rgba(255, 255, 255, .86);
}

.workspace-hero p {
    font-size: .9rem;
    margin-top: 2px;
}

.workspace-hero .back-link {
    font-size: .78rem;
}

.hero-action {
    border: 0;
    color: #1d4ed8;
    font-size: .86rem;
    font-weight: 800;
    padding: 7px 11px;
}

.ie-board {
    align-items: stretch;
    gap: 20px;
}

.ie-column {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 22px 52px rgba(15, 23, 42, .11);
    overflow: hidden;
    padding: 0;
}

.ie-column::before {
    content: "";
    display: block;
    height: 8px;
}

.ie-column:nth-child(1)::before {
    background: linear-gradient(90deg, #2563eb, #06b6d4);
}

.ie-column:nth-child(2)::before {
    background: linear-gradient(90deg, #0f766e, #84cc16);
}

.ie-column:nth-child(3)::before {
    background: linear-gradient(90deg, #e11d48, #f59e0b);
}

.rich-form {
    padding: 18px;
}

.idea-card-head {
    align-items: center;
    display: flex;
    gap: 12px;
}

.idea-number {
    align-items: center;
    background: #0f172a;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 38px;
    font-size: .95rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.cell-title {
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    font-size: 1rem;
    padding: 12px 13px;
}

.cell-title:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, .18);
}

.editor-toolbar {
    background: #101827;
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
    gap: 7px;
    padding: 9px;
}

button.tool-btn,
button.color-dot {
    appearance: none;
    border: 0;
    cursor: pointer;
    margin: 0;
}

.tool-btn {
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, .18);
}

.wide-tool {
    min-width: 72px;
}

.color-dot {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .18);
}

.rich-editor {
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(135deg, rgba(37, 99, 235, .20), rgba(6, 182, 212, .20)) border-box;
    border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .04);
    font-size: .98rem;
}

.rich-editor:focus {
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

.save-idea-btn {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .24);
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    width: 100%;
}

.save-idea-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.autosave-status {
    align-items: center;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    gap: 7px;
    margin-top: 12px;
    min-height: 34px;
    padding: 7px 10px;
    width: 100%;
}

.autosave-status.is-saving {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.autosave-status.is-saved {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.autosave-status.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.live-updated {
    animation: livePulse 1.2s ease;
}

.cell-files {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 8px;
    padding: 14px 18px 18px;
}

.upload-form {
    margin: 0;
}

.upload-drop {
    align-items: center;
    background: linear-gradient(135deg, #eef6ff, #f8fafc);
    border: 1px dashed #60a5fa;
    border-radius: 8px;
    color: #1d4ed8;
    cursor: pointer;
    display: flex;
    font-size: .86rem;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    padding: 8px 10px;
    transition: background .18s ease, border-color .18s ease;
}

.upload-drop:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
}

.upload-drop input {
    display: none;
}

.upload-status {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.upload-status span {
    color: #475569;
    font-size: .8rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.upload-status div {
    background: #e2e8f0;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.upload-status i {
    background: linear-gradient(90deg, #2563eb, #06b6d4);
    display: block;
    height: 100%;
    transition: width .18s ease;
    width: 0;
}

.upload-status.is-error span {
    color: #b91c1c;
}

.upload-status.is-error i {
    background: #ef4444;
}

.upload-icon {
    align-items: center;
    background: #dbeafe;
    border-radius: 8px;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.upload-copy {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item {
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-width: 0;
    padding: 7px;
}

.file-name {
    align-items: center;
    color: #243044;
    display: flex;
    font-size: .84rem;
    font-weight: 800;
    gap: 8px;
    min-height: 38px;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
}

.file-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name i {
    color: #2563eb;
    flex: 0 0 auto;
}

.file-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.file-actions form {
    margin: 0;
}

.file-action {
    align-items: center;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    text-decoration: none;
    width: 34px;
}

.file-action.view {
    background: #e0f2fe;
    color: #0369a1;
}

.file-action.delete {
    background: #fee2e2;
    color: #b91c1c;
}

.file-action:hover {
    filter: brightness(.97);
}

.repository-panel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.repository-upload {
    max-width: 520px;
}

.repository-drop {
    min-height: 92px;
}

.repository-dates {
    display: grid;
    gap: 14px;
}

.repository-date {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.repository-date-head {
    align-items: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, .10), rgba(6, 182, 212, .08));
    border-bottom: 1px solid rgba(148, 163, 184, .22);
    display: flex;
    gap: 10px;
    padding: 12px 14px;
}

.repository-date-head i {
    color: #2563eb;
}

.repository-date-head strong {
    font-size: .95rem;
}

.repository-date-head span {
    color: #64748b;
    font-size: .78rem;
    font-weight: 800;
    margin-left: auto;
}

.repository-files {
    display: grid;
    gap: 8px;
    padding: 12px;
}

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

.repository-file small {
    color: #64748b;
    font-size: .76rem;
    font-weight: 800;
}

.repository-empty {
    color: #64748b;
}

.calendar-hero {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(124, 58, 237, .94), rgba(6, 182, 212, .84)),
        #7c3aed;
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(124, 58, 237, .18);
    color: #fff;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 18px;
}

.calendar-hero h2 {
    color: #fff;
    font-weight: 900;
    margin: 0;
}

.calendar-hero p {
    color: rgba(255, 255, 255, .86);
    margin: 4px 0 0;
}

.calendar-nav {
    align-items: center;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    padding: 8px 10px;
}

.calendar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.calendar-add-btn {
    align-items: center;
    background: #fff;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
    color: #0f172a;
    display: inline-flex;
    font-weight: 900;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
}

.calendar-add-btn i {
    color: #2563eb;
    font-size: 1.05rem;
}

.calendar-nav a {
    align-items: center;
    background: rgba(255, 255, 255, .20);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    text-decoration: none;
    width: 34px;
}

.calendar-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 340px;
}

.calendar-layout-full {
    grid-template-columns: minmax(0, 1fr);
}

.calendar-panel,
.calendar-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.calendar-panel {
    max-width: 100%;
    overflow-x: auto;
    padding: 14px;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(7, minmax(180px, 1fr));
    min-width: 1310px;
    width: 100%;
}

.calendar-weekdays {
    color: #64748b;
    font-size: .78rem;
    font-weight: 900;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;
}

.calendar-day {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-width: 0;
    min-height: 138px;
    overflow: hidden;
    padding: 9px;
    position: relative;
}

.calendar-day.is-empty {
    background: transparent;
    border-color: transparent;
}

.calendar-day.is-today {
    border-color: #38bdf8;
    box-shadow: inset 0 0 0 2px rgba(56, 189, 248, .18);
}

.day-number {
    align-items: center;
    background: #fff;
    border-radius: 8px;
    color: #172033;
    display: inline-flex;
    font-size: .86rem;
    font-weight: 900;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.day-events {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    min-width: 0;
    overflow: hidden;
}

.calendar-event {
    background: color-mix(in srgb, var(--event-color) 13%, white);
    border-left: 4px solid var(--event-color);
    border-radius: 8px;
    box-sizing: border-box;
    color: #172033;
    cursor: help;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    padding: 7px;
    width: 100%;
}

.calendar-event strong,
.upcoming-item strong {
    display: block;
    font-size: .82rem;
    overflow-wrap: anywhere;
    white-space: normal;
}

.calendar-event span,
.upcoming-item span {
    color: #64748b;
    font-size: .76rem;
    font-weight: 800;
}

.event-description {
    color: #334155;
    display: block;
    font-size: .76rem;
    line-height: 1.35;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.calendar-day:hover .calendar-event strong {
    white-space: normal;
}

.calendar-side {
    display: grid;
    gap: 14px;
}

.calendar-card {
    padding: 16px;
}

.calendar-card h3 {
    font-size: 1rem;
    font-weight: 900;
    margin-bottom: 12px;
}

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

.activity-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 120px;
}

.activity-modal .modal-content {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .24);
    overflow: hidden;
}

.activity-modal .modal-header {
    align-items: flex-start;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(37, 99, 235, .88)),
        #172033;
    color: #fff;
    padding: 18px;
}

.activity-modal .modal-title {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0;
}

.activity-modal .modal-body {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.activity-modal .modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 18px;
}

.activity-modal .btn-close {
    filter: invert(1);
    opacity: .9;
}

.subject-inline-controls {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 120px 1fr;
}

.subject-edit-form textarea {
    min-height: 74px;
}

.color-choice {
    display: flex;
    gap: 8px;
}

.color-choice label {
    background: var(--pick);
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
    height: 34px;
    width: 42px;
}

.color-choice input {
    opacity: 0;
}

.color-choice label:has(input:checked) {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .28);
}

.upcoming-list {
    display: grid;
    gap: 8px;
}

.upcoming-item {
    background: #f8fafc;
    border-left: 5px solid var(--event-color);
    border-radius: 8px;
    padding: 10px;
}

.admin-users-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: 340px minmax(0, 1fr);
}

.admin-users-list {
    display: grid;
    gap: 12px;
}

.user-admin-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
    display: grid;
    gap: 8px;
    padding: 12px;
}

.user-admin-card.is-disabled {
    opacity: .62;
}

.user-edit-form {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 46px minmax(0, 1fr) 40px;
}

.user-avatar {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    height: 46px;
    justify-content: center;
    width: 46px;
}

.user-fields {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-actions {
    display: flex;
    justify-content: flex-end;
}

.delete-user-btn {
    align-items: center;
    background: #fee2e2;
    border: 0;
    border-radius: 8px;
    color: #b91c1c;
    display: inline-flex;
    font-size: .84rem;
    font-weight: 900;
    gap: 7px;
    min-height: 36px;
    padding: 8px 12px;
}

.admin-publications {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.section-heading h3 {
    font-size: 1.2rem;
    font-weight: 900;
    margin: 2px 0 0;
}

.publication-user-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
    padding: 14px;
}

.publication-user-head {
    align-items: center;
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.small-avatar {
    height: 34px;
    width: 34px;
}

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

.publication-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-width: 0;
    padding: 12px;
}

.publication-card > span {
    color: #2563eb;
    display: block;
    font-size: .82rem;
    font-weight: 900;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.publication-card div {
    max-height: 240px;
    overflow: auto;
}

.monitor-shell {
    display: grid;
    gap: 16px;
}

.monitor-top {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .98), rgba(37, 99, 235, .88));
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 18px;
}

.monitor-top h2 {
    color: #fff;
    font-weight: 900;
    margin: 4px 0 0;
}

.monitor-top p {
    color: rgba(255, 255, 255, .78);
    margin: 0;
}

.monitor-picker {
    min-width: 280px;
}

.monitor-user {
    align-items: center;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.monitor-user strong,
.monitor-user small {
    display: block;
}

.monitor-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: calc(100vh - 270px);
}

.monitor-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.monitor-card-head {
    align-items: center;
    background: #0f172a;
    color: #fff;
    display: flex;
    gap: 10px;
    padding: 12px;
}

.monitor-card-head span {
    align-items: center;
    background: linear-gradient(135deg, #38bdf8, #a3e635);
    border-radius: 8px;
    color: #08111f;
    display: inline-flex;
    flex: 0 0 34px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
}

.monitor-card-head h3 {
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitor-content {
    flex: 1;
    line-height: 1.55;
    overflow: auto;
    padding: 16px;
}

.publication-files {
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 7px;
    margin-top: 10px;
    padding-top: 10px;
}

.compact-file {
    padding: 5px;
}

.compact-file .file-name {
    font-size: .78rem;
    min-height: 32px;
}

.compact-file .file-action {
    height: 30px;
    width: 30px;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, .36);
    }
    55% {
        box-shadow: 0 0 0 8px rgba(6, 182, 212, .10);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.subject-row {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(148, 163, 184, .25);
}

@media (max-width: 991px) {
    .sidebar-toggle,
    body.sidebar-hidden .sidebar-toggle {
        display: inline-flex;
        left: 14px;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        border-radius: 0;
        box-shadow: 18px 0 45px rgba(15, 23, 42, .22);
        height: 100vh;
        left: 0;
        max-width: 86vw;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        width: 300px;
        z-index: 35;
    }

    body.sidebar-open .sidebar {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-hidden .app-shell {
        display: block;
    }

    body.sidebar-hidden .main-panel,
    .main-panel {
        padding: 70px 14px 14px;
    }

    .sidebar .brand {
        margin-bottom: 12px;
    }

    .sidebar-label {
        display: block;
    }

    .sidebar .nav {
        display: grid;
        flex-direction: column !important;
        gap: 8px;
        overflow-x: visible;
        padding-bottom: 6px;
    }

    .sidebar .nav-link {
        flex: initial;
        min-width: 0;
    }

    .workspace-hero {
        padding: 12px;
    }

    .workspace-hero .hero-action {
        width: auto;
    }

    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .admin-users-layout {
        grid-template-columns: 1fr;
    }

    .publication-grid {
        grid-template-columns: 1fr;
    }

    .monitor-top {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .monitor-picker {
        min-width: 0;
    }

    .monitor-grid {
        grid-template-columns: 1fr;
    }

    .calendar-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .calendar-actions {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 575px) {
    .sidebar {
        padding: 12px;
    }

    .sidebar .nav-link {
        min-width: 156px;
        padding: 9px;
    }

    .sidebar .nav-link i {
        flex-basis: 30px;
        height: 30px;
        width: 30px;
    }

    .repository-file {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .repository-file .file-actions {
        justify-content: flex-start;
    }

    .repository-date-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .repository-date-head span {
        margin-left: 0;
    }

    .topbar {
        gap: 10px;
        padding: 12px;
    }

    .topbar h1 {
        font-size: 1.15rem;
    }

    .workspace-hero {
        gap: 8px;
    }

    .workspace-hero h2 {
        font-size: 1.12rem;
    }

    .workspace-hero p {
        display: none;
    }

    .idea-card-head {
        align-items: stretch;
    }

    .idea-number {
        height: auto;
    }

    .editor-toolbar {
        position: sticky;
        top: 6px;
    }

    .wide-tool {
        min-width: 64px;
    }

    .rich-form {
        padding: 14px;
    }

    .calendar-panel {
        overflow-x: auto;
    }

    .calendar-weekdays,
    .calendar-grid {
        min-width: 1310px;
    }

    .activity-row {
        grid-template-columns: 1fr;
    }

    .user-edit-form,
    .user-fields {
        grid-template-columns: 1fr;
    }

    .user-actions {
        justify-content: stretch;
    }

    .user-actions .file-action {
        width: 100%;
    }
}
