:root {
  --green: #48904d;
  --coral: #e55f66;
  --ink: #1b2430;
  --muted: #6b7787;
  --line: #e2e7ee;
  --bg: #f5f7fa;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.6 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

main { max-width: 1160px; margin: 0 auto; padding: 26px 20px 70px; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 26px;
  background: var(--green); color: #fff; padding: 0 22px;
}
.brand { font-size: 19px; font-weight: 700; color: #fff; text-decoration: none; padding: 15px 0; }
.brand span { font-weight: 400; opacity: .82; }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a, .top .out {
  color: #fff; text-decoration: none; padding: 15px 15px;
  opacity: .85; border-bottom: 3px solid transparent;
}
.top nav a:hover, .top .out:hover { opacity: 1; }
.top nav a.on { opacity: 1; border-bottom-color: #fff; font-weight: 600; }
.top .out { margin-left: 18px; font-size: 14px; }

/* ---------- page furniture ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}
h1 { font-size: 25px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); margin: 0; max-width: 74ch; }
.dim { color: var(--muted); font-size: 13px; }
.ok { color: var(--green); font-weight: 600; margin: 0; }
.error { color: #c0392b; font-weight: 600; }
.empty {
  background: var(--card); border: 1px dashed var(--line);
  border-radius: 10px; padding: 34px; text-align: center; color: var(--muted);
}
.missing { color: #b9c1cc; font-size: 13px; }
.req { color: var(--coral); }
.right { text-align: right; }
.grow { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: #c8d1dc; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #3d7d42; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.danger { color: #c0392b; border-color: #f0c7c2; background: #fff; }
.btn.danger:hover { background: #fdf0ee; }

/* ---------- build bar ---------- */
.build-bar {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 22px;
}
.build-bar form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.build-bar label { display: flex; flex-direction: column; gap: 5px; font-size: 13px;
  color: var(--muted); font-weight: 600; }
.recent { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

input[type=text], input[type=password], input[type=number], select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; min-width: 210px; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #b9dcc0; border-color: var(--green); }

/* ---------- tables ---------- */
.grid { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grid th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line);
  background: #fafbfd;
}
.grid td { padding: 11px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.off { opacity: .5; }
.grid tr.dragging { opacity: .35; }
.grid .num { width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid .drag { width: 26px; cursor: grab; color: #b9c1cc; font-size: 17px; user-select: none; }
.grid .name { font-weight: 650; }
.grid .co { color: var(--green); font-size: 13px; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 7px;
  background: #eef1f5; display: block; }
.thumb.logo { object-fit: contain; background: #fff; border: 1px solid var(--line); }
audio { height: 34px; max-width: 230px; vertical-align: middle; }
.save-hint { color: var(--green); font-size: 13px; height: 20px; margin: 8px 2px; }
.tag.off { background: #f0f2f5; color: var(--muted); border-radius: 5px;
  padding: 1px 7px; font-size: 11px; }

/* ---------- chips ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px;
  font-weight: 600; background: #eef1f5; color: var(--muted); text-decoration: none;
}
.chip.done { background: #e4f4e7; color: #2e7d34; }
.chip.running { background: #fff4dd; color: #a06a00; }
.chip.queued { background: #eaf0fb; color: #3f5c94; }
.chip.failed { background: #fdeceb; color: #c0392b; }
.chip span { opacity: .7; margin-left: 5px; }

/* ---------- forms ---------- */
.card-form, .event, .inline-form {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin-bottom: 18px;
}
.card-form label, .login label { display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 15px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card-form .row { display: flex; gap: 18px; flex-wrap: wrap; }
.card-form .row > label { flex: 1; min-width: 240px; }
.uploads .upload {
  background: #fafbfd; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; min-width: 250px;
}
.preview { width: 100%; max-height: 190px; object-fit: contain; border-radius: 8px;
  background: #fff; margin-bottom: 8px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- cropper ---------- */
.crop-stage { margin-top: 10px; }
.crop-canvas { position: relative; display: inline-block; max-width: 100%;
  background: #23272e; border-radius: 8px; overflow: hidden; line-height: 0; }
.crop-canvas img { max-width: 100%; max-height: 300px; display: block;
  user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 2px solid #fff; cursor: move;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5); box-sizing: border-box; }
.crop-box .h { position: absolute; width: 15px; height: 15px; background: #fff;
  border-radius: 3px; }
.crop-box .nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-box .ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-box .sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-box .se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-tools { display: flex; align-items: center; gap: 10px; margin-top: 8px;
  flex-wrap: wrap; }
.trim { margin: 6px 0 18px; }
.trim summary { cursor: pointer; font-weight: 600; color: var(--green); margin-bottom: 10px; }
.check { display: flex; flex-direction: row !important; align-items: center; gap: 8px;
  font-weight: 400 !important; color: var(--ink) !important; margin-bottom: 6px !important; }
.check.big { font-weight: 600 !important; margin: 10px 0 !important; }
.events { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
  margin-bottom: 16px; }
.events legend { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.danger { margin-top: 26px; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- events ---------- */
.event-head { display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.event-actions { display: flex; gap: 8px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px 14px; margin: 12px 0 14px; max-height: 310px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; }

/* ---------- job ---------- */
.job { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; }
.bar { height: 12px; background: #eef1f5; border-radius: 20px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green);
  transition: width .5s ease; }
.step { margin: 12px 0 0; color: var(--muted); }
.step b { color: var(--ink); margin-right: 8px; }
.done video { display: block; width: 100%; max-width: 720px; margin-top: 16px;
  border-radius: 10px; background: #000; }
.failed pre { background: #fdf6f5; border: 1px solid #f0d5d1; border-radius: 8px;
  padding: 12px; overflow: auto; font-size: 12px; max-height: 320px; color: #7a3b34; }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 90px auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.login h1 { color: var(--green); }
.login h1 span { color: var(--ink); font-weight: 400; }
.login input { width: 100%; }
.login button { width: 100%; padding: 11px; border: 0; border-radius: 8px;
  background: var(--green); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: 6px; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 0; }
  .top nav { width: 100%; overflow-x: auto; }
  .grid .drag, .grid th:nth-child(4), .grid td:nth-child(4) { display: none; }
}
