* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #687385;
    --line: #dfe5ef;
    --primary: #176bff;
    --primary-dark: #0d55d9;
    --danger: #c73636;
    --success: #137a4a;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
    --radius: 8px;
}

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

button,
input {
    font: inherit;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar,
.panel,
.login-card,
.download-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    margin-bottom: 18px;
}

.brand,
.top-actions,
.download-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand img,
.download-brand img {
    max-width: 150px;
    max-height: 58px;
    object-fit: contain;
}

.brand small,
.section-title p,
.field small,
.dropzone span,
.dropzone em,
.download-card p,
.file-summary span {
    color: var(--muted);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #13213a;
    color: #fff;
    font-weight: 800;
}

.brand-mark.big {
    width: 58px;
    height: 58px;
    margin: 0 auto;
}

.storage-widget {
    min-width: 190px;
}

.storage-widget span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.storage-widget i {
    display: block;
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: #e8edf5;
}

.storage-widget b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.panel {
    padding: 22px;
    margin-top: 18px;
}

.section-title {
    margin-bottom: 18px;
}

.section-title h1,
.section-title h2,
.login-card h1,
.download-card h1 {
    margin: 0 0 6px;
    letter-spacing: 0;
}

.section-title p,
.login-card p,
.download-card p {
    margin: 0;
}

.section-title.inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-grid {
    display: grid;
    grid-template-columns: 220px minmax(260px, 1fr) auto;
    align-items: end;
    gap: 18px;
}

.logo-uploader,
.field {
    display: grid;
    gap: 8px;
}

.logo-uploader > span,
.field > span {
    font-size: 0.92rem;
    font-weight: 700;
}

.logo-preview {
    display: grid;
    place-items: center;
    min-height: 92px;
    padding: 14px;
    border: 1px dashed #b7c3d6;
    border-radius: var(--radius);
    background: #f8faff;
    color: var(--muted);
}

.logo-preview img {
    max-width: 170px;
    max-height: 70px;
    object-fit: contain;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #cfd8e6;
    border-radius: var(--radius);
    color: var(--text);
    background: #fff;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 255, 0.14);
}

input[type="file"] {
    width: 100%;
    color: var(--muted);
}

.button,
.icon-button,
.danger-link {
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    font-weight: 800;
}

.button.primary {
    color: #fff;
    background: var(--primary);
}

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

.button.ghost {
    color: var(--text);
    background: #eef3fb;
}

.button.large {
    width: 100%;
    min-height: 52px;
}

.button.huge {
    width: 100%;
    min-height: 60px;
    font-size: 1.05rem;
}

.button.small {
    min-height: 36px;
    padding: 0 12px;
}

.upload-form {
    display: grid;
    gap: 16px;
}

.dropzone {
    display: grid;
    place-items: center;
    min-height: 190px;
    padding: 24px;
    text-align: center;
    border: 2px dashed #b7c3d6;
    border-radius: var(--radius);
    background: #f8faff;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dropzone strong {
    font-size: 1.25rem;
}

.dropzone em {
    font-style: normal;
    font-size: 0.92rem;
}

.dropzone.is-dragging {
    border-color: var(--primary);
    background: #edf4ff;
}

.alert {
    margin: 14px 0;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: #fff;
}

.alert.success {
    color: var(--success);
    border-color: #bfe8d4;
    background: #effaf5;
}

.alert.error {
    color: var(--danger);
    border-color: #f1c5c5;
    background: #fff2f2;
}

.link-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow-wrap: anywhere;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #3a4658;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8faff;
}

td {
    font-size: 0.94rem;
}

.empty {
    text-align: center;
    color: var(--muted);
}

.icon-button {
    min-height: 34px;
    padding: 0 11px;
    color: var(--primary);
    background: #eaf2ff;
    font-weight: 800;
}

.danger-link {
    color: var(--danger);
    background: transparent;
    font-weight: 800;
}

.login-page,
.download-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card,
.download-card {
    width: min(460px, 100%);
    padding: 30px;
    text-align: center;
}

.login-card form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
    text-align: left;
}

.download-card {
    width: min(560px, 100%);
}

.download-brand {
    justify-content: center;
    margin-bottom: 22px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.file-summary {
    display: grid;
    gap: 5px;
    margin: 24px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8faff;
    overflow-wrap: anywhere;
}

.download-card form {
    margin: 18px 0 14px;
}

@media (max-width: 820px) {
    .topbar,
    .top-actions,
    .settings-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .settings-grid {
        display: grid;
    }

    .brand {
        align-self: flex-start;
    }

    .storage-widget {
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 10px;
    }

    .panel,
    .topbar,
    .login-card,
    .download-card {
        padding: 16px;
    }

    .link-alert {
        align-items: stretch;
        flex-direction: column;
    }
}

.password-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    align-items: end;
    gap: 18px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.upload-progress {
    display: grid;
    grid-template-columns: 1fr 52px;
    align-items: center;
    gap: 12px;
}

.upload-progress i {
    display: block;
    height: 12px;
    overflow: hidden;
    border-radius: 99px;
    background: #e8edf5;
}

.upload-progress b {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width .18s ease;
}

.upload-progress span {
    color: var(--muted);
    font-weight: 800;
    text-align: right;
}

.hidden {
    display: none !important;
}

.button:disabled {
    cursor: progress;
    opacity: .72;
}

@media (max-width: 900px) {
    .password-grid {
        grid-template-columns: 1fr;
    }
}
/* Compact settings area only */
.settings-panel {
    padding: 18px 22px;
}

.settings-panel .section-title {
    margin-bottom: 14px;
}

.settings-panel .section-title h1 {
    font-size: 1.55rem;
    line-height: 1.15;
}

.settings-panel .section-title p {
    font-size: 0.95rem;
}

.settings-panel .settings-grid {
    grid-template-columns: 220px minmax(260px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.settings-panel .password-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
}

.settings-panel .logo-uploader,
.settings-panel .field {
    gap: 6px;
}

.settings-panel .logo-uploader > span,
.settings-panel .field > span {
    font-size: 0.86rem;
}

.settings-panel .logo-preview {
    min-height: 68px;
    padding: 8px 10px;
}

.settings-panel .logo-preview img {
    max-width: 145px;
    max-height: 48px;
}

.settings-panel input[type="text"],
.settings-panel input[type="password"] {
    height: 38px;
    padding: 0 11px;
}

.settings-panel input[type="file"] {
    font-size: 0.86rem;
}

.settings-panel input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 8px;
    border: 1px solid #cfd8e6;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.settings-panel .button {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.92rem;
}

.settings-panel .field small {
    font-size: 0.82rem;
}

.upload-progress.is-indeterminate i {
    position: relative;
}

.upload-progress.is-indeterminate b {
    position: absolute;
    width: 38%;
    animation: upload-slide 1s ease-in-out infinite;
}

@keyframes upload-slide {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(270%); }
}

@media (max-width: 900px) {
    .settings-panel .settings-grid,
    .settings-panel .password-grid {
        grid-template-columns: 1fr 1fr;
    }

    .settings-panel .button {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .settings-panel .settings-grid,
    .settings-panel .password-grid {
        grid-template-columns: 1fr;
    }
}
/* Alignment fix for settings first row */
.settings-panel .settings-grid {
    grid-template-columns: 220px minmax(280px, 1fr) auto;
    align-items: start;
    column-gap: 14px;
    row-gap: 10px;
}

.settings-panel .settings-grid > .button {
    align-self: start;
    margin-top: 30px;
}

.settings-panel .logo-uploader {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
}

.settings-panel .logo-preview {
    height: 68px;
    min-height: 68px;
}

.settings-panel .logo-uploader input[type="file"] {
    margin-top: 6px;
    width: 100%;
    max-width: 220px;
    line-height: 1.2;
}

.settings-panel .settings-grid > .field {
    align-self: start;
    padding-top: 30px;
}

.settings-panel .settings-grid > .field > span {
    position: absolute;
    transform: translateY(-24px);
}

.settings-panel .settings-grid > .field small {
    margin-top: 2px;
    line-height: 1.25;
}

.settings-panel .password-grid {
    margin-top: 10px;
    padding-top: 12px;
}

@media (max-width: 900px) {
    .settings-panel .settings-grid > .field {
        padding-top: 0;
    }

    .settings-panel .settings-grid > .field > span {
        position: static;
        transform: none;
    }

    .settings-panel .settings-grid > .button {
        margin-top: 0;
    }
}