:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17212b;
    background: #f4f6f8;
    letter-spacing: 0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f4f6f8;
}

.topbar {
    color: #ffffff;
    background: #143642;
    border-bottom: 4px solid #16a085;
}

.topbar-inner {
    width: min(1080px, calc(100% - 32px));
    min-height: 88px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    color: #143642;
    background: #ffffff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 800;
}

h1,
h2,
p {
    margin: 0;
}

.topbar h1 {
    font-size: 20px;
    line-height: 1.25;
}

.topbar p {
    margin-top: 3px;
    color: #c7d9dd;
    font-size: 13px;
}

.workspace {
    width: min(1080px, calc(100% - 32px));
    margin: 36px auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.tool-panel,
.details-panel,
.open-water-panel,
.archive-panel {
    background: #ffffff;
    border: 1px solid #d9e0e4;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(18, 40, 48, 0.05);
}

.tool-panel {
    padding: 28px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e6eaed;
}

.step {
    display: block;
    margin-bottom: 5px;
    color: #52707a;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.panel-heading h2,
.details-panel h2 {
    font-size: 18px;
    line-height: 1.35;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #346056;
    font-size: 12px;
    font-weight: 700;
}

.status-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a085;
}

form {
    display: grid;
}

label {
    margin-bottom: 8px;
    color: #273740;
    font-size: 14px;
    font-weight: 700;
}

input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 13px;
    color: #17212b;
    background: #ffffff;
    border: 1px solid #aebbc2;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    outline: none;
}

input:focus {
    border-color: #168d78;
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.14);
}

.field-note {
    margin: 7px 0 22px;
    color: #687981;
    font-size: 12px;
    line-height: 1.5;
}

.folder-input {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    border: 1px solid #aebbc2;
    border-radius: 6px;
    overflow: hidden;
}

.folder-input:focus-within {
    border-color: #168d78;
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.14);
}

.folder-input span {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #53656e;
    background: #eef2f3;
    border-right: 1px solid #cbd4d8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}

.folder-input input {
    height: 44px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

button {
    min-height: 44px;
    padding: 0 20px;
    color: #ffffff;
    background: #137e6c;
    border: 1px solid #0f6a5b;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

button:hover {
    background: #0f6f60;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

#working-message {
    color: #5e7078;
    font-size: 12px;
}

.notice {
    display: grid;
    gap: 5px;
    margin-bottom: 24px;
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.45;
}

.notice-error {
    color: #721c24;
    background: #fff1f2;
    border: 1px solid #efc5c9;
}

.notice-success {
    color: #245447;
    background: #eaf8f4;
    border: 1px solid #b9dfd5;
}

.notice a {
    width: fit-content;
    color: inherit;
    font-weight: 750;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.details-panel {
    padding: 22px;
}

.details-panel h2 {
    padding-bottom: 16px;
    border-bottom: 1px solid #e6eaed;
}

dl,
dd {
    margin: 0;
}

dl > div {
    padding: 16px 0;
    border-bottom: 1px solid #edf0f2;
}

dl > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

dt {
    margin-bottom: 4px;
    color: #283a43;
    font-size: 13px;
    font-weight: 750;
}

dd {
    color: #687981;
    font-size: 12px;
    line-height: 1.5;
}

.archive-panel {
    grid-column: 1 / -1;
    overflow: hidden;
}

.open-water-panel {
    grid-column: 1 / -1;
    padding: 24px;
}

.open-water-heading {
    padding-bottom: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #e6eaed;
}

.open-water-heading h2 {
    font-size: 18px;
    line-height: 1.35;
}

.open-water-form {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr) auto;
    gap: 18px;
    align-items: start;
}

.upload-field {
    min-width: 0;
    display: grid;
}

.upload-field .field-note {
    margin-bottom: 0;
}

input[type="file"] {
    padding: 8px 10px;
    color: #53656e;
    background: #f8fafb;
}

input[type="file"]::file-selector-button {
    height: 28px;
    margin-right: 10px;
    padding: 0 10px;
    color: #27434d;
    background: #e7edef;
    border: 1px solid #becbd0;
    border-radius: 4px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.open-water-action {
    padding-top: 25px;
}

.open-water-action button {
    white-space: nowrap;
}

.archive-heading {
    min-height: 84px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #e6eaed;
}

.archive-heading h2 {
    font-size: 18px;
    line-height: 1.35;
}

.archive-count {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #526971;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 750;
}

.archive-empty {
    min-height: 120px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    color: #687981;
    font-size: 13px;
}

.archive-empty strong {
    color: #283a43;
    font-size: 14px;
}

.archive-table-head,
.archive-row {
    display: grid;
    grid-template-columns: minmax(190px, 1.35fr) minmax(135px, 0.7fr) minmax(140px, 0.7fr) 280px;
    gap: 18px;
    align-items: center;
}

.archive-table-head {
    min-height: 38px;
    padding: 0 24px;
    color: #687981;
    background: #f5f7f8;
    border-bottom: 1px solid #e3e8ea;
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
}

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

.archive-row {
    min-height: 70px;
    padding: 12px 24px;
    border-bottom: 1px solid #edf0f2;
    font-size: 13px;
}

.archive-row:last-child {
    border-bottom: 0;
}

.archive-name {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.archive-name a {
    min-width: 0;
    overflow: hidden;
    color: #176f63;
    font-weight: 750;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-name a:hover,
.archive-open:hover,
.archive-build:hover,
.archive-region:hover {
    text-decoration: underline;
}

.archive-name span,
.archive-date,
.archive-size {
    color: #687981;
    font-size: 12px;
}

.archive-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.archive-open,
.archive-build,
.archive-region {
    color: #176f63;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.archive-build {
    color: #325d6a;
}

.archive-region {
    color: #8a4d16;
}

@media (max-width: 760px) {
    .workspace {
        margin: 20px auto;
        grid-template-columns: 1fr;
    }

    .tool-panel {
        padding: 20px;
    }

    .details-panel {
        order: 2;
    }

    .open-water-panel {
        order: 3;
        padding: 20px;
    }

    .archive-panel {
        order: 4;
    }

    .open-water-form {
        grid-template-columns: 1fr;
    }

    .open-water-action {
        padding-top: 0;
    }

    .form-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .archive-heading {
        padding: 18px 20px;
    }

    .archive-table-head {
        display: none;
    }

    .archive-row {
        min-height: 0;
        padding: 16px 20px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px 12px;
    }

    .archive-name {
        grid-column: 1 / -1;
    }

    .archive-date,
    .archive-size {
        grid-column: 1;
    }

    .archive-actions {
        grid-column: 2;
        grid-row: 2 / span 2;
        align-self: center;
        align-items: flex-end;
        flex-direction: column;
        gap: 7px;
    }
}
