:root {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #172033;
    background: #f8f8fb;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

html, body {
    min-width: 360px;
    min-height: 100%;
    margin: 0;
    background: #f8f8fb;
}

body, button, input {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font-size: inherit;
}

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

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 5;
    inset: 0 auto 0 0;
    display: flex;
    width: 308px;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e1e4eb;
}

.brand {
    display: flex;
    align-items: center;
    margin: 20px 26px 36px;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: #3730b5;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}

.brand-copy, .user-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    color: #111827;
    font-size: 18px;
}

.brand-copy small, .user-copy small {
    color: #78849a;
    font-size: 13px;
}

.sidebar-section {
    padding: 0 17px;
}

.sidebar-heading {
    display: block;
    margin: 0 14px 14px;
    color: #8993a5;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .035em;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    gap: 12px;
    border-radius: 13px;
    color: #3730b5;
    background: #ecebf8;
    font-size: 15px;
    font-weight: 600;
}

.sidebar-icon {
    font-size: 18px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    padding: 14px 17px 18px;
    border-top: 1px solid #e1e4eb;
}

.integrity-note {
    display: flex;
    align-items: center;
    min-height: 40px;
    margin-bottom: 16px;
    padding: 0 12px;
    gap: 10px;
    border-radius: 12px;
    background: #f7f7fa;
    color: #718096;
    font-size: 12px;
}

.integrity-icon {
    color: #5146d8;
    font-size: 18px;
}

.user-card {
    display: flex;
    align-items: center;
    margin: 0 4px 16px;
    gap: 10px;
}

.avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: #ecebfa;
    color: #4b43c6;
    font-size: 14px;
}

.user-copy strong {
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}

.user-copy small {
    font-size: 12px;
}

.sidebar-footnote {
    padding-left: 4px;
    color: #9aa3b2;
    font-size: 11px;
}

.sidebar-logout {
    align-self: flex-start;
    margin: 0 0 11px 4px;
    color: #6b778c;
    font-size: 13px;
}

.sidebar-logout:hover {
    color: #3730b5;
}

.main-content {
    min-height: 100vh;
    margin-left: 308px;
}

.workspace-page {
    min-height: 100vh;
    padding: 52px 48px 42px;
}

.workspace-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    gap: 24px;
}

.workspace-actions,
.detail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-toggle {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid #dfe3eb;
    border-radius: 9px;
    background: #fff;
    color: #475467;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.selection-toggle:hover {
    border-color: #b9b5ed;
    color: #3730b5;
}

.selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: -20px 0 22px;
    gap: 12px;
    color: #657187;
    font-size: 13px;
}

.file-selection-toolbar {
    justify-content: flex-start;
    margin: -2px 0 14px;
}

.selection-control {
    display: inline-flex;
    align-items: center;
    margin: 0 0 13px;
    gap: 7px;
    color: #657187;
    cursor: pointer;
    font-size: 12px;
}

.selection-control input,
.select-column input {
    width: 15px;
    height: 15px;
    accent-color: #3730b5;
    cursor: pointer;
}

.select-column {
    width: 42px !important;
    padding-right: 4px !important;
    padding-left: 14px !important;
}

.file-table.selection-enabled th:nth-child(2),
.file-table.selection-enabled td:nth-child(2) {
    width: 28%;
    padding-left: 12px;
}

.visually-hidden {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.danger-button,
.danger-text-button {
    border: 1px solid #f0c4c0;
    border-radius: 10px;
    background: #fff;
    color: #b42318;
    cursor: pointer;
    font-weight: 600;
}

.danger-button {
    min-height: 42px;
    padding: 0 14px;
}

.danger-text-button {
    margin-left: 8px;
    padding: 5px 8px;
}

.danger-button:hover,
.danger-text-button:hover {
    background: #fff4f2;
}

.eyebrow {
    color: #4038b6;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .025em;
}

h1, h2, p {
    margin-top: 0;
}

.workspace-heading h1, .detail-title-row h1 {
    margin: 12px 0 4px;
    color: #111827;
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -.035em;
}

.subtitle {
    margin: 0;
    color: #7a8498;
    font-size: 16px;
}

.primary-button, .upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    background: #3730b5;
    box-shadow: 0 2px 4px #231b6418;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.primary-button:hover, .upload-button:hover {
    background: #2e289c;
}

.button-plus {
    font-size: 20px;
    line-height: 1;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 320px));
    align-items: start;
    gap: 22px;
}

.project-card {
    display: flex;
    min-height: 174px;
    flex-direction: column;
    padding: 23px 24px;
    border: 1px solid #e0e4ec;
    border-radius: 16px;
    background: #fff;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: #c8c5ef;
    box-shadow: 0 10px 28px #32315d12;
}

.project-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #172033;
    font-size: 16px;
}

.project-card-open {
    display: flex;
    width: 100%;
    flex: 1;
    flex-direction: column;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.project-card-description {
    overflow: hidden;
    min-height: 21px;
    margin: 11px 0 20px;
    color: #7b879a;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-action {
    align-self: flex-start;
    margin-top: 12px;
    padding: 6px 0 0;
    border: 0;
    background: transparent;
    color: #5146d8;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.project-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.project-card-actions .danger-text-button {
    margin-left: 0;
    padding: 6px 8px;
    border: 1px solid #f0c4c0;
    background: #fff;
    color: #b42318;
}

.project-card-actions .danger-text-button:hover {
    background: #fff4f2;
}

.project-card-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-open-icon {
    color: #8791a3;
    font-size: 20px;
}

.project-card-meta {
    display: flex;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    gap: 8px;
    border-top: 1px solid #e2e5ed;
    color: #738096;
    font-size: 13px;
}

.meta-clock {
    margin-left: 7px;
    font-size: 15px;
}

.empty-state, .loading-state {
    display: flex;
    min-height: 300px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: #778398;
    text-align: center;
}

.empty-icon, .dialog-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 17px;
    background: #eeedfb;
    color: #443cc3;
    font-size: 24px;
}

.empty-state h2 {
    margin-bottom: 7px;
    color: #263247;
    font-size: 19px;
}

.empty-state p {
    max-width: 540px;
    margin-bottom: 18px;
    line-height: 1.65;
}

.secondary-button, .text-button {
    border: 0;
    background: transparent;
    color: #3730b5;
    cursor: pointer;
    font-weight: 600;
}

.secondary-button {
    padding: 10px 14px;
    border: 1px solid #d8d6f1;
    border-radius: 10px;
    background: #fff;
}

.notice {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 15px;
    gap: 10px;
    border-radius: 10px;
    font-size: 13px;
}

.notice-warning {
    border: 1px solid #f2d29a;
    background: #fff9ed;
    color: #8a5a16;
}

.notice-warning span {
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
}

.notice-info {
    border: 1px solid #cbc9ef;
    background: #f3f2fc;
    color: #3730a3;
}

.loading-state {
    flex-direction: row;
    min-height: 200px;
    gap: 11px;
}

.spinner {
    width: 17px;
    height: 17px;
    border: 2px solid #d7d4f2;
    border-top-color: #3730b5;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.detail-page {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: 34px 44px 28px;
}

.login-required {
    display: grid;
    min-height: 100vh;
    align-content: center;
    justify-items: center;
    gap: 16px;
    padding: 30px;
    text-align: center;
}

.login-required h1 {
    margin: 0;
    color: #172033;
    font-size: 26px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 50% 0%, #ecebfa 0%, transparent 52%),
        #f8f8fb;
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    border: 1px solid #e2e5ed;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 55px #26205b12;
}

.login-brand {
    margin: 0 0 32px;
}

.login-card h1 {
    margin: 10px 0 6px;
    color: #172033;
    font-size: 30px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    margin-top: 25px;
    gap: 9px;
}

.login-card label {
    color: #364152;
    font-size: 13px;
    font-weight: 600;
}

.login-card input[type="password"] {
    height: 43px;
    padding: 0 12px;
    border: 1px solid #d9deea;
    border-radius: 10px;
    outline-color: #5a50c9;
}

.login-submit {
    margin-top: 8px;
}

.login-note {
    margin: 19px 0 0;
    color: #8a94a6;
    font-size: 11px;
    line-height: 1.55;
}

.login-error {
    margin-top: 17px;
    padding: 11px 12px;
    border: 1px solid #f2c8c5;
    border-radius: 9px;
    background: #fff5f4;
    color: #a13731;
    font-size: 12px;
    line-height: 1.5;
}

.detail-heading {
    margin-bottom: 27px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
    gap: 10px;
    border: 0;
    background: transparent;
    color: #68758a;
    cursor: pointer;
    font-size: 15px;
}

.back-button span {
    font-size: 21px;
}

.detail-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 20px;
}

.detail-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-title-row h1 {
    margin-top: 0;
    font-size: 34px;
}

.upload-button {
    position: relative;
    overflow: hidden;
}

.upload-button > span {
    font-size: 19px;
}

.upload-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-file-input:disabled {
    cursor: wait;
}

.file-input-hidden {
    display: none;
}

.detail-stats {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
    gap: 10px 22px;
    color: #738096;
    font-size: 13px;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 18px;
}

.tabs {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 12px;
    background: #f0f1f5;
}

.tab {
    min-height: 36px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #69758a;
    cursor: pointer;
    font-size: 14px;
}

.tab.selected {
    border-color: #e5e7ee;
    background: #fff;
    box-shadow: 0 1px 3px #17203314;
    color: #202a3d;
    font-weight: 600;
}

.search-box {
    display: flex;
    width: min(350px, 48%);
    height: 42px;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    border: 1px solid #dde2eb;
    border-radius: 11px;
    background: #fff;
    color: #7a8498;
}

.search-box > span {
    font-size: 23px;
    line-height: 1;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #344054;
    font-size: 13px;
}

.search-box input::placeholder {
    color: #8993a5;
}

.table-frame {
    overflow: hidden;
    flex: 1;
    min-height: 220px;
    border: 1px solid #dfe3eb;
    border-radius: 14px;
    background: #fff;
}

.file-table-scroll {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
    text-align: left;
}

@media (max-width: 1250px) {
    .file-table {
        min-width: 760px;
    }

    .file-table th, .file-table td {
        padding-right: 8px;
        padding-left: 8px;
        font-size: 12px;
    }
}

.file-table th {
    padding: 14px 12px;
    border-bottom: 1px solid #e2e5ed;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.file-table td {
    padding: 11px 12px;
    color: #657187;
    font-size: 13px;
    white-space: nowrap;
}

.file-table tbody tr + tr td {
    border-top: 1px solid #eef0f4;
}

.file-table th:first-child, .file-table td:first-child {
    width: 28%;
    padding-left: 14px;
}

.file-path {
    overflow: hidden;
    max-width: 360px;
    color: #202b3d;
    font-weight: 500;
    text-overflow: ellipsis;
}

.file-hash {
    overflow: hidden;
    max-width: 360px;
    margin-top: 4px;
    color: #8791a3;
    font-size: 11px;
    text-overflow: ellipsis;
}

.status-pill {
    display: inline-flex;
    padding: 5px 10px;
    border: 1px solid #a6e8cc;
    border-radius: 20px;
    background: #ebfaf4;
    color: #15966a;
    font-size: 11px;
}

.status-pill.deleted {
    border-color: #e4c9c7;
    background: #fff4f2;
    color: #a63b32;
}

.download-link {
    color: #66758a;
    white-space: nowrap;
}

.download-link:hover {
    color: #3730b5;
}

.unavailable-action {
    color: #9aa3b2;
    font-size: 11px;
}

.table-empty {
    display: grid;
    min-height: 190px;
    place-items: center;
    padding: 24px;
    color: #8a94a6;
    font-size: 14px;
    text-align: center;
}

.history-table {
    padding: 0 14px;
}

.history-head, .history-row {
    display: grid;
    grid-template-columns: 170px 145px minmax(150px, 1fr) 150px;
    align-items: center;
    min-height: 54px;
    gap: 12px;
    border-bottom: 1px solid #eef0f4;
    color: #768196;
    font-size: 13px;
}

.history-head {
    color: #64748b;
}

.history-row strong {
    color: #3730b5;
    font-weight: 600;
}

.truncate {
    overflow: hidden;
    color: #263247;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 3px 0;
    color: #8a94a6;
    font-size: 12px;
}

.modal-backdrop {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #11182766;
}

.info-dialog {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 60px #11182733;
}

.info-dialog h2 {
    margin: 0 0 10px;
    color: #172033;
    font-size: 21px;
}

.info-dialog p {
    margin: 0 0 20px;
    color: #718096;
    font-size: 14px;
    line-height: 1.65;
}

.project-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.project-form label {
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.project-form label span {
    color: #8993a5;
    font-weight: 400;
}

.project-form input,
.project-form textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 11px 12px;
    border: 1px solid #d8dce6;
    border-radius: 10px;
    color: #172033;
    background: #fff;
    font: inherit;
}

.project-form input:focus,
.project-form textarea:focus {
    border-color: #5146d8;
    outline: 3px solid #5146d81a;
}

.form-error {
    color: #b42318;
    font-size: 13px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    gap: 10px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: 0;
    background: transparent;
    color: #7b879a;
    cursor: pointer;
    font-size: 24px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    z-index: 1000;
    right: 16px;
    bottom: 16px;
    padding: 13px 18px;
    border-radius: 10px;
    background: #b42318;
    color: #fff;
    box-shadow: 0 8px 28px #1720332b;
}

#blazor-error-ui a {
    margin-left: 10px;
    color: #fff;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    margin-left: 12px;
    cursor: pointer;
}

@media (max-width: 1050px) {
    .sidebar {
        width: 250px;
    }

    .main-content {
        margin-left: 250px;
    }

    .workspace-page {
        padding-right: 30px;
        padding-left: 30px;
    }

    .detail-page {
        padding-right: 28px;
        padding-left: 28px;
    }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid #e1e4eb;
    }

    .brand {
        margin: 13px 18px;
    }

    .sidebar-section {
        padding: 0 18px 12px;
    }

    .sidebar-heading, .sidebar-bottom {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .workspace-page {
        min-height: calc(100vh - 120px);
        padding: 30px 20px;
    }

    .workspace-heading {
        align-items: flex-start;
        margin-bottom: 24px;
        flex-wrap: wrap;
    }

    .workspace-actions {
        flex-wrap: wrap;
    }

    .selection-toolbar {
        flex-wrap: wrap;
    }

    .workspace-heading h1, .detail-title-row h1 {
        font-size: 28px;
    }

    .workspace-heading .primary-button {
        padding: 0 13px;
        font-size: 13px;
    }

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

    .project-card {
        width: 100%;
    }

    .detail-page {
        min-height: calc(100vh - 120px);
        padding: 24px 18px;
    }

    .detail-title-row {
        align-items: flex-start;
    }

    .upload-button {
        min-height: 39px;
        padding: 0 12px;
        font-size: 12px;
    }

    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .search-box {
        width: 100%;
    }

    .history-table {
        overflow-x: auto;
    }

    .history-head, .history-row {
        min-width: 650px;
    }
}

@media (max-width: 480px) {
    .workspace-heading {
        flex-direction: column;
    }

    .detail-title-row {
        flex-direction: column;
    }

    .detail-stats {
        flex-direction: column;
        gap: 8px;
    }
}
