:root {
  color-scheme: light;
  --ink: #171a1f;
  --muted: #68707c;
  --line: #dce0e5;
  --paper: #f6f7f8;
  --white: #ffffff;
  --green: #14804a;
  --red: #c73544;
  --cyan: #00a9bb;
  --yellow: #f4bd27;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }

header {
  min-height: 190px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px max(24px, calc((100vw - 1120px) / 2));
  background: #171a1f;
  color: white;
  border-bottom: 5px solid var(--cyan);
}
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-button { color: white; border-color: #68707c; background: transparent; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #171a1f; }
.login-card { width: min(440px, 100%); padding: 32px; border-radius: 8px; background: white; box-shadow: 0 24px 80px #0008; }
.login-card h1 { color: var(--ink); font-size: 42px; }
.login-card form { grid-template-columns: 1fr; margin-top: 24px; }
.login-card .eyebrow { color: var(--cyan); }

.eyebrow {
  margin: 0 0 8px;
  color: #7bd8df;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  line-height: .95;
  letter-spacing: 0;
}

h1 span { color: var(--yellow); font-size: .55em; }

.system-state {
  padding: 8px 0;
  color: #bdc4cc;
  font-size: 14px;
}

main { max-width: 1120px; margin: 0 auto; }

.band {
  padding: 42px 24px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 4px; font-size: 24px; letter-spacing: 0; }
h3 { margin-bottom: 3px; font-size: 16px; }
.section-heading p, article p, small { color: var(--muted); }
.section-heading p, article p { margin-bottom: 0; font-size: 14px; }

.connection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

article {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.service-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: white;
  font-weight: 900;
}

.google { background: #4285f4; }
.youtube { background: #ff0033; color: white; font-size: 20px; }
.connection-grid.single { grid-template-columns: minmax(0, 560px); }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button.primary { background: var(--ink); color: white; }
.button.secondary { background: white; }
.button:disabled { opacity: .45; cursor: not-allowed; }

form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

label > span, legend {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 750;
}

.wide { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #b8bec6;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #00a9bb22; }
textarea { min-height: 84px; resize: vertical; }
small { display: block; margin-top: 6px; line-height: 1.4; }

.input-suffix { display: flex; }
.input-suffix input { border-radius: 5px 0 0 5px; }
.input-suffix b {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #eceff2;
  border: 1px solid #b8bec6;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  font-size: 12px;
}

fieldset { padding: 0; border: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; margin: 8px 16px 8px 0; font-size: 13px; }
.check input { width: 17px; min-height: 17px; margin: 0; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-row span { margin: 0; }
.toggle-row input { width: 22px; min-height: 22px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.creator-panel {
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding: 15px 16px;
  background: #e8f6f2;
  border: 1px solid #abd9ca;
  border-radius: 6px;
}

.creator-panel:not([hidden]) { display: flex; }
.creator-panel > div { display: flex; align-items: center; gap: 11px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.creator-panel small { margin: 2px 0 0; }

.queue-heading { align-items: center; }
.queue-alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #e2a9af;
  border-radius: 6px;
  background: #fbe8ea;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  font-size: 20px;
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table { width: 100%; border-collapse: collapse; min-width: 1040px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { background: #eceff2; color: #505761; font-size: 11px; text-transform: uppercase; }
th:nth-child(1), td:nth-child(1) { width: 280px; min-width: 280px; }
th:nth-child(2), td:nth-child(2) { width: 320px; min-width: 320px; }
th:nth-child(3), td:nth-child(3) { width: 190px; min-width: 190px; }
td:first-child { font-weight: 700; overflow-wrap: break-word; }
.badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 4px;
  background: #e9edf1;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.uploaded { color: var(--green); background: #e4f4eb; }
.badge.failed { color: var(--red); background: #fbe8ea; }
.badge.waiting_approval { color: #7a5700; background: #fff2c9; }
.archive-state { max-width: 180px; color: var(--green); }
.job-error { display: block; max-width: 360px; margin-top: 6px; color: var(--red); font-weight: 500; }
.job-action { min-height: 32px; padding: 0 10px; font-size: 12px; }
#empty-state { padding: 38px 16px; color: var(--muted); text-align: center; }

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 15px;
  border-radius: 5px;
  background: var(--ink);
  color: white;
  box-shadow: 0 12px 30px #0003;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}

#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 720px) {
  header { min-height: 160px; align-items: flex-start; flex-direction: column; padding-top: 32px; }
  .connection-grid, form { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  article { grid-template-columns: 42px 1fr; }
  article .button { grid-column: 1 / -1; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .queue-heading { flex-direction: row; align-items: center; }
  .form-actions { flex-direction: column-reverse; }
  .creator-panel { align-items: stretch; flex-direction: column; }
}
