/* ─────────────────────────────────────────────────────────────────
   Mooby — backoffice / dashboard design system. Light mode.
   Shares brand language with the public site (Satoshi + Inter + violet).
   ───────────────────────────────────────────────────────────────── */

@import url("https://api.fontshare.com/v2/css?f[]=satoshi@500,600,700,800,900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* Surfaces */
  --ivory:    #FBFAF7;
  --paper:    #FFFFFF;
  --cloud:    #F6F6F8;
  --fog:      #F0F0F3;
  --smoke:    #E5E5EA;
  --line:     #E5E5EA;
  --line-soft:#EFEFF2;

  /* Brand */
  --violet:        #6D28FF;
  --violet-deep:   #5B21B6;
  --lilac:         #8B5CF6;
  --lilac-soft:    #C4B5FD;
  --mist:          #F5F3FF;

  /* Text */
  --ink:      #09090B;
  --graphite: #18181B;
  --slate:    #3F3F46;
  --mute:     #71717A;
  --dim:      #A1A1AA;

  /* Accents */
  --emerald: #059669;
  --amber:   #D97706;
  --rose:    #E11D48;
  --sky:     #0EA5E9;

  /* Status */
  --success: #10B981;
  --danger:  #EF4444;
  --warning: #F59E0B;

  /* Sizes */
  --sidebar-w:    248px;
  --topbar-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-pill:  999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(9,9,11,.04);
  --shadow-sm: 0 1px 2px 0 rgba(9,9,11,.04), 0 1px 1px 0 rgba(9,9,11,.03);
  --shadow:    0 2px 4px -1px rgba(9,9,11,.05), 0 1px 2px 0 rgba(9,9,11,.04);
  --shadow-md: 0 4px 8px -2px rgba(9,9,11,.06), 0 2px 4px -1px rgba(9,9,11,.04);
  --shadow-lg: 0 12px 24px -8px rgba(9,9,11,.08), 0 4px 8px -2px rgba(9,9,11,.04);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ivory);
  color: var(--graphite);
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.005em;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; transition: color .15s ease; }
button { cursor: pointer; font: inherit; border: 0; background: transparent; }

::selection { background: rgba(109,40,255,.18); color: var(--ink); }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ivory); }
::-webkit-scrollbar-thumb { background: var(--smoke); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #d4d4d8; }

h1, h2, h3, h4, h5 {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }

/* ── App shell (sidebar + topbar + content) ───────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--smoke);
}

.sidebar-brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand img { height: 26px; width: auto; }
.sidebar-brand-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--smoke);
  background: var(--cloud);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--slate);
}

.sidebar-section-label {
  margin: 16px 22px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 10px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--slate);
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: var(--cloud); color: var(--ink); }
.sidebar-link.is-active {
  background: var(--mist);
  color: var(--violet);
  font-weight: 600;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--lilac));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--mute);
  font-weight: 500;
}

.sidebar-logout {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--smoke);
  background: var(--paper);
  border-radius: 999px;
  color: var(--slate);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.sidebar-logout:hover { border-color: var(--ink); color: var(--ink); background: var(--cloud); }

/* ── Main column ───────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(251, 250, 247, .85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--smoke);
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar-title-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  margin-top: 1px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
}
.topbar-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--success);
}

.content {
  padding: 32px;
  flex: 1;
}

/* ── Eyebrow ───────────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--violet);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--violet);
}

/* ── Cards / panels ───────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.card-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  margin-top: 2px;
}

/* ── Grids ────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 980px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── KPI / metric cards ───────────────────────────────────────────── */
.metric {
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.metric:hover { border-color: var(--lilac-soft); box-shadow: var(--shadow-md); }

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--mist);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.metric-icon svg { width: 16px; height: 16px; }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
}
.metric-value {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1;
}
.metric-delta {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--violet);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--violet-deep); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--smoke);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--cloud); border-color: rgba(9,9,11,.18); }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  padding: 7px 12px;
  font-weight: 500;
}
.btn-ghost:hover { background: var(--cloud); color: var(--ink); }

.btn svg { width: 14px; height: 14px; }

/* ── Status pills ─────────────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 1px solid;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 999px; }

.status-active   { color: #047857; background: #ECFDF5; border-color: #A7F3D0; }
.status-active::before   { background: #10B981; }
.status-pending  { color: #B45309; background: #FFFBEB; border-color: #FDE68A; }
.status-pending::before  { background: #F59E0B; }
.status-error    { color: #B91C1C; background: #FEF2F2; border-color: #FECACA; }
.status-error::before    { background: #EF4444; }
.status-neutral  { color: var(--slate); background: var(--cloud); border-color: var(--smoke); }
.status-neutral::before  { background: var(--mute); }
.status-info     { color: var(--violet); background: var(--mist); border-color: var(--lilac-soft); }
.status-info::before     { background: var(--violet); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data thead th {
  text-align: left;
  padding: 12px 18px;
  background: var(--cloud);
  color: var(--mute);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--smoke);
}
table.data tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--graphite);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--cloud); }

.table-empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--mute);
  font-size: 13px;
}

/* ── List rows (for non-tabular content) ──────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.list-row:hover { border-color: var(--lilac-soft); }
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.list-row-sub {
  font-size: 12px;
  color: var(--mute);
  font-weight: 500;
}

/* ── Forms ────────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .form-grid-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, label.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--graphite);
  letter-spacing: -0.005em;
}

.field input,
.field select,
.field textarea,
input[type="text"]:not(.bare),
input[type="email"]:not(.bare),
input[type="password"]:not(.bare),
input[type="tel"]:not(.bare),
input[type="number"]:not(.bare),
select:not(.bare),
textarea:not(.bare) {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--smoke);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 500 14px/1.4 "Inter", system-ui, sans-serif;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(109,40,255,.12);
}

.field .helptext, .helptext {
  font-size: 12px;
  color: var(--mute);
}

ul.errorlist {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

/* ── Section heading inside content ───────────────────────────────── */
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
}
.section-head p {
  font-size: 13px;
  color: var(--mute);
  margin-top: 4px;
}

/* ── Auth (login / register) ──────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(800px 500px at 10% -10%, rgba(109,40,255,.10), transparent 55%),
    radial-gradient(700px 500px at 95% 15%, rgba(139,92,246,.07), transparent 55%),
    var(--ivory);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.auth-card-logo img { height: 24px; }
.auth-card-logo-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--smoke);
  background: var(--cloud);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--slate);
}
.auth-card h1 {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.035em;
  margin-bottom: 4px;
}
.auth-card .sub {
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 22px;
}
.auth-card-form { display: grid; gap: 14px; }
.auth-card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--smoke);
  font-size: 12px;
}
.auth-card-footer a { color: var(--violet); font-weight: 600; }
.auth-card-footer a:hover { color: var(--violet-deep); }

/* ── Public form pages (cobertura, chip, portabilidade) ───────────── */
.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
}
.public-header {
  border-bottom: 1px solid var(--smoke);
  background: var(--paper);
}
.public-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.public-header-inner img { height: 24px; }
.public-main { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.public-card {
  width: 100%;
  max-width: 560px;
  background: var(--paper);
  border: 1px solid var(--smoke);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.public-card h1 {
  font-family: "Satoshi", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.035em;
  margin-bottom: 6px;
}
.public-card .sub {
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 22px;
}

/* ── Utility ──────────────────────────────────────────────────────── */
.text-mute { color: var(--mute); }
.text-slate { color: var(--slate); }
.text-violet { color: var(--violet); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--smoke);
  }
  .sidebar-brand, .sidebar-footer, .sidebar-section-label { display: none; }
  .sidebar-nav { flex-direction: row; padding: 0; }
  .sidebar-link { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px; }
}
