/* ============================================================
   Brascast Platform — Base & Layout
   Reset, tipografia, helpers, layout principal.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* Layout principal */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--text-soft); font-size: 11px; }
.breadcrumb .current { color: var(--brand); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 15px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-600); }
.btn--ghost { color: var(--text-muted); border-color: var(--border); background: var(--surface); }
.btn--ghost:hover { color: var(--brand); border-color: var(--brand-300); background: var(--brand-100); }
.btn--icon {
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); transition: all .15s;
  position: relative;
}
.btn--icon:hover { color: var(--brand); border-color: var(--brand-300); background: var(--brand-100); }
.btn--icon .badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 99px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

/* Cards / Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card__title { font-size: 15px; font-weight: 700; }
.card__body { padding: 18px 20px; }
.card__foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Tables */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl thead th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
}
.tbl tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--brand-50); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .right { text-align: right; }

/* Pills / Badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  letter-spacing: .02em;
}
.pill--brand { background: var(--brand); color: #fff; }
.pill--soft  { background: var(--brand-100); color: var(--brand-600); }
.pill--dark  { background: var(--text); color: var(--surface); }
.pill--muted { background: var(--surface-3); color: var(--text-muted); }

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.stat__body {
  padding: 18px 18px 16px;
  display: flex; align-items: center; gap: 16px;
}
.stat__icon {
  width: 54px; height: 54px;
  border-radius: var(--radius-md);
  background: var(--brand-100);
  color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat--alt .stat__icon { order: 2; margin-left: auto; }
.stat__num { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; color: var(--text); }
.stat__label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
  font-size: 13px; font-weight: 600;
  color: var(--brand);
  transition: background .15s;
  cursor: pointer;
}
.stat__foot:hover { background: var(--brand-100); }
.stat__foot i { font-size: 11px; }

/* Helpers */
.row { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-link  { color: var(--brand); font-weight: 600; }
.text-link:hover { color: var(--brand-600); text-decoration: underline; }


/* Responsive */
@media (max-width: 1080px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .app-main { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Row actions, shared by every listing page */
.pact {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14.5px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.pact--edit { color: #1f5fa9; background: #eaf1fb; border-color: #cfe0f5; }
.pact--edit:hover { color: #164a86; background: #dde9f8; border-color: #b6d2f0; }

.pact--perm { color: #6a4899; background: #f2edfa; border-color: #ddd0f0; }
.pact--perm:hover { color: #533779; background: #e9e0f6; border-color: #cbb8e8; }

.pact--del { color: #b8322a; background: #fdeceb; border-color: #f6cdc9; }
.pact--del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

.pact.is-confirm { color: #fff; background: var(--danger); border-color: var(--danger); }
.pact:disabled { opacity: .5; cursor: not-allowed; }
