.app-shell {
    width: min(1560px, calc(100% - 24px));
    padding-top: 16px;
    padding-bottom: 28px;
}

.app-hero {
    min-height: 210px;
    padding: 24px 28px;
}

.app-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    align-items: stretch;
}

.app-hero h1 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.app-hero .ds-lead {
    max-width: 780px;
    line-height: 1.5;
}

.app-workspace h2,
.app-selected-panel h2 {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
}

.app-workspace .ds-section-head,
.app-selected-panel .ds-section-head {
    gap: 6px;
}

.app-logo {
    width: clamp(150px, 18vw, 230px);
}

.app-summary {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 132px;
    padding: 16px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    background: var(--surface-0);
}

.app-workspace {
    display: grid;
    gap: 16px;
    margin-top: 16px;
    padding: 20px;
}

.app-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 16px;
    align-items: start;
}

.app-alert {
    margin: 0;
}

.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(18, 24, 32, 0.34);
    backdrop-filter: blur(3px);
}

.app-loading-overlay[hidden],
.app-button-loading[hidden] {
    display: none;
}

.app-loading-card {
    display: grid;
    justify-items: center;
    gap: 10px;
    width: min(340px, 100%);
    padding: 22px;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    color: var(--ink-900);
    background: var(--surface-0);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.app-loading-card strong {
    font-size: 1rem;
}

.app-loading-card span:last-child {
    color: var(--ink-600);
    line-height: 1.45;
}

.app-spinner,
.app-inline-spinner,
.app-button-spinner {
    display: inline-block;
    border-radius: 999px;
    border: 3px solid rgba(210, 0, 53, 0.18);
    border-top-color: var(--brand-500);
    animation: app-spin 0.75s linear infinite;
}

.app-spinner {
    width: 42px;
    height: 42px;
}

.app-inline-spinner,
.app-button-spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.app-loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--ink-700);
    font-weight: 600;
}

.app-button-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.app-button-spinner {
    border-color: rgba(255, 255, 255, 0.32);
    border-top-color: #fff;
}

.app-is-loading {
    cursor: progress;
}

@keyframes app-spin {
    to {
        transform: rotate(360deg);
    }
}

.app-form {
    position: relative;
    gap: 12px;
}

.app-form .ds-field {
    gap: 6px;
}

.app-form .ds-field input {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
}

.app-file-picker {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px dashed rgba(210, 0, 53, 0.38);
    border-radius: 16px;
    background: var(--surface-0);
    cursor: pointer;
}

.app-file-picker input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.app-file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 10px;
    color: #b00035;
    background: #f8d4df;
    font-weight: 700;
    white-space: nowrap;
}

.app-file-name {
    min-width: 0;
    margin-left: 12px;
    overflow: hidden;
    color: var(--ink-900);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-file-picker:focus-within {
    border-color: rgba(210, 0, 53, 0.55);
    box-shadow: 0 0 0 4px var(--brand-ring);
}

.app-search-field input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

.app-dropdown-shell {
    position: relative;
}

.app-dropdown {
    display: grid;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface-0);
    box-shadow: var(--shadow-soft);
}

.app-vendor-dropdown {
    max-height: 190px;
}

.app-option {
    display: grid;
    grid-template-columns: 22px minmax(82px, 110px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
}

.app-option:last-child {
    border-bottom: 0;
}

.app-option:hover,
.app-option:focus-within {
    background: var(--brand-soft);
}

.app-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-500);
}

.app-client-code {
    font-family: var(--font-mono);
    color: var(--brand-700);
}

.app-client-name {
    overflow: hidden;
    color: var(--ink-900);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-empty {
    padding: 12px 14px;
    color: var(--ink-600);
    line-height: 1.5;
}

.app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.app-actions .ds-button {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
}

.app-actions .ds-button:disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.58;
    transform: none;
}

.app-selected-panel {
    display: grid;
    gap: 14px;
    padding: 20px;
}

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

.app-selected-item {
    display: grid;
    grid-template-columns: minmax(82px, 110px) minmax(0, 1fr) 40px;
    gap: 12px;
    align-items: center;
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface-0);
}

.app-remove {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(210, 0, 53, 0.16);
    border-radius: 12px;
    color: var(--brand-700);
    background: var(--surface-100);
    cursor: pointer;
}

.app-remove:hover {
    background: var(--brand-soft);
}

@media (max-width: 1200px) {
    .app-hero-grid,
    .app-main-grid {
        grid-template-columns: 1fr;
    }

    .app-selected-panel {
        margin-top: 16px;
    }
}

@media (max-width: 680px) {
    .app-shell {
        width: min(1560px, calc(100% - 16px));
        padding-top: 12px;
    }

    .app-hero,
    .app-workspace,
    .app-selected-panel {
        padding: 16px;
    }

    .app-option,
    .app-selected-item {
        grid-template-columns: 22px minmax(0, 1fr);
    }

    .app-selected-item {
        grid-template-columns: minmax(0, 1fr) 40px;
    }

    .app-option .app-client-code {
        grid-column: 2;
    }

    .app-option .app-client-name {
        grid-column: 2;
        white-space: normal;
    }
}
