:root {
  --bg: #030303;
  --surface: #0d0d0d;
  --surface-2: #161616;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f5;
  --muted: #a39a90;
  --gold: #c28135;
  --gold-hover: #a86f2d;
  --gold-soft: rgba(194, 129, 53, 0.14);
  --ok: #3fb979;
  --err: #e24b4a;
  --warn: #e8a552;
  --radius: 14px;
  --ui: 'Karla', system-ui, sans-serif;
  --serif: 'Cardo', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 110px;
}
[hidden] { display: none !important; }
a { color: var(--gold); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(3, 3, 3, 0.92); backdrop-filter: blur(12px); z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--gold); }
.brand-sub { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.who { text-align: right; font-size: 14px; color: var(--muted); }
.who b { color: var(--text); font-weight: 600; }
.who .bal { color: var(--gold); font-weight: 700; }
.who .logout { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer;
  font: inherit; padding: 0; margin-left: 8px; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 24px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; margin: 0 0 8px; }
.intro p { color: var(--muted); max-width: 720px; margin: 0 0 28px; }
.login { max-width: 560px; margin: 12vh auto; text-align: center; }
.login p { color: var(--muted); font-size: 18px; }

.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card.ready { border-color: rgba(63, 185, 121, 0.45); }
.card.busy { border-color: var(--gold-soft); }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-title { flex: 1; min-width: 0; }
.card-title input {
  width: 100%; background: transparent; border: 0; color: var(--text); font: 600 18px var(--ui); padding: 0;
  border-bottom: 1px dashed transparent;
}
.card-title input:focus { outline: none; border-bottom-color: var(--gold); }
.card-type { font-size: 13px; color: var(--muted); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 6px;
  border-radius: 8px; }
.icon-btn:hover { color: var(--err); background: var(--surface-2); }

.chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); }
.chip.ready { background: rgba(63, 185, 121, 0.15); color: var(--ok); }
.chip.queued, .chip.running, .chip.busy { background: var(--gold-soft); color: var(--gold); }
.chip.delivered { background: rgba(63, 185, 121, 0.15); color: var(--ok); }
.chip.failed { background: rgba(226, 75, 74, 0.15); color: var(--err); }

.summary { display: flex; flex-wrap: wrap; gap: 6px; }
.summary span { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px;
  padding: 2px 9px; }

.text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.text em { color: var(--muted); }
.busy-line { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--gold-soft); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.media img, .media video { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px;
  background: #000; display: block; }
.media audio { width: 100%; }

.err { background: rgba(226, 75, 74, 0.1); border: 1px solid rgba(226, 75, 74, 0.35); color: #ffb3b2;
  border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; }

.fields { display: flex; flex-direction: column; gap: 10px; }
.fields label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.fields input[type=text], .fields textarea, .admin input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: 15px var(--ui); padding: 10px 12px;
}
.fields textarea { min-height: 120px; resize: vertical; }
.fields input:focus, .fields textarea:focus, .admin input:focus { outline: none; border-color: var(--gold); }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 42px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); padding: 3px; flex: none; }

.recorder { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.recorder .rec.on { background: var(--err); border-color: var(--err); color: #fff; }
.recorder .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.recorder audio { width: 100%; margin-top: 4px; }
.file-label { cursor: pointer; }
.file-label input { display: none; }
.photo-preview { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: #000; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font: 500 15px var(--ui); cursor: pointer; text-align: left; transition: 0.15s;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #120b03; font-weight: 700;
  text-align: center; }
.btn.primary:hover { background: var(--gold-hover); }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 28px; font-size: 17px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.add {
  margin-top: 18px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: transparent; border: 1px dashed rgba(194, 129, 53, 0.5); color: var(--gold); border-radius: var(--radius);
  padding: 22px; font: 600 17px var(--ui); cursor: pointer;
}
.add:hover { background: var(--gold-soft); }
.add .plus { font-size: 26px; line-height: 1; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.type {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.type:hover { border-color: var(--gold); }
.type b { display: block; font-size: 16px; margin-bottom: 4px; }
.type span { color: var(--muted); font-size: 14px; }

.sendbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: rgba(13, 13, 13, 0.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.sendbar-info { font-size: 15px; color: var(--muted); }
.sendbar-info b { color: var(--text); }

.admin { background: var(--surface); border: 1px solid var(--gold-soft); border-radius: var(--radius); padding: 14px;
  margin-bottom: 22px; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-row label { font-size: 14px; color: var(--muted); }
.admin input { width: 220px; }
.admin table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.admin td, .admin th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.admin-scroll { overflow-x: auto; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; max-width: 90vw;
  background: var(--surface-2); border: 1px solid var(--gold); border-radius: 10px; padding: 12px 18px;
  white-space: pre-wrap; }

@media (max-width: 640px) {
  main { padding: 20px 16px; }
  .top { padding: 12px 16px; }
  h1 { font-size: 30px; }
  .jobs { grid-template-columns: 1fr; }
  .sendbar { padding: 12px 16px; flex-direction: column; align-items: stretch; text-align: center; gap: 10px; }
  .who { font-size: 13px; }
}
