﻿/* == RESET ====================================================== */
:root {
  /* Accent fixo do sistema */
  --accent:        #4ADE80;
  --accent-dim:    rgba(74,222,128,.15);
  --accent-border: rgba(74,222,128,.35);
  --accent-dark:   #22C55E;

  --admin-accent: #A855F7;
  --admin-dim:    rgba(168,85,247,.15);

  --green:      #22C55E;
  --green-dim:  rgba(34,197,94,.14);
  --red:        #EF4444;
  --red-dim:    rgba(239,68,68,.14);
  --blue:       #3B82F6;
  --blue-dim:   rgba(59,130,246,.14);
  --yellow:     #F59E0B;
  --yellow-dim: rgba(245,158,11,.13);
  --purple:     #A855F7;

  --nicho-restaurante:     #F97316;
  --nicho-restaurante-dim: rgba(249,115,22,.13);
  --nicho-ativacao:        #3B82F6;
  --nicho-ativacao-dim:    rgba(59,130,246,.13);
  --nicho-degustacao:      #A855F7;
  --nicho-degustacao-dim:  rgba(168,85,247,.13);
  --nicho-feira:           #F59E0B;
  --nicho-feira-dim:       rgba(245,158,11,.13);

  --sidebar-w: 252px;
  --topbar-h:  62px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --transition: 0.28s cubic-bezier(0.4,0,0.2,1);

  --font-body:    'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;

  --bg:        #F1F4F8;
  --surface-0: #FAFBFD;
  --surface-1: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F7;
  --surface-4: #E4EAF2;
  --border:    rgba(0,0,0,.07);
  --border-2:  rgba(0,0,0,.12);
  --txt:       #0F1923;
  --txt-muted: #4A6078;
  --txt-dim:   #8CA0B3;
  --bg-input:  #FFFFFF;
  --bg-hover:  rgba(0,0,0,.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow:    0 10px 30px rgba(15,25,35,.12);

  --sb-bg:        #1C2026;
  --sb-border:    rgba(255,255,255,.06);
  --sb-txt:       rgba(255,255,255,.55);
  --sb-txt-dim:   rgba(255,255,255,.28);
  --sb-hover:     rgba(255,255,255,.06);
  --sb-hover-txt: rgba(255,255,255,.92);
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:14px; -webkit-font-smoothing:antialiased; scroll-behavior:smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--txt);
  padding-left: var(--sidebar-w);
  transition: background var(--transition), color var(--transition), padding-left var(--transition);
  overflow-x: clip;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

/* == SIDEBAR ==================================================== */
.sidebar {
  position: fixed; left:0; top:0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  z-index: 2000;
  display: flex; flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sidebar-logo-wrap { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.db-wordmark { display: flex; align-items: center; gap: 10px; }
.db-logo-img { height: 28px; width: auto; object-fit: contain; border-radius: 6px; display: block; }
.db-wordmark-sep { width: 1px; height: 20px; background: var(--sb-border); }
.db-wordmark-label { font-family: var(--font-display); font-size: 9px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; color: var(--sb-txt-dim); }
.sidebar-brand-fallback {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: #fff;
}
.sidebar-brand-name { font-family: var(--font-display); font-weight: 800; font-size: .95rem; color: rgba(255,255,255,.9); }
.btn-close-mobile { display: none; background: none; border: 1px solid var(--sb-border);
  border-radius: 8px; color: var(--sb-txt); padding: 6px 10px; font-size: .8rem; }

.sidebar-user-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sb-border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-dim); border: 1.5px solid var(--accent-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--accent); flex-shrink: 0;
}
.avatar.admin-av { background: var(--admin-dim); border-color: rgba(168,85,247,.4); color: var(--admin-accent); }
.user-info strong { font-size: .82rem; display: block; color: rgba(255,255,255,.9); }
.user-info small  { font-size: .7rem; color: var(--sb-txt); }
.role-badge {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius-full);
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px;
}
.role-admin      { background: var(--admin-dim); color: var(--admin-accent); }
.role-funcionario { background: var(--accent-dim); color: var(--accent); }

.menu-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.menu-nav::-webkit-scrollbar { width: 3px; }
.menu-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.nav-header-text {
  padding: 14px 16px 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .10em; text-transform: uppercase;
  color: var(--sb-txt-dim);
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px; border-radius: var(--radius);
  color: var(--sb-txt); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap; overflow: hidden; position: relative;
}
.menu-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.menu-item:hover { background: var(--sb-hover); color: var(--sb-hover-txt); }
.menu-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.menu-item.active svg { color: var(--accent); }
.menu-item.active-admin { background: var(--admin-dim); color: var(--admin-accent); font-weight: 600; }

.nav-badge {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: var(--red); color: #fff;
  font-size: .6rem; font-weight: 800; border-radius: 20px;
  padding: 1px 5px; min-width: 17px; text-align: center; line-height: 1.4;
}

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--sb-border); flex-shrink: 0; }
.btn-logout {
  display: flex; align-items: center; gap: 10px;
  color: var(--sb-txt); font-size: .82rem; padding: 9px 10px; border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  background: none; border: none; width: 100%;
}
.btn-logout svg { width: 17px; flex-shrink: 0; }
.btn-logout:hover { background: rgba(239,68,68,.12); color: #f87171; }

/* == TOPBAR ACTIONS ====================================== */
/* == MAIN WRAPPER ================================================ */
.main-wrapper { margin-top: 0; min-height: 100vh; }
.main-content  { padding: 24px; background: var(--bg); }

/* == PAGE HEADER ================================================ */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.3rem; font-weight: 700; font-family: var(--font-display); color: var(--txt); }
.page-header p  { color: var(--txt-muted); font-size: .82rem; margin-top: 3px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* == CARDS ====================================================== */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card-accent { background: var(--accent-dim); border-color: var(--accent-border); }
.card-title  { font-size: .7rem; color: var(--txt-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.card-value  { font-size: 1.45rem; font-weight: 800; }

/* == STATS ====================================================== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat-label { font-size: .68rem; color: var(--txt-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.stat-value { font-size: 1.3rem; font-weight: 800; color: var(--txt); }
.stat-value.accent { color: var(--accent); }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.purple { color: var(--purple); }
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 18px; }
.stat-icon.accent { background: var(--accent-dim); color: var(--accent); }
.stat-icon.green  { background: var(--green-dim);  color: var(--green); }
.stat-icon.red    { background: var(--red-dim);    color: var(--red); }
.stat-icon.purple { background: var(--admin-dim);  color: var(--admin-accent); }
.stat-icon.yellow { background: var(--yellow-dim); color: var(--yellow); }

/* == GRID ======================================================= */
.grid   { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }

/* == BOTÕES ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: .82rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-accent  { background: var(--accent); color: #0a0a0a; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-outline { background: transparent; color: var(--txt-muted); border: 1px solid var(--border-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost   { background: transparent; color: var(--txt-muted); }
.btn-ghost:hover { color: var(--txt); }
.btn-green   { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.btn-red     { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-admin   { background: var(--admin-dim); color: var(--admin-accent); border: 1px solid rgba(168,85,247,.35); }
.btn-sm  { padding: 5px 12px; font-size: .76rem; }
.btn-lg  { padding: 11px 22px; font-size: .88rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon  { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 8px; }

/* == FORMULÁRIOS ================================================ */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: .76rem; color: var(--txt-muted); margin-bottom: 4px; font-weight: 500; }
.form-control {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-2);
  border-radius: 8px; color: var(--txt); padding: 9px 12px;
  font-size: .85rem; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-family: var(--font-body);
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,222,128,.14);
}
.form-control::placeholder { color: var(--txt-dim); }
select.form-control option { background: #fff; color: #111; }
.form-hint { font-size: .7rem; color: var(--txt-muted); margin-top: 3px; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group { position: relative; }
.input-group .form-control { padding-left: 38px; }
.input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--txt-muted); }
.input-icon svg { width: 15px; }
.form-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; padding-bottom: 0; }
.form-section-label {
  font-size: .67rem; font-weight: 800; letter-spacing: .10em;
  text-transform: uppercase; color: var(--txt-dim);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.form-section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle-switch {
  width: 40px; height: 22px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  position: relative; cursor: pointer; transition: background .2s, border-color .2s;
  flex-shrink: 0; appearance: none; outline: none;
}
.toggle-switch::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; top: 2px; left: 2px;
  transition: transform .2s, background .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch:checked { background: var(--accent); border-color: var(--accent-dark); }
.toggle-switch:checked::after { transform: translateX(18px); }
.toggle-label { font-size: .82rem; color: var(--txt); cursor: pointer; }
.toggle-hint  { font-size: .72rem; color: var(--txt-muted); }

/* == ALERTS ===================================================== */
.alert {
  padding: 10px 14px; border-radius: 8px; font-size: .82rem;
  margin-bottom: 14px; display: flex; align-items: center; gap: 9px;
}
.alert svg { width: 15px; flex-shrink: 0; }
.alert-success { background: var(--green-dim); border: 1px solid rgba(34,197,94,.3); color: #166534; }
.alert-error   { background: var(--red-dim); border: 1px solid rgba(239,68,68,.3); color: #991b1b; }
.alert-warning { background: var(--yellow-dim); border: 1px solid rgba(245,158,11,.3); color: #92400e; }
.alert-info    { background: var(--blue-dim); border: 1px solid rgba(59,130,246,.3); color: #1e40af; }

/* == TABELAS ==================================================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th { padding: 10px 14px; text-align: left; font-size: .67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--txt-muted);
  border-bottom: 1px solid var(--border-2); white-space: nowrap;
  background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
thead th[data-sortable="1"] {
  cursor: pointer;
  user-select: none;
  transition: color .15s ease, background .15s ease;
}
thead th[data-sortable="1"]:hover,
thead th[data-sortable="1"]:focus-visible {
  color: var(--accent);
  background: var(--accent-dim);
  outline: none;
}
thead th[data-sort-direction] {
  color: var(--accent);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(74,222,128,.04); }

/* == BADGES ===================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-active, .badge-approved, .badge-concluido   { background: var(--green-dim); color: var(--green); }
.badge-pending, .badge-agendado, .badge-em_andamento { background: var(--yellow-dim); color: var(--yellow); }
.badge-cancelled, .badge-cancelado, .badge-error     { background: var(--red-dim); color: var(--red); }
.badge-info, .badge-confirmado                        { background: var(--blue-dim); color: var(--blue); }
.badge-accent                                          { background: var(--accent-dim); color: var(--accent); }

.nicho-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; cursor: default;
  border: 1.5px solid currentColor; transition: all .15s;
  white-space: nowrap;
}
.nicho-pill.restaurante { color: var(--nicho-restaurante); background: var(--nicho-restaurante-dim); }
.nicho-pill.ativacao    { color: var(--nicho-ativacao);    background: var(--nicho-ativacao-dim); }
.nicho-pill.degustacao  { color: var(--nicho-degustacao);  background: var(--nicho-degustacao-dim); }
.nicho-pill.feira_evento,
.nicho-pill.feira       { color: var(--nicho-feira);       background: var(--nicho-feira-dim); }
.nicho-pill-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px;
  background: rgba(255,255,255,.45); border: 1px solid currentColor; color: inherit;
  font-size: .55rem; font-weight: 800; line-height: 1;
}
.nicho-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 14px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--border-2);
  background: var(--surface-2);
  color: var(--txt-muted);
  flex: 1 1 122px;
  min-width: 112px;
  max-width: 180px;
  min-height: 98px;
  text-align: center;
  position: relative;
  user-select: none;
  box-shadow: 0 0 0 0 transparent;
  transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
  font-family: var(--font-body);
  overflow: hidden;
}
.nicho-card:hover { transform: translateY(-1px); border-color: var(--accent-border); }
.nicho-card:focus-within {
  outline: 2px solid var(--accent-border);
  outline-offset: 2px;
}
.nicho-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.nicho-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 999px;
  background: currentColor; color: #fff;
  font-size: .78rem; font-weight: 800; line-height: 1;
}
.nicho-card-label,
.nicho-card-hint {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.nicho-card-label { font-size: .78rem; font-weight: 700; }
.nicho-card-hint { font-size: .65rem; opacity: .75; }

/* == SECTION HEADER ============================================= */
.section-hd { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: .82rem; font-weight: 700; color: var(--txt); font-family: var(--font-display); }

/* == UTILITÁRIOS ================================================ */
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-14 { margin-top: 14px; }
.mt-20 { margin-top: 20px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-muted { color: var(--txt-muted); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.fw-700 { font-weight: 700; }
.fs-sm  { font-size: .78rem; }

/* == AUTH LAYOUT ================================================ */
body.auth-body { display: block; padding-left: 0; }
.auth-wrap {
  min-height: 100vh; display: flex;
  background: radial-gradient(ellipse at 20% 20%, var(--accent-dim) 0%, transparent 55%), var(--bg);
}
.auth-visual {
  flex: 1; background: var(--surface-1); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px; min-height: 100vh; gap: 0;
}
.auth-visual-logo-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; margin-bottom: 40px;
}
.auth-visual-logo-wrap img { width: clamp(140px,22vw,220px); height: auto; object-fit: contain; }
.auth-visual-title { font-size: 2rem; font-weight: 800; color: var(--txt);
  text-align: center; line-height: 1.2; margin-bottom: 12px; font-family: var(--font-display); }
.auth-visual-title span { color: var(--accent); }
.auth-visual-sub { font-size: .87rem; color: var(--txt-muted); text-align: center; max-width: 300px; line-height: 1.6; }
.auth-visual-features { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.auth-feature { display: flex; align-items: center; gap: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.auth-feature-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-feature-icon svg { width: 15px; color: var(--accent); }
.auth-feature-text strong { font-size: .82rem; display: block; }
.auth-feature-text small  { font-size: .72rem; color: var(--txt-muted); }

.auth-form-wrap { width: 420px; max-width: 100%; padding: 48px 40px;
  display: flex; flex-direction: column; justify-content: center; }
.auth-logo     { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.auth-logo img { height: 30px; width: auto; object-fit: contain; }
.auth-title    { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; font-family: var(--font-display); }
.auth-subtitle { font-size: .82rem; color: var(--txt-muted); margin-bottom: 22px; }
.auth-footer   { text-align: center; font-size: .8rem; color: var(--txt-muted); margin-top: 18px; }
.auth-footer a { color: var(--accent); }
.auth-divider  { height: 1px; background: var(--border); margin: 18px 0; position: relative; }
.auth-divider span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--bg); padding: 0 10px; font-size: .72rem; color: var(--txt-dim); }

/* == MOBILE ===================================================== */
@media(max-width:1100px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media(max-width:800px) {
  .auth-visual { display: none; }
  .auth-form-wrap { width: 100%; padding: 32px 22px; min-height: 100vh; }
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nicho-card { flex: 1 1 calc(50% - 8px); min-width: 130px; }
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .btn-close-mobile { display: inline-flex; }
  body { padding-left: 0; }
  .sidebar { transform: translateX(-100%); }
}
@media(max-width:480px) {
  .stats-row { grid-template-columns: 1fr; }
  .auth-form-wrap { padding: 24px 16px; }
}

/* Side navigation inspirado na referencia da identidade visual */
:root {
  --sidebar-w: 270px;
  --sidebar-compact-w: 75px;
  --topbar-h: 66px;
}
body {
  background: #eef5fe;
  padding-left: var(--sidebar-w);
}
body.sidebar-compact { padding-left: var(--sidebar-compact-w); }
.flex { display: flex; align-items: center; }
.nav_image {
  display: flex;
  min-width: 55px;
  justify-content: center;
}
.nav_image img {
  height: 35px;
  width: 35px;
  border-radius: 50%;
  object-fit: cover;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-w);
  background: #fff;
  padding: 15px 10px;
  box-shadow: 0 0 2px rgba(0,0,0,.1);
  border-right: 0;
  transition: all .4s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar.close { width: var(--sidebar-compact-w); }
.logo_items {
  gap: 8px;
  height: 45px;
  justify-content: space-between;
  flex-shrink: 0;
}
.brand_lockup {
  gap: 8px;
  min-width: 0;
  text-decoration: none;
}
.logo_name {
  font-size: 22px;
  color: #333;
  font-weight: 500;
  transition: all .3s ease;
  white-space: nowrap;
}
.sidebar.close .logo_name,
.sidebar.close #lock-icon {
  opacity: 0;
  pointer-events: none;
}
#lock-icon {
  padding: 10px;
  color: #4070f4;
  font-size: 25px;
  cursor: pointer;
  margin-left: -4px;
  transition: all .3s ease;
}
.menu_container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 22px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.menu_container::-webkit-scrollbar { display: none; }
.menu_items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
.menu_items::-webkit-scrollbar { display: none; }
.menu_item { list-style: none; margin: 0; padding: 0; }
.menu_title {
  position: relative;
  height: 50px;
  width: 55px;
}
.menu_title .title {
  margin-left: 15px;
  transition: all .3s ease;
  color: #707070;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar.close .title { opacity: 0; }
.menu_title .line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 3px;
  width: 20px;
  border-radius: 25px;
  background: #aaa;
  opacity: 0;
  transition: all .3s ease;
}
.sidebar.close .line { opacity: 1; }
.item { list-style: none; }
.link {
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 8px;
  color: #707070;
  min-height: 50px;
  transition: all .2s ease;
  overflow: hidden;
}
.link:hover,
.link.active {
  color: #fff;
  background-color: #4070f4;
}
.link span {
  white-space: nowrap;
  transition: opacity .2s ease;
}
.link i {
  height: 50px;
  min-width: 55px;
  display: flex;
  font-size: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.sidebar.close .link span,
.sidebar.close .data_text,
.sidebar.close .profile_logout {
  opacity: 0;
  pointer-events: none;
}
.sidebar_profile {
  padding-top: 15px;
  margin-top: 15px;
  gap: 10px;
  border-top: 2px solid rgba(0,0,0,.1);
  justify-content: space-between;
  overflow: hidden;
  flex-shrink: 0;
}
.profile_link {
  min-width: 0;
  gap: 0;
  color: inherit;
  text-decoration: none;
}
.sidebar_profile .data_text {
  display: flex;
  flex-direction: column;
  transition: opacity .2s ease;
}
.sidebar_profile .name {
  font-size: 15px;
  color: #333;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar_profile .email {
  font-size: 12px;
  color: #707070;
}
.profile_logout button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f8fafc;
  color: #707070;
  font-size: 20px;
}
.profile_logout button:hover {
  background: rgba(239,68,68,.1);
  color: var(--red);
}
.main-wrapper {
  margin-top: 0;
  min-height: 100vh;
}
.main-content {
  padding: 14px 18px;
  background: #eef5fe;
}
.page-header {
  margin-bottom: 10px;
}
.page-header h1 {
  font-size: 1.15rem;
  line-height: 1.2;
}
.page-header p {
  display: none !important;
}
.page-header-row {
  gap: 8px;
}
@media screen and (max-width:800px) {
  body,
  body.sidebar-compact {
    padding-left: 0;
  }
  .sidebar {
    left: 0;
    z-index: 1000;
    transform: none;
  }
  .sidebar.close {
    left: -100%;
    width: var(--sidebar-w);
    transform: none;
  }
  #lock-icon {
    display: none;
  }
  .main-content {
    padding: 12px;
  }
}

/* Front refactor - padrão visual alinhado ao sidebar branco */
:root {
  --accent:        #4070F4;
  --accent-dim:    rgba(64,112,244,.11);
  --accent-border: rgba(64,112,244,.28);
  --accent-dark:   #2453D6;
  --admin-accent:  #4070F4;
  --admin-dim:     rgba(64,112,244,.11);

  --bg:        #EEF5FE;
  --surface-0: #F8FBFF;
  --surface-1: #FFFFFF;
  --surface-2: #F5F9FF;
  --surface-3: #EAF2FF;
  --surface-4: #DCE8F8;
  --border:    rgba(15,25,35,.08);
  --border-2:  rgba(15,25,35,.14);
  --txt:       #202936;
  --txt-muted: #5F6D7E;
  --txt-dim:   #9AA8B8;
  --bg-input:  #FFFFFF;
  --bg-hover:  rgba(64,112,244,.05);
  --shadow-sm: 0 1px 2px rgba(15,25,35,.06);
  --shadow-md: 0 8px 22px rgba(15,25,35,.08);
  --shadow:    0 16px 40px rgba(15,25,35,.10);
  --radius:    8px;
  --radius-lg: 8px;
}

body {
  background: var(--bg);
  color: var(--txt);
}

.main-content {
  padding: 14px 18px 18px;
  background: var(--bg);
}

.page-header,
.page-header.mb-20,
.page-header.mb-24 {
  margin-bottom: 10px;
}

.page-header h1 {
  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.page-header p {
  display: none !important;
}

.page-header-row {
  min-height: 36px;
  gap: 8px;
}

.card,
.stat,
.mc-panel,
.mc-session,
.mc-status-card,
.mc-modal-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.card {
  padding: 16px;
}

.card:hover,
.stat:hover {
  border-color: rgba(64,112,244,.18);
}

.stats-row {
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 14px 15px;
}

.stat-label,
.card-title,
.section-title,
.form-section-label,
thead th {
  letter-spacing: .04em;
}

.stat-value {
  font-size: 1.18rem;
}

.section-hd {
  min-height: 28px;
  margin-bottom: 10px;
}

.section-title {
  font-size: .78rem;
  font-weight: 700;
}

.btn {
  min-height: 34px;
  border-radius: 8px;
  padding: 7px 13px;
  font-weight: 600;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(64,112,244,.18);
}

.btn-accent:hover {
  background: var(--accent-dark);
  filter: none;
  transform: translateY(-1px);
}

.btn-outline,
.btn-ghost {
  background: #fff;
  border: 1px solid var(--border-2);
  color: var(--txt-muted);
}

.btn-outline:hover,
.btn-ghost:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-red {
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.18);
  color: var(--red);
}

.btn-green {
  background: rgba(34,197,94,.10);
  border: 1px solid rgba(34,197,94,.18);
  color: var(--green);
}

label {
  font-size: .72rem;
  color: var(--txt-muted);
  font-weight: 600;
  margin-bottom: 5px;
}

.form-control {
  min-height: 36px;
  border-radius: 8px;
  border-color: var(--border-2);
  background: #fff;
  color: var(--txt);
  padding: 8px 11px;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(64,112,244,.12);
}

.form-section {
  padding: 16px 0;
}

.form-section-label {
  color: var(--txt-muted);
  margin-bottom: 12px;
}

.input-icon {
  color: var(--txt-dim);
}

.toggle-switch:checked {
  background: var(--accent);
  border-color: var(--accent-dark);
}

.table-wrap {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.card > .table-wrap {
  border: 0;
  border-radius: 0;
}

table {
  font-size: .8rem;
}

thead th {
  background: #F6F9FE;
  color: #6C7888;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
}

tbody td {
  padding: 9px 12px;
}

tbody tr:hover td {
  background: rgba(64,112,244,.045);
}

.badge,
.nicho-pill {
  border-radius: 999px;
}

.badge {
  padding: 3px 8px;
  font-size: .62rem;
}

.alert {
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.avatar {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.avatar.admin-av {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.grid {
  gap: 14px;
}

.mb-20,
.mb-24 {
  margin-bottom: 14px;
}

.mt-20 {
  margin-top: 14px;
}

.auth-wrap {
  background: var(--bg);
}

.auth-visual,
.auth-form-wrap {
  background: var(--surface-1);
}

.pub-shell,
.pub-card {
  background: var(--surface-1);
  border-radius: 8px;
}

@media(max-width:1100px) {
  .main-content {
    padding: 12px;
  }
}

@media(max-width:800px) {
  .main-content {
    padding: 10px;
  }

  .page-header-row {
    align-items: flex-start;
  }

  .page-header-row > div,
  .page-header-row > form,
  .page-header-row > a,
  .page-header-row > button {
    max-width: 100%;
  }

  .btn {
    min-height: 36px;
  }
}

/* Camada final do front: sidebar, responsividade e acabamento */
.sidebar.close .sidebar_profile {
  align-items: center;
}

.sidebar.close .profile_logout {
  opacity: 1;
  pointer-events: auto;
}

.sidebar.close .profile_logout button {
  width: 42px;
  height: 42px;
}

.nicho-card-icon {
  background: rgba(255,255,255,.48);
  border: 1px solid currentColor;
  color: inherit;
}

.empty-state,
td[colspan] {
  color: var(--txt-muted);
}

.card form > div[style*="flex"],
.page-header-row > div[style*="flex"] {
  gap: 8px !important;
}

.stats-row[style*="repeat(4"],
.stats-row[style*="repeat(3"] {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.main-content > * {
  max-width: 100%;
}

.table-wrap {
  max-width: 100%;
}

.profile_logout {
  flex-shrink: 0;
}

.sidebar_profile .nav_image {
  min-width: 44px;
}

@media(max-width:1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media(max-width:800px) {
  body,
  body.sidebar-compact {
    padding-left: var(--sidebar-compact-w);
  }

  .sidebar,
  .sidebar.close {
    left: 0;
    width: var(--sidebar-compact-w);
    transform: none;
    padding: 12px 8px;
  }

  .logo_items {
    justify-content: center;
  }

  .brand_lockup {
    justify-content: center;
  }

  .nav_image {
    min-width: 44px;
  }

  .logo_name,
  #lock-icon,
  .menu_title .title,
  .link span,
  .data_text {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
  }

  .menu_container {
    margin-top: 14px;
  }

  .menu_title {
    width: 100%;
    height: 28px;
    justify-content: center;
  }

  .menu_title .line {
    opacity: 1;
  }

  .link {
    justify-content: center;
    min-height: 46px;
    margin-bottom: 6px;
  }

  .link i {
    min-width: 100%;
    height: 46px;
  }

  .sidebar_profile {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    margin-top: 10px;
  }

  .profile_link {
    justify-content: center;
  }

  .profile_logout {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .profile_logout button {
    width: 42px;
    height: 42px;
    background: #f1f5ff;
    color: var(--accent);
  }

  .main-content {
    padding: 10px;
  }

  .page-header-row {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .page-header-row .btn,
  .page-header-row form,
  .page-header-row select,
  .page-header-row input {
    width: 100%;
  }

  .card {
    padding: 13px;
  }

  .stats-row,
  .stats-row[style],
  .form-row {
    grid-template-columns: 1fr !important;
  }

  .table-wrap {
    border-radius: 8px;
  }

  tbody td,
  thead th {
    padding: 8px 10px;
  }
}

@media(max-width:520px) {
  .main-content {
    padding: 8px;
  }

  .btn {
    justify-content: center;
  }

  .card {
    padding: 12px;
  }
}

/* Estrutura única das views internas */
.app-view {
  width: 100%;
  min-height: calc(100vh - 28px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15,25,35,.05);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-view > .page-header {
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  min-height: 42px;
}

.app-view > .page-header + .card,
.app-view > .page-header + .stats-row,
.app-view > .page-header + .grid {
  margin-top: 0;
}

.app-view .page-header h1 {
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 800;
}

.app-view .page-header p {
  display: none !important;
}

.app-view > .card,
.app-view > .grid > .card,
.app-view > .stats-row > .stat,
.app-view .mc-panel,
.app-view .mc-session,
.app-view .mc-shell {
  box-shadow: none;
}

.app-view > .card {
  margin: 0;
}

.app-view > .card:has(> form) {
  background: var(--surface-2);
  border-color: var(--border);
}

.app-view > .card:has(> form) .form-control {
  background: #fff;
}

.app-view > .card > .table-wrap,
.app-view > .table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.app-view .section-hd {
  margin-bottom: 12px;
  min-height: 28px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.app-view .section-title {
  color: var(--txt);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-view .grid,
.app-view .stats-row {
  margin-bottom: 0;
}

.app-view .grid-3,
.app-view .grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.app-view .grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-view .grid-2[style*="align-items:start"] {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .48fr);
}

.app-view .grid-2 > .card,
.app-view .grid-3 > .card,
.app-view .grid-4 > .card {
  min-width: 0;
}

.app-view .stats-row {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.app-view .card .stats-row,
.app-view .card .grid {
  gap: 10px;
}

.app-view table {
  table-layout: auto;
}

.app-view thead th:first-child,
.app-view tbody td:first-child {
  padding-left: 14px;
}

.app-view thead th:last-child,
.app-view tbody td:last-child {
  padding-right: 14px;
}

.app-view .btn-icon {
  min-width: 34px;
}

.app-view .form-row {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.app-view .form-section {
  padding: 14px 0;
}

.app-view .form-section:first-child {
  padding-top: 0;
}

.app-view .form-section-label::after {
  background: var(--border);
}

.app-view .alert {
  margin-bottom: 0;
}

.record-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--txt);
}

.record-subtitle {
  font-size: .72rem;
  color: var(--txt-muted);
  margin-top: 2px;
}

.metric-inline {
  display: inline-flex;
  min-width: 68px;
  flex-direction: column;
  gap: 2px;
}

.metric-inline span:first-child {
  color: var(--txt-muted);
  font-size: .62rem;
  text-transform: uppercase;
  font-weight: 700;
}

.metric-inline strong {
  color: var(--accent);
  font-size: .86rem;
}

@media(max-width:1100px) {
  .app-view .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media(max-width:800px) {
  .app-view {
    min-height: calc(100vh - 20px);
    padding: 12px;
    gap: 12px;
  }

  .app-view > .page-header {
    min-height: 0;
    padding-bottom: 12px;
  }

  .app-view .page-header-row {
    gap: 10px;
  }

  .app-view > .card:has(> form) form > div {
    align-items: stretch !important;
  }

  .app-view > .card:has(> form) form > div > div {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Perfil */
.profile-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
  gap: 14px;
  align-items: start;
}

.profile-card,
.profile-side-card {
  min-width: 0;
}

.profile-photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.profile-photo {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 2px solid var(--accent-border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 1.35rem;
  font-weight: 800;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-photo-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.profile-photo-copy strong {
  font-size: .9rem;
  color: var(--txt);
  line-height: 1.2;
}

.profile-photo-copy span,
.profile-photo-copy small {
  font-size: .72rem;
  color: var(--txt-muted);
}

.profile-photo-button {
  width: fit-content;
  margin-top: 4px;
  cursor: pointer;
}

.profile-photo-button input {
  display: none;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.profile-info-list {
  display: flex;
  flex-direction: column;
}

.profile-info-list > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.profile-info-list > div:last-child {
  border-bottom: 0;
}

.profile-info-list span {
  color: var(--txt-muted);
  font-size: .74rem;
}

.profile-info-list strong {
  color: var(--txt);
  font-size: .78rem;
  text-align: right;
  overflow-wrap: anywhere;
}

@media(max-width:1100px) {
  .profile-shell {
    grid-template-columns: 1fr;
  }
}

@media(max-width:560px) {
  .profile-photo-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-photo-copy,
  .profile-photo-button,
  .profile-actions .btn {
    width: 100%;
  }

  .profile-actions {
    justify-content: stretch;
  }
}

/* Acessibilidade e responsividade final */
html {
  font-size: 16px;
}

body {
  line-height: 1.55;
}

.main-content {
  padding: 22px;
}

.app-view {
  min-width: 0;
  gap: 16px;
  padding: 18px;
}

.app-view > .page-header {
  min-height: 0;
  padding-bottom: 12px;
}

.app-view .page-header h1 {
  font-size: clamp(1.18rem, 1rem + .45vw, 1.5rem);
  line-height: 1.22;
}

.app-view > .card,
.app-view > .grid > .card,
.app-view .mc-panel,
.app-view .mc-session,
.app-view .stat,
.card {
  border-radius: 8px;
}

.app-view > .card,
.app-view > .grid > .card,
.app-view > .card:has(> form) {
  background: #fff;
  padding: 20px;
}

.app-view label,
.app-view .mc-field label {
  color: var(--txt);
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.35;
}

.app-view .form-hint,
.app-view .toggle-hint,
.app-view .record-subtitle,
.app-view .mc-note,
.app-view .mc-panel p {
  font-size: .86rem;
  line-height: 1.5;
}

.app-view .form-control,
.app-view input[type="text"],
.app-view input[type="email"],
.app-view input[type="tel"],
.app-view input[type="date"],
.app-view input[type="datetime-local"],
.app-view input[type="password"],
.app-view input[type="number"],
.app-view select,
.app-view textarea,
.app-view .mc-field input,
.app-view .mc-field textarea {
  min-height: 46px;
  font-size: 1rem;
  line-height: 1.35;
  padding: 11px 14px;
}

.app-view textarea,
.app-view .mc-field textarea {
  min-height: 108px;
}

.app-view .input-group .form-control {
  padding-left: 42px;
}

.app-view .input-icon {
  left: 13px;
}

.app-view .btn {
  min-height: 42px;
  font-size: .96rem;
  line-height: 1.2;
  padding: 10px 16px;
  gap: 8px;
}

.app-view .btn-sm {
  min-height: 38px;
  font-size: .9rem;
  padding: 8px 12px;
}

.app-view .btn-icon,
.app-view .mc-icon-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.app-view .section-title,
.app-view .card-title {
  font-size: .86rem;
  letter-spacing: .03em;
}

.app-view .record-title {
  font-size: 1rem;
}

.app-view .badge,
.app-view .nicho-pill,
.app-view .mc-badge {
  font-size: .78rem;
  min-height: 26px;
}

.app-view .table-wrap,
.app-view > .card > .table-wrap,
.app-view > .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-view table {
  min-width: 760px;
  font-size: .95rem;
}

.app-view thead th {
  font-size: .8rem;
  padding: 12px 14px;
}

.app-view tbody td {
  padding: 13px 14px;
  vertical-align: middle;
}

.app-view .form-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}

.app-view .grid-2[style*="align-items:start"],
.app-view .promotor-form-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .44fr);
  gap: 16px;
}

.promotor-form-grid > .card {
  min-width: 0;
}

.promotor-photo-row > div:last-child {
  min-width: 0;
}

.app-view * {
  overflow-wrap: anywhere;
}

.app-view .btn,
.app-view select,
.app-view input,
.app-view textarea {
  overflow-wrap: normal;
}

.app-view .form-control:focus,
.app-view .btn:focus-visible,
.app-view a:focus-visible,
.app-view button:focus-visible {
  outline: 3px solid rgba(60, 102, 246, .22);
  outline-offset: 2px;
}

.client-access-panel[hidden],
.client-password-reset[hidden] {
  display: none !important;
}

.client-access-panel.is-visible,
.client-password-reset.is-visible {
  display: block !important;
}

.app-view [style*="font-size:.5"],
.app-view [style*="font-size: .5"],
.app-view [style*="font-size:.6"],
.app-view [style*="font-size: .6"] {
  font-size: .82rem !important;
}

.app-view [style*="font-size:.7"],
.app-view [style*="font-size: .7"] {
  font-size: .9rem !important;
}

.app-view [style*="font-size:.8"],
.app-view [style*="font-size: .8"] {
  font-size: .96rem !important;
}

@media(max-width:1180px) {
  .app-view .grid-2[style*="align-items:start"],
  .app-view .promotor-form-grid,
  .profile-shell {
    grid-template-columns: 1fr !important;
  }
}

@media(max-width:800px) {
  .main-content {
    padding: 12px;
  }

  .app-view {
    padding: 12px;
    gap: 12px;
  }

  .app-view .page-header-row {
    align-items: stretch;
    flex-direction: column;
  }

  .app-view .page-header-row > div,
  .app-view .page-header-row > a,
  .app-view .page-header-row > button,
  .app-view .page-header-row > form {
    width: 100%;
  }

  .app-view .page-header-row .btn,
  .app-view .page-header-row select,
  .app-view .page-header-row input {
    width: 100%;
  }

  .app-view > .card,
  .app-view > .grid > .card,
  .app-view > .card:has(> form) {
    padding: 16px;
  }

  .app-view .stats-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  }

  .app-view .table-wrap,
  .app-view > .card > .table-wrap,
  .app-view > .table-wrap {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .app-view .mc-shell {
    min-height: 0;
  }
}

@media(max-width:560px) {
  html {
    font-size: 15.5px;
  }

  .main-content {
    padding: 8px;
  }

  .app-view {
    padding: 10px;
    border-radius: 8px;
  }

  .app-view > .card,
  .app-view > .grid > .card,
  .app-view > .card:has(> form) {
    padding: 14px;
  }

  .app-view .form-control,
  .app-view input[type="text"],
  .app-view input[type="email"],
  .app-view input[type="tel"],
  .app-view input[type="date"],
  .app-view input[type="datetime-local"],
  .app-view input[type="password"],
  .app-view input[type="number"],
  .app-view select,
  .app-view textarea {
    min-height: 44px;
  }

  .app-view form > .btn,
  .app-view form > div > .btn,
  .app-view .profile-actions .btn,
  .app-view .promotor-photo-row .btn {
    width: 100%;
    justify-content: center;
  }

  .promotor-photo-row {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .promotor-photo-row > div:last-child {
    width: 100%;
  }
}

/* Camada global de responsividade: impede estouro horizontal em URLs, grids e cards. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.main-wrapper,
.main-content,
.app-view,
.app-view > *,
.app-view .grid,
.app-view .form-row,
.app-view .stats-row,
.app-view .page-header-row,
.app-view .card,
.app-view section,
.app-view article,
.app-view form,
.app-view fieldset {
  min-width: 0;
  max-width: 100%;
}

body:not(.sidebar-compact) .main-content {
  max-width: calc(100vw - var(--sidebar-w));
}

body.sidebar-compact .main-content {
  max-width: calc(100vw - var(--sidebar-compact-w));
}

.app-view .card,
.app-view .mc-page,
.app-view .mc-grid,
.app-view .mc-side,
.app-view .mc-panel,
.app-view .mc-body,
.app-view .mc-status-card,
.app-view .mc-alert,
.app-view .mc-session,
.app-view .mc-session-top,
.app-view .mc-field,
.app-view .mc-row,
.app-view .mc-actions,
.app-view .mc-webhook-actions {
  min-width: 0 !important;
  max-width: 100% !important;
}

.app-view .mc-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px) !important;
}

.app-view .mc-code,
.app-view code,
.app-view pre,
.app-view .form-hint,
.app-view .toggle-hint,
.app-view .mc-note,
.app-view .mc-session-sub {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.app-view pre {
  overflow-x: auto;
  white-space: pre-wrap;
}

.app-view .mc-webhook-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.app-view .mc-webhook-actions .btn,
.app-view .mc-actions .btn {
  min-width: 0;
  white-space: normal;
}

@media(max-width:1180px) {
  .app-view .mc-grid {
    grid-template-columns: 1fr !important;
  }

  .app-view .mc-webhook-actions {
    grid-template-columns: 1fr !important;
  }
}

@media(max-width:800px) {
  body:not(.sidebar-compact) .main-content,
  body.sidebar-compact .main-content,
  .main-content {
    max-width: calc(100vw - var(--sidebar-compact-w));
  }

  .app-view .grid,
  .app-view .grid-2,
  .app-view .form-row,
  .app-view .stats-row {
    grid-template-columns: 1fr !important;
  }

  .app-view .mc-actions,
  .app-view .mc-webhook-actions,
  .app-view .page-header-row {
    align-items: stretch;
  }

  .app-view .mc-actions .btn,
  .app-view .mc-webhook-actions .btn,
  .app-view .mc-link {
    width: 100%;
    justify-content: center;
  }
}

@media(max-width:560px) {
  .app-view .card,
  .app-view .mc-body,
  .app-view .mc-panel-head {
    padding: 12px !important;
  }
}

@media(prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Mobile hardening: tabelas e filtros não podem esmagar texto. */
.main-content,
.app-view {
  width: 100%;
}

.app-view .table-wrap,
.app-view > .card > .table-wrap,
.app-view > .table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.app-view .table-wrap table {
  width: max-content;
  min-width: max(100%, 760px);
  max-width: none;
  table-layout: auto !important;
}

.app-view .table-wrap th,
.app-view .table-wrap td {
  min-width: 112px;
  white-space: nowrap;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.app-view .table-wrap th:first-child,
.app-view .table-wrap td:first-child {
  min-width: 220px;
}

.app-view .table-wrap th:last-child,
.app-view .table-wrap td:last-child {
  min-width: 96px;
}

.app-view .table-wrap td[colspan] {
  min-width: 0;
  white-space: normal;
}

.app-view .table-wrap td > div[style*="display:flex"],
.app-view .table-wrap td > form,
.app-view .table-wrap .record-title,
.app-view .table-wrap .record-subtitle,
.app-view .table-wrap .badge,
.app-view .table-wrap .nicho-pill,
.app-view .table-wrap .metric-inline,
.app-view .table-wrap .btn {
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.app-view .table-wrap .record-title,
.app-view .table-wrap .record-subtitle {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-view .table-wrap td > div[style*="justify-content:flex-end"],
.app-view .table-wrap td > div[style*="justify-content: flex-end"] {
  width: max-content;
  margin-left: auto;
}

.app-view label,
.app-view .btn,
.app-view .badge,
.app-view .nicho-pill,
.app-view .metric-inline,
.app-view .page-header h1 {
  word-break: normal !important;
  overflow-wrap: normal !important;
}

@media(max-width:800px) {
  body,
  body.sidebar-compact {
    padding-left: var(--sidebar-compact-w);
  }

  body:not(.sidebar-compact) .main-content,
  body.sidebar-compact .main-content,
  .main-content {
    width: calc(100vw - var(--sidebar-compact-w));
    max-width: calc(100vw - var(--sidebar-compact-w));
    padding: 10px;
  }

  .app-view {
    padding: 12px;
    overflow: hidden;
  }

  .app-view > .card:has(> form) form > div[style*="display:flex"],
  .app-view > form[style*="display:flex"] {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
  }

  .app-view > .card:has(> form) form > div[style*="display:flex"] > *,
  .app-view > form[style*="display:flex"] > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .app-view .input-group {
    width: 100%;
    min-width: 0;
  }

  .app-view .btn:not(.btn-icon) {
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .app-view .table-wrap {
    margin-inline: 0 !important;
    padding-inline: 0 !important;
  }
}

@media(max-width:560px) {
  body:not(.sidebar-compact) .main-content,
  body.sidebar-compact .main-content,
  .main-content {
    padding: 8px;
  }

  .app-view {
    padding: 10px;
  }

  .app-view > .card,
  .app-view > .grid > .card,
  .app-view > .card:has(> form) {
    padding: 12px !important;
  }
}

.nicho-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.nicho-card {
  --nicho-color: var(--accent);
  --nicho-bg: var(--accent-dim);
}

.nicho-card.is-active {
  border-color: var(--nicho-color) !important;
  background: var(--nicho-bg) !important;
  color: var(--nicho-color) !important;
  box-shadow: 0 0 0 3px var(--nicho-bg);
  transform: translateY(-1px);
}

.nicho-card .nicho-card-icon i,
.nicho-pill-mark i {
  font-size: 1rem;
  line-height: 1;
}

.nicho-card-add {
  border-style: dashed;
}

.nicho-icon-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--nicho-color);
  background: var(--nicho-bg);
  color: var(--nicho-color);
  flex-shrink: 0;
}

.nicho-color-input {
  min-height: 42px;
  padding: 4px;
}

.nicho-modal[hidden] {
  display: none !important;
}

.nicho-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.nicho-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 35, .45);
}

.nicho-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.nicho-pill.dynamic {
  color: var(--nicho-color);
  background: var(--nicho-bg);
}

@media(max-width:560px) {
  .nicho-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nicho-card {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .nicho-modal {
    align-items: flex-end;
    padding: 10px;
  }

  .nicho-modal-panel {
    width: 100%;
    padding: 14px;
  }
}
