/* Dzine Studio — «цифрова фотолабораторія»: нейтральний графіт, бурштиновий акцент */

:root {
  --bg: #181818;
  --panel: #1f1f1f;
  --panel-2: #262626;
  --border: #303030;
  --text: #e9e7e3;
  --muted: #9b978f;
  --accent: #e3a23f;
  --accent-dim: rgba(227, 162, 63, .14);
  --err: #d96a5f;
  --err-dim: rgba(217, 106, 95, .12);
  --ok: #8fb573;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }

input[type="text"], input[type="password"], input[type="date"], input[type="number"],
textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 84px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #2d2d2d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1c1503;
  font-weight: 600;
}
.btn-primary:hover { background: #eeb35a; }
.btn-danger { border-color: var(--err); color: var(--err); background: transparent; }
.btn-danger:hover { background: var(--err-dim); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge-accent { color: var(--accent); border-color: rgba(227,162,63,.4); background: var(--accent-dim); }
.badge-err { color: var(--err); border-color: rgba(217,106,95,.45); background: var(--err-dim); }
.badge-ok { color: var(--ok); border-color: rgba(143,181,115,.4); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ── хедер ── */
header.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo { font-weight: 700; letter-spacing: .12em; font-size: 15px; }
.logo span { color: var(--accent); }
.topbar .spacer { flex: 1; }

.banner-paused {
  background: var(--err-dim);
  border-bottom: 1px solid rgba(217,106,95,.4);
  color: var(--err);
  text-align: center;
  padding: 9px 16px;
  font-size: 14px;
}

/* ── розкладка кабінету ── */
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  padding: 18px 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  font-weight: 600;
}

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* вкладки режимів */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 8px;
}
.tabs button.active {
  color: var(--accent);
  border-color: rgba(227,162,63,.5);
  background: var(--accent-dim);
  font-weight: 600;
}

/* дропзона */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.upload-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.upload-item { position: relative; width: 86px; }
.upload-item img {
  width: 86px; height: 86px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.upload-item .tag {
  position: absolute;
  left: 4px; bottom: 4px;
  background: rgba(20,20,20,.85);
  color: var(--accent);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(227,162,63,.4);
}
.upload-item .rm {
  position: absolute;
  top: -7px; right: -7px;
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}
.upload-item .rm:hover { color: var(--err); border-color: var(--err); }

.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
  width: 36px; height: 38px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.stepper button:first-child { border-radius: 8px 0 0 8px; }
.stepper button:last-child { border-radius: 0 8px 8px 0; }
.stepper input { width: 52px; text-align: center; border-radius: 0; border-left: 0; border-right: 0; }

/* ── черга ── */
.queue-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  min-height: 10px;
}
.task-card {
  flex: 0 0 250px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  transition: opacity .6s, border-color .3s;
}
.task-card.done { border-color: rgba(143,181,115,.5); }
.task-card.fading { opacity: 0; }
.task-card.error { border-color: var(--err); }
.task-card .t-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.task-card .t-thumb {
  width: 38px; height: 38px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--panel);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 16px;
}
.task-card .t-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card .t-status { font-size: 12.5px; color: var(--muted); margin: 3px 0; min-height: 18px; }
.task-card .t-status.err { color: var(--err); white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow-y: auto; }
.task-card .t-actions { display: flex; gap: 6px; margin-top: 8px; }

.progress {
  height: 5px;
  background: var(--panel);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width .5s ease;
}
.task-card.active .progress > i { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .task-card.active .progress > i { animation: none; }
  * { transition: none !important; }
}

/* ── галерея ── */
.gallery-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.gallery-tools input[type="text"] { max-width: 260px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--panel-2); border: 0; color: var(--muted); padding: 8px 13px; }
.seg button.active { background: var(--accent-dim); color: var(--accent); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.g-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.g-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.g-card .g-meta { padding: 7px 9px; }
.g-card .g-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-card .g-sub { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.g-card .g-check {
  position: absolute;
  top: 8px; left: 8px;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid #fff8;
  background: rgba(20,20,20,.5);
  display: none;
  align-items: center;
  justify-content: center;
  color: #1c1503;
  font-size: 14px;
}
.gallery-grid.selecting .g-check { display: flex; }
.g-card.selected .g-check { background: var(--accent); border-color: var(--accent); }
.g-card.deleted img { opacity: .25; }
.g-card .g-deleted-note {
  position: absolute; inset: 0 0 38px 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12.5px;
}

/* ── лайтбокс / модалки ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 1200px;
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lightbox .lb-img {
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.lightbox .lb-img img { max-width: 100%; max-height: 92vh; object-fit: contain; }
.lightbox .lb-side { padding: 18px; overflow-y: auto; border-left: 1px solid var(--border); }
.lightbox .lb-side h3 { margin: 0 0 4px; font-size: 16px; word-break: break-word; }
.lb-prompt {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  margin: 8px 0;
}
.lb-refs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.lb-refs img { width: 64px; height: 64px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); }
.lb-params { font-size: 13px; color: var(--muted); margin: 8px 0; }
.lb-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(25,25,25,.75);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 19px;
}
.lb-nav:hover { border-color: var(--accent); color: var(--accent); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close {
  position: absolute;
  top: 14px; right: 18px;
  background: rgba(25,25,25,.75);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 16px;
}
@media (max-width: 860px) {
  .lightbox { grid-template-columns: 1fr; max-height: 94vh; overflow-y: auto; }
  .lightbox .lb-img img { max-height: 55vh; }
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
  max-height: 92vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .m-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.key-reveal {
  background: var(--panel-2);
  border: 1px solid rgba(227,162,63,.5);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 16px;
  text-align: center;
  letter-spacing: .04em;
  color: var(--accent);
  user-select: all;
  word-break: break-all;
}

/* ── сторінка логіна ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card .logo { display: block; text-align: center; font-size: 19px; margin-bottom: 22px; }
.login-err { color: var(--err); font-size: 13.5px; min-height: 20px; margin: 10px 0 0; }

/* ── адмінка ── */
.admin-nav { display: flex; gap: 6px; padding: 12px 20px 0; flex-wrap: wrap; }
.admin-nav button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 8px 16px;
}
.admin-nav button.active { color: var(--accent); border-color: rgba(227,162,63,.5); background: var(--accent-dim); }
.admin-page { padding: 18px 20px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
table.data td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.cell-prompt { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-card {
  flex: 1;
  min-width: 150px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.stat-card .v { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-card .l { font-size: 13px; color: var(--muted); }

.chart-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chart-box svg { width: 100%; height: 160px; display: block; }

.toast-zone { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  padding: 11px 15px;
  font-size: 13.5px;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.toast.err { border-left-color: var(--err); color: var(--err); }
