:root {
    color-scheme: light;
    --basic-100: #ffffff;
    --basic-200: #f7f9fc;
    --basic-300: #edf1f7;
    --basic-400: #e4e9f2;
    --basic-500: #c5cee0;
    --basic-600: #596579;
    --basic-700: #2e3a59;
    --basic-800: #222b45;
    --basic-900: #151a30;
    --primary-500: #3366ff;
    --primary-600: #274bdb;
    --primary-700: #1e40af;
    --success-500: #00db92;
    --info-500: #0095ff;
    --warning-500: #ffaa00;
    --danger-500: #ff3d71;
    --shadow-soft: 0 16px 40px rgba(34, 43, 69, 0.08);
    --shadow-card: 0 10px 24px rgba(34, 43, 69, 0.05);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    color: var(--basic-800);
    background:
        radial-gradient(circle at top right, rgba(51, 102, 255, 0.08), transparent 28%),
        linear-gradient(180deg, #f9fbff 0%, #f2f5fb 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

html {
    scrollbar-gutter: stable;
}

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.brand-block {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 32px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(51, 102, 255, 0.14);
    background: rgba(51, 102, 255, 0.08);
    color: var(--primary-500);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin: 0;
}

h1 {
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

h2 {
    font-size: clamp(22px, 2.4vw, 26px);
    line-height: 1.23;
    font-weight: 700;
}

h3 {
    font-size: 18px;
    line-height: 1.33;
    font-weight: 700;
}

p,
li {
    color: var(--basic-700);
    font-size: 13px;
    line-height: 1.54;
}

.lead {
    max-width: 760px;
    color: var(--basic-600);
    font-size: 15px;
    line-height: 1.6;
}

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

.app-header > .toolbar {
    justify-content: flex-end;
    justify-self: end;
    min-width: 0;
}

.app-nav {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(143, 155, 179, 0.3);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow-card);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 12px;
    color: var(--basic-600);
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-link.active {
    background: var(--primary-500);
    color: var(--basic-100);
    box-shadow: 0 8px 18px rgba(51, 102, 255, 0.26);
}

.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(197, 206, 224, 0.75);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow-soft);
}

.section-card,
.card {
    border: 1px solid rgba(197, 206, 224, 0.72);
    border-radius: 18px;
    padding: 20px;
    background: var(--basic-100);
    box-shadow: var(--shadow-card);
}

.section-card {
    padding: 24px;
}

.stack > * + * {
    margin-top: 16px;
}

.section-stack > * + * {
    margin-top: 20px;
}

.batch-flow {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.batch-flow > * + * {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.split-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.9fr);
    align-items: start;
}

.label {
    color: var(--basic-600);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.value {
    margin-top: 8px;
    color: var(--basic-800);
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    word-break: break-word;
}

.muted {
    color: var(--basic-600);
}

.mono {
    font-family: "SFMono-Regular", ui-monospace, "Menlo", "Monaco", monospace;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--primary-500);
    color: var(--basic-100);
    font-size: 14px;
    font-weight: 700;
    line-height: 16px;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 10px 22px rgba(51, 102, 255, 0.24);
}

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

.button.secondary {
    background: transparent;
    color: var(--primary-500);
    border-color: rgba(51, 102, 255, 0.34);
    box-shadow: none;
}

.button.secondary:hover {
    background: rgba(51, 102, 255, 0.08);
    color: var(--primary-600);
}

.button.danger {
    background: rgba(255, 61, 113, 0.12);
    color: #d02b5d;
    border-color: rgba(255, 61, 113, 0.26);
    box-shadow: none;
}

.button.danger:hover {
    background: rgba(255, 61, 113, 0.18);
    color: #b42553;
}

.button.ghost {
    background: transparent;
    color: var(--basic-700);
    border-color: transparent;
    box-shadow: none;
}

.button.ghost:hover {
    background: rgba(143, 155, 179, 0.12);
}

.button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

label {
    color: var(--basic-700);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

input,
textarea,
select {
    width: 100%;
    min-height: 48px;
    padding: 13px 16px;
    border: 1px solid rgba(197, 206, 224, 0.9);
    border-radius: 12px;
    background: var(--basic-100);
    color: var(--basic-800);
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(51, 102, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.16);
}

input[type="file"] {
    min-height: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.upload-surface {
    border: 1px dashed rgba(51, 102, 255, 0.38);
    border-radius: 18px;
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(51, 102, 255, 0.04) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.upload-surface strong {
    display: block;
    margin-bottom: 8px;
    color: var(--basic-800);
    font-size: 15px;
    line-height: 1.5;
}

.notice {
    display: grid;
    gap: 8px;
    border-radius: 16px;
    padding: 16px 18px;
    border: 1px solid rgba(197, 206, 224, 0.82);
    background: var(--basic-200);
    color: var(--basic-700);
}

.notice strong {
    color: var(--basic-800);
    font-size: 13px;
    line-height: 1.35;
}

.notice.success {
    border-color: rgba(0, 219, 146, 0.28);
    background: rgba(0, 219, 146, 0.08);
}

.notice.error {
    border-color: rgba(255, 61, 113, 0.28);
    background: rgba(255, 61, 113, 0.08);
}

.notice.info {
    border-color: rgba(0, 149, 255, 0.22);
    background: rgba(0, 149, 255, 0.08);
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--basic-300);
    color: var(--basic-700);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
}

.badge.primary {
    background: rgba(51, 102, 255, 0.1);
    color: var(--primary-500);
}

.badge.success {
    background: rgba(0, 219, 146, 0.12);
    color: #009a67;
}

.badge.warning {
    background: rgba(255, 170, 0, 0.14);
    color: #b87700;
}

.badge.danger {
    background: rgba(255, 61, 113, 0.12);
    color: #d02b5d;
}

.badge.secondary {
    background: rgba(143, 155, 179, 0.14);
    color: var(--basic-600);
}

.summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(197, 206, 224, 0.82);
    background: var(--basic-100);
    color: var(--basic-700);
    box-shadow: var(--shadow-card);
}

.summary-pill strong {
    color: inherit;
    font-size: 15px;
    line-height: 1;
}

.summary-pill span {
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.summary-pill.primary {
    border-color: rgba(51, 102, 255, 0.22);
    background: rgba(51, 102, 255, 0.08);
    color: var(--primary-500);
}

.summary-pill.success {
    border-color: rgba(0, 219, 146, 0.24);
    background: rgba(0, 219, 146, 0.1);
    color: #009a67;
}

.summary-pill.warning {
    border-color: rgba(255, 170, 0, 0.24);
    background: rgba(255, 170, 0, 0.12);
    color: #b87700;
}

.summary-pill.danger {
    border-color: rgba(255, 61, 113, 0.24);
    background: rgba(255, 61, 113, 0.1);
    color: #d02b5d;
}

.summary-pill.secondary {
    border-color: rgba(143, 155, 179, 0.22);
    background: rgba(143, 155, 179, 0.12);
    color: var(--basic-600);
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    border: 1px solid rgba(197, 206, 224, 0.72);
    border-radius: 18px;
    padding: 18px;
    background: var(--basic-100);
    box-shadow: var(--shadow-card);
}

.stat-card .value {
    margin-top: 12px;
    font-size: 18px;
    line-height: 1.33;
}

.detail-list {
    display: grid;
    gap: 12px;
}

.detail-list.scroll-panel {
    max-height: 520px;
    padding-right: 6px;
    overflow-y: auto;
}

.detail-list.scroll-panel::-webkit-scrollbar {
    width: 10px;
}

.detail-list.scroll-panel::-webkit-scrollbar-track {
    background: rgba(197, 206, 224, 0.28);
    border-radius: 999px;
}

.detail-list.scroll-panel::-webkit-scrollbar-thumb {
    background: rgba(143, 155, 179, 0.62);
    border-radius: 999px;
}

.detail-list.scroll-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(143, 155, 179, 0.82);
}

.table-shell {
    overflow-x: auto;
    border: 1px solid rgba(197, 206, 224, 0.72);
    border-radius: 16px;
    background: var(--basic-100);
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: 12px 14px;
    border-top: 1px solid rgba(197, 206, 224, 0.52);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
    line-height: 1.5;
    color: var(--basic-700);
}

.status-action-cell {
    white-space: nowrap;
}

.status-action-cell form {
    margin: 0;
}

th {
    border-top: none;
    background: var(--basic-200);
    color: var(--basic-800);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table-shell table tr:first-child td {
    border-top: none;
}

.detail-item {
    display: grid;
    gap: 4px;
    padding: 14px 0;
    border-top: 1px solid rgba(197, 206, 224, 0.56);
}

.detail-item:first-child {
    border-top: none;
    padding-top: 0;
}

.mini-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-card {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid rgba(197, 206, 224, 0.72);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(247, 249, 252, 0.94), #ffffff);
}

.mini-card.current {
    border-color: rgba(51, 102, 255, 0.3);
    background: linear-gradient(180deg, rgba(51, 102, 255, 0.06), #ffffff);
}

.mini-card .value {
    margin-top: 0;
    font-size: 16px;
    line-height: 1.4;
}

.mini-meta {
    color: var(--basic-600);
    font-size: 12px;
    line-height: 1.45;
}

.fold-card {
    border: 1px solid rgba(197, 206, 224, 0.72);
    border-radius: 16px;
    background: var(--basic-100);
    overflow: hidden;
}

.fold-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 16px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    background: rgba(247, 249, 252, 0.78);
}

.fold-summary::-webkit-details-marker {
    display: none;
}

.fold-summary::after {
    content: "⌄";
    flex: 0 0 auto;
    color: var(--basic-600);
    font-size: 16px;
    line-height: 1;
    transition: transform 0.12s ease;
}

.fold-card[open] .fold-summary::after {
    transform: rotate(180deg);
}

.fold-content {
    display: grid;
    gap: 16px;
    padding: 0 18px 18px;
}

.fold-title {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.fold-title strong {
    color: var(--basic-800);
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.fold-title p {
    color: var(--basic-600);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.compact-header {
    align-items: center;
    margin-bottom: 18px;
}

.compact-header .brand-block {
    gap: 6px;
}

.compact-header h1 {
    font-size: clamp(24px, 2.6vw, 30px);
}

.compact-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.compatibility-shell {
    max-width: 760px;
    margin: 0 auto;
}

.compact-search-card {
    padding: 28px;
}

.form-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.form-header h2 {
    font-size: 24px;
}

.subtle-text {
    color: var(--basic-600);
    font-size: 14px;
    line-height: 1.5;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.hint-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
}

.hint-item {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    gap: 6px;
    color: var(--basic-600);
    font-size: 13px;
    line-height: 1.4;
}

.help-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(143, 155, 179, 0.36);
    border-radius: 999px;
    background: var(--basic-100);
    color: var(--basic-600);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    box-shadow: none;
    padding: 0;
    overflow: visible;
}

.help-trigger:hover,
.help-trigger:focus-visible {
    border-color: rgba(51, 102, 255, 0.44);
    color: var(--primary-500);
    outline: none;
}

.help-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    width: min(300px, 72vw);
    padding: 12px 14px;
    border: 1px solid rgba(197, 206, 224, 0.92);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 36px rgba(34, 43, 69, 0.12);
    color: var(--basic-700);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    display: none;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 20;
}

.help-trigger:hover .help-popover,
.help-trigger:focus-visible .help-popover {
    display: block;
}

.help-popover::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 12px;
    height: 12px;
    border-right: 1px solid rgba(197, 206, 224, 0.92);
    border-bottom: 1px solid rgba(197, 206, 224, 0.92);
    background: rgba(255, 255, 255, 0.98);
    transform: translateX(-50%) rotate(45deg);
}

.minimal-upload {
    padding: 20px;
}

.minimal-upload .field {
    margin-top: 0;
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-picker {
    display: grid;
    gap: 12px;
}

.file-picker-summary {
    min-height: 48px;
    padding: 13px 16px;
    border: 1px solid rgba(197, 206, 224, 0.9);
    border-radius: 12px;
    background: var(--basic-100);
    color: var(--basic-700);
    font-size: 13px;
    line-height: 1.5;
}

.file-picker-summary strong {
    display: block;
    margin-bottom: 4px;
    color: var(--basic-800);
    font-size: 13px;
    line-height: 1.4;
}

.progress-block {
    display: grid;
    gap: 8px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--basic-300);
    overflow: hidden;
}

.progress-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary-500), var(--info-500));
    transition: width 0.16s ease;
}

.upload-state {
    color: var(--basic-600);
    font-size: 13px;
    line-height: 1.5;
}

.statusline {
    min-height: 56px;
}

.auth-layout {
    max-width: 980px;
    margin: 24px auto 0;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    align-items: start;
}

.auth-panel {
    padding: 32px;
}

.auth-aside {
    padding: 24px;
}

.helper-list {
    display: grid;
    gap: 12px;
}

.helper-list li {
    list-style: none;
    padding: 0;
}

@media (max-width: 900px) {
    .app-header,
    .auth-layout,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: stretch;
    }

    .app-header > .toolbar {
        justify-content: flex-start;
        justify-self: stretch;
    }

    .app-header .app-nav {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .shell {
        padding: 20px 14px 32px;
    }

    .panel,
    .section-card,
    .auth-panel,
    .auth-aside {
        padding: 20px;
        border-radius: 20px;
    }

    .toolbar,
    .badge-row,
    .hint-row,
    .meta-row {
        width: 100%;
    }

    .button,
    .nav-link {
        width: 100%;
    }

    .form-header {
        flex-direction: column;
        align-items: stretch;
    }

    .app-nav {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .app-nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav .nav-link {
        flex: 0 0 auto;
        width: auto;
        min-width: max-content;
        white-space: nowrap;
    }

    .app-header > .toolbar > .button {
        width: 100%;
    }

    .hint-row {
        gap: 10px;
    }

    .hint-item {
        font-size: 12px;
    }

    .help-popover {
        left: auto;
        right: 0;
        width: min(280px, calc(100vw - 40px));
        transform: none;
    }

    .help-popover::after {
        left: auto;
        right: 10px;
        transform: rotate(45deg);
    }
}
