:root {
  color-scheme: light dark;
  --page: #f5f7f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --surface-strong: #eef2f3;
  --text: #172126;
  --text-soft: #526168;
  --text-faint: #78868c;
  --border: #dce3e5;
  --border-strong: #c5d0d3;
  --accent: #126b64;
  --accent-hover: #0c5751;
  --accent-soft: #e2f2ef;
  --success: #237349;
  --success-soft: #e6f4eb;
  --warning: #8a5b10;
  --warning-soft: #fbf0d9;
  --danger: #a23c42;
  --danger-soft: #f9e7e8;
  --focus: #297eae;
  --topbar-height: 64px;
  --radius: 8px;
  --shadow: 0 12px 28px rgba(25, 41, 48, 0.1);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 300px; min-height: 100%; background: var(--page); }
body { min-height: 100vh; margin: 0; background: var(--page); color: var(--text); font-size: 14px; line-height: 1.55; }
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; transform: translateY(-150%); border-radius: 6px; padding: 8px 12px; background: var(--text); color: var(--surface); text-decoration: none; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.topbar { height: var(--topbar-height); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 96%, transparent); }
.topbar__inner { width: min(calc(100% - 40px), 1220px); height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 auto; }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 7px; background: var(--text); color: var(--surface); font-size: 15px; font-weight: 800; }
.brand__name { font-size: 15px; font-weight: 750; }
.brand__divider { width: 1px; height: 17px; background: var(--border-strong); }
.brand__product { color: var(--text-soft); font-size: 13px; font-weight: 650; }
.account-slot { min-width: 68px; min-height: 36px; display: flex; align-items: center; justify-content: flex-end; }
.account-placeholder { width: 84px; height: 30px; border-radius: 6px; background: var(--surface-strong); }
.account { display: flex; align-items: center; gap: 8px; }
.account__avatar { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; }
.account__identity { min-width: 0; display: grid; margin-right: 4px; line-height: 1.2; }
.account__identity strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account__identity small { margin-top: 3px; color: var(--text-faint); font-size: 10px; }

.page-shell { width: min(calc(100% - 40px), 1220px); margin: 0 auto; padding: 42px 0 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.page-heading h1, .auth-view h1, .state-view h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: 0; }
.page-heading p { max-width: 620px; margin: 8px 0 0; color: var(--text-soft); }

.connection-state { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.connection-copy { display: flex; align-items: center; gap: 9px; }
.connection-copy > i { color: var(--text-faint); font-size: 18px; }
.connection-copy > div { display: grid; line-height: 1.25; text-align: right; }
.connection-copy strong { font-size: 12px; }
.connection-copy span { margin-top: 3px; color: var(--text-faint); font-size: 10px; }
.connection-copy--live > i { color: var(--success); }
.connection-copy--connecting > i, .connection-copy--degraded > i, .connection-copy--retrying > i { color: var(--warning); }

.summary-band { min-height: 94px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.summary-item { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 19px 24px; }
.summary-item + .summary-item { border-left: 1px solid var(--border); }
.summary-item > i { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-strong); color: var(--text-soft); font-size: 18px; }
.summary-item > div { min-width: 0; display: grid; }
.summary-item span { color: var(--text-faint); font-size: 11px; font-weight: 650; }
.summary-item strong { margin-top: 1px; font-size: 22px; line-height: 1.2; }
.summary-item--active > i { background: var(--warning-soft); color: var(--warning); }
.summary-item--completed > i { background: var(--success-soft); color: var(--success); }
.summary-item--attention > i { background: var(--danger-soft); color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.segmented { display: inline-flex; flex: 0 0 auto; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-strong); }
.segmented button { min-width: 82px; min-height: 34px; border: 0; border-radius: 5px; padding: 0 12px; background: transparent; color: var(--text-soft); cursor: pointer; font-size: 12px; font-weight: 680; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20, 35, 42, 0.11); }
.search-field { width: min(100%, 300px); height: 42px; display: flex; align-items: center; gap: 8px; margin-left: auto; border: 1px solid var(--border); border-radius: 7px; padding: 0 11px; background: var(--surface); color: var(--text-faint); }
.search-field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 12%, transparent); }
.search-field input { min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-field input::placeholder { color: var(--text-faint); }

.workspace { min-height: 520px; display: grid; grid-template-columns: minmax(430px, 1.05fr) minmax(360px, 0.95fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.workspace--empty { display: grid; grid-template-columns: 1fr; place-items: center; }
.transfer-browser { min-width: 0; border-right: 1px solid var(--border); }
.records-heading { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.records-heading h2 { margin: 0; font-size: 14px; }
.records-heading span { color: var(--text-faint); font-size: 11px; }
.transfer-list { max-height: 640px; overflow-y: auto; scrollbar-width: thin; }
.transfer-list ul { margin: 0; padding: 0; list-style: none; }
.transfer-list li + li { border-top: 1px solid var(--border); }
.transfer-row { width: 100%; min-height: 94px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 76px 16px; align-items: center; gap: 12px; border: 0; border-left: 3px solid transparent; padding: 13px 14px 13px 12px; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.transfer-row:hover { background: var(--surface-subtle); }
.transfer-row--selected { border-left-color: var(--accent); background: var(--accent-soft); }
.file-icon, .detail-icon { display: grid; place-items: center; border-radius: 7px; background: var(--surface-strong); color: var(--text-soft); }
.file-icon { width: 38px; height: 38px; font-size: 19px; }
.file-summary { min-width: 0; display: grid; }
.file-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-summary > span { overflow: hidden; margin-top: 3px; color: var(--text-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-summary progress { width: 100%; height: 4px; margin-top: 9px; }
.row-progress { display: grid; justify-items: end; }
.row-progress strong { font-size: 13px; }
.row-progress span { max-width: 76px; overflow: hidden; margin-top: 4px; color: var(--text-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.row-caret { color: var(--text-faint); font-size: 14px; }
.list-limit { display: flex; align-items: center; gap: 6px; margin: 0; border-top: 1px solid var(--border); padding: 10px 16px; color: var(--text-faint); font-size: 10px; }

progress { overflow: hidden; border: 0; border-radius: 3px; background: var(--surface-strong); color: var(--accent); appearance: none; }
progress::-webkit-progress-bar { border-radius: 3px; background: var(--surface-strong); }
progress::-webkit-progress-value { border-radius: 3px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 3px; background: var(--accent); }

.transfer-detail { min-width: 0; padding: 24px; background: var(--surface-subtle); }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.detail-title { min-width: 0; display: flex; align-items: center; gap: 12px; }
.detail-icon { width: 42px; height: 42px; flex: 0 0 42px; font-size: 21px; }
.detail-title > div { min-width: 0; }
.detail-title span { display: block; color: var(--text-faint); font-size: 10px; font-weight: 700; }
.detail-title h2 { max-width: 310px; overflow-wrap: anywhere; margin: 2px 0 0; font-size: 15px; line-height: 1.35; }
.status-badge { min-height: 27px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 0 8px; background: var(--surface-strong); color: var(--text-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-badge--completed { background: var(--success-soft); color: var(--success); }
.status-badge--failed, .status-badge--canceled { background: var(--danger-soft); color: var(--danger); }
.status-badge--queued, .status-badge--syncing, .status-badge--finalizing, .status-badge--processing { background: var(--warning-soft); color: var(--warning); }
.status-tone--completed { background: var(--success-soft); color: var(--success); }
.status-tone--failed, .status-tone--canceled { background: var(--danger-soft); color: var(--danger); }
.status-tone--queued, .status-tone--syncing, .status-tone--finalizing { background: var(--warning-soft); color: var(--warning); }

.detail-notice { display: flex; align-items: center; gap: 7px; margin-top: 14px; border-radius: 6px; padding: 8px 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.detail-notice--error { background: var(--danger-soft); color: var(--danger); }
.progress-section { padding: 24px 0 22px; }
.progress-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.progress-heading > div { display: grid; }
.progress-heading span { color: var(--text-faint); font-size: 10px; }
.progress-heading strong { margin-top: 2px; font-size: 29px; line-height: 1.2; }
.detail-progress { width: 100%; height: 8px; margin-top: 13px; }
.progress-section p { margin: 11px 0 0; color: var(--text-soft); font-size: 12px; }
.detail-metrics { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-metrics div { min-width: 0; padding: 15px 0; }
.detail-metrics div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--border); }
.detail-metrics div:nth-child(n+3) { border-top: 1px solid var(--border); }
.detail-metrics dt, .detail-times dt { color: var(--text-faint); font-size: 10px; }
.detail-metrics dd { overflow: hidden; margin: 3px 0 0; color: var(--text); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.detail-times { display: grid; gap: 10px; margin: 20px 0 0; }
.detail-times div { min-width: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
.detail-times dd { min-width: 0; overflow: hidden; margin: 0; color: var(--text-soft); font-size: 11px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.detail-times code { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.attention-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 20px; border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border)); border-radius: 7px; padding: 12px; background: var(--danger-soft); color: var(--danger); }
.attention-note > i { margin-top: 2px; }
.attention-note p { margin: 0; font-size: 11px; }
.detail-placeholder { min-height: 430px; display: grid; place-items: center; align-content: center; color: var(--text-faint); text-align: center; }
.detail-placeholder i { font-size: 30px; }
.detail-placeholder p { margin: 8px 0 0; }

.filtered-empty { min-height: 250px; display: grid; place-items: center; align-content: center; padding: 24px; color: var(--text-soft); text-align: center; }
.filtered-empty > i { margin-bottom: 9px; color: var(--text-faint); font-size: 28px; }
.filtered-empty strong { color: var(--text); }
.text-button { border: 0; padding: 7px; background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 700; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 7px; padding: 0 15px; cursor: pointer; text-decoration: none; font-size: 12px; font-weight: 720; }
.button--primary { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.button--primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button--quiet { border-color: var(--border); background: var(--surface); color: var(--text-soft); }
.button--quiet:hover { border-color: var(--border-strong); color: var(--text); }
.button--small { min-height: 34px; padding: 0 11px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; flex: 0 0 36px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--text-soft); cursor: pointer; text-decoration: none; }
.icon-button:hover { background: var(--surface-strong); color: var(--text); }
.icon-button--bordered { width: 42px; height: 42px; flex-basis: 42px; border: 1px solid var(--border); background: var(--surface); }
button:disabled { cursor: wait; opacity: 0.55; }

.auth-view { min-height: calc(100vh - var(--topbar-height) - 106px); display: grid; place-items: center; align-content: center; max-width: 520px; margin: 0 auto; text-align: center; }
.auth-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 19px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 27px; }
.auth-view p { margin: 12px 0 0; color: var(--text-soft); }
.auth-actions { display: flex; justify-content: center; gap: 9px; margin-top: 24px; }
.auth-view .privacy-note { display: flex; align-items: center; gap: 6px; margin-top: 19px; color: var(--text-faint); font-size: 11px; }
.auth-view .privacy-note i { color: var(--success); font-size: 15px; }

.state-view { display: grid; place-items: center; align-content: center; padding: 48px 24px; text-align: center; }
.state-view--fatal { min-height: calc(100vh - var(--topbar-height) - 106px); }
.state-view__icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 8px; background: var(--surface-strong); color: var(--text-soft); font-size: 24px; }
.state-view--error .state-view__icon, .state-view--fatal .state-view__icon { background: var(--danger-soft); color: var(--danger); }
.state-view--empty .state-view__icon { background: var(--success-soft); color: var(--success); }
.state-view h2 { margin: 0; font-size: 19px; }
.state-view p { max-width: 440px; margin: 7px 0 18px; color: var(--text-soft); }

.loading-view { padding-top: 7px; }
.skeleton { border-radius: 5px; background: var(--surface-strong); }
.skeleton--heading { width: min(360px, 70%); height: 38px; }
.skeleton--subheading { width: min(520px, 90%); height: 14px; margin-top: 12px; }
.loading-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 34px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.loading-stats .skeleton { height: 92px; border-radius: 0; }
.loading-workspace { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1px; height: 520px; margin-top: 78px; border: 1px solid var(--border); background: var(--border); }
.loading-workspace .skeleton { border-radius: 0; background: var(--surface); }
.records-loading { display: grid; align-content: start; border-right: 1px solid var(--border); }
.records-loading .skeleton { height: 94px; border-radius: 0; border-bottom: 1px solid var(--border); }
.detail-loading { display: grid; align-content: start; gap: 18px; padding: 24px; background: var(--surface-subtle); }
.detail-loading .skeleton:nth-child(1) { height: 48px; }
.detail-loading .skeleton:nth-child(2) { height: 96px; }
.detail-loading .skeleton:nth-child(3) { height: 160px; }
.spin { animation: spin 900ms linear infinite; }
.status-icon--active { animation: pulse-opacity 1.2s ease-in-out infinite alternate; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%); min-width: 180px; max-width: calc(100vw - 32px); border: 1px solid color-mix(in srgb, var(--text) 18%, transparent); border-radius: 7px; padding: 10px 15px; background: var(--text); color: var(--surface); box-shadow: var(--shadow); text-align: center; font-size: 12px; font-weight: 680; }
.toast[data-tone="error"] { background: var(--danger); color: #ffffff; }
.noscript { width: min(calc(100% - 32px), 640px); margin: 32px auto; border: 1px solid var(--border); border-radius: 7px; padding: 16px; background: var(--surface); color: var(--text-soft); text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-opacity { from { opacity: 0.55; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: skeleton-pulse 1.3s ease-in-out infinite alternate; }
  @keyframes skeleton-pulse { from { opacity: 0.52; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 880px) {
  .workspace { grid-template-columns: minmax(330px, .9fr) minmax(320px, 1.1fr); }
  .summary-item { padding-inline: 17px; }
  .summary-item > i { display: none; }
  .account__identity { display: none; }
}

@media (max-width: 720px) {
  :root { --topbar-height: 58px; }
  .topbar__inner, .page-shell { width: min(calc(100% - 28px), 1220px); }
  .page-shell { padding-top: 28px; }
  .brand__name { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 22px; }
  .connection-state { width: 100%; justify-content: space-between; }
  .connection-copy > div { text-align: left; }
  .summary-band { grid-template-columns: 1fr 1fr; }
  .summary-item { min-height: 76px; padding: 14px 16px; }
  .summary-item:nth-child(3) { border-top: 1px solid var(--border); border-left: 0; }
  .summary-item:nth-child(4) { border-top: 1px solid var(--border); }
  .toolbar { align-items: stretch; flex-wrap: wrap; margin-top: 20px; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { min-width: 74px; min-height: 40px; flex: 1; }
  .search-field { width: auto; min-width: 0; flex: 1; margin-left: 0; }
  .workspace { display: block; min-height: 0; overflow: visible; }
  .transfer-browser { border-right: 0; }
  .transfer-list { max-height: none; }
  .transfer-detail { border-top: 1px solid var(--border); }
  .records-loading { border-right: 0; }
  .detail-loading { border-top: 1px solid var(--border); }
  .loading-workspace { grid-template-columns: 1fr; height: 620px; }
  .loading-workspace .skeleton:nth-child(2) { display: none; }
}

@media (max-width: 480px) {
  .brand__divider, .brand__product { display: none; }
  .page-heading h1, .auth-view h1, .state-view h1 { font-size: 25px; }
  .summary-item strong { font-size: 19px; }
  .transfer-row { grid-template-columns: 34px minmax(0, 1fr) 62px; gap: 10px; padding-inline: 10px; }
  .file-icon { width: 34px; height: 34px; }
  .row-caret { display: none; }
  .row-progress span { max-width: 62px; }
  .transfer-detail { padding: 19px 15px; }
  .detail-header { display: grid; }
  .status-badge { justify-self: start; margin-left: 54px; }
  .detail-title h2 { max-width: calc(100vw - 105px); }
  .detail-metrics div:nth-child(even) { padding-left: 13px; }
  .auth-actions { align-items: stretch; flex-direction: column; width: 100%; }
  .auth-actions .button { width: 100%; }
  .auth-view .privacy-note { align-items: flex-start; text-align: left; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111719;
    --surface: #182023;
    --surface-subtle: #151c1f;
    --surface-strong: #222c30;
    --text: #edf2f3;
    --text-soft: #b5c0c4;
    --text-faint: #849499;
    --border: #2c383c;
    --border-strong: #405055;
    --accent: #72c8bd;
    --accent-hover: #91d7cf;
    --accent-soft: #193834;
    --success: #7bc69a;
    --success-soft: #19382a;
    --warning: #e2b867;
    --warning-soft: #392e1b;
    --danger: #ec9298;
    --danger-soft: #412629;
    --focus: #69b8df;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  }
  .brand__mark { background: var(--text); color: var(--page); }
  .button--primary { color: #0d2421; }
  .segmented button[aria-selected="true"] { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
}
