:root {
  --blue: #0061D5;
  --blue-hover: #004eaa;
  --blue-light: #EEF4FF;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e2e5eb;
  --bg-page: #edf0f7;
  --bg-card: #ffffff;
  --bg-subtle: #f8f9fb;
  --red: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.5;
  min-height: 100vh;
  padding: 16px;
}

#app {
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  padding: 28px 28px 32px;
}

/* ── Header / Logo ────────────────────────────────────────────── */

.header {
  text-align: center;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  height: 46px;
  width: auto;
  max-width: 100%;
  display: inline-block;
}

/* ── File info ───────────────────────────────────────────────── */

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 26px;
}

.file-icon { font-size: 18px; flex-shrink: 0; }

.file-name {
  font-weight: 600;
  font-size: 14px;
  word-break: break-all;
  color: var(--text);
}

/* ── Form sections ───────────────────────────────────────────── */

.form-section { margin-bottom: 24px; }

.section-label {
  display: block;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 13px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
}

.radio-option input {
  cursor: pointer;
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Box Picker ──────────────────────────────────────────────── */

.picker-wrapper { margin-top: 16px; }

.selected-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--blue-light);
  border: 1px solid #c0d8f5;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
}

.link-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  flex-shrink: 0;
  margin-left: 8px;
}

#picker-container {
  height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Options toggle ──────────────────────────────────────────── */

.toggle-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 15px;
}

.toggle-option input {
  margin-top: 2px;
  accent-color: var(--blue);
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.hint {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Actions ─────────────────────────────────────────────────── */

.actions { margin-top: 10px; }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-hover);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  display: inline-block;
  padding: 11px 28px;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  background: #fff;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--blue-light); }

.error-msg {
  margin-top: 12px;
  color: var(--red);
  font-size: 14px;
}

/* ── State cards (processing / error) ────────────────────────── */

.state-card {
  text-align: center;
  padding: 36px 8px;
}

.spinner {
  width: 46px;
  height: 46px;
  border: 3.5px solid #e5e7eb;
  border-top-color: var(--blue);
  border-radius: 50%;
  margin: 0 auto 26px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.state-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 28px;
  line-height: 1.65;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.state-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 16px;
}

/* ── Picker status messages ──────────────────────────────────── */

.picker-loading,
.picker-error {
  padding: 16px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.picker-error { color: var(--red); }

/* ── Utilities ───────────────────────────────────────────────── */

.hidden { display: none !important; }
