:root {
  --bg-main: #ecf0f4;
  --bg-soft: rgba(255, 255, 255, 0.72);
  --card: rgba(255, 255, 255, 0.82);
  --line: #cfd5dc;
  --line-strong: #b8c2cd;
  --text: #1a222b;
  --muted: #5f6a75;
  --accent: #0a7a6f;
  --accent-2: #0b5c87;
  --danger: #b73e3e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Sora", sans-serif;
  background: linear-gradient(180deg, #f6f8fb 0%, #eaf0f4 55%, #e8ecef 100%);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
  z-index: -1;
}

.orb-a {
  width: 320px;
  height: 320px;
  right: -60px;
  top: 20px;
  background: radial-gradient(circle, rgba(15, 130, 119, 0.24) 0%, rgba(15, 130, 119, 0) 72%);
}

.orb-b {
  width: 360px;
  height: 360px;
  left: -70px;
  bottom: -80px;
  background: radial-gradient(circle, rgba(11, 92, 135, 0.23) 0%, rgba(11, 92, 135, 0) 72%);
}

.page {
  width: min(1280px, 94vw);
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.84), rgba(241, 246, 252, 0.78));
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 56px rgba(36, 61, 84, 0.13);
  display: grid;
  gap: 16px;
  animation: fade-up 440ms ease;
}

.hero-title h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4.6vw, 3.15rem);
  letter-spacing: -0.03em;
}

.hero-title p {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--accent-2);
}

.hero-controls {
  display: grid;
  gap: 10px;
}

.search-label {
  font-size: 0.84rem;
  color: var(--muted);
}

.search-input {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.88);
}

.search-input:focus {
  outline: 2px solid rgba(10, 122, 111, 0.24);
  border-color: var(--accent);
}

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-jump {
  border: 1px solid #bdd4e5;
  background: #eff8ff;
  color: #1f4d70;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  cursor: pointer;
}

.tool-jump:hover {
  background: #e5f2fd;
}

.tool-jump.active {
  background: linear-gradient(120deg, #0b5c87, #0a7a6f);
  color: #fff;
  border-color: transparent;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
}

.metric span {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
}

.metric small {
  color: var(--muted);
}

.status {
  margin-top: 16px;
  border: 1px solid #d8e0e8;
  border-radius: 16px;
  background: rgba(253, 255, 255, 0.86);
  padding: 12px;
}

.status-sticky {
  position: sticky;
  top: 12px;
  z-index: 25;
  box-shadow: 0 12px 34px rgba(29, 47, 66, 0.13);
}

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-operation {
  margin: 0;
  color: #245f69;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: "IBM Plex Mono", monospace;
}

.progress-wrap {
  margin-top: 8px;
  width: 100%;
  height: 10px;
  border: 1px solid #d8e1ea;
  border-radius: 999px;
  overflow: hidden;
  background: #f6fafc;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0b5c87, #0a7a6f);
  transition: width 180ms ease;
}

#status-text {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  border-radius: 18px;
  border: 1px solid rgba(210, 218, 226, 0.9);
  padding: 16px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(38, 53, 71, 0.08);
  animation: fade-up 360ms ease;
}

.tool-card.filtered-out {
  display: none;
}

.card h2 {
  margin: 2px 0 13px;
  font-size: 1.08rem;
}

form {
  display: grid;
  gap: 10px;
}

.subform {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

label {
  color: var(--muted);
  font-size: 0.88rem;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
select,
button {
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.93rem;
  padding: 10px;
  font-family: inherit;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid rgba(11, 92, 135, 0.2);
  border-color: var(--accent-2);
}

input[type="range"] {
  padding: 0;
}

button {
  cursor: pointer;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(130deg, var(--accent-2), var(--accent));
  font-weight: 600;
}

button:hover {
  filter: brightness(1.03);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover {
  filter: none;
  background: #f7f9fb;
}

.download {
  text-decoration: none;
  color: #fff;
  background: #152131;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.drop-zone {
  border: 2px dashed #96b6d2;
  border-radius: 14px;
  padding: 18px 12px;
  text-align: center;
  color: #25557a;
  background: linear-gradient(180deg, #f3f9ff, #f6fbff);
  cursor: pointer;
  transition: transform 130ms ease, background 130ms ease;
}

.drop-zone.active {
  background: linear-gradient(180deg, #e6f3ff, #ecf8ff);
  transform: translateY(-1px);
}

.help {
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.list-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.file-list li[draggable="true"] {
  cursor: move;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.mini-btn {
  border: 1px solid #dae3ec;
  background: #f8fbfe;
  color: #627181;
  min-width: 32px;
  padding: 5px 8px;
  border-radius: 8px;
}

.mini-btn:hover {
  background: #f0f6fc;
}

.preview,
.preview-grid {
  min-height: 36px;
  display: grid;
  gap: 8px;
}

.preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  background: #fff;
}

.preview-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.preview-pdf {
  display: block;
}

.preview-pdf .preview-main {
  margin-bottom: 6px;
}

.preview-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e7edf4;
}

.preview-embed {
  width: 100%;
  min-height: 140px;
  border: 0;
  border-radius: 9px;
}

.history-panel {
  border-radius: 18px;
  border: 1px solid rgba(210, 218, 226, 0.9);
  padding: 14px;
  background: var(--bg-soft);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(38, 53, 71, 0.08);
  height: fit-content;
  position: sticky;
  top: 130px;
}

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

.history-head h2 {
  margin: 0;
  font-size: 1.03rem;
}

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

.history-item {
  border: 1px solid #d8e1ea;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.history-file {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
}

.history-time {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.77rem;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.history-actions a,
.history-actions button {
  font-size: 0.76rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d7e1eb;
  background: #f8fbff;
  color: #1f4d70;
  text-decoration: none;
}

.history-actions button {
  cursor: pointer;
}

.history-empty {
  color: var(--muted);
  font-size: 0.86rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 76px;
  z-index: 45;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 24px));
}

.toast {
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  background: #1f2a39;
  box-shadow: 0 10px 24px rgba(15, 24, 37, 0.3);
  transform: translateY(8px);
  opacity: 0;
  animation: toast-in 220ms ease forwards;
  font-size: 0.86rem;
}

.toast.success {
  background: linear-gradient(140deg, #0a7a6f, #0b5c87);
}

.toast.error {
  background: linear-gradient(140deg, #9f2e2e, #b73e3e);
}

.floating-download,
.floating-top {
  position: fixed;
  right: 18px;
  z-index: 40;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(16, 28, 44, 0.28);
}

.floating-download {
  bottom: 18px;
  background: #152131;
  padding: 12px 16px;
}

.floating-top {
  bottom: 66px;
  padding: 10px 13px;
  background: linear-gradient(120deg, #0b5c87, #0a7a6f);
}

.hidden {
  display: none;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .history-panel {
    position: relative;
    top: 0;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(680px, 95vw);
    padding-top: 16px;
  }

  .hero {
    padding: 18px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

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

  .status-sticky {
    top: 8px;
  }

  .floating-download {
    right: 12px;
    bottom: 12px;
    padding: 10px 13px;
    font-size: 0.88rem;
  }

  .floating-top {
    right: 12px;
    bottom: 56px;
    font-size: 0.82rem;
  }

  .toast-root {
    right: 12px;
    bottom: 64px;
  }
}
