:root {
  --navy: #14305E;
  --navy-dark: #0C1F40;
  --blue: #155F82;
  --sky: #D7E9F7;
  --gold: #F5A623;
  --ink: #1B1B1B;
  --border: #D9E2EC;
  --bg: #F4F7FB;
  --danger: #B3261E;
  --warn: #9A6700;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.topbar h1 {
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

header.topbar button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.5);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

main {
  max-width: 860px;
  margin: 24px auto;
  padding: 0 16px 60px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 18px;
}

h2 {
  font-family: "Montserrat", Arial, sans-serif;
  color: var(--navy);
  font-size: 18px;
  margin-top: 0;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--blue); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.Draft { background: #E7EAF0; color: #4A5568; }
.badge.Running { background: var(--sky); color: var(--blue); }
.badge.Ready { background: #E2F5E8; color: #1D7A3C; }
.badge.Needs.review, .badge.Needs { background: #FFF3D6; color: var(--warn); }
.badge.Failed, .badge.Interrupted { background: #FBE3E1; color: var(--danger); }

button.primary {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
button.primary:hover { background: var(--navy); }
button.secondary {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
button.secondary.danger { color: var(--danger); border-color: var(--danger); }
button.secondary.danger:hover { background: #FBE3E1; }
td button + button { margin-left: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.prev-runs { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: #FAFBFD; }
.prev-runs-title { font-weight: 700; color: var(--navy); }
.prev-runs td { padding: 8px 6px; }
.prev-runs td:last-child { text-align: right; white-space: nowrap; }
.prev-runs tr.highlight td { background: #FFF3D6; }
.row-error { color: var(--danger); font-size: 12px; margin-top: 4px; max-width: 360px; }

.manual-upload { margin-top: 16px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: #FAFBFD; }
.manual-upload summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blue); }
.manual-upload[open] summary { margin-bottom: 6px; }
button:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 4px; color: var(--navy); }
input[type=text], input[type=date], input[type=file], input[type=password], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}

/* Hand-uploaded agendas: the order they'll be recapped in, as draggable pills. */
.agenda-preview { margin-top: 12px; }
.agenda-preview-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.agenda-preview-head .hint { margin: 0; }
.agenda-pills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.agenda-pill {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 6px 8px 6px 12px; border-radius: 999px; font-size: 14px;
  background: var(--sky); color: var(--navy); border: 1px solid #B5D5EE;
  cursor: grab; user-select: none; transition: box-shadow .15s, opacity .15s;
}
.agenda-pill:hover { box-shadow: 0 3px 10px rgba(20, 48, 94, .18); }
.agenda-pill:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.agenda-pill.dragging { opacity: .4; }
.agenda-pill.needs-type { background: #FDEBC8; color: #7A4D00; border-color: #F5C877; }
.agenda-pill-grip { color: var(--blue); opacity: .6; font-size: 16px; line-height: 1; }
.agenda-pill-num {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700;
}
.agenda-pill-name { font-weight: 600; overflow-wrap: anywhere; }
.agenda-pill-meta { font-size: 12px; opacity: .75; white-space: nowrap; }
.agenda-pill-type { width: auto; padding: 3px 6px; font-size: 13px; }
.agenda-pill-remove {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .7); color: inherit; font-size: 16px; line-height: 1;
}
.agenda-pill-remove:hover { background: #fff; color: var(--danger); }
@media (max-width: 600px) {
  .agenda-pill { flex-wrap: wrap; border-radius: 16px; }
}

.dropzone {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 2px dashed var(--border); border-radius: 8px;
  background: #fff; transition: border-color .15s, background .15s;
}
.dropzone input[type=file] { flex: 1; min-width: 0; border: none; padding: 0; }
.dropzone-text { flex: 0 0 auto; font-size: 13px; color: #667; }
.dropzone.dragover { border-color: var(--blue); background: var(--sky); }
.dropzone.has-file { border: 2px solid #1D7A3C; background: #E2F5E8; }
.dropzone.has-file .dropzone-text { color: #1D7A3C; font-weight: 700; }
.dropzone.rejected { border-color: var(--danger); }
.dropzone.rejected .dropzone-text { color: var(--danger); }
@media (max-width: 600px) {
  .dropzone { flex-wrap: wrap; }
}

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hint { color: #667; font-size: 12px; margin-top: 4px; }

.steps { list-style: none; padding: 0; margin: 0 0 16px; }
.steps li {
  padding: 8px 10px; border-radius: 6px; margin-bottom: 4px; font-size: 14px;
  display: flex; justify-content: space-between; background: #F0F3F8;
}
.steps li.active { background: var(--sky); font-weight: 600; }
.steps li.done { background: #E2F5E8; color: #1D7A3C; }
.steps li.failed { background: #FBE3E1; color: var(--danger); }

#log {
  background: var(--navy-dark); color: #D7E9F7; font-family: Consolas, monospace; font-size: 12px;
  padding: 12px; border-radius: 8px; height: 220px; overflow-y: auto; white-space: pre-wrap;
}

.carousel { margin-top: 10px; }
.carousel-stage { display: flex; align-items: center; justify-content: center; gap: 12px; }
/* Slides are 1080x1350 (4:5); cap the height so the whole slide fits on screen. */
#slideMain {
  flex: 0 1 min(480px, calc((100vh - 160px) * 0.8)); min-width: 0;
  aspect-ratio: 4 / 5; object-fit: contain;
  border-radius: 8px; border: 1px solid var(--border); background: #fff;
  box-shadow: 0 4px 16px rgba(20, 48, 94, .12);
}
.carousel-arrow {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--blue); background: #fff; color: var(--blue);
  font-size: 28px; line-height: 1; cursor: pointer; padding: 0 0 4px;
}
.carousel-arrow:hover:not(:disabled) { background: var(--sky); }
.carousel-count { text-align: center; font-size: 13px; color: #5A6B80; margin: 8px 0 4px; }
.thumbs { display: flex; justify-content: safe center; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.thumbs img {
  flex: none; width: 64px; border-radius: 4px; border: 2px solid transparent;
  cursor: pointer; opacity: .6;
}
.thumbs img:hover { opacity: 1; }
.thumbs img.active { border-color: var(--gold); opacity: 1; }
@media (max-width: 600px) {
  .carousel-stage { gap: 6px; }
  .carousel-arrow { width: 36px; height: 36px; font-size: 24px; }
}

/* ---------- pills & status boxes ---------- */

.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#progressDownloads:not(:empty) { margin: 0 0 14px; }
.pill-label { font-size: 13px; font-weight: 600; color: var(--navy); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  text-decoration: none; border: 1px solid transparent;
  transition: transform .1s, box-shadow .15s;
}
a.pill:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(20, 48, 94, .18); }
.pill-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .7); font-size: 13px;
}
.pill-ext { font-weight: 400; opacity: .8; font-size: 12px; }
.pill-sky   { background: var(--sky); color: var(--blue); border-color: #B5D5EE; }
.pill-navy  { background: var(--navy); color: #fff; }
.pill-navy .pill-icon { background: rgba(255, 255, 255, .2); }
.pill-gold  { background: #FDEBC8; color: #7A4D00; border-color: #F5C877; }
.pill-green { background: #E2F5E8; color: #1D7A3C; border-color: #B7E2C4; }
.pill-disabled { background: #F0F3F8; color: #8A94A6; border: 1px dashed var(--border); font-weight: 400; }

.download-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.section-title { font-size: 15px; color: var(--navy); margin: 22px 0 10px; }

.status-box {
  border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; border-left: 6px solid;
}
.status-headline { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.status-box.pass    { background: #E2F5E8; border-color: #1D7A3C; color: #14532D; }
.status-box.review  { background: #FFF3D6; border-color: var(--gold); color: #5C3D00; }
.status-box.fail    { background: #FBE3E1; border-color: var(--danger); color: #7A1A14; }
.status-box.neutral { background: #F0F3F8; border-color: var(--blue); color: var(--ink); }

.count-pill { padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fff; }
.count-pill.c-error  { color: var(--danger); }
.count-pill.c-warn   { color: var(--warn); }
.count-pill.c-review { color: var(--blue); }

.issue-box { border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; }
.issue-box ul { margin: 6px 0 0; padding-left: 20px; }
.issue-box li { margin-bottom: 4px; }
.issue-title { font-weight: 700; }
.issue-box.c-error  { background: #FDF1F0; border: 1px solid #F3C2BD; }
.issue-box.c-warn   { background: #FFF9EB; border: 1px solid #F5DDA0; }
.issue-box.c-review { background: #F1F7FC; border: 1px solid #C9DFF0; }

.hidden { display: none !important; }
