:root {
  --ink: #17211b;
  --muted: #68736c;
  --line: #dce3dd;
  --paper: #f3f6f2;
  --card: #ffffff;
  --green: #176b43;
  --green-dark: #0e4e30;
  --soft-green: #e8f3ec;
  --danger: #a33b32;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 8%, #e2eee5 0, transparent 27rem), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.login-card { width: min(440px, 100%); margin: 8vh auto 0; padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 22px 70px rgba(30,53,38,.10); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--green); color: white; font: 700 24px Georgia, serif; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font: 600 clamp(32px, 5vw, 48px) Georgia, serif; }
h2 { font-size: 22px; }
.muted, .drop-zone p { color: var(--muted); }
form { display: grid; gap: 18px; margin-top: 30px; }
label { display: grid; gap: 8px; font-size: 14px; font-weight: 650; }
input { width: 100%; padding: 12px 14px; border: 1px solid #cbd5cd; border-radius: 10px; outline: none; background: white; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,67,.12); }
.primary, .ghost, .icon-button { border: 0; border-radius: 10px; font-weight: 700; }
.primary { padding: 12px 18px; background: var(--green); color: white; box-shadow: 0 6px 16px rgba(23,107,67,.16); }
.primary:hover { background: var(--green-dark); }
.ghost { padding: 10px 14px; background: white; color: var(--ink); border: 1px solid var(--line); }
.error { min-height: 18px; margin: -6px 0; color: var(--danger); font-size: 14px; }
header, .section-heading, .account { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account { color: var(--muted); }
.upload-card, .files-section { margin-top: 34px; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 36px rgba(30,53,38,.05); }
.drop-zone { padding: 46px 24px; text-align: center; border: 1.5px dashed #9db0a2; border-radius: 15px; background: #fbfcfb; transition: .2s ease; outline: none; }
.drop-zone.drag, .drop-zone:focus-visible { border-color: var(--green); background: var(--soft-green); transform: translateY(-2px); }
.drop-zone h2 { margin-top: 12px; }
.drop-zone p { margin: 8px 0 18px; }
.drop-zone small { display: block; margin-top: 14px; color: var(--muted); }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: auto; border-radius: 50%; background: var(--soft-green); color: var(--green); font-size: 24px; }
.upload-queue { display: grid; gap: 10px; margin-top: 16px; }
.queue-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 16px; padding: 12px 14px; border-radius: 10px; background: var(--paper); font-size: 14px; }
.queue-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 99px; background: #d9e2db; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s; }
.files-section { margin-top: 20px; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { padding: 11px 12px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--line); }
td { padding: 16px 12px; border-bottom: 1px solid #edf0ed; font-size: 14px; }
.filename { max-width: 330px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { padding: 8px 10px; background: var(--soft-green); color: var(--green-dark); }
.icon-button.danger { background: #faecea; color: var(--danger); }
.empty { margin-top: 22px; padding: 30px; border-radius: 12px; background: var(--paper); color: var(--muted); text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 340px; padding: 13px 16px; border-radius: 10px; background: var(--ink); color: white; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1120px); padding-top: 20px; }
  .login-card { padding: 26px; }
  header { align-items: flex-start; }
  .account { align-items: flex-end; flex-direction: column; }
  .upload-card, .files-section { padding: 15px; border-radius: 16px; }
  .drop-zone { padding: 34px 16px; }
}

/* --- Per-file origins dialog --- */
dialog {
  width: min(500px, calc(100% - 32px));
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(30,53,38,.18);
  background: var(--card);
}
dialog::backdrop { background: rgba(0,0,0,.35); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.03em; }
.origins-filename { margin: 0 0 20px; font-size: 13px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog label { display: grid; gap: 8px; font-size: 14px; font-weight: 650; }
dialog textarea { width: 100%; padding: 11px 13px; border: 1px solid #cbd5cd; border-radius: 10px; font: 13px/1.5 ui-monospace, monospace; resize: vertical; outline: none; }
dialog textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,67,.12); }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- Whitelist badge --- */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.badge-default { background: #f0f2f1; color: var(--muted); }
.badge-open { background: #fff3cd; color: #8a6800; }
.badge-custom { background: var(--soft-green); color: var(--green-dark); }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
