:root {
  color: #1c2434;
  background: #f4f7fb;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

.shell { max-width: 1180px; margin: 0 auto; padding: 48px 24px 64px; }

.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }

.eyebrow { margin: 0 0 8px; color: #657089; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; }

h1, h2 { margin: 0; color: #172033; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.04em; }
h2 { font-size: 1.2rem; }
.subtitle { max-width: 600px; color: #657089; line-height: 1.6; }

.health { border-radius: 999px; padding: 10px 14px; font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.health--checking { color: #775900; background: #fff6cc; }
.health--ready { color: #0b6b47; background: #dff8eb; }
.health--error { color: #ad2637; background: #ffe5e9; }

.grid { display: grid; grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.4fr); gap: 20px; }
.card { padding: 24px; border: 1px solid #e1e7f0; border-radius: 20px; background: #fff; box-shadow: 0 16px 40px rgba(42, 57, 86, 0.06); }
.connection-card { margin-bottom: 20px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.limit { padding: 5px 9px; border-radius: 99px; color: #536079; background: #edf1f7; font-size: 0.76rem; }

.connection-form { display: grid; grid-template-columns: 1.35fr 0.75fr 1fr 1fr auto; gap: 12px; align-items: end; }
.connection-form label { display: grid; gap: 6px; color: #536079; font-size: 0.78rem; font-weight: 700; }
.connection-form input, .connection-form select { width: 100%; border: 1px solid #cbd5e5; border-radius: 9px; padding: 10px; color: #1c2434; background: #fff; font: inherit; }
.connection-form input:focus, .connection-form select:focus { outline: 3px solid #dce7ff; border-color: #306cff; }
.connection-form .button { min-height: 40px; white-space: nowrap; }
.connection-status { margin: 12px 0 0; color: #657089; font-size: 0.82rem; }
.connection-mode-hint { margin: 12px 0 0; color: #536079; font-size: 0.82rem; line-height: 1.5; }

.drop-zone { display: flex; min-height: 220px; padding: 28px; border: 1.5px dashed #aebad0; border-radius: 16px; align-items: center; justify-content: center; flex-direction: column; gap: 9px; color: #657089; cursor: pointer; text-align: center; transition: 150ms ease; }
.drop-zone:hover, .drop-zone--active { border-color: #306cff; background: #f2f6ff; color: #2458d1; }
.drop-zone strong { color: #1c2434; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; width: 42px; height: 42px; border-radius: 50%; place-items: center; color: #fff; background: #306cff; font-size: 1.5rem; }

.selected-files, .status { min-height: 22px; margin-top: 14px; color: #536079; font-size: 0.9rem; }
.upload-result { margin-top: 10px; color: #0b6b47; font-size: 0.86rem; line-height: 1.5; }
.upload-result p { margin: 0; }
.upload-result__failures { margin: 8px 0 0; padding-left: 20px; color: #ad2637; }
.button { border: 0; border-radius: 10px; padding: 10px 15px; cursor: pointer; font: inherit; font-weight: 700; }
.button:disabled { cursor: wait; opacity: 0.6; }
.button--primary { width: 100%; margin-top: 12px; color: #fff; background: #245de8; }
.button--primary:hover:not(:disabled) { background: #174dcc; }
.button--quiet { color: #245de8; background: #ebf1ff; }

.file-list { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: #f8faff; }
.file-badge { padding: 7px 6px; border-radius: 7px; color: #315bd1; background: #dbe7ff; font-size: 0.6rem; font-weight: 800; }
.file-details { min-width: 0; flex: 1; display: grid; gap: 4px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.file-meta, .empty-state { color: #657089; font-size: 0.8rem; }
.file-actions { display: flex; gap: 10px; }
.file-actions a, .file-actions button { padding: 0; border: 0; color: #245de8; background: transparent; cursor: pointer; font: inherit; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.empty-state { margin: 32px 0; text-align: center; }
.empty-state--error { color: #ad2637; }

.media-viewer { width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; color: #172033; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32); }
.media-viewer::backdrop { background: rgba(12, 20, 38, 0.68); backdrop-filter: blur(4px); }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #e5eaf2; }
.viewer-toolbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-close { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #34405a; background: #edf1f7; cursor: pointer; font-size: 1.5rem; line-height: 1; }
.viewer-body { display: grid; min-height: 260px; max-height: calc(100vh - 190px); place-items: center; padding: 20px; background: #101827; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: calc(100vh - 230px); object-fit: contain; }
.viewer-body p { max-width: 420px; color: #d8e0f3; text-align: center; line-height: 1.6; }
.viewer-loading { color: #d8e0f3; }
.viewer-message { color: #ffd3da; }
.media-viewer > .button { display: inline-block; margin: 16px 20px; }

@media (max-width: 760px) {
  .shell { padding: 28px 16px 40px; }
  .hero { flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .connection-form { grid-template-columns: 1fr; }
  .file-row { align-items: flex-start; flex-wrap: wrap; }
  .file-actions { width: 100%; margin-left: 54px; }
}
