:root {
    --navy: #0a2f4d;
    --navy-soft: #123f63;
    --red: #d71920;
    --red-dark: #a91218;
    --sky: #e8f2f8;
    --ink: #111827;
    --muted: #64748b;
    --line: #d7e0e8;
    --paper: #ffffff;
    --surface: #eef4f8;
    --success: #147b4b;
    --danger: #a51622;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--surface);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(10, 47, 77, 0.08), rgba(10, 47, 77, 0) 240px),
        var(--surface);
    font-family: Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 10px;
}

.shell.single {
    align-content: center;
}

.workspace,
.status {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(10, 47, 77, 0.12);
    border-radius: 8px;
    box-shadow: 0 14px 38px rgba(10, 47, 77, 0.12);
}

.workspace {
    overflow: hidden;
    padding: 14px;
}

.workspace.compact {
    width: 100%;
}

.status {
    padding: 12px 14px;
}

.topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.brand-row,
.login-brand {
    display: grid;
    grid-template-columns: minmax(92px, 32%) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.app-logo {
    display: block;
    width: 100%;
    max-width: 150px;
    height: auto;
    aspect-ratio: 2.25 / 1;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(10, 47, 77, 0.08);
}

.login-logo {
    max-width: 132px;
}

.top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--red);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    color: var(--navy);
    font-size: 27px;
    line-height: 1.06;
}

h2 {
    color: var(--navy);
    font-size: 17px;
}

.subhead {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.ghost-link,
.button {
    min-height: 48px;
    border-radius: 8px;
    font-weight: 900;
    text-decoration: none;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    background: #ffffff;
    border: 1px solid rgba(10, 47, 77, 0.18);
    padding: 0 12px;
}

.ghost-link:disabled {
    color: var(--muted);
    background: #edf3f7;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 58px;
    padding: 0 18px;
    border: 0;
    background: var(--red);
    color: #ffffff;
    font-size: 17px;
    box-shadow: 0 12px 24px rgba(215, 25, 32, 0.22);
    cursor: pointer;
}

.button:active {
    background: var(--red-dark);
    transform: translateY(1px);
}

.button.small {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    font-size: 15px;
}

.upload-panel,
.login-form {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.field input,
.login-form input {
    width: 100%;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-size: 16px;
}

.dropzone {
    display: grid;
    gap: 10px;
    align-content: center;
    min-height: 226px;
    padding: 18px;
    border: 1px solid rgba(10, 47, 77, 0.14);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f6fbff);
    text-align: center;
    cursor: pointer;
    box-shadow: inset 0 -3px 0 rgba(10, 47, 77, 0.04);
}

.dropzone:focus-within {
    outline: 3px solid rgba(215, 25, 32, 0.18);
}

.dropzone input {
    width: 100%;
    min-height: 44px;
}

.drop-icon {
    width: 58px;
    height: 58px;
    display: inline-grid;
    place-items: center;
    justify-self: center;
    border-radius: 8px;
    background: var(--navy);
    color: #ffffff;
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.drop-title {
    display: block;
    color: var(--navy);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.14;
}

.drop-subtitle {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.notice {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 13px;
    border-radius: 8px;
    border: 1px solid;
}

.notice.error {
    color: var(--danger);
    background: #fff1f2;
    border-color: #f2b8bf;
}

.notice.success {
    color: #123d25;
    background: #edf9f1;
    border-color: #a8dbb6;
}

.history {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.page-history {
    margin-top: 16px;
}

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

.section-title span,
.empty-state {
    color: var(--muted);
    font-size: 13px;
}

.empty-state {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #f7fafc;
}

.history-list {
    display: grid;
    gap: 8px;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid rgba(10, 47, 77, 0.12);
    border-radius: 8px;
    background: #ffffff;
}

.history-item strong,
.history-item small {
    display: block;
}

.history-item strong {
    color: var(--navy);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.history-item em {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    min-height: 34px;
    border-radius: 8px;
    background: var(--sky);
    color: var(--navy);
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.install-panel {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    align-items: end;
    padding: 12px;
    background: rgba(10, 47, 77, 0.38);
}

.install-panel[hidden] {
    display: none;
}

.install-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 20px 54px rgba(10, 47, 77, 0.22);
}

.install-card h2 {
    margin-bottom: 8px;
}

.install-card p,
.install-card li {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.install-card ol {
    margin: 12px 0 0;
    padding-left: 20px;
}

.panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--navy);
    font-weight: 900;
}

.status dl,
.diagnostic-list {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
}

.status dl div,
.diagnostic-list div {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

dt,
.diagnostic-list strong {
    color: var(--muted);
    font-size: 13px;
}

dd {
    margin: 0;
    color: var(--navy);
    font-weight: 900;
    text-align: right;
    word-break: break-word;
}

@media (max-width: 360px) {
    .brand-row,
    .login-brand {
        grid-template-columns: 1fr;
    }

    .app-logo {
        max-width: 132px;
    }
}

@media (min-width: 760px) {
    .shell {
        width: min(940px, calc(100% - 40px));
        margin: 0 auto;
        grid-template-columns: minmax(0, 1fr) 280px;
        align-items: center;
        gap: 18px;
        padding: 24px 0;
    }

    .shell.single {
        grid-template-columns: minmax(0, 520px);
        justify-content: center;
    }

    .workspace {
        padding: 22px;
    }

    .topbar {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .top-actions {
        grid-template-columns: auto auto auto;
    }

    .button.small {
        width: auto;
    }

    h1 {
        font-size: 32px;
    }
}
