:root {
    --background: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #162033;
    --muted: #667085;
    --border: #e4e9f1;
    --blue: #3867f4;
    --blue-dark: #2852d4;
    --danger: #d64545;
    --shadow: 0 10px 30px rgba(25, 39, 70, .07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background: var(--background);
}

a {
    color: inherit;
}

header {
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1120px;
    margin: auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.brand-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #4978ff, #2351da);
    color: white;
    font-weight: 800;
    font-size: 32px;
    box-shadow: 0 10px 24px rgba(56,103,244,.25);
}

.brand-icon.small {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 21px;
}

nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

nav a {
    text-decoration: none;
}

.username {
    color: var(--muted);
}

main {
    max-width: 1120px;
    margin: auto;
    padding: 36px 24px 80px;
}

.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.welcome h1 {
    margin: 0 0 5px;
    font-size: 32px;
}

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

.storage-stat {
    background: var(--surface);
    padding: 13px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    text-align: right;
}

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

.storage-stat span {
    color: var(--muted);
    font-size: 12px;
}

.drop-zone {
    min-height: 230px;
    border: 2px dashed #b7c5ec;
    background: linear-gradient(
        180deg,
        #fbfcff,
        #f4f7ff
    );
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: .18s ease;
    margin-bottom: 28px;
}

.drop-zone:hover,
.drop-zone.dragging {
    border-color: var(--blue);
    background: #edf2ff;
    transform: translateY(-1px);
}

.upload-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
}

.drop-zone h2 {
    margin: 0;
    font-size: 20px;
}

.drop-zone p {
    margin: 5px 0;
    color: var(--muted);
}

.drop-zone small {
    color: #98a2b3;
}

#uploadStatus {
    margin-top: 12px;
    color: var(--blue);
    font-weight: 600;
}

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

.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
    color: var(--text);
}

input:focus,
select:focus {
    outline: 2px solid rgba(56,103,244,.16);
    border-color: var(--blue);
}

.search-form input {
    width: min(400px, 100%);
}

button,
.button {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

button:hover,
.button:hover {
    background: var(--surface-soft);
}

.primary {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.primary:hover {
    background: var(--blue-dark);
}

.danger {
    color: var(--danger);
}

.full {
    width: 100%;
    margin-top: 8px;
}

.file-count {
    color: var(--muted);
    font-size: 14px;
}

.files,
.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.file-row,
.user-row {
    display: flex;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
}

.file-row:last-child,
.user-row:last-child {
    border-bottom: 0;
}

.file-icon {
    width: 42px;
    height: 42px;
    background: var(--surface-soft);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 13px;
    font-size: 20px;
}

.file-info,
.user-info {
    flex: 1;
    min-width: 0;
}

.file-info strong,
.file-info span,
.user-info strong,
.user-info span {
    display: block;
}

.file-info strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info span,
.user-info span {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.file-actions,
.user-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-actions form,
.user-actions form {
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--muted);
}

.empty-state div {
    font-size: 44px;
}

.empty-state h2 {
    color: var(--text);
    margin-bottom: 5px;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(
            circle at top right,
            #e7edff,
            transparent 35%
        ),
        var(--background);
}

.login-card {
    width: 100%;
    max-width: 410px;
    background: white;
    padding: 38px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(31,45,75,.12);
    border: 1px solid var(--border);
}

.login-card .brand-icon {
    margin: 0 auto;
}

.login-card h1 {
    text-align: center;
    margin: 18px 0 3px;
}

.subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 28px;
}

.login-card label {
    font-size: 13px;
    font-weight: 600;
    display: block;
    margin: 13px 0 6px;
}

.login-card input {
    width: 100%;
}

.alert {
    background: #fff1f1;
    border: 1px solid #ffd3d3;
    color: #a82929;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.admin-card {
    padding: 22px;
    margin-bottom: 24px;
}

.admin-card h2 {
    margin-top: 0;
}

.new-user-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 14px;
}

.password-reset {
    display: flex;
    gap: 6px;
}

.password-reset input {
    width: 155px;
}

.badge {
    display: inline-block;
    background: #edf2ff;
    color: var(--blue);
    font-size: 9px;
    letter-spacing: .05em;
    padding: 3px 6px;
    border-radius: 5px;
    margin-left: 5px;
}

@media (max-width: 700px) {

    .header-inner {
        padding: 12px 15px;
    }

    .brand span,
    .username {
        display: none;
    }

    nav {
        gap: 12px;
    }

    main {
        padding: 24px 14px 60px;
    }

    .welcome h1 {
        font-size: 26px;
    }

    .storage-stat {
        padding: 10px 13px;
    }

    .drop-zone {
        min-height: 200px;
    }

    .toolbar,
    .search-form {
        align-items: stretch;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-form {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-form input {
        flex: 1;
        min-width: 180px;
    }

    .file-count {
        align-self: flex-start;
    }

    .file-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .file-info {
        width: calc(100% - 60px);
    }

    .file-actions {
        width: 100%;
        padding-left: 55px;
        margin-top: 12px;
    }

    .user-row {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

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

    .password-reset {
        flex: 1;
    }

    .password-reset input {
        flex: 1;
    }
}

.upload-status {
    width: min(520px, calc(100% - 40px));
    margin-top: 20px;
    padding: 14px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(25, 39, 70, .06);
}

.upload-status-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 10px;
}

.upload-status-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text);
}

.upload-status-row strong {
    color: var(--blue);
    font-size: 13px;
}

.progress-track {
    width: 100%;
    height: 9px;
    background: #e8edf6;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--blue);
    border-radius: 999px;
    transition: width .12s linear;
}

.upload-message {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.upload-status.success .progress-bar {
    background: #2e9b62;
}

.upload-status.success .upload-message {
    color: #23764c;
}

.upload-status.error {
    border-color: #efc8c8;
    background: #fffafa;
}

.upload-status.error .progress-bar {
    background: var(--danger);
}

.upload-status.error .upload-message {
    color: var(--danger);
}

.drop-zone:has(.upload-status:not([hidden])) {
    cursor: default;
}

@media (max-width: 700px) {
    .upload-status {
        width: calc(100% - 24px);
    }
}
