* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #0055ff;
    --blue-dark: #002b80;
    --ink: #1a2332;
    --muted: #617087;
    --line: #dfe8f4;
    --surface: #ffffff;
    --background: #f3f7fc;
    --danger: #b42318;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--ink);
    font-family: 'Poppins', sans-serif;
}

.site-header {
    width: 100%;
    min-height: 72px;
    padding: 16px 8%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    box-shadow: 0 2px 8px rgba(23, 53, 92, 0.07);
    position: relative;
    z-index: 10;
}

.logo {
    color: var(--blue);
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
    list-style: none;
}

.nav-links a {
    color: #3a4a5c;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--blue);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    margin-left: auto;
    padding: 5px;
    border: 0;
    background: transparent;
}

.hamburger span {
    width: 24px;
    height: 3px;
    border-radius: 3px;
    background: var(--ink);
}

main {
    flex: 1;
}

.login-shell,
.role-shell,
.admin-shell {
    width: min(1120px, 88%);
    margin: 0 auto;
}

.login-shell,
.role-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
    padding: 56px 0;
}

.login-card {
    width: min(100%, 460px);
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 20px 55px rgba(32, 66, 112, 0.12);
}

.role-panel {
    width: min(100%, 820px);
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 20px 55px rgba(32, 66, 112, 0.12);
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 30px;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 210px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8faff;
}

.role-card p {
    margin: 9px 0 24px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.role-button {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding: 10px 17px;
    border: 1px solid var(--blue);
    border-radius: 8px;
    background: var(--blue);
    color: white;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.role-button:hover {
    background: #0045d1;
}

.lock-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 14px;
    background: var(--blue);
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--blue);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    color: var(--blue-dark);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    line-height: 1.2;
}

.intro {
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

label {
    font-size: 0.88rem;
    font-weight: 600;
}

input[type='text'],
input[type='password'],
select {
    width: 100%;
    min-height: 48px;
    margin-bottom: 8px;
    padding: 10px 13px;
    border: 1px solid #c9d5e5;
    border-radius: 9px;
    background: white;
    color: var(--ink);
    font: inherit;
}

select {
    cursor: pointer;
}

textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #c9d5e5;
    border-radius: 9px;
    font: inherit;
    resize: vertical;
}

fieldset {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
}

legend {
    padding: 0 6px;
    font-size: 0.88rem;
    font-weight: 600;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.filter-admin-list {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}

.filter-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.catalog-tabs {
    justify-content: flex-start;
    margin: 0 0 24px;
}

.catalog-thumb {
    width: 82px;
    height: 56px;
    border-radius: 7px;
    object-fit: cover;
}

.catalog-edit-row td {
    padding-top: 0;
    background: #f8faff;
}

.catalog-edit-row summary {
    padding: 10px 0;
    color: var(--blue);
    font-weight: 600;
    cursor: pointer;
}

.catalog-edit-form {
    max-width: 760px;
    padding: 8px 0 18px;
}

.catalog-edit-form label {
    display: grid;
    gap: 7px;
}

input:focus {
    outline: 3px solid rgba(0, 85, 255, 0.15);
    border-color: var(--blue);
}

.primary-button,
.secondary-button,
.download-button,
.view-button,
.edit-button,
.admin-button,
.mail-button,
.delete-button,
.file-picker {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 17px;
    border-radius: 8px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.primary-button {
    border: 1px solid var(--blue);
    background: var(--blue);
    color: white;
}

.primary-button:hover {
    background: #0045d1;
}

.secondary-button,
.file-picker {
    border: 1px solid #bed0e6;
    background: white;
    color: var(--blue-dark);
}

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

.toolbar-actions form {
    display: inline-flex;
}

.bottom-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 24px;
}

.bottom-actions form {
    display: inline-flex;
}

.excel-shell {
    width: min(1500px, 94%);
    margin: 0 auto;
    padding: 42px 0 70px;
}

.excel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 22px;
    margin-bottom: 24px;
}

.excel-sheet {
    margin-top: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
    box-shadow: 0 9px 28px rgba(29, 62, 105, 0.07);
}

.excel-sheet h2 {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.excel-table-wrap {
    max-height: 70vh;
    overflow: auto;
}

.excel-table {
    width: auto;
    min-width: 0;
    table-layout: fixed;
}

.excel-table .excel-row-number-column {
    width: 58px;
}

.excel-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    min-width: 0;
    background: #f1f6fd;
    text-align: center;
}

.excel-table .row-number {
    left: 0;
    z-index: 3;
    width: 58px;
    min-width: 58px;
    position: sticky;
    background: #f1f6fd;
    color: #6d7c90;
    text-align: center;
}

.excel-table td {
    min-width: 0;
    max-width: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.excel-limit-note {
    padding: 15px 24px;
    border-top: 1px solid var(--line);
    background: #fff8e8;
    color: #795a13;
    font-size: 0.85rem;
}

.mail-button {
    border: 1px solid var(--blue);
    background: var(--blue);
    color: white;
}

.admin-button,
.view-button,
.edit-button {
    border: 1px solid var(--blue);
    background: white;
    color: var(--blue);
}

.edit-button {
    background: var(--blue);
    color: white;
}

.edit-button:hover {
    background: #0045d1;
}

.readonly-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 24px 0 0;
    padding: 16px 18px;
    border: 1px solid #c9d9ee;
    border-radius: 10px;
    background: #f4f8fe;
    color: #43566f;
    font-size: 0.88rem;
    line-height: 1.6;
}

.readonly-note strong {
    color: var(--blue-dark);
}

.unavailable {
    color: #7a8798;
    font-size: 0.8rem;
}

.alert {
    margin-top: 22px;
    padding: 13px 15px;
    border-radius: 9px;
    font-size: 0.9rem;
}

.alert.success {
    border: 1px solid #a6dcc4;
    background: #edf9f3;
    color: #146c43;
}

.alert.error {
    border: 1px solid #f0b4af;
    background: #fff3f2;
    color: #9c2d24;
}

.admin-shell {
    padding: 58px 0 72px;
}

.management-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 26px;
}

.management-card {
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
    box-shadow: 0 9px 28px rgba(29, 62, 105, 0.07);
}

.management-form {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.management-form .primary-button {
    margin-top: 8px;
}

.partner-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.partner-selector select {
    width: min(100%, 360px);
    margin: 0;
}

.temporary-password {
    margin-top: 10px;
}

.temporary-password code {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 6px;
    background: white;
    color: var(--ink);
    font-size: 1rem;
    user-select: all;
}

.admin-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 30px;
}

.upload-card,
.files-card {
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
    box-shadow: 0 9px 28px rgba(29, 62, 105, 0.07);
}

.upload-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
    margin-top: 26px;
    padding: 25px 28px;
}

h2 {
    color: var(--blue-dark);
    font-size: 1.15rem;
}

.upload-card p,
.files-heading p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.86rem;
}

.upload-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-form input[type='file'] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.selected-file {
    max-width: 190px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.files-card {
    margin-top: 22px;
    overflow: hidden;
}

.files-heading {
    padding: 24px 28px 19px;
    border-bottom: 1px solid var(--line);
}

.storage-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 28px;
    border-bottom: 1px solid var(--line);
    background: #f8faff;
    color: var(--muted);
    font-size: 0.86rem;
}

.storage-breadcrumbs a {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.storage-breadcrumbs a:hover {
    text-decoration: underline;
}

.storage-breadcrumbs strong {
    color: var(--blue-dark);
}

.folder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
}

.folder-toolbar p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.82rem;
}

.folder-create-form,
.folder-rename-form,
.file-rename-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.folder-create-form input {
    min-width: 190px;
}

.folder-rename-form input,
.file-rename-form input {
    width: 145px;
    padding: 8px 10px;
    font-size: 0.8rem;
}

.file-rename-form input {
    width: 190px;
}

.folder-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--blue-dark);
    font-weight: 600;
    text-decoration: none;
}

.folder-link:hover {
    color: var(--blue);
}

.folder-icon {
    color: #e6a82d;
    font-size: 1.15rem;
}

.folder-row td {
    background: #fbfcff;
}

.folder-actions {
    min-width: 390px;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px 18px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8faff;
    color: #5c6c80;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    color: #35455a;
    font-size: 0.86rem;
}

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

.file-icon {
    margin-right: 10px;
    color: var(--blue);
}

.actions-heading {
    text-align: right;
}

.actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.delete-form,
.user-delete-form,
.folder-rename-form,
.file-rename-form {
    display: inline-flex;
}

.download-button {
    border: 1px solid #b9cce5;
    color: var(--blue-dark);
}

.delete-button {
    border: 1px solid #efc2bd;
    background: white;
    color: var(--danger);
}

.empty-state {
    display: grid;
    gap: 7px;
    padding: 55px 28px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--ink);
}

.footer {
    padding: 20px;
    border-top: 1px solid #15243a;
    background: #0a1628;
    color: #7f8998;
    font-size: 0.85rem;
    text-align: center;
}

.footer span {
    color: var(--blue);
    font-weight: 600;
}

@media (max-width: 900px) {
    .hamburger {
        display: flex;
    }

    .folder-toolbar,
    .folder-create-form {
        align-items: stretch;
        flex-direction: column;
    }

    .folder-create-form input {
        width: 100%;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        flex-direction: column;
        padding: 24px 8%;
        background: white;
        box-shadow: 0 12px 25px rgba(20, 48, 87, 0.12);
    }

    .nav-links.open {
        display: flex;
    }

    .upload-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-form {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .selected-file {
        max-width: 100%;
    }

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

@media (max-width: 650px) {
    .login-shell,
    .role-shell,
    .admin-shell {
        width: 90%;
    }

    .login-card,
    .role-panel {
        padding: 30px 24px;
    }

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

    .admin-shell {
        padding-top: 40px;
    }

    .admin-topline {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .bottom-actions {
        justify-content: flex-start;
    }

    .excel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .files-heading,
    .upload-card {
        padding: 22px 20px;
    }

    thead {
        display: none;
    }

    tr {
        display: block;
        padding: 14px 18px;
        border-bottom: 1px solid var(--line);
    }

    td {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        padding: 7px 0;
        border: 0;
        text-align: right;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
    }

    .actions {
        justify-content: space-between;
        margin-top: 8px;
    }

    .excel-table thead {
        display: table-header-group;
    }

    .excel-table tr {
        display: table-row;
        padding: 0;
        border: 0;
    }

    .excel-table th,
.excel-table td {
        display: table-cell;
        padding: 12px 14px;
        text-align: left;
    }

    .excel-table td::before {
        content: none;
    }
}

.excel-cell-input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.84rem;
}

.excel-cell-input:hover,
.excel-cell-input:focus {
    border-color: #a9c3e5;
    background: white;
}

.excel-cell-input.changed {
    border-color: #e1a928;
    background: #fff8e8;
}

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

.editor-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
