/* ============================================================================
   FXAP Decryptor — dark SaaS theme · lemon-yellow accent
   ========================================================================== */

:root {
    /* Surfaces */
    --bg: #08080b;
    --bg-soft: #0c0c11;
    --surface: #101016;
    --surface-2: #14141c;
    --surface-3: #1a1a24;
    --border: #23232e;
    --border-strong: #2e2e3c;

    /* Text */
    --text: #ececf1;
    --text-muted: #a0a0b0;
    --text-dim: #6b6b7c;

    /* Accent — lemon yellow */
    --accent: #facc15;
    --accent-soft: #fde047;
    --accent-deep: #eab308;
    --accent-dim: #a16207;
    --accent-glow: rgba(250, 204, 21, 0.18);
    --accent-glow-strong: rgba(250, 204, 21, 0.35);
    --on-accent: #0a0a0f;

    /* Semantic */
    --good: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;
    --info: #60a5fa;

    /* Radii / shadows */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.3);

    --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "Consolas", "Microsoft YaHei", monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(250, 204, 21, 0.06), transparent 60%),
        radial-gradient(900px 400px at 0% 0%, rgba(96, 165, 250, 0.05), transparent 55%),
        var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent-soft);
    background: rgba(250, 204, 21, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
}

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

/* ---------------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(8, 8, 11, 0.72);
    border-bottom: 1px solid var(--border);
}

.topbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
    color: var(--on-accent);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4), 0 6px 18px var(--accent-glow-strong);
}

.brand__accent {
    color: var(--accent);
}

.brand__badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 20px;
}

.topbar__nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.topbar__link {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
}

.topbar__link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.topbar__link.is-active {
    color: var(--accent);
    background: var(--accent-glow);
}

.topbar__status {
    display: flex;
    align-items: center;
}

.health {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.health__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: background 0.2s;
}

.health.is-online .health__dot {
    background: var(--good);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.health.is-offline .health__dot {
    background: var(--bad);
}

/* ---------------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------------- */

.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 56px 24px 24px;
}

.hero__inner {
    max-width: 760px;
}

.hero__eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
}

.pill--accent {
    color: var(--accent);
    border-color: rgba(250, 204, 21, 0.35);
    background: var(--accent-glow);
}

.hero__title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4.5vw, 44px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero__highlight {
    color: var(--accent);
    text-shadow: 0 0 28px var(--accent-glow-strong);
}

.hero__subtitle {
    margin: 0;
    font-size: 16px;
    color: var(--text-muted);
    max-width: 640px;
}

/* ---------------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------------- */

.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px 48px;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.card__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card__hint {
    font-size: 12px;
    color: var(--text-dim);
}

.card__tools {
    display: flex;
    gap: 6px;
}

/* ---------------------------------------------------------------------------
   Form
   --------------------------------------------------------------------------- */

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

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.field__optional {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 4px;
}

.field__optional--ok {
    color: var(--good);
}

.field__hint {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}

.field__combo {
    display: flex;
    gap: 8px;
}

/* Dropzone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 16px;
    text-align: center;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.dropzone.is-selected {
    border-color: var(--good);
    border-style: solid;
}

.dropzone__icon {
    color: var(--accent);
}

.dropzone.is-selected .dropzone__icon {
    color: var(--good);
}

.dropzone__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.dropzone__hint {
    font-size: 12px;
    color: var(--text-dim);
}

.input {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.input--mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

.input::placeholder {
    color: var(--text-dim);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field__combo .input {
    flex: 1;
}

/* Switch */
.switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-soft);
    transition: border-color 0.15s;
}

.switch:hover {
    border-color: var(--border-strong);
}

.switch__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.switch__title {
    font-size: 13px;
    font-weight: 600;
}

.switch__desc {
    font-size: 12px;
    color: var(--text-dim);
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch__track {
    flex: none;
    width: 42px;
    height: 24px;
    border-radius: 20px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    position: relative;
    transition: background 0.2s, border-color 0.2s;
}

.switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .switch__track {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .switch__track .switch__thumb {
    transform: translateX(18px);
    background: var(--on-accent);
}

.form__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: 10px 16px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--block {
    width: 100%;
}

.btn--primary {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent-deep));
    color: var(--on-accent);
    border-color: rgba(250, 204, 21, 0.5);
    box-shadow: 0 6px 20px var(--accent-glow-strong);
}

.btn--primary:hover:not(:disabled) {
    background: var(--accent);
    box-shadow: 0 8px 26px var(--accent-glow-strong);
}

.btn--ghost {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
}

.btn--ghost:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-strong);
}

.btn--danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--bad);
    border-color: rgba(248, 113, 113, 0.35);
}

.btn--danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.2);
}

.btn--sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn--icon {
    padding: 6px;
    line-height: 0;
}

/* ---------------------------------------------------------------------------
   Capabilities list
   --------------------------------------------------------------------------- */

.caps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cap {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cap__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 16px;
    background: var(--accent-glow);
    border: 1px solid rgba(250, 204, 21, 0.25);
}

.cap__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cap__title {
    font-size: 13px;
    font-weight: 600;
}

.cap__desc {
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------------------------------------------------------------------------
   Stats
   --------------------------------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat__value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat__value--good {
    color: var(--good);
}

.stat__value--bad {
    color: var(--bad);
}

.stat__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

/* ---------------------------------------------------------------------------
   Progress
   --------------------------------------------------------------------------- */

.card--progress {
    padding: 16px 20px;
}

.progress__track {
    height: 8px;
    border-radius: 8px;
    background: var(--surface-3);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent-deep), var(--accent-soft));
    box-shadow: 0 0 12px var(--accent-glow-strong);
    transition: width 0.3s ease;
}

.progress__bar.is-indeterminate {
    width: 35%;
    animation: indeterminate 1.2s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.progress__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.progress__state {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.progress__state.is-running { color: var(--accent); }
.progress__state.is-success { color: var(--good); }
.progress__state.is-partial { color: var(--warn); }
.progress__state.is-failed, .progress__state.is-cancelled { color: var(--bad); }

.progress__count {
    font-size: 12px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.progress__download {
    margin-top: 14px;
}

.progress__download .btn {
    text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Table
   --------------------------------------------------------------------------- */

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table th.num,
.table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:not(.empty-row):hover td {
    background: var(--surface-2);
}

.resource-name {
    font-weight: 600;
    color: var(--text);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-soft);
}

.empty-row td {
    text-align: center;
    color: var(--text-dim);
    padding: 26px 10px;
}

/* Status badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: capitalize;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge--running { color: var(--accent); background: var(--accent-glow); }
.badge--success { color: var(--good); background: rgba(52, 211, 153, 0.12); }
.badge--partial { color: var(--warn); background: rgba(251, 191, 36, 0.12); }
.badge--failed { color: var(--bad); background: rgba(248, 113, 113, 0.12); }
.badge--pending { color: var(--text-muted); background: var(--surface-2); }

/* ---------------------------------------------------------------------------
   Console
   --------------------------------------------------------------------------- */

.card--console {
    padding: 0;
    overflow: hidden;
}

.card--console .card__head {
    padding: 16px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.console {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    padding: 14px 20px 18px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-soft);
    color: var(--text-muted);
}

.console__line {
    display: flex;
    gap: 12px;
    padding: 1px 0;
    align-items: baseline;
}

.console__time {
    flex: none;
    color: var(--text-dim);
    font-size: 11px;
    min-width: 58px;
    opacity: 0.8;
}

.console__msg {
    white-space: pre-wrap;
    word-break: break-word;
}

.console__line--info { color: var(--text-muted); }
.console__line--log { color: var(--text-muted); }
.console__line--success { color: var(--good); }
.console__line--warn { color: var(--warn); }
.console__line--error { color: var(--bad); }
.console__line--stage {
    color: var(--accent);
    font-weight: 600;
}
.console__line--system { color: var(--text-dim); font-style: italic; }

.console__line--stage .console__msg {
    text-shadow: 0 0 12px var(--accent-glow);
}

/* ---------------------------------------------------------------------------
   History
   --------------------------------------------------------------------------- */

.history {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-soft);
}

.history__time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    flex: none;
}

.history__folder {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history__empty {
    color: var(--text-dim);
    font-size: 13px;
    padding: 8px 0;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */

.footer {
    border-top: 1px solid var(--border);
    padding: 24px;
}

.footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.footer__dim {
    color: var(--text-dim);
}

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.is-hidden {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal__panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.modal__pathbar {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.modal__list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 240px;
}

.browser-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.browser-row:hover {
    background: var(--surface-2);
}

.browser-row.is-selected {
    background: var(--accent-glow);
    border: 1px solid rgba(250, 204, 21, 0.35);
}

.browser-row__icon {
    color: var(--accent);
    flex: none;
}

.browser-row__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browser-row__tag {
    flex: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid rgba(250, 204, 21, 0.3);
    padding: 1px 7px;
    border-radius: 20px;
}

.browser-empty {
    color: var(--text-dim);
    text-align: center;
    padding: 40px 12px;
    font-size: 13px;
}

.modal__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.modal__hint {
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------------------------------------------------------------------------
   Utility
   --------------------------------------------------------------------------- */

.is-hidden {
    display: none !important;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 920px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .topbar__nav {
        display: none;
    }
}

@media (max-width: 520px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .console__time {
        display: none;
    }
}
