@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Plus+Jakarta+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── DESIGN TOKENS ───────────────────────────────────── */
:root {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --surface3:  #f1f5f9;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;
  --text:      #0f172a;
  --text2:     #334155;
  --muted:     #64748b;
  --muted2:    #94a3b8;
  --blue:      #2563eb;
  --blue-h:    #1d4ed8;
  --blue-dim:  #eff6ff;
  --blue-mid:  #bfdbfe;
  --green:     #16a34a;
  --green-dim: #f0fdf4;
  --green-mid: #bbf7d0;
  --red:       #dc2626;
  --red-dim:   #fef2f2;
  --red-mid:   #fecaca;
  --amber:     #d97706;
  --amber-dim: #fffbeb;
  --amber-mid: #fde68a;
  --sidebar-w: 220px;
  --display:   'Bricolage Grotesque', sans-serif;
  --sans:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', monospace;
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 6px -1px rgba(15,23,42,0.07), 0 2px 4px -2px rgba(15,23,42,0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ─── SHELL ───────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-mark {
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.01em;
  display: block;
}

.sidebar-logo-sub {
  font-size: 0.68rem;
  color: var(--muted2);
  margin-top: 1px;
  display: block;
  line-height: 1.4;
}

.sidebar-nav {
  padding: 10px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted2);
  padding: 8px 8px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--surface3); color: var(--text2); }

.nav-item.is-active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.63rem;
  background: var(--surface3);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--blue-dim);
  border: 1px solid var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
  font-family: var(--display);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-email {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.63rem;
  color: var(--muted2);
  text-transform: capitalize;
}

/* ─── MAIN ────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── TOPBAR ──────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: var(--shadow-xs);
}

.topbar-title {
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px #dcfce7;
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 2px #dcfce7; }
  50%      { box-shadow: 0 0 0 3px #bbf7d0; }
}

/* ─── PAGE ────────────────────────────────────────────── */
.page { padding: 24px; flex: 1; }

.page-header { margin-bottom: 22px; }

.page-title {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-desc {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── STAT CARDS ──────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover { box-shadow: var(--shadow-sm); border-color: var(--border2); }

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-value {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}

.card-value.accent  { color: var(--blue); }
.card-value.success { color: var(--green); }
.card-value.danger  { color: var(--red); }

.card h2 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.card strong {
  display: block;
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ─── PANEL ───────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-xs);
  margin-top: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.panel-step {
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--blue-mid);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.panel h2 {
  font-family: var(--display);
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--text);
}

.panel > p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 5px;
  margin-bottom: 16px;
  line-height: 1.6;
  max-width: 580px;
}

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.12s, box-shadow 0.12s, transform 0.1s, border-color 0.12s;
  white-space: nowrap;
  padding: 7px 15px;
  line-height: 1;
}

/* Primary */
button[type="submit"], .btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 1px 2px rgba(37,99,235,0.18);
}

button[type="submit"]:hover, .btn-primary:hover {
  background: var(--blue-h);
  border-color: var(--blue-h);
  box-shadow: 0 3px 10px rgba(37,99,235,0.28);
  transform: translateY(-1px);
}

button[type="submit"]:active, .btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Secondary */
button:not([type="submit"]), .btn-secondary {
  background: var(--surface);
  color: var(--text2);
  border-color: var(--border2);
  box-shadow: var(--shadow-xs);
}

button:not([type="submit"]):hover, .btn-secondary:hover {
  background: var(--surface3);
  border-color: var(--muted2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:not([type="submit"]):active, .btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-ghost {
  background: transparent !important;
  color: var(--muted) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

.btn-ghost:hover {
  background: var(--surface3) !important;
  color: var(--text2) !important;
  border-color: var(--border2) !important;
  transform: none !important;
}

.btn-sm { padding: 5px 11px !important; font-size: 0.74rem !important; border-radius: 5px !important; }

/* ─── FORM INPUTS ─────────────────────────────────────── */
label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 5px;
}

input[type="text"],
input:not([type]),
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.83rem;
  margin-bottom: 10px;
  transition: border-color 0.14s, box-shadow 0.14s;
  outline: none;
  box-shadow: var(--shadow-xs);
}

input[type="text"]:focus,
input:not([type]):focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

input::placeholder { color: var(--muted2); }
textarea::placeholder { color: var(--muted2); }

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.ads-form textarea,
.ads-form input,
.ads-form select {
  margin-bottom: 12px;
}

.cards-compact {
  margin-bottom: 12px;
}

.fb-profile-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  margin-bottom: 10px;
}

.fb-profile-card > summary {
  list-style: none;
  cursor: pointer;
}

.fb-profile-card > summary::-webkit-details-marker {
  display: none;
}

.icon-btn {
  width: 32px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
}

.checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
  margin-bottom: 0;
}

/* ─── DROPZONE ────────────────────────────────────────── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--border2);
  background: var(--surface2);
  border-radius: 8px;
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  margin-bottom: 10px;
}

.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.dropzone input[type="file"] { display: none; }

.dropzone span { font-size: 0.8rem; color: var(--muted); }
.dropzone.is-dragover span { color: var(--blue); }

.dropzone-icon { font-size: 1.3rem; color: var(--muted2); }
.dropzone.is-dragover .dropzone-icon { color: var(--blue); }

/* ─── FILE LIST ───────────────────────────────────────── */
.file-list {
  max-height: 110px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  line-height: 1.9;
}

/* ─── CONFIRM FORM ────────────────────────────────────── */
.confirm-form {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ─── ALERTS ──────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 7px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.81rem;
  line-height: 1.5;
}

.alert.warn { background: var(--amber-dim); border: 1px solid var(--amber-mid); color: #92400e; }
.alert.ok   { background: var(--green-dim); border: 1px solid var(--green-mid); color: #14532d; }
.alert.bad  { background: var(--red-dim);   border: 1px solid var(--red-mid);   color: #991b1b; }

.alert strong { font-weight: 600; display: block; margin-bottom: 3px; }
.alert ul { margin: 4px 0 0 14px; }
.alert li { margin-top: 2px; }

/* ─── TABLES ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }

thead { background: var(--surface2); }

th {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }

td:first-child, th:first-child { padding-left: 16px; }
td:last-child,  th:last-child  { padding-right: 16px; }

.mono-cell { font-family: var(--mono); font-size: 0.77rem; color: var(--text); }

.ua {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 0.72rem;
}

/* ─── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge::before { content: ''; width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; }

.badge.ok      { background: var(--green-dim); color: #15803d; border: 1px solid var(--green-mid); }
.badge.ok::before { background: var(--green); }

.badge.bad     { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red-mid); }
.badge.bad::before { background: var(--red); }

.badge.pending { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-mid); }
.badge.pending::before { background: var(--amber); }

/* ─── AUTH ────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }

.auth-box {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}

.auth-box h1 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.auth-box p { font-size: 0.81rem; color: var(--muted); margin-bottom: 20px; }

/* ─── GRID / INLINE FORMS ─────────────────────────────── */
.grid-form {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.inline-form { display: inline-flex; gap: 5px; align-items: center; }

/* ─── COMING SOON ─────────────────────────────────────── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 24px;
  text-align: center;
  gap: 8px;
}

.coming-soon-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--surface3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--muted2);
}

.coming-soon h2 { font-family: var(--display); font-size: 0.93rem; font-weight: 700; color: var(--text2); }
.coming-soon p  { font-size: 0.78rem; color: var(--muted); margin-top: 0 !important; }

/* ─── LEGACY CONTAINER (auth pages, admin) ────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 56px; }
.hero h1 { font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: var(--text); }
.hero p  { font-size: 0.82rem; color: var(--muted); margin: 4px 0 16px; }

/* ─── ANIMATIONS ──────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header { animation: fade-up 0.28s ease both; }
.cards       { animation: fade-up 0.28s ease 0.04s both; }
.panel       { animation: fade-up 0.28s ease 0.08s both; }
.panel:nth-of-type(2) { animation-delay: 0.12s; }
.panel:nth-of-type(3) { animation-delay: 0.16s; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .topbar { padding: 0 14px; }
  .confirm-form { flex-direction: column; align-items: flex-start; }
  .grid-form { grid-template-columns: 1fr; }
}
