:root {
  --ink: #15201b;
  --muted: #69736d;
  --line: #dce2de;
  --paper: rgba(255, 255, 252, .88);
  --green: #1d694b;
  --green-dark: #124b35;
  --lime: #c9f27b;
  --cream: #f4f3ea;
  --danger: #a94136;
  --warning: #976515;
  --shadow: 0 24px 70px rgba(36, 48, 41, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 10%, #fff 0, transparent 34%), var(--cream); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 999px; filter: blur(4px); pointer-events: none; opacity: .62; z-index: -1; }
.ambient-one { width: 34rem; height: 34rem; right: -12rem; top: -11rem; background: #d8edb1; }
.ambient-two { width: 25rem; height: 25rem; left: -13rem; bottom: -10rem; background: #d4e7dc; }

.login-layout { min-height: 100vh; max-width: 1180px; margin: 0 auto; padding: 4rem 2rem; display: grid; grid-template-columns: 1.1fr .8fr; gap: 8rem; align-items: center; }
.login-intro h1 { margin: .7rem 0 1.5rem; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(3.4rem, 7vw, 6.2rem); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.login-intro h1 span { color: var(--green); }
.intro-copy { max-width: 30rem; color: var(--muted); font-size: 1.08rem; line-height: 1.8; }
.eyebrow { margin: 1.2rem 0 0; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
.brand-mark { width: 4.2rem; height: 4.2rem; display: grid; place-items: center; border-radius: 1.15rem; background: var(--ink); color: var(--lime); font-weight: 900; letter-spacing: -.06em; transform: rotate(-3deg); box-shadow: .55rem .55rem 0 var(--lime); }
.brand-mark.small { width: 2.25rem; height: 2.25rem; border-radius: .65rem; font-size: .75rem; box-shadow: .25rem .25rem 0 var(--lime); }
.trust-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 2.5rem; }
.trust-row span { padding: .55rem .8rem; border: 1px solid #cbd4ce; border-radius: 999px; color: #526159; font-size: .78rem; background: rgba(255,255,255,.46); }

.login-card, .panel { border: 1px solid rgba(195, 205, 199, .75); background: var(--paper); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card { padding: 2.4rem; border-radius: 1.8rem; }
.card-kicker { margin: 0 0 .35rem; color: var(--green); font-weight: 750; font-size: .82rem; }
.login-card h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 2rem; font-weight: 500; }
.muted { color: var(--muted); line-height: 1.65; }
label { display: block; margin: 1.25rem 0 .5rem; color: #36453d; font-size: .84rem; font-weight: 700; }
input { width: 100%; border: 1px solid #ccd4cf; border-radius: .85rem; background: rgba(255,255,255,.84); color: var(--ink); padding: .9rem 1rem; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(29, 105, 75, .1); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 4.5rem; }
.password-wrap .text-button { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); }
.text-button, .ghost-button { border: 0; background: transparent; color: var(--green); font-weight: 750; font-size: .8rem; padding: .5rem; border-radius: .55rem; }
.text-button:hover, .ghost-button:hover { background: rgba(29,105,75,.08); }
.primary-button { border: 0; border-radius: .9rem; background: var(--green); color: #fff; min-height: 3.15rem; padding: .75rem 1.15rem; display: inline-flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 750; box-shadow: 0 .55rem 1.3rem rgba(29,105,75,.18); transition: transform .18s, background .18s; }
.primary-button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.full { width: 100%; }
.login-card .primary-button { margin-top: .8rem; }
.form-error { min-height: 1.3rem; margin: .65rem 0 0; color: var(--danger); font-size: .82rem; }

.app-layout { min-height: 100vh; }
.topbar { height: 4.6rem; padding: 0 max(1.25rem, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(197,206,201,.8); background: rgba(250,250,246,.72); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; gap: .85rem; align-items: center; color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 650; }
.user-menu { display: flex; gap: .8rem; align-items: center; font-size: .85rem; }
.source-badge, .storage-chip { border: 1px solid #cfdbd4; border-radius: 999px; background: rgba(255,255,255,.66); color: var(--muted); padding: .38rem .65rem; font-size: .72rem; }
.offline-banner { max-width: 1180px; margin: 1.2rem auto 0; padding: .9rem 1.1rem; border: 1px solid #e0c48c; border-radius: .9rem; background: #fff7e5; display: flex; gap: .8rem; align-items: center; color: #6e4a0c; }
.offline-banner div { display: flex; gap: .7rem; align-items: baseline; }
.offline-banner span { font-size: .82rem; }
.status-dot { width: .52rem; height: .52rem; border-radius: 50%; background: #45a66f; box-shadow: 0 0 0 4px rgba(69,166,111,.12); display: inline-block; flex: 0 0 auto; }
.offline-banner .status-dot, .storage-chip.offline .status-dot { background: #d39834; box-shadow: 0 0 0 4px rgba(211,152,52,.14); }

.workspace { max-width: 1180px; margin: 0 auto; padding: 3.5rem 1.25rem 5rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2rem; }
.page-heading h1 { margin: .3rem 0; font-family: Georgia, "Noto Serif SC", serif; font-weight: 500; font-size: clamp(2.2rem, 5vw, 3.45rem); letter-spacing: -.035em; }
.page-heading p { margin-bottom: 0; }
.storage-chip { display: flex; align-items: center; gap: .55rem; white-space: nowrap; padding: .65rem .85rem; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 1.25rem; align-items: start; }
.panel { border-radius: 1.35rem; padding: 1.5rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.panel-head.compact { margin-bottom: .85rem; }
.panel-head > div:first-child { display: flex; gap: .7rem; align-items: center; }
.panel-head h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.35rem; font-weight: 550; }
.step-label { margin: 0; color: var(--green); font-size: .7rem; font-weight: 900; letter-spacing: .09em; }
.mode-tabs { display: flex; padding: .25rem; background: #eaeee9; border-radius: .75rem; }
.mode-tab { border: 0; background: transparent; color: var(--muted); border-radius: .55rem; padding: .55rem .8rem; font-size: .78rem; font-weight: 750; }
.mode-tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.dropzone { border: 1.5px dashed #aebbb3; border-radius: 1.05rem; min-height: 12rem; display: grid; place-content: center; justify-items: center; text-align: center; background: rgba(244,247,243,.64); transition: border .18s, background .18s, transform .18s; outline: none; }
.dropzone:hover, .dropzone:focus, .dropzone.dragging { border-color: var(--green); background: rgba(220,239,225,.62); transform: translateY(-1px); }
.upload-glyph { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: .9rem; color: var(--green-dark); background: var(--lime); font-size: 1.35rem; font-weight: 900; margin-bottom: .6rem; }
.dropzone h3 { margin: 0; font-size: .96rem; }
.dropzone p { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }
.file-list { display: grid; gap: .55rem; margin-top: .8rem; }
.file-item { display: grid; grid-template-columns: 2rem minmax(0,1fr) auto; gap: .75rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .8rem; background: rgba(255,255,255,.66); }
.file-icon { width: 2rem; height: 2rem; border-radius: .55rem; display: grid; place-items: center; color: var(--green); background: #e3eee7; font-size: .7rem; font-weight: 900; }
.file-meta { min-width: 0; }
.file-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.file-meta span { color: var(--muted); font-size: .7rem; }
.remove-file { width: 1.8rem; height: 1.8rem; border: 0; border-radius: .5rem; background: transparent; color: var(--muted); }
.remove-file:hover { background: #f4e5e2; color: var(--danger); }
.settings-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.2rem; margin-top: .7rem; }
.provider-options { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.provider-option { margin: 0; padding: .65rem; border: 1px solid var(--line); border-radius: .8rem; display: grid; grid-template-columns: 2rem minmax(0,1fr) auto; gap: .55rem; align-items: center; background: rgba(255,255,255,.6); cursor: pointer; }
.provider-option:has(input:checked) { border-color: var(--green); background: #edf6ef; box-shadow: 0 0 0 2px rgba(29,105,75,.07); }
.provider-option.disabled { opacity: .42; cursor: not-allowed; }
.provider-option input { position: absolute; opacity: 0; pointer-events: none; }
.provider-icon { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: .6rem; color: #fff; font-weight: 900; }
.provider-icon.superbed { background: #2d7357; }
.provider-icon.smms { background: #53647c; }
.provider-option strong, .provider-option small { display: block; }
.provider-option strong { font-size: .76rem; }
.provider-option small { margin-top: .1rem; color: var(--muted); font-size: .64rem; }
.checkmark { color: var(--green); opacity: 0; }
.provider-option:has(input:checked) .checkmark { opacity: 1; }
.input-prefix { display: flex; border: 1px solid #ccd4cf; border-radius: .85rem; background: rgba(255,255,255,.84); overflow: hidden; }
.input-prefix:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(29,105,75,.1); }
.input-prefix span { display: grid; place-items: center; padding-left: .9rem; color: var(--muted); }
.input-prefix input { border: 0; box-shadow: none; background: transparent; padding-left: .35rem; }
.field-help { margin: .45rem 0 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.upload-action { margin-top: .35rem; }
.upload-action.loading { position: relative; overflow: hidden; }
.upload-action.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 25%, rgba(255,255,255,.2) 50%, transparent 75%); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.side-column { position: sticky; top: 5.8rem; }
.empty-state { min-height: 13rem; display: grid; place-content: center; justify-items: center; text-align: center; color: #89928c; }
.empty-state span { font-size: 1.6rem; color: #b3beb7; }
.empty-state p { max-width: 12rem; font-size: .78rem; line-height: 1.6; }
.results-list { display: grid; gap: .65rem; }
.result-item { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(255,255,255,.7); }
.result-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.result-provider { display: flex; gap: .45rem; align-items: center; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.result-state { font-size: .66rem; border-radius: 999px; padding: .2rem .45rem; background: #e4f2e8; color: var(--green); }
.result-state.failed { background: #f6e6e3; color: var(--danger); }
.result-name { margin: .65rem 0 .25rem; font-size: .78rem; overflow-wrap: anywhere; word-break: break-all; }
.result-url { display: block; color: var(--green); font-size: .7rem; line-height: 1.5; overflow-wrap: anywhere; word-break: break-all; text-decoration: none; }
.result-error { color: var(--danger); font-size: .72rem; }
.result-actions { display: flex; justify-content: flex-end; margin-top: .45rem; }

.history-panel { margin-top: 1.25rem; box-shadow: 0 18px 50px rgba(36,48,41,.08); }
.history-content { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.history-table th { padding: .75rem; text-align: left; color: var(--muted); font-size: .68rem; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.history-table td { padding: .85rem .75rem; border-bottom: 1px solid #edf0ed; }
.history-table tr:last-child td { border-bottom: 0; }
.history-url { max-width: 34rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--green); }
.history-loading, .history-empty, .history-offline { padding: 2rem; color: var(--muted); text-align: center; font-size: .82rem; }
.history-offline { color: var(--warning); }
.pagination { display: flex; align-items: center; justify-content: center; gap: .7rem; padding-top: 1rem; font-size: .75rem; color: var(--muted); }
.ghost-button { border: 1px solid var(--line); background: rgba(255,255,255,.6); color: #526159; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 2rem); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: .75rem; font-size: .78rem; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 880px) {
  .login-layout { grid-template-columns: 1fr; gap: 2.5rem; max-width: 620px; padding-top: 2.5rem; }
  .login-intro h1 { font-size: clamp(3rem, 13vw, 5rem); }
  .trust-row { margin-top: 1.5rem; }
  .main-grid { grid-template-columns: 1fr; }
  .side-column { position: static; }
}

@media (max-width: 620px) {
  .login-layout { padding: 1.5rem 1rem 2rem; }
  .login-card { padding: 1.4rem; border-radius: 1.25rem; }
  .topbar { padding: 0 1rem; }
  .brand > span:last-child, .source-badge { display: none; }
  .workspace { padding: 2.2rem .8rem 3rem; }
  .page-heading { align-items: start; flex-direction: column; }
  .panel { padding: 1rem; border-radius: 1rem; }
  .panel-head { align-items: flex-start; }
  .mode-tabs { flex-shrink: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .provider-options { grid-template-columns: 1fr; }
  .dropzone { min-height: 10rem; }
  .offline-banner { margin: .8rem; align-items: flex-start; }
  .offline-banner div { display: block; }
  .offline-banner div span { display: block; margin-top: .2rem; }
  .history-table th:nth-child(2), .history-table td:nth-child(2) { display: none; }
  .history-url { max-width: 12rem; }
}

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