@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500&family=DM+Serif+Display&display=swap');

:root {
  --bg:       #F7F6F3;
  --surface:  #FFFFFF;
  --border:   #E4E2DC;
  --border2:  #CBC8BF;
  --text:     #1A1917;
  --muted:    #6B6860;
  --hint:     #A5A39C;
  --teal:     #0F6E56;
  --teal-bg:  #E1F5EE;
  --teal-mid: #1D9E75;
  --blue:     #185FA5;
  --blue-bg:  #E6F1FB;
  --amber:    #854F0B;
  --amber-bg: #FAEEDA;
  --purple:   #3C3489;
  --purple-bg:#EEEDFE;
  --red:      #A32D2D;
  --red-bg:   #FCEBEB;
  --radius:   10px;
  --radius-lg:14px;
  --font:     'DM Sans', sans-serif;
  --font-d:   'DM Serif Display', serif;
  --shadow:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}
.sidebar-logo {
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: var(--text);
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-logo span { color: var(--teal); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 1.25rem;
  font-size: .875rem;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { color: var(--teal); background: var(--teal-bg); font-weight: 500; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-bottom {
  margin-top: auto;
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--border);
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--muted);
  padding: .5rem 0;
  cursor: pointer;
}
.user-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal-mid); flex-shrink: 0;
}
.user-badge .dot.admin { background: var(--purple); }
.user-badge strong { color: var(--text); font-weight: 500; }

.main { flex: 1; overflow-x: hidden; }
.page-header {
  padding: 1.5rem 2rem 0;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-family: var(--font-d);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text);
}
.page-header p { font-size: .825rem; color: var(--muted); margin-top: 2px; }
.content { padding: 0 2rem 2rem; }

/* ── Stats ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
}
.stat-card .lbl { font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.stat-card .val { font-size: 1.5rem; font-weight: 500; color: var(--text); font-family: var(--font-d); }

/* ── Cards / Lists ── */
.pub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.pub-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.pub-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pub-title { font-size: .95rem; font-weight: 500; color: var(--text); }
.pub-meta { font-size: .775rem; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pub-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }
.group-qtd-grid { display: flex; gap: 20px; flex-wrap: wrap; }
.gq-item .gq-label { font-size: .7rem; color: var(--muted); }
.gq-item .gq-val { font-size: 1rem; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.edit-note { font-size: .7rem; color: var(--purple); margin-top: 2px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: .7rem; padding: 2px 8px;
  border-radius: 20px; font-weight: 500; white-space: nowrap;
}
.b-gray   { background: #F1EFE8; color: #5F5E5A; }
.b-blue   { background: var(--blue-bg);   color: var(--blue);   }
.b-teal   { background: var(--teal-bg);   color: var(--teal);   }
.b-amber  { background: var(--amber-bg);  color: var(--amber);  }
.b-purple { background: var(--purple-bg); color: var(--purple); }
.b-red    { background: var(--red-bg);    color: var(--red);    }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: var(--radius);
  font-size: .8rem; font-family: var(--font);
  cursor: pointer; border: 1px solid var(--border2);
  background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; }
.btn.pri { background: var(--text); color: var(--surface); border-color: transparent; }
.btn.pri:hover { opacity: .85; }
.btn.sm { padding: 4px 9px; font-size: .75rem; }
.btn.success { border-color: var(--teal); color: var(--teal); }
.btn.success:hover { background: var(--teal-bg); }
.btn.danger  { border-color: var(--red);  color: var(--red);  }
.btn.danger:hover  { background: var(--red-bg); }

/* ── Table (distribuição) ── */
.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl th { font-size: .7rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 8px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }

/* ── Entrega check ── */
.check-circle {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .8rem; background: var(--surface);
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.check-circle:hover { border-color: var(--teal-mid); background: var(--teal-bg); }
.check-circle.done { background: var(--teal-mid); border-color: var(--teal-mid); color: #fff; }

/* ── Progress bar ── */
.prog-wrap { height: 3px; background: var(--border); border-radius: 2px; margin: 8px 0 12px; }
.prog-fill  { height: 3px; background: var(--teal-mid); border-radius: 2px; transition: width .3s; }

/* ── Modal ── */
.modal-overlay {
  background: rgba(26,25,23,.4);
  border-radius: var(--radius-lg);
  padding: 2rem 1rem;
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 300px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%; max-width: 520px;
}
.modal h3 { font-family: var(--font-d); font-size: 1.1rem; font-weight: 400; margin-bottom: 1.25rem; color: var(--text); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: .875rem; font-family: var(--font);
  color: var(--text); background: var(--surface);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(29,158,117,.12);
}
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ── Scrape result list ── */
.scrape-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.scrape-item:last-child { border-bottom: none; }
.scrape-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--teal-mid); }
.scrape-thumb { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--bg); flex-shrink: 0; }
.scrape-info { flex: 1; min-width: 0; }
.scrape-info .st { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrape-info .sm { font-size: .75rem; color: var(--muted); }

/* ── Misc ── */
.empty { text-align: center; padding: 2.5rem; color: var(--muted); font-size: .875rem; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.section-label { font-size: .7rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.alert { font-size: .8rem; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; }
.alert.err  { background: var(--red-bg);   color: var(--red);   }
.alert.ok   { background: var(--teal-bg);  color: var(--teal);  }
.alert.info { background: var(--blue-bg);  color: var(--blue);  }

input[type=number], input[type=date] {
  padding: 5px 8px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: .8rem; font-family: var(--font);
  color: var(--text); background: var(--surface);
}
input[type=number]:focus, input[type=date]:focus {
  outline: none; border-color: var(--teal-mid);
}

.lock-tag { font-size: .7rem; padding: 1px 7px; border-radius: 20px; background: var(--purple-bg); color: var(--purple); margin-left: 6px; }

@media (max-width: 700px) {
  .sidebar { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content { padding: 0 1rem 2rem; }
  .page-header { padding: 1rem 1rem 0; }
}
.user-badge .dot.super { background: #7F77DD; }
#nav-superusers { display: none; }