:root {
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f5f7fb;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--soft);
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

main {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

h3 {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
  min-width: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

p {
  margin: 0;
}

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

.ok {
  color: var(--green);
}

.label {
  font-size: 11px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

input[type="checkbox"] {
  width: auto;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

button {
  font: inherit;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  border-color: #cbd5e1;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
}

button.small {
  padding: 4px 9px;
  font-size: 12px;
}

.fields {
  display: flex;
  flex-direction: column;
}

.field {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
}

.field:last-child {
  border-bottom: none;
}

.field .value {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.copy {
  padding: 2px 8px;
  font-size: 11px;
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}

.jobs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.job {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
}

.job:hover {
  background: var(--soft);
}

.job.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.job-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.job-title {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no {
  color: var(--muted);
  font-weight: 400;
}

.pill {
  flex: none;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
}

.pill.blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill.green {
  background: #dcfce7;
  color: var(--green);
}

.pill.red {
  background: #fee2e2;
  color: var(--red);
}

.pill.amber {
  background: #fef3c7;
  color: var(--amber);
}

.pill.spin::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
}

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

.gen select {
  width: auto;
}

.answer {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.answer .q {
  font-weight: 600;
  color: var(--ink);
}

.answer .a {
  white-space: pre-wrap;
  color: var(--text);
}

.answer .copy {
  align-self: flex-start;
}

.notice {
  text-align: center;
  align-items: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.5);
}

.toast.error {
  background: var(--red);
}

/* --- collapsible profile ------------------------------------------- */

button.collapse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 2px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

button.collapse svg {
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
  color: var(--muted);
}

button.collapse.open svg {
  transform: none;
}

.fields[hidden] {
  display: none;
}

/* --- jobs ---------------------------------------------------------- */

h3 .count {
  font-weight: 400;
  font-size: 12px;
}

button.small svg {
  vertical-align: -2px;
}

button.icon-only {
  padding: 4px 6px;
  line-height: 0;
}

button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.add {
  padding: 10px;
  border-radius: 10px;
  background: var(--soft);
}

.add[hidden],
.gen[hidden],
#banner[hidden] {
  display: none;
}

.app-no {
  color: var(--green);
  font-weight: 600;
}

.empty {
  padding: 8px 4px;
}

button.copy {
  line-height: 0;
  padding: 5px 7px;
}

button.copy.wide {
  line-height: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.banner {
  margin: 10px 10px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
}

.banner a {
  color: inherit;
  font-weight: 600;
}

/* --- install page (opened outside the extension) --------------------- */

body.install {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.install main {
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.install-card {
  max-width: 460px;
  width: 100%;
  align-items: center;
  text-align: center;
  padding: 28px 24px;
  gap: 12px;
}

.install-card h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

a.button {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

a.button.primary {
  background: var(--accent);
  color: #fff;
}

.steps {
  text-align: left;
  margin: 4px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--soft);
}

/* --- this page: the posting, earlier bids, resume, done ------------- */

.page-fields .field {
  grid-template-columns: 70px 1fr auto;
}

.page-fields input,
.page-fields textarea {
  padding: 5px 8px;
}

.field.tall {
  align-items: start;
}

.field.tall .label,
.field.tall .copy {
  margin-top: 6px;
}

textarea.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.alert {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.alert.red {
  background: #fee2e2;
  color: var(--red);
}

.alert.amber {
  background: #fef3c7;
  color: var(--amber);
}

.alert.green {
  background: #dcfce7;
  color: var(--green);
}

.bids {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  max-height: 170px;
  overflow-y: auto;
}

.bid {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 2px;
  font-size: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.bid:last-child {
  border-bottom: none;
}

.bid.mine .no {
  color: var(--ink);
  font-weight: 600;
}

.bid .muted {
  flex: none;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

ul.problems {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--red);
  max-height: 150px;
  overflow-y: auto;
}

ul.problems code {
  color: var(--ink);
}

#page-clear[hidden] {
  display: none;
}
