*, *::before, *::after {
    box-sizing: border-box;
}

@font-face {
    font-display: swap;
    font-family: "HarmonyOS Sans SC";
    font-style: normal;
    font-weight: 400;
    src: url("/static/fonts/HarmonyOS_Sans_SC_Regular.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "HarmonyOS Sans SC";
    font-style: normal;
    font-weight: 500;
    src: url("/static/fonts/HarmonyOS_Sans_SC_Medium.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "HarmonyOS Sans SC";
    font-style: normal;
    font-weight: 700 900;
    src: url("/static/fonts/HarmonyOS_Sans_SC_Bold.ttf") format("truetype");
}

:root {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --surface-soft: #fafafa;
    --surface-strong: #f1f1f1;
    --line: #e4e4e4;
    --line-strong: #cfcfcf;
    --text: #111111;
    --text-soft: #2f2f2f;
    --muted: #666666;
    --muted-soft: #9a9a9a;
    --accent: #ff8a00;
    --accent-dark: #b85f00;
    --accent-soft: #fff4e7;
    --accent-line: #ffd19a;
    --ok: #178a45;
    --ok-bg: #edf8f1;
    --ok-line: #bfe5cd;
    --danger: #c93636;
    --danger-bg: #fff1f1;
    --danger-line: #efbcbc;
    --warn: #b85f00;
    --warn-bg: #fff4e7;
    --warn-line: #ffd19a;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 24px rgba(0, 0, 0, 0.06);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);
    --font-main: "HarmonyOS Sans SC", sans-serif;
    --font-mono: "HarmonyOS Sans SC", sans-serif;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(180deg, #ffffff 0%, var(--bg) 44%, #f1f2f4 100%);
    font-family: var(--font-main);
    font-size: 15.5px;
    line-height: 1.55;
    text-rendering: geometricPrecision;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 138, 0, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 138, 0, 0.2) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: none;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
    color: var(--text);
    text-decoration: none;
}

.brand:hover {
    color: var(--text);
    text-decoration: none;
}

.brand-logo {
    width: 38px;
    height: 38px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(255, 138, 0, 0.2));
}

.brand-text {
    font-family: "Arial Black", var(--font-main);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.brand-tag {
    display: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 14.5px;
    font-weight: 680;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-strong);
}

.nav-link.active {
    color: var(--accent-dark);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.nav-user {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.inline-form {
    margin: 0;
}

.page {
    position: relative;
    width: min(1160px, calc(100% - 32px));
    margin: 26px auto 48px;
}

.toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 800;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 28px));
    pointer-events: none;
}

.toast {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    background: #111111;
    color: #ffffff;
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 650;
    line-height: 1.5;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
    opacity: 1;
    transform: translateY(0);
    animation: toast-in 0.22s ease-out both;
    pointer-events: auto;
}

.toast.success,
.toast.error {
    background: #111111;
    color: #ffffff;
}

.toast-hide {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translate(18px, 10px);
    }
    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

.tab-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tab-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.hero-card,
.card,
.auth-card {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 22px;
}

.hero-card h1 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: 0;
}

.hero-card p {
    margin: 0;
    color: var(--muted);
    font-size: 15.5px;
}

.card {
    padding: 20px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 13px;
    margin-bottom: 13px;
}

h1,
h2 {
    color: var(--text);
    font-weight: 760;
    letter-spacing: 0;
}

h2 {
    margin: 0 0 13px;
    font-size: 19px;
    line-height: 1.35;
}

.section-head h2 {
    margin: 0;
}

.hint {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.6;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 11px;
    overflow-anchor: none;
}

label {
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 720;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    padding: 11px 13px;
    font: inherit;
    font-size: 15.5px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

select {
    appearance: none;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text) 50%),
        linear-gradient(135deg, var(--text) 50%, transparent 50%),
        linear-gradient(90deg, var(--line) 0, var(--line));
    background-position:
        calc(100% - 20px) 50%,
        calc(100% - 14px) 50%,
        calc(100% - 42px) 50%;
    background-size:
        6px 6px,
        6px 6px,
        1px 24px;
    background-repeat: no-repeat;
    padding-right: 52px;
}

select:hover {
    border-color: var(--accent-line);
    background-color: var(--accent-soft);
}

select option {
    color: var(--text);
    background: #ffffff;
    font-size: 15px;
}

.custom-select {
    position: relative;
}

.custom-select-trigger {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    padding: 11px 13px;
    font: inherit;
    font-size: 15.5px;
    font-weight: 680;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.12);
}

.custom-select-trigger:disabled {
    color: var(--muted);
    cursor: not-allowed;
    background: var(--surface-soft);
}

.custom-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-right: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.16s ease;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(225deg) translateY(-2px);
}

.custom-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    display: none;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
    background: #ffffff;
    padding: 6px;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
}

.custom-select.open .custom-select-menu {
    display: grid;
    gap: 4px;
}

.custom-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    padding: 10px 11px;
    font: inherit;
    font-size: 15px;
    font-weight: 680;
    text-align: left;
    cursor: pointer;
}

.custom-select-option:hover {
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.custom-select-option.selected {
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

.custom-select-option.selected code {
    color: #ffffff;
}

.custom-select-option.selected:hover {
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

.custom-select-option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-option code {
    flex: 0 0 auto;
}

input,
select {
    min-height: 46px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-soft);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.16);
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    padding: 2px 0 4px;
}

.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 8px 11px;
    color: var(--text-soft);
    font-size: 14.5px;
    font-weight: 650;
    cursor: pointer;
}

.radio-item input {
    width: auto;
    min-height: auto;
    margin: 0;
    accent-color: var(--accent);
}

.field-block {
    display: flex;
    flex-direction: column;
    gap: 11px;
    border-left: 3px solid var(--accent-line);
    padding-left: 13px;
}

.hidden {
    display: none !important;
}

#target-repo-block.hidden {
    display: none !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    border: 1px solid var(--accent-dark);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 740;
    font-size: 14.5px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:hover {
    background: var(--accent-dark);
    color: #fff;
    box-shadow: 0 8px 18px rgba(255, 138, 0, 0.24);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.disabled {
    opacity: 0.42;
    pointer-events: none;
}

.btn.ghost {
    border-color: var(--line-strong);
    background: #fff;
    color: var(--text-soft);
}

.btn.ghost:hover {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-dark);
    box-shadow: none;
}

.btn.small {
    min-height: 33px;
    padding: 6px 11px;
    font-size: 13px;
}

.btn.danger {
    border-color: var(--danger-line);
    background: #fff;
    color: var(--danger);
}

.btn.danger:hover {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: var(--text);
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.table-wrap.no-scroll {
    overflow-x: visible;
}

table {
    width: 100%;
    min-width: 792px;
    border-collapse: collapse;
    font-size: 14.5px;
}

.table-wrap.no-scroll table {
    min-width: 0;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid #eeeeee;
    padding: 12px 13px;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    background: var(--surface-soft);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 760;
    line-height: 1.4;
}

td {
    color: var(--text-soft);
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fff8ef;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 3px 9px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.badge.success {
    color: var(--ok);
    border-color: var(--ok-line);
    background: var(--ok-bg);
}

.badge.failed,
.badge.partial_failed {
    color: var(--danger);
    border-color: var(--danger-line);
    background: var(--danger-bg);
}

details summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-size: 14.5px;
    font-weight: 700;
    user-select: none;
}

pre {
    max-width: 920px;
    margin: 8px 0 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fafafa;
    padding: 11px;
    color: var(--text-soft);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
}

code {
    color: var(--accent-dark);
    font-family: var(--font-mono);
    font-size: 0.94em;
}

.error-text {
    margin: 0 0 13px;
    color: var(--danger);
    font-size: 14.5px;
    font-weight: 650;
}

.progress-card {
    border-color: var(--accent-line);
}

.progress-card.progress-ok {
    border-color: var(--ok-line);
}

.progress-card.progress-failed {
    border-color: var(--danger-line);
}

.progress-current {
    margin-bottom: 11px;
    color: var(--text-soft);
    font-size: 15.5px;
    font-weight: 720;
}

.layer-list {
    display: grid;
    gap: 9px;
    margin-bottom: 13px;
}

.layer-row {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 11px;
}

.layer-row.done {
    border-color: var(--ok-line);
    background: var(--ok-bg);
}

.layer-top {
    display: flex;
    justify-content: space-between;
    gap: 13px;
    margin-bottom: 9px;
    font-size: 13px;
}

.layer-state {
    color: var(--muted);
    text-align: right;
    overflow-wrap: anywhere;
}

.layer-bar {
    height: 20px;
    overflow: hidden;
    border: 1px solid #d7d7d7;
    border-radius: var(--radius-sm);
    background: #eeeeee;
}

.layer-bar span {
    display: block;
    width: 0;
    min-width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #ffb04a 100%);
    color: #161616;
    font-size: 12px;
    font-weight: 760;
    line-height: 18px;
    text-align: center;
    transition: width 0.12s ease;
}

.layer-meta {
    min-height: 18px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.batch-progress {
    display: grid;
    gap: 10px;
    margin-bottom: 13px;
}

.batch-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 13px;
    color: var(--text-soft);
    font-size: 14.5px;
    font-weight: 720;
}

.batch-progress-top span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.batch-bar {
    height: 24px;
}

.batch-bar span {
    line-height: 22px;
}

.terminal-details {
    margin-top: 11px;
}

.terminal-output {
    max-height: 320px;
    overflow: auto;
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

.copy-list {
    display: grid;
    gap: 9px;
    margin: 0 0 13px;
}

.copy-list.compact {
    margin: 0;
}

.copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 11px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    padding: 9px;
}

.copy-row code {
    min-width: 0;
    overflow-wrap: anywhere;
}

.copy-btn {
    flex: 0 0 auto;
}

.copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.action-row form {
    margin: 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    margin-top: 15px;
}

.page-meter {
    color: var(--muted);
    font-size: 14.5px;
    font-weight: 650;
}

.log-types {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 13px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(0, 0, 0, 0.42);
}

.modal-panel {
    width: min(920px, 100%);
    max-height: min(720px, calc(100vh - 44px));
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
}

.modal-head h2 {
    margin: 0;
}

.modal-output {
    max-width: none;
    max-height: none;
    flex: 1;
    overflow: auto;
    margin: 0;
    border: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #111111;
    color: #ffffff;
    padding: 16px;
}

.confirm-panel {
    width: min(460px, 100%);
}

.confirm-body {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.confirm-body p {
    margin: 0;
    color: var(--text-soft);
    font-size: 15.5px;
    font-weight: 620;
    line-height: 1.55;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-wrap {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
}

.auth-card {
    padding: 24px;
}

.auth-card h1 {
    margin: 0 0 8px;
    font-family: "Arial Black", var(--font-main);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

@media (max-width: 980px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 13px;
        padding: 13px 0;
    }

    .main-nav {
        align-items: flex-start;
    }

    .nav-user {
        margin-left: 0;
        width: 100%;
    }

    .tab-grid {
        grid-template-columns: 1fr;
    }

    .page {
        width: calc(100% - 20px);
        margin: 18px auto 31px;
    }

    .card,
    .hero-card,
    .auth-card {
        padding: 17px;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    table {
        min-width: 704px;
    }

    .table-wrap.no-scroll {
        overflow-x: auto;
    }
}

@media (max-width: 560px) {
    .brand-text {
        font-size: 19px;
    }

    .nav-link {
        min-height: 35px;
        padding: 7px 10px;
    }

    h2 {
        font-size: 18px;
    }

    .radio-item {
        width: 100%;
    }

    .layer-top {
        flex-direction: column;
        gap: 4px;
    }

    .layer-state {
        text-align: left;
    }
}
