:root {
  --fg: #1d2330; --muted: #8a93a3; --line: #e3e7ee; --bg: #f6f7f9; --accent: #2f6fde;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
input, select { border: 1px solid #c9d0db; border-radius: 6px; padding: 6px 8px; background: #fff; }
input:focus, select:focus { outline: 2px solid #b8cdf5; border-color: var(--accent); }
button {
  border: 1px solid #c9d0db; border-radius: 6px; padding: 5px 10px; background: #fff; cursor: pointer;
}
button:hover:not(:disabled) { background: #eef2f8; }
button:disabled { opacity: .35; cursor: default; }
button[type=submit] { background: var(--accent); border-color: var(--accent); color: #fff; }
button[type=submit]:hover:not(:disabled) { background: #255bb8; }
.muted { color: var(--muted); }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login {
  display: flex; flex-direction: column; gap: 12px; width: 280px; padding: 24px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #556; }
.login-error { margin: 0; color: #c62828; font-size: 13px; }

/* header */
header {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
#new-job { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
#url { flex: 1; min-width: 260px; max-width: 720px; }
.form-error { color: #c62828; font-size: 13px; }
.vision-down {
  display: inline-block; max-width: 420px; padding: 6px 8px; border-radius: 6px; font-size: 12px;
  color: #8a4b00; background: #fff4e0; border: 1px solid #f3d29b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.logout { color: var(--muted); text-decoration: none; white-space: nowrap; }
.logout:hover { color: var(--fg); }

/* table */
/* narrow screens scroll the table sideways; main fills the page so that works below the table too */
main { flex: 1; padding: 16px 20px; overflow-x: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; table-layout: fixed; background: #fff;
        border: 1px solid var(--line); border-radius: 8px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { white-space: nowrap; font-size: 12px; font-weight: 600; color: #667; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
.c-name { width: 18%; } .c-country { width: 70px; } .c-product { width: 16%; }
.c-url { width: auto; } .c-btn { width: 56px; text-align: center; } .c-status { width: 200px; }
td.c-name { cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.c-name.editing { overflow: visible; }
.editor { display: flex; gap: 4px; }
.editor:not(.dirty) button { display: none; }  /* ✓ / ✕ appear once the text differs */
td.c-name input { flex: 1; min-width: 0; padding: 2px 6px; }
td.c-name button { padding: 0 7px; font-weight: 700; }
td.c-name button.ok { color: #fff; background: #2e9d4f; border-color: #2e9d4f; }
td.c-name button.cancel { color: #fff; background: #d64545; border-color: #d64545; }
.placeholder { font-style: italic; opacity: 0; }
tr:hover .placeholder { opacity: 1; }
td.c-product { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.c-url { cursor: copy; position: relative; }
td.c-url .url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.c-url .url:not(.muted) { color: var(--accent); }
td.c-url.copied::after, td.c-url.copy-failed::after {
  content: "copied"; position: absolute; right: 8px; top: 6px; padding: 1px 6px; border-radius: 4px;
  font-size: 11px; color: #fff; background: #2e9d4f;
}
td.c-url.copy-failed::after { content: "copy failed"; background: #d64545; }
td.c-btn button { padding: 2px 8px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600;
  color: #fff; background: #8a93a3;
}
.s-queued { background: #9aa3b2; }
.s-starting { background: #6b7fd7; }
.s-downloading { background: #2f8fd6; }
.s-transcribing { background: #8c5fd0; }
.s-analysis { background: #c27a12; }
.s-done { background: #2e9d4f; }
.s-error { background: #d64545; }
.err {
  margin-top: 3px; font-size: 12px; color: #a33; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.err.open { white-space: pre-wrap; word-break: break-word; }

/* screenshot modal: the overlay itself scrolls (full-page mobile captures are tall) */
.modal {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto; padding: 32px 0;
  background: rgba(20, 24, 32, .72);
}
.modal[hidden] { display: none; }
.modal-box { position: relative; width: min(420px, 92vw); margin: 0 auto; }
.modal-box img { display: block; width: 100%; background: #fff; border-radius: 6px; }
.modal-close {
  position: fixed; top: 14px; right: 18px; z-index: 11; width: 34px; height: 34px;
  border-radius: 50%; font-size: 16px; line-height: 1; padding: 0;
}
