:root {
  --bg: #0a0b0f;
  --bg-elevated: #101218;
  --panel: #14161d;
  --panel-hover: #181b23;
  --border: #23262f;
  --border-soft: #1b1d25;
  --text: #eef0f4;
  --muted: #7c8394;
  --muted-soft: #565c6b;
  --accent: #6d5ef8;
  --accent-2: #9b7bff;
  --accent-soft: rgba(109, 94, 248, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-pop: 0 12px 40px -8px rgba(109, 94, 248, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(109,94,248,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(155,123,255,.06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ===== Layout: sidebar + content ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  border-right: 1px solid var(--border-soft);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 26px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
}
.brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: var(--shadow-pop);
  flex-shrink: 0;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-link .ic { font-size: 15px; width: 18px; text-align: center; opacity: .85; }
.nav-link:hover { background: var(--panel-hover); color: var(--text); }
.nav-link.active {
  background: var(--accent-soft);
  color: #cfc8ff;
}
.nav-link.active .ic { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 34px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-head {
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 4px;
}
.page-head p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

/* ===== Cards ===== */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: .6;
}
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 11.5px; margin-top: 5px; font-weight: 500; }

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin: 16px 0 7px;
  font-weight: 600;
  letter-spacing: .01em;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input[type=file] { color: var(--muted); font-size: 13px; margin-top: 4px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .1s ease, box-shadow .15s ease, filter .12s ease;
}
button:hover, .btn:hover { filter: brightness(1.08); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
.btn-danger { background: linear-gradient(135deg, #f87171, #ef4444); }
.btn-danger:hover { box-shadow: 0 12px 30px -10px rgba(248,113,113,.5); }
.btn-secondary { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--panel-hover); box-shadow: none; filter: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; margin-top: 0; }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
  border: 1px solid transparent;
  font-weight: 500;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(52,211,153,.25); }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(248,113,113,.25); }

.step-card { border-left: 2px solid var(--accent); }
.step-header { display: flex; justify-content: space-between; align-items: center; }
.step-header h2 { margin-bottom: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border-soft);
}
.pill.active { background: var(--ok-soft); color: var(--ok); border-color: rgba(52,211,153,.25); }
.pill.paused { background: var(--warn-soft); color: var(--warn); border-color: rgba(251,191,36,.25); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-elevated); }

.status-in_progress { color: var(--accent-2); font-weight: 600; }
.status-replied { color: var(--ok); font-weight: 600; }
.status-done { color: var(--muted); }
.status-failed { color: var(--danger); font-weight: 600; }
.status-blocked_suspected { color: var(--warn); font-weight: 600; }

.content.login-wrap {
  min-height: 100vh;
  width: 100%;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 380px;
  padding: 34px 32px;
}
.login-box .brand { justify-content: center; padding-bottom: 22px; }
.login-box h1 { text-align: center; font-size: 18px; margin: 0 0 22px; font-weight: 700; }

.hint { color: var(--muted-soft); font-size: 12px; margin-top: 7px; line-height: 1.5; }

form.inline { display: inline; }

/* ===== Media grid (steps) ===== */
.media-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 8px;
  background: var(--bg-elevated);
  transition: border-color .12s ease, background .12s ease;
  cursor: text;
}
.media-dropzone:hover, .media-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.media-dropzone .dz-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 10px;
}
.media-dropzone .dz-hint {
  font-size: 11.5px;
  color: var(--muted-soft);
  margin-top: 10px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.media-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.media-thumb img, .media-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-thumb .rm-btn {
  position: absolute;
  top: 5px; right: 5px;
  margin: 0;
  padding: 0;
  width: 19px;
  height: 19px;
  min-width: 19px;
  border-radius: 50%;
  background: rgba(10,11,15,.72);
  backdrop-filter: blur(2px);
  color: #fff;
  border: none;
  box-shadow: none;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background .12s ease, transform .12s ease;
}
.media-thumb .rm-btn:hover {
  background: var(--danger);
  box-shadow: none;
  transform: scale(1.08);
  filter: none;
}
.media-thumb .badge-new {
  position: absolute; bottom: 4px; left: 4px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  background: var(--accent); color: white;
  padding: 2px 5px; border-radius: 4px;
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; padding: 12px; }
  .brand { padding: 0 10px; }
  .nav-group { flex-direction: row; }
  .sidebar-footer { display: none; }
  .content { padding: 22px 18px 60px; max-width: 100%; }
}
