:root {
  --bg: #f4f1ea;
  --surface: #fffcf7;
  --text: #1d2935;
  --muted: #5f6f7e;
  --line: #d8d1c5;
  --primary: #0f766e;
  --primary-strong: #0b5b56;
  --accent: #c05621;
  --accent-soft: #ffe4d0;
  --danger: #c81e1e;
  --ok: #1f8f56;
  --shadow: 0 10px 30px rgba(29, 41, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #fff6dd 0%, transparent 45%),
    radial-gradient(circle at 85% 12%, #d8f1ff 0%, transparent 36%), var(--bg);
  overflow-x: hidden;
}

.background-orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  opacity: 0.25;
  filter: blur(2px);
  pointer-events: none;
}

.background-orb--left {
  background: #b6d7c9;
  top: -70px;
  left: -90px;
}

.background-orb--right {
  background: #ffd7b3;
  top: 16vh;
  right: -80px;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 20px 42px;
  display: grid;
  gap: 14px;
  animation: rise 480ms ease both;
}

.hero {
  padding: 18px 8px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

h1,
h2,
label,
button {
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.8rem, 3.4vw, 2.75rem);
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-input label {
  display: block;
  font-size: 0.93rem;
  margin-bottom: 10px;
}

.path-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}

.path-row input {
  flex: 1 1 420px;
  width: auto;
  min-width: 240px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #c9c0b1;
  padding: 0 12px;
  font-size: 0.98rem;
}

.path-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.path-row input:focus {
  outline: 2px solid #6fb9aa;
  border-color: transparent;
}

.hint {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-drop {
  border-style: dashed;
  text-align: center;
  transition: transform 180ms ease, background-color 180ms ease;
}

.panel-drop.drag-over {
  transform: scale(1.01);
  background: #f3fff9;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  background: #e9ecef;
  color: #24303b;
}

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

.status-top h2 {
  margin: 0;
  font-size: 1.15rem;
}

.badge {
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e9ecef;
}

.badge.success {
  background: #d7f6df;
  color: var(--ok);
}

.badge.error {
  background: #ffe2e0;
  color: var(--danger);
}

.badge.loading {
  background: #e2f1ff;
  color: #186ca5;
}

.progress-wrap {
  width: 100%;
  height: 11px;
  background: #ede9de;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e 0%, #35a79a 100%);
  transition: width 260ms ease;
}

.status-text {
  margin: 10px 0 0;
  color: var(--muted);
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.preview-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.preview-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-list {
  margin-top: 12px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.preview-item {
  border: 1px solid #e0d8ca;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
  width: 100%;
  min-width: 0;
}

.preview-item small {
  display: block;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.panel-preview {
  overflow: hidden;
}

.preview-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.folder-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.folder-modal.open {
  display: block;
}

.folder-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 30, 38, 0.48);
}

.folder-modal-content {
  position: relative;
  width: min(760px, calc(100% - 24px));
  margin: 6vh auto 0;
  background: #fffdf9;
  border: 1px solid #dccfb9;
  border-radius: 18px;
  box-shadow: 0 22px 52px rgba(16, 20, 28, 0.28);
  padding: 14px;
  max-height: 82vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

.folder-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.folder-modal-head h2 {
  margin: 0;
}

.folder-modal-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.modal-path {
  color: var(--muted);
  font-size: 0.9rem;
}

.folder-list {
  border: 1px solid #e5dac7;
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  padding: 8px;
  min-height: 240px;
}

.folder-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  color: #24303b;
  cursor: pointer;
}

.folder-item:hover {
  border-color: #d8ccb7;
  background: #fff9f0;
}

.folder-item.empty {
  cursor: default;
  color: var(--muted);
}

.folder-modal-actions {
  display: flex;
  justify-content: flex-end;
}

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

@media (max-width: 760px) {
  .panel-actions {
    flex-direction: column;
  }

  .path-row {
    flex-direction: column;
  }

  .folder-modal-content {
    margin-top: 4vh;
  }
}
