:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --panel: #ffffff;
    --text: #101828;
    --muted: #667085;
    --accent: #3b82f6;
    --accent-strong: #2563eb;
    --border: #d0d5dd;
    --border-strong: #98a2b3;
    --shadow: 0 24px 42px rgba(16, 24, 40, 0.1);
    --success-bg: #ecfdf3;
    --success-text: #067647;
    --error-bg: #fef3f2;
    --error-text: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: radial-gradient(circle at top, #eaf2ff 0%, var(--bg) 48%);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    width: min(760px, 100%);
    background: var(--panel);
    border: 1px solid rgba(152, 162, 179, 0.32);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 28px;
}

h1 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.1rem);
    letter-spacing: -0.03em;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.subtitle {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.45;
}

.feedback {
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    font-size: 0.95rem;
    transition: opacity 160ms ease, transform 160ms ease;
}

.feedback.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #abecc6;
}

.feedback.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #fecdca;
}

.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background: #fbfcff;
    transition: border-color 140ms ease, background-color 140ms ease, transform 120ms ease;
    outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--accent);
    background: #eef4ff;
}

.drop-zone.is-over {
    border-color: var(--accent);
    background: #eff6ff;
    transform: scale(0.996);
}

.drop-zone strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.drop-zone span {
    color: var(--muted);
}

.file-grid {
    margin-top: 14px;
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: auto;
    max-height: 250px;
}

.file-ticket {
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #ffffff;
    padding: 9px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.file-ticket-number {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #344054;
    border: 1px solid #d0d5dd;
    background: #f9fafb;
    font-size: 0.74rem;
    flex-shrink: 0;
}

.file-ticket-name {
    margin: 0;
    color: #1f2937;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-size: 0.86rem;
}

.file-empty {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin: 20px 0;
}

legend {
    padding: 0 6px;
    color: #344054;
    font-weight: 600;
}

.field-label {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.option {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.option:last-child {
    margin-bottom: 0;
}

.custom-input {
    margin-top: 10px;
}

input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

button {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 188px;
    justify-content: center;
    transition: background-color 120ms ease, transform 100ms ease, opacity 120ms ease;
}

button:hover {
    background: var(--accent-strong);
}

button:active {
    transform: translateY(1px);
}

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

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    display: none;
    animation: spin 0.8s linear infinite;
}

button.is-loading .spinner {
    display: inline-block;
}

.hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

@media (max-width: 1000px) {
    .file-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .file-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .file-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

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