/* ── Базові стилі: компактний, чистий, як у дошки оголошень AliBord ── */
* { box-sizing: border-box; }
:root {
  --bg: #f5f7fa;
  --white: #fff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #2858FF;
  --accent-dark: #1e47cc;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --blue: #3b82f6;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.4; }
a { color: inherit; text-decoration: none; }

/* ── Синя шапка (як на AliBord header) ── */
.appbar {
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.appbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.appbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.appbar__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  flex-shrink: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}
.appbar__back:hover { transform: translateX(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.18); }
.appbar__logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.appbar__logo-icon { font-size: 20px; }
.appbar__nav { display: flex; gap: 6px; }
.appbar__link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  color: rgba(255,255,255,0.85);
  border-radius: 999px;
  font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.appbar__link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.appbar__link.is-active { background: rgba(255,255,255,0.2); color: #fff; }
@media (max-width: 500px) {
  .appbar__logo-text { display: none; }
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

/* ── Stats dashboard ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--white); padding: 14px 16px; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.stat__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat__value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat--green .stat__value  { color: var(--green); }
.stat--yellow .stat__value { color: var(--yellow); }
.stat--blue .stat__value   { color: var(--blue); }
.stat--gray .stat__value   { color: var(--text); }

/* ── Grid сайтів ── */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 767px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.tile {
  background: var(--white);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  min-height: 140px;
  color: inherit;
}
.tile:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.1); transform: translateY(-1px); }
.tile__head { display: flex; gap: 10px; align-items: center; }
.tile__logo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.tile__logo--placeholder { background: linear-gradient(135deg, var(--accent), var(--purple)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.tile__head-info { min-width: 0; }
.tile__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__domain { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__stats { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.tile__stat-label { color: var(--text-muted); }
.tile__stat b { color: var(--text); }
.tile__stat--warn b { color: var(--yellow); }

.tile--add {
  border: 2px dashed var(--border);
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.tile--add:hover { background: rgba(40,88,255,0.05); border-color: var(--accent); color: var(--accent); }
.tile--add__icon { font-size: 36px; font-weight: 300; line-height: 1; }
.tile--add__label { font-size: 13px; }

/* ── Site head ── */
.site-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.site-head__back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--white); color: var(--accent); font-size: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.site-head__back:hover { background: var(--accent); color: #fff; }
.site-head__logo { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.site-head__logo--ph { background: linear-gradient(135deg, var(--accent), var(--purple)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; }
.site-head__title { flex: 1; min-width: 0; }
.site-head__title h1 { margin: 0; font-size: 22px; }
.site-head__domain { font-size: 13px; color: var(--text-muted); font-family: monospace; }
.site-head__actions { display: flex; gap: 6px; }

.site-summary { display: flex; flex-wrap: wrap; gap: 16px 22px; background: var(--white); padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); font-size: 14px; align-items: center; }
.site-summary .label { color: var(--text-muted); margin-right: 4px; }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }

/* ── Filterbar ── */
.filterbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; align-items: center; }
.filter-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--white); color: var(--text-muted); font-size: 13px; border: 1px solid var(--border); }
.filter-chip:hover { background: var(--bg); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-chip--green.active   { background: var(--green); border-color: var(--green); }
.filter-chip--yellow.active  { background: var(--yellow); border-color: var(--yellow); }
.filter-chip--blue.active    { background: var(--blue); border-color: var(--blue); }
.filter-chip--purple.active  { background: var(--purple); border-color: var(--purple); }
.filter-chip--gray.active    { background: var(--text-muted); border-color: var(--text-muted); }
.btn--right { margin-left: auto; }

/* ── Task cards (як AliBord listing — фото зверху, body знизу) ── */
.task-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .task-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .task-grid { grid-template-columns: 1fr; gap: 10px; } }

.tcard {
  position: relative;
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.tcard:hover { box-shadow: 0 8px 22px rgba(0,0,0,0.12); }
.tcard__handle {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(2px);
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; cursor: grab; user-select: none;
}
.tcard__handle:active { cursor: grabbing; }

.tcard__media {
  position: relative;
  aspect-ratio: 4/3;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
  overflow: hidden;
}
.tcard__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard__media-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
  background: var(--bg);
}
.tcard__media-count {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7); color: #fff;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.tcard__badge {
  position: absolute; top: 8px; right: 8px;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.tcard__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tcard__title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.tcard__price {
  font-size: 18px; font-weight: 700; color: var(--green);
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
}
.tcard__price span { font-size: 14px; font-weight: 500; margin-left: 2px; }
.tcard__price-uah { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 0; }
.tcard__meta { display: flex; flex-wrap: wrap; gap: 4px; }
.tcard__footer { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); margin-top: auto; padding-top: 4px; }
.tcard__date, .tcard__tg { display: inline-flex; align-items: center; gap: 4px; }
.tcard__date svg, .tcard__tg svg { flex-shrink: 0; }
.tcard__tg { color: var(--accent); font-weight: 500; }
.tcard__actions { display: flex; gap: 4px; margin-top: 6px; }
.tcard__desc { margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.tcard__desc-text { white-space: pre-wrap; line-height: 1.5; }
.tcard__shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.tcard__shot img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; display: block; }

/* ── Badges ── */
.badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1.6; }
.badge--gray    { background: #f1f5f9; color: var(--text-muted); }
.badge--blue    { background: #dbeafe; color: #1e40af; }
.badge--yellow  { background: #fef3c7; color: #92400e; }
.badge--purple  { background: #ede9fe; color: #5b21b6; }
.badge--green   { background: #d1fae5; color: #065f46; }
.badge--neutral { background: #f5f3ff; color: #4c1d95; }
.badge--tag     { background: #f5f5f5; color: #525252; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--border); background: var(--white); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit; transition: all 0.12s; }
.btn:hover { background: var(--bg); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--bg); color: var(--text); }
.btn--danger { background: transparent; color: var(--red); border-color: rgba(239,68,68,0.3); }
.btn--danger:hover { background: rgba(239,68,68,0.1); }
.btn--xs { padding: 4px 8px; font-size: 12px; }

.empty { padding: 30px; text-align: center; color: var(--text-muted); grid-column: 1 / -1; }

/* ── Modal ── */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; }
.modal.active { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(2px); }
.modal__dialog { position: relative; background: var(--white); border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal__dialog--lg { max-width: 680px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--white); z-index: 2; }
.modal__head h3 { margin: 0; font-size: 17px; }
.modal__close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 0 8px; line-height: 1; }
.modal__body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal__body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.modal__body input, .modal__body textarea, .modal__body select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 14px; color: var(--text); background: var(--white);
}
.modal__body textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.modal__actions .btn--danger { margin-right: auto; }

/* ── Photo uploader (як AliBord створення оголошення) ── */
.modal__body--listing { gap: 14px; }
.photo-uploader { display: flex; flex-direction: column; gap: 6px; }
.photo-uploader__label { font-size: 13px; color: var(--text-muted); }
.photo-uploader__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.photo-uploader__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.photo-uploader__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-uploader__remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: none; border-radius: 50%;
  font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-uploader__remove:hover { background: var(--red); }
.photo-uploader__add {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: var(--text-muted);
  transition: all 0.12s;
}
.photo-uploader__add:hover { border-color: var(--accent); color: var(--accent); background: rgba(40,88,255,0.04); }
.photo-uploader__add-icon { font-size: 28px; font-weight: 300; line-height: 1; }
.photo-uploader__add-text { font-size: 12px; }

/* Drag&drop visual */
.tcard.dragging { opacity: 0.5; }
.tcard.drag-over { outline: 2px solid var(--accent); }
