/* =========================================================
   PHOENIX WORKFLOWS + SMOOTH MOTION
   ========================================================= */

:root {
    --motion-fast: 180ms;
    --motion-medium: 320ms;
    --motion-slow: 620ms;
    --motion-page: 820ms;
    --motion-ease: cubic-bezier(.22, .61, .36, 1);
    --motion-soft: cubic-bezier(.16, 1, .3, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    text-rendering: optimizeLegibility;
}

a,
button,
input,
textarea,
select,
.hud-panel,
.personnel-card,
.launch-card,
.quick-nav-card,
.image-tile,
.side-nav a,
.report-list-card,
.channel-button,
.profile-visual-card,
.report-editor-panel,
.report-detail-panel {
    transition:
        transform var(--motion-medium) var(--motion-soft),
        opacity var(--motion-medium) ease,
        color var(--motion-fast) ease,
        background-color var(--motion-medium) ease,
        border-color var(--motion-medium) ease,
        box-shadow var(--motion-medium) ease,
        filter var(--motion-medium) ease;
}

.site-main,
.page-frame {
    animation: phoenix-workspace-enter var(--motion-page) var(--motion-soft) both;
}

.reveal {
    opacity: 0;
    transform: translateY(20px) scale(.992);
    filter: blur(2px);
    transition:
        opacity var(--motion-slow) var(--motion-soft),
        transform var(--motion-slow) var(--motion-soft),
        filter var(--motion-slow) var(--motion-soft);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.hud-panel:hover,
.personnel-card:hover {
    transform: translateY(-2px);
}

.platform-form input:focus,
.platform-form textarea:focus,
.platform-form select:focus {
    transform: translateY(-1px);
}

.sidebar {
    transition:
        transform var(--motion-medium) var(--motion-soft),
        box-shadow var(--motion-medium) ease;
}

.sidebar-backdrop {
    transition:
        opacity var(--motion-medium) ease,
        visibility var(--motion-medium) ease;
}

.page-transition {
    transition:
        opacity var(--motion-medium) ease,
        visibility var(--motion-medium) ease;
}

/* -------------------- Profile -------------------- */

.profile-workspace {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    gap: 18px;
}

.profile-visual-card {
    position: sticky;
    top: calc(var(--topbar) + 24px);
    align-self: start;
    overflow: hidden;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(5, 26, 48, .94), rgba(2, 12, 24, .97));
    box-shadow: var(--shadow);
    clip-path: polygon(13px 0, 100% 0, 100% calc(100% - 13px), calc(100% - 13px) 100%, 0 100%, 0 13px);
}

.profile-visual-card:hover {
    border-color: rgba(66, 179, 255, .42);
    box-shadow: 0 0 34px rgba(0, 123, 255, .12);
}

.profile-banner {
    height: 145px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(9, 79, 143, .3), rgba(1, 8, 16, .88)),
        url("../images/command-interface.jpg") center / cover;
}

.profile-banner img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    animation: profile-image-enter .8s var(--motion-soft) both;
}

.profile-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(1, 8, 16, .86), transparent 60%);
}

.profile-visual-body {
    position: relative;
    padding: 72px 24px 24px;
}

.profile-avatar-large {
    position: absolute;
    top: -58px;
    left: 24px;
    width: 116px;
    height: 116px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: var(--cyan);
    border: 2px solid var(--line-bright);
    background: #020b15;
    box-shadow: 0 0 24px rgba(0, 123, 255, .22);
    clip-path: polygon(18% 0, 82% 0, 100% 18%, 100% 82%, 82% 100%, 18% 100%, 0 82%, 0 18%);
    font: 20px Consolas, monospace;
    transition:
        transform var(--motion-medium) var(--motion-soft),
        box-shadow var(--motion-medium) ease;
}

.profile-avatar-large:hover {
    transform: translateY(-3px) scale(1.025);
    box-shadow: 0 0 35px rgba(0, 150, 255, .3);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: profile-image-enter .7s var(--motion-soft) both;
}

.profile-visual-body h2 {
    margin: 8px 0 4px;
    color: var(--white);
    letter-spacing: 3px;
}

.profile-display-name {
    color: var(--muted);
    font-size: 13px;
}

.profile-custom-status {
    margin: 17px 0;
    padding: 11px 13px;
    color: var(--cyan);
    border: 1px solid rgba(56, 181, 255, .2);
    background: rgba(3, 18, 33, .62);
    line-height: 1.5;
}

.profile-completeness {
    margin: 18px 0;
}

.profile-completeness-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 10px;
}

.profile-completeness-head b {
    color: var(--cyan);
    font-family: Consolas, monospace;
}

.profile-completeness-bar {
    height: 7px;
    margin-top: 8px;
    padding: 1px;
    border: 1px solid rgba(56, 181, 255, .25);
    background: rgba(0, 5, 10, .7);
}

.profile-completeness-bar i {
    height: 100%;
    display: block;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    box-shadow: 0 0 10px rgba(23, 140, 255, .5);
    transition: width .8s var(--motion-soft);
}

.profile-data-list {
    margin: 0;
}

.profile-data-list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(40, 139, 224, .12);
}

.profile-data-list dt {
    color: var(--muted);
}

.profile-data-list dd {
    margin: 0;
    color: var(--text);
    text-align: right;
}

.profile-workspace-main {
    display: grid;
    gap: 18px;
}

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

.profile-editor-grid .span-two {
    grid-column: span 2;
}

.media-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 18px;
}

.media-upload-card {
    position: relative;
    overflow: hidden;
    min-height: 130px;
    display: grid;
    place-items: center;
    padding: 18px;
    color: var(--muted);
    border: 1px dashed rgba(56, 181, 255, .35);
    background: rgba(1, 10, 20, .45);
    cursor: pointer;
    text-align: center;
}

.media-upload-card::after {
    content: "";
    position: absolute;
    inset: -40%;
    background: linear-gradient(110deg, transparent 35%, rgba(89, 211, 255, .1), transparent 65%);
    transform: translateX(-55%);
    transition: transform .75s var(--motion-soft);
}

.media-upload-card:hover {
    color: var(--cyan);
    border-color: var(--line-bright);
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(0, 123, 255, .1);
}

.media-upload-card:hover::after {
    transform: translateX(55%);
}

.media-upload-card input {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    cursor: pointer;
}

.media-upload-card strong,
.media-upload-card span {
    position: relative;
    z-index: 1;
    display: block;
}

.media-upload-card strong {
    color: var(--cyan);
    letter-spacing: 1px;
}

.media-upload-card span {
    margin-top: 7px;
    font-size: 11px;
}

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

.report-stat {
    padding: 16px;
    border: 1px solid rgba(42, 149, 238, .18);
    background: rgba(1, 9, 18, .52);
}

.report-stat:hover {
    transform: translateY(-3px);
    border-color: var(--line-bright);
}

.report-stat strong,
.report-stat span {
    display: block;
}

.report-stat strong {
    color: var(--cyan);
    font-size: 25px;
}

.report-stat span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1px;
}

/* -------------------- Reports -------------------- */

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

.reports-sidebar,
.report-editor-panel,
.report-detail-panel {
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(5, 26, 48, .92), rgba(2, 12, 24, .96));
    box-shadow: var(--shadow);
}

.reports-sidebar {
    align-self: start;
    position: sticky;
    top: calc(var(--topbar) + 24px);
    overflow: hidden;
}

.reports-sidebar-head {
    padding: 19px;
    border-bottom: 1px solid var(--line);
}

.reports-sidebar-head h2 {
    margin: 6px 0 0;
    color: var(--white);
    letter-spacing: 2px;
}

.report-filter-bar {
    display: grid;
    gap: 9px;
    padding: 14px;
    border-bottom: 1px solid rgba(42, 143, 226, .14);
}

.report-filter-bar input,
.report-filter-bar select {
    width: 100%;
    min-height: 40px;
    padding: 0 11px;
    color: var(--text);
    border: 1px solid rgba(45, 147, 234, .28);
    background: rgba(1, 9, 18, .8);
    outline: 0;
}

.report-list {
    max-height: 660px;
    overflow-y: auto;
    padding: 9px;
}

.report-list-card {
    width: 100%;
    display: grid;
    gap: 7px;
    margin-bottom: 8px;
    padding: 14px;
    color: var(--text);
    text-align: left;
    border: 1px solid rgba(42, 143, 226, .16);
    background: rgba(2, 12, 23, .62);
    cursor: pointer;
}

.report-list-card:hover,
.report-list-card.active {
    color: var(--white);
    border-color: var(--line-bright);
    background: rgba(11, 69, 123, .18);
    transform: translateX(4px);
}

.report-list-card.active {
    box-shadow: inset 3px 0 0 var(--cyan);
}

.report-list-card strong {
    color: var(--cyan);
    line-height: 1.35;
}

.report-list-card small {
    color: var(--muted);
}

.report-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
}

.report-status-badge,
.report-priority-badge {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 0 8px;
    border: 1px solid currentColor;
    font: 8px Consolas, monospace;
    letter-spacing: 1px;
}

.report-status-badge.draft { color: var(--muted); }
.report-status-badge.submitted { color: var(--warning); }
.report-status-badge.under_review { color: var(--blue); }
.report-status-badge.approved { color: var(--green); }
.report-status-badge.rejected { color: #ff7c88; }
.report-status-badge.archived { color: #8f7cff; }

.report-priority-badge.low { color: var(--muted); }
.report-priority-badge.normal { color: var(--cyan); }
.report-priority-badge.high { color: var(--warning); }
.report-priority-badge.critical { color: #ff7c88; }

.reports-main {
    min-width: 0;
    display: grid;
    gap: 18px;
}

.report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    background: rgba(3, 17, 31, .86);
}

.report-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.report-template-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin: 13px 0 19px;
}

.report-template {
    min-height: 70px;
    padding: 11px;
    color: var(--muted);
    border: 1px solid rgba(42, 143, 226, .18);
    background: rgba(1, 9, 18, .5);
    cursor: pointer;
    text-align: left;
}

.report-template:hover {
    color: var(--cyan);
    border-color: var(--line-bright);
    transform: translateY(-3px);
}

.report-template strong,
.report-template span {
    display: block;
}

.report-template strong {
    color: var(--cyan);
    font-size: 10px;
}

.report-template span {
    margin-top: 5px;
    line-height: 1.4;
    font-size: 10px;
}

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

.report-form-grid .span-two {
    grid-column: span 2;
}

.report-form-grid textarea[name="content"] {
    min-height: 320px;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.6;
}

.report-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 17px;
}

.report-detail-panel {
    overflow: hidden;
    animation: report-panel-enter .55s var(--motion-soft) both;
}

.report-detail-header {
    position: relative;
    padding: 26px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(1, 8, 16, .9), rgba(1, 8, 16, .65)),
        url("../images/command-interface.jpg") center / cover;
}

.report-detail-header h2 {
    margin: 8px 0 5px;
    color: var(--white);
    letter-spacing: 2px;
}

.report-detail-number {
    color: var(--cyan);
    font: 10px Consolas, monospace;
    letter-spacing: 1.5px;
}

.report-detail-body {
    padding: 25px;
}

.report-detail-data {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 20px;
}

.report-detail-data div {
    padding: 12px;
    border: 1px solid rgba(42, 143, 226, .16);
    background: rgba(1, 9, 18, .5);
}

.report-detail-data div:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 181, 255, .36);
}

.report-detail-data span,
.report-detail-data strong {
    display: block;
}

.report-detail-data span {
    color: var(--muted);
    font-size: 9px;
}

.report-detail-data strong {
    margin-top: 5px;
    color: var(--text);
}

.report-document {
    padding: 22px;
    color: var(--text);
    border: 1px solid rgba(42, 143, 226, .17);
    background: rgba(0, 6, 12, .68);
    white-space: pre-wrap;
    line-height: 1.75;
    font-family: Consolas, "Courier New", monospace;
}

.report-review-box {
    margin-top: 18px;
    padding: 17px;
    color: var(--text);
    border-left: 3px solid var(--warning);
    background: rgba(118, 78, 17, .12);
}

.report-review-box.approved {
    border-left-color: var(--green);
    background: rgba(23, 105, 77, .1);
}

.report-review-box.rejected {
    border-left-color: #ff7c88;
    background: rgba(111, 31, 42, .12);
}

.report-comments {
    display: grid;
    gap: 10px;
    margin-top: 19px;
}

.report-comment {
    padding: 13px 15px;
    border: 1px solid rgba(42, 143, 226, .15);
    background: rgba(2, 12, 23, .58);
    animation: comment-enter .38s var(--motion-soft) both;
}

.report-comment:hover {
    transform: translateX(3px);
    border-color: rgba(56, 181, 255, .32);
}

.report-comment header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.report-comment strong {
    color: var(--cyan);
}

.report-comment time {
    color: var(--muted);
    font-size: 9px;
}

.report-comment p {
    margin: 0;
    line-height: 1.55;
}

.report-attachment-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.report-attachment {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid rgba(42, 143, 226, .15);
    background: rgba(2, 12, 23, .55);
}

.report-attachment:hover {
    transform: translateX(3px);
    border-color: rgba(56, 181, 255, .3);
}

.report-attachment button {
    color: var(--cyan);
    border: 0;
    background: transparent;
    cursor: pointer;
}

.review-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 15px;
}

.review-controls textarea {
    min-height: 80px;
    color: var(--white);
    border: 1px solid rgba(45, 147, 234, .3);
    background: rgba(1, 9, 18, .8);
    padding: 12px;
}

.review-buttons {
    display: grid;
    gap: 7px;
}

.empty-report-workspace {
    min-height: 470px;
    display: grid;
    place-items: center;
    padding: 30px;
    color: var(--muted);
    border: 1px dashed rgba(56, 181, 255, .25);
    text-align: center;
}

/* -------------------- Animation -------------------- */

@keyframes phoenix-workspace-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes profile-image-enter {
    from {
        opacity: 0;
        transform: scale(1.06);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes report-panel-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes comment-enter {
    from {
        opacity: 0;
        transform: translateX(-7px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* -------------------- Print / Responsive -------------------- */

@media print {
    .topbar,
    .sidebar,
    .site-footer,
    .report-toolbar,
    .reports-sidebar,
    .app-notice,
    .review-controls,
    .report-comments-form,
    .scanlines,
    .page-transition,
    .phoenix-loader {
        display: none !important;
    }

    .site-main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .page-heading {
        display: none;
    }

    .report-detail-panel {
        border: 0;
        box-shadow: none;
    }

    body {
        color: #111;
        background: #fff;
    }

    .report-document,
    .report-detail-data div {
        color: #111;
        border-color: #aaa;
        background: #fff;
    }
}

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

    .profile-visual-card,
    .reports-sidebar {
        position: static;
    }

    .report-list {
        max-height: 360px;
    }

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

@media (max-width: 700px) {
    .profile-editor-grid,
    .media-upload-grid,
    .report-form-grid,
    .report-template-grid,
    .report-detail-data,
    .recent-reports-grid {
        grid-template-columns: 1fr;
    }

    .profile-editor-grid .span-two,
    .report-form-grid .span-two {
        grid-column: auto;
    }

    .review-controls {
        grid-template-columns: 1fr;
    }

    .report-editor-actions,
    .report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .report-toolbar-actions,
    .report-editor-actions {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}