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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--secondary);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 18px; height: 18px; }

.sidebar-logo-text {
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.sidebar-logo-version {
  font-size: .65rem;
  font-weight: 500;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  padding: .1rem .35rem;
  border-radius: var(--radius-sm);
  margin-left: .25rem;
}

.sidebar-nav {
  padding: .75rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: .75rem 1.25rem .25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.72);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.09);
  color: #fff;
}

.sidebar-nav a svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .75rem;
  color: rgba(255,255,255,.35);
}

.sidebar-demo-badge {
  display: inline-block;
  background: rgba(217,119,6,.25);
  color: #fbbf24;
  padding: .15rem .55rem;
  border-radius: var(--radius-sm);
  font-size: .7rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.page-header .subtitle {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.page-body {
  padding: 1.75rem;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.card-body { padding: 1.25rem; }

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
}

.stat-card .stat-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-top: .2rem;
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th {
  text-align: left;
  padding: .625rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: 0; }

.table tbody tr:hover { background: var(--background); }

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}

.btn:disabled { opacity: .55; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--background); text-decoration: none; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { opacity: .9; text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: .9; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: .4rem .7rem;
}
.btn-ghost:hover { background: var(--border-light); color: var(--text); text-decoration: none; }

.btn-sm {
  padding: .3rem .65rem;
  font-size: .8125rem;
}

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

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}
.empty-state svg {
  width: 44px; height: 44px;
  margin: 0 auto .75rem;
  opacity: .4;
}
.empty-state p { font-size: .9375rem; }

/* ── Alert inline ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #164e63; border: 1px solid #a5f3fc; }

/* ── Mobile toggle ── */
.sidebar-toggle {
  display: none;
  background: none; border: none;
  padding: .4rem;
  color: var(--text);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle { display: flex; }
  .page-body { padding: 1rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }
