:root {
  --bg: #0b0b0d;
  --panel: #131316;
  --panel-2: #18181c;
  --line: #26262c;
  --line-soft: #1d1d22;
  --text: #ececed;
  --dim: #8c8c97;
  --accent: #c9f24e;
  --danger: #ff6a5e;
  --r: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px max(24px, calc((100% - 940px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 17px;
}

.brand .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.meta {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

.top .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s, transform .06s;
  white-space: nowrap;
}

.btn:hover { border-color: #3a3a44; }
.btn:focus-visible, .icon:focus-visible { outline: 2px solid #5c6c33; outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #101208; font-weight: 600; }
.btn.primary:hover { background: #d7ff5f; border-color: #d7ff5f; }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }

.btn.accent { background: transparent; border-color: #3d4a24; color: var(--accent); }
.btn.accent:hover { background: rgba(201, 242, 78, .08); border-color: #556a2e; }

.btn.danger { background: transparent; border-color: #4a2523; color: var(--danger); }
.btn.danger:hover { background: #2a1614; border-color: #6b302b; }

.btn.wide { width: 100%; }
.btn.compact { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.icon {
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--dim);
  cursor: pointer; font-size: 14px;
}
.icon:hover { background: var(--panel-2); color: var(--text); }

/* ---------- feed ---------- */

.feed {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

.count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--dim);
}

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.card:hover { border-color: var(--line); background: #16161a; }

.thumb {
  position: relative;
  width: 112px;
  height: 70px;
  border-radius: 9px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}

.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

.badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0,0,0,.72);
  font-family: var(--mono);
  font-size: 10.5px;
  color: #d8d8dd;
}

.line {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-body .meta { margin-top: 6px; }
.card-actions { display: flex; gap: 6px; }

.overdue .meta-date { color: var(--danger); }

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  color: var(--dim);
  font-size: 13.5px;
  text-align: center;
}

/* ---------- modal ---------- */

.modal {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 60px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  overflow: auto;
}

.modal::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.modal-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }


#card-video {
  width: 100%;
  max-height: 30vh;
  border-radius: 12px;
  background: #000;
  border: 1px solid var(--line);
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--dim); letter-spacing: .02em; }

input[type="datetime-local"],
input:not([type]),
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}

textarea { font-family: var(--sans); }
input[type="datetime-local"] { font-family: var(--mono); font-size: 13px; }
input:focus, textarea:focus { border-color: #4a4a58; }

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

.hint { color: var(--dim); font-size: 13px; }

/* ---------- batch rows ---------- */

.rows { display: flex; flex-direction: column; gap: 12px; }

.row-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
}

.file-slot {
  display: block;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
}

.file-slot.has-file { border-style: solid; border-color: #3c4a22; color: var(--text); }

.row-status { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.row-status.err { color: var(--danger); }
.row-status.ok { color: var(--accent); }

.progress-list { display: flex; flex-direction: column; gap: 4px; }

/* ---------- login ---------- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }

.login-card {
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
}

.login-hint { color: var(--dim); font-size: 13px; margin-top: -6px; }
.err { color: var(--danger); font-size: 12.5px; min-height: 16px; }

/* ---------- mobile queue ---------- */

.queue-top { padding: 12px 16px; }

.queue-list {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qcard {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}

.qcard video { width: 100%; max-height: 60vh; display: block; background: #000; }
.qbody { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.qdate { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.qcard.overdue .qdate { color: var(--danger); }
.qdesc { font-size: 14.5px; white-space: pre-wrap; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: #26262c;
  border: 1px solid #3a3a44;
  font-size: 13.5px;
  z-index: 100;
  max-width: calc(100vw - 32px);
}

@media (max-width: 720px) {
  .feed { padding: 18px 14px 60px; }
  .card { grid-template-columns: 84px 1fr; gap: 12px; }
  .thumb { width: 84px; height: 56px; }
  .card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .top { padding: 10px 14px; gap: 10px; }
  #btn-logout { display: none; }
}
