/* shared-shell.css — TRATO palette, used by all internal screens via iframe
 * Mantém compat com classes Bootstrap/Sneat (bg-label-*, btn-primary, etc.)
 * mas substitui o roxo #696cff pela paleta terracota+tinta do shell.
 */
:root {
  /* Trato tokens (espelho do index.html) */
  --ink: #18181B;
  --ink-2: #27272A;
  --paper: #FAFAF7;
  --paper-2: #F4F2EC;
  --line: #E7E3D8;
  --line-soft: #EEEAE0;
  --muted: #6B675C;
  --muted-2: #8E8A7F;
  --clay: #C2553B;
  --clay-ink: #8C3A24;
  --clay-soft: #F5E3DC;
  --moss: #4F6B4A;
  --moss-soft: #E2EAD9;
  --gold: #B8893E;
  --gold-soft: #F3E5C2;
  --danger: #B0413E;
  --danger-soft: #F4D9D7;
  --info-soft: #DCE6EF;
  --info: #355C7D;

  /* Bootstrap overrides — só os escopos que importam */
  --bs-primary: var(--clay);
  --bs-primary-rgb: 194, 85, 59;
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--paper-2);
  --bs-tertiary-bg: var(--paper-2);
  --bs-body-bg: #ffffff;
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);

  --sneat-bg: var(--paper);
}

/* Base reset */
html, body {
  height: 100%; margin: 0; padding: 0;
  background: var(--paper);
  font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px; color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold { color: var(--ink); letter-spacing: -0.005em; }
h4 { font-weight: 700; font-size: 1.35rem; }
h5 { font-weight: 600; font-size: 1.1rem; }
h6 { font-weight: 600; font-size: 0.95rem; }
.text-muted { color: var(--muted) !important; }
.text-secondary { color: var(--muted) !important; }
small, .small { color: var(--muted); }

/* ============ BUTTONS ============ */
.btn-primary {
  background: var(--ink); border-color: var(--ink); color: #fff;
  font-weight: 500;
}
.btn-primary:hover, .btn-primary:focus { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn-outline-primary {
  color: var(--clay-ink); border-color: var(--clay); background: transparent;
}
.btn-outline-primary:hover { background: var(--clay-soft); border-color: var(--clay); color: var(--clay-ink); }

.btn-secondary { background: var(--paper-2); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: #ECE8DD; border-color: var(--line); color: var(--ink); }
.btn-outline-secondary {
  color: var(--ink-2); border-color: var(--line); background: transparent;
}
.btn-outline-secondary:hover { background: var(--paper-2); border-color: var(--line); color: var(--ink); }

.btn-success { background: var(--moss); border-color: var(--moss); }
.btn-outline-success { color: var(--moss); border-color: var(--moss); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--gold); border-color: var(--gold); color: #fff; }

.btn-text-secondary { color: var(--muted); background: transparent; border: 0; }
.btn-text-secondary:hover { background: var(--paper-2); color: var(--ink); }

.btn { font-weight: 500; }
.btn-xs { padding: .2rem .5rem; font-size: .72rem; line-height: 1.2; border-radius: .35rem; font-weight: 600; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

/* ============ TEXT/BG SEMANTIC ============ */
.text-primary { color: var(--clay-ink) !important; }
.bg-primary { background: var(--ink) !important; color: #fff !important; }
.bg-light { background: var(--paper-2) !important; }

.bg-label-primary   { background: var(--clay-soft) !important; color: var(--clay-ink) !important; }
.bg-label-secondary { background: var(--paper-2) !important; color: var(--muted) !important; }
.bg-label-success   { background: var(--moss-soft) !important; color: var(--moss) !important; }
.bg-label-info      { background: var(--info-soft) !important; color: var(--info) !important; }
.bg-label-warning   { background: var(--gold-soft) !important; color: #7A5A1F !important; }
.bg-label-danger    { background: var(--danger-soft) !important; color: var(--danger) !important; }

.text-success { color: var(--moss) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--gold) !important; }
.text-info    { color: var(--info) !important; }

/* ============ FORM ============ */
.form-control, .form-select {
  font-size: .88rem;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 .15rem rgba(24, 24, 27, .08);
}
.form-control::placeholder { color: var(--muted-2); }
.form-label { color: var(--ink-2); font-weight: 500; font-size: .82rem; margin-bottom: .35rem; }

.form-check-input { border-color: var(--muted-2); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { box-shadow: 0 0 0 .15rem rgba(24, 24, 27, .08); }

kbd {
  background: var(--ink); color: #fff; padding: 1px 5px;
  border-radius: 3px; font-size: .7rem; font-family: inherit;
}

/* ============ BADGES ============ */
.badge { font-weight: 600; font-size: .68rem; letter-spacing: .02em; padding: .28rem .55rem; border-radius: .35rem; }
.badge.rounded-pill { padding: .22rem .6rem; font-size: .65rem; }

/* ============ CARDS ============ */
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line-soft);
  padding: .8rem 1rem;
}
.card-body { padding: 1rem; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--line-soft);
}

/* ============ TABLES ============ */
.table { color: var(--ink); border-color: var(--line-soft); margin-bottom: 0; }
.table thead {
  font-size: 11.5px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--paper-2);
}
.table thead th { font-weight: 600; border-bottom: 1px solid var(--line); padding: .65rem .75rem; }
.table tbody tr { border-color: var(--line-soft); }
.table > :not(caption) > * > * { padding: .7rem .75rem; border-bottom-color: var(--line-soft); }
.table-hover tbody tr:hover { background: var(--paper-2); }

/* ============ NAV TABS ============ */
.nav-tabs { border-bottom: 1px solid var(--line); }
.nav-tabs .nav-link {
  color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  padding: .55rem 1rem; font-weight: 500; background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav-tabs .nav-link.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; background: transparent; }

/* ============ DROPDOWN ============ */
.dropdown-menu {
  font-size: 13px;
  box-shadow: 0 12px 28px -8px rgba(24,24,27,.18);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.dropdown-item { padding: .4rem .7rem; border-radius: 5px; color: var(--ink-2); }
.dropdown-item:hover { background: var(--paper-2); color: var(--ink); }
.dropdown-header { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.dropdown-divider { border-color: var(--line-soft); margin: .3rem 0; }

/* ============ PROGRESS ============ */
.progress { height: 6px; background: var(--paper-2); border-radius: 4px; }
.progress-bar { background: var(--ink); }

/* ============ ALERTS ============ */
.alert { border-radius: 8px; padding: .6rem .9rem; border: 1px solid; }
.alert-info { background: var(--info-soft); border-color: var(--info-soft); color: var(--info); }
.alert-success { background: var(--moss-soft); border-color: var(--moss-soft); color: var(--moss); }
.alert-warning { background: var(--gold-soft); border-color: var(--gold-soft); color: #7A5A1F; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }

/* ============ LIST GROUP ============ */
.list-group-item { background: #fff; border-color: var(--line-soft); color: var(--ink-2); font-size: .9rem; }
.list-group-item.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.list-group-item-action:hover { background: var(--paper-2); color: var(--ink); }

/* ============ PAGINATION ============ */
.page-link { color: var(--ink-2); border-color: var(--line); font-size: .82rem; }
.page-link:hover { background: var(--paper-2); color: var(--ink); }
.page-item.active .page-link { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ============ INPUT GROUPS ============ */
.input-group-text { background: var(--paper-2); border-color: var(--line); color: var(--muted); }

/* ============ APP SHELL legacy (caso uma tela ainda tenha sidebar/navbar — fica coerente) ============ */
.app-root { display: flex; height: 100vh; }
.menu-vertical {
  width: 244px; background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.app-brand { padding: 18px 22px; display: flex; align-items: center; gap: 10px; }
.app-brand-logo {
  width: 28px; height: 28px; background: var(--ink); border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.app-brand-text { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); }
.menu-vertical .nav-link {
  color: var(--ink-2); font-size: 13.5px; padding: 9px 16px; margin: 1px 14px; border-radius: 6px;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.menu-vertical .nav-link:hover { background: var(--paper-2); }
.menu-vertical .nav-link.active {
  background: var(--ink); color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.menu-vertical .nav-link i { font-size: 18px; flex-shrink: 0; }
.menu-vertical .nav-link.pin-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-vertical .nav-link.pin-link .pin-remove {
  flex-shrink: 0; opacity: 0; border: none; background: transparent; color: inherit;
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; padding: 0; margin-left: auto;
}
.menu-vertical .nav-link.pin-link:hover .pin-remove { opacity: .6; }
.menu-vertical .nav-link.pin-link .pin-remove:hover { opacity: 1 !important; background: rgba(0,0,0,.08); }
.menu-vertical .nav-link.pin-link .pin-remove i { font-size: 14px; }
.menu-vertical .menu-header {
  padding: 12px 22px 6px; font-size: 11px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}

.layout-page { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.navbar-app {
  height: 56px; background: var(--paper); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0;
}
.navbar-app .search { flex: 1; max-width: 360px; }
.navbar-app .form-control { background: transparent; border: none; padding-left: 0; }
.input-group-merge .input-group-text { border-right: 0; background: transparent; }
.input-group-merge .form-control { border-left: 0; }
.badge-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; background: var(--clay); border-radius: 50%; border: 2px solid #fff; }

.content-wrapper { flex: 1; overflow-y: auto; padding: 24px; }
.container-xxl { max-width: 1440px; }

.avatar { width: 38px; height: 38px; min-width: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; background: var(--clay-soft); color: var(--clay-ink); border-radius: 50%; }
.avatar-sm { width: 28px; height: 28px; min-width: 28px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; min-width: 40px; }
.avatar-lg { width: 56px; height: 56px; min-width: 56px; font-size: 18px; }

.demo-bar { display: none !important; }

/* ============ KPI PRIMITIVE (usado pelas telas novas) ============ */
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px;
}
.kpi small {
  display: block; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--ink); letter-spacing: -0.01em; }

/* ============ COMMON PRIMITIVES ============ */
code {
  background: var(--paper-2); color: var(--clay-ink); padding: 1px 5px;
  border-radius: 4px; font-size: .85em;
}
.border, .border-bottom, .border-top, .border-start, .border-end { border-color: var(--line) !important; }
.border-primary { border-color: var(--ink) !important; }
.text-body { color: var(--ink) !important; }
hr { border-color: var(--line); opacity: 1; }

/* Hub home button — visible only in standalone mode (shell hides it via CSS injection) */
.hub-home-btn {
  position: fixed; top: 12px; right: 12px; z-index: 2100;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 5px 12px 5px 8px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(24,24,27,.06);
  display: inline-flex; align-items: center; gap: 6px;
}
.hub-home-btn:hover { color: var(--clay-ink); border-color: var(--clay); }

/* ============ TWEAKS — variações injetadas pelo shell via data-attrs no body ============ */
body[data-paper="neutral"] { --paper: #FAFAFA; --paper-2: #F4F4F4; --line: #E5E5E5; --line-soft: #ECECEC; }
body[data-paper="cool"]    { --paper: #F7F8FA; --paper-2: #EDF0F4; --line: #DDE2E8; --line-soft: #E6EAEF; }
body[data-paper="warm"]    { --paper: #FAFAF7; --paper-2: #F4F2EC; --line: #E7E3D8; --line-soft: #EEEAE0; }

/* Heading font — quando algo for explicitamente serifado nas telas, troca aqui */
body[data-headings="sans"] h1,
body[data-headings="sans"] h2,
body[data-headings="sans"] h3,
body[data-headings="sans"] h4,
body[data-headings="sans"] h5,
body[data-headings="sans"] h6 { font-family: 'Public Sans', system-ui, sans-serif !important; letter-spacing: -0.02em; }
body[data-headings="grotesque"] h1,
body[data-headings="grotesque"] h2,
body[data-headings="grotesque"] h3,
body[data-headings="grotesque"] h4,
body[data-headings="grotesque"] h5,
body[data-headings="grotesque"] h6,
body[data-headings="grotesque"] .fw-bold { font-family: 'Inter', system-ui, sans-serif !important; letter-spacing: -0.025em; font-weight: 700; }
body[data-headings="serif"] h1,
body[data-headings="serif"] h2,
body[data-headings="serif"] h3,
body[data-headings="serif"] h4,
body[data-headings="serif"] h5 { font-family: 'Fraunces', Georgia, serif !important; letter-spacing: -0.005em; font-weight: 600; }

/* Density — compact toma menos espaço, principalmente em listas */
body[data-density="compact"] .card-body { padding: .75rem; }
body[data-density="compact"] .card-header { padding: .55rem .75rem; }
body[data-density="compact"] .table > :not(caption) > * > * { padding: .45rem .6rem; }
body[data-density="compact"] .kpi { padding: 10px 12px; }
body[data-density="compact"] .kpi .v { font-size: 19px; }
body[data-density="compact"] .form-control,
body[data-density="compact"] .form-select { font-size: .82rem; padding: .3rem .55rem; }
body[data-density="compact"] .btn-sm { padding: .25rem .55rem; }
body[data-density="compact"] .content-wrapper { padding: 16px; }
body[data-density="compact"] h4 { font-size: 1.2rem; }
body[data-density="compact"] h5 { font-size: 1rem; }
body[data-density="compact"] h6 { font-size: .9rem; }
