/* ======================================================
   FONTS & VARIABLES
====================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
  /* Colors */
  --bg: #070A0F;
  --panel: #0B111B;
  --panel-glass: rgba(11, 17, 27, 0.7);
  --line: rgba(255, 255, 255, 0.08); /* Mais sutil */
  --text: #E8EEF8;
  --text-dim: #B9C6DA;
  
  /* Brand */
  --primary: #FF6A00;
  --primary-hover: #FF8A3D;
  --primary-glow: rgba(255, 106, 0, 0.3);
  
  /* Status */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);

  /* Measurements */
  --radius: 12px;
  --radius-lg: 18px;
  --header-height: 70px;
  --sidebar-width: 260px;
  
  /* Effects */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
  --glass: blur(12px) saturate(110%);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Safe areas (iOS PWA / notch) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* Touch target (Apple-ish) */
  --tap: 44px;

}

/* ======================================================
   RESET & BASE
====================================================== */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: 
    radial-gradient(circle at 15% 0%, rgba(255, 106, 0, 0.08), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(255, 138, 61, 0.05), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: color 0.2s var(--ease); }
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: 1.2; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3441; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Utilities */
.muted { color: var(--text-dim); font-size: 0.875rem; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* Flex row helper */
.row{ display:flex; align-items:center; gap:10px; min-width:0; }
.row > *{ min-width:0; }


/* ======================================================
   LAYOUT
====================================================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  height: 100vh;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 800;
  padding: 0 12px 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo span { color: var(--primary); }

.userbox {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.userbox:hover { background: rgba(255, 255, 255, 0.03); }

.avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 106, 0, 0.1);
  border: 1px solid rgba(255, 106, 0, 0.2);
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
}
.username { font-weight: 600; font-size: 0.95rem; display: block; }
.userrole { font-size: 0.75rem; color: var(--text-dim); display: block; }

/* Navigation */
.nav {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1; overflow-y: auto;
}

.navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}
.navlink i { font-size: 1.25rem; transition: color 0.2s; }

.navlink:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transform: translateX(4px);
}
.navlink.active {
  background: rgba(255, 106, 0, 0.08);
  color: var(--primary);
  border-color: rgba(255, 106, 0, 0.15);
  font-weight: 600;
}
.navlink.active i { color: var(--primary); }

.navlink.danger { margin-top: auto; }
.navlink.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.navlink.danger i { color: var(--danger); }

/* Dropdown groups (sidebar) */
.navgroup {
  border-radius: var(--radius);
}
.navgroup > summary {
  list-style: none;
  cursor: pointer;
}
.navgroup > summary::-webkit-details-marker { display: none; }

.nav-caret {
  margin-left: auto;
  opacity: .7;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.navgroup[open] .nav-caret {
  transform: rotate(180deg);
  opacity: 1;
}

.navgroup-items{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 2px 34px; /* indent */
}

.navsublink{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.90rem;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}
.navsublink i{ font-size: 1.1rem; }
.navsublink:hover{
  background: rgba(255,255,255,0.04);
  color: var(--text);
  transform: translateX(4px);
}
.navsublink.active{
  background: rgba(255, 106, 0, 0.08);
  color: var(--primary);
  border-color: rgba(255, 106, 0, 0.15);
  font-weight: 600;
}
.navsublink.active i{ color: var(--primary); }

/* Dropdown (topbar) */
.dropdown{ position: relative; }
.mini-avatar{
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  background: rgba(255, 106, 0, 0.18);
  border: 1px solid rgba(255, 106, 0, 0.25);
  color: var(--primary);
}
.dropdown-menu{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 260px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(11,17,27,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: none;
  z-index: 80;
}
.dropdown.open .dropdown-menu{ display: block; animation: ddIn .12s ease-out; }
@keyframes ddIn{ from{opacity:0; transform: translateY(-6px);} to{opacity:1; transform: translateY(0);} }

.dropdown-head{ padding: 8px 10px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 8px; }
.dropdown-name{ font-weight: 800; }
.dropdown-role{ font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.dropdown-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  border-radius: 14px;
  color: rgba(255,255,255,.92);
  transition: background .2s var(--ease);
}
.dropdown-item:hover{ background: rgba(255,255,255,0.06); }
.dropdown-item.danger{ color: #fca5a5; }
.dropdown-item.danger:hover{ background: rgba(239,68,68,0.12); }
.dropdown-sep{ height: 1px; background: rgba(255,255,255,0.08); margin: 8px 6px; }

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

.topbar {
  /* Allow wrapping on smaller screens without clipping */
  min-height: var(--header-height);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;

  padding: 12px 32px;
  padding-top: calc(12px + var(--safe-top));
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 15, 0.8);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Topbar rows */
.topbar > .row{ flex: 1 1 auto; }
.topbar > .row:last-child{
  flex: 0 1 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 8px;
}
.topbar-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }

.content {
  padding: clamp(16px, 3vw, 32px);
  width: 100%;
  max-width: none;
  margin: 0;
}

/* ======================================================
   COMPONENTS
====================================================== */
/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* Optional: Glow effect on card header */
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.section-title {
  font-weight: 700;
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
}

/* Forms */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
}
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.2); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.15);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

/* Input group (suffix like %) */
.input-group{ position: relative; }
.input-group input{ padding-right: 44px; }
.input-suffix{
  position: absolute;
  right: 14px;
  top: calc(100% - 22px);
  transform: translateY(-50%);
  color: var(--text-dim);
  font-weight: 900;
  font-size: 12px;
  pointer-events: none;
}


/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  min-height: var(--tap);
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 12px rgba(255, 106, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 106, 0, 0.35);
}
.btn:active { transform: translateY(0); }

.btn-ghost,
.btn.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none; text-shadow: none;
}
.btn-ghost:hover,
.btn.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-danger,
.btn.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  box-shadow: none; text-shadow: none;
}
.btn-danger:hover,
.btn.btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Icon button (topbar, actions) */
.icon-btn{
  width: var(--tap);
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-1px);
}

.sidebar-toggle{ display:none; }
@media (max-width: 768px){
  .sidebar-toggle{ display:inline-flex; }
}


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

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Alerts/Badges */
.alert {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: #fecaca;
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.alert.ok {
  border-color: var(--success);
  background: var(--success-bg);
  color: #bbf7d0;
}

.alert.warn {
  border-color: rgba(245,158,11,0.65);
  background: rgba(245,158,11,0.14);
  color: #fde68a;
}
.pill, .badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}

.badge.ok {
  border-color: var(--success);
  background: var(--success-bg);
  color: #bbf7d0;
}
.badge.warn {
  border-color: rgba(245,158,11,0.65);
  background: rgba(245,158,11,0.14);
  color: #fde68a;
}

.badge.danger {
  border-color: rgba(239,68,68,0.65);
  background: rgba(239,68,68,0.14);
  color: #fca5a5;
}

/* Tabs (simples) */
.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:6px;
  border-radius:18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.tab{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  color: var(--text-dim);
  font-weight:700;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: all .2s var(--ease);
}
.tab:hover{
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.tab.active{
  background: rgba(255,106,0,0.10);
  border-color: rgba(255,106,0,0.18);
  color: var(--primary);
}

/* ======================================================
   LOGIN & HERO
====================================================== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-left {
  padding: 60px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  background: radial-gradient(circle at bottom left, rgba(255,106,0,0.1), transparent 50%);
}
.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.login-card {
  width: 100%; max-width: 400px;
}
.login-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; }
.login-sub { color: var(--text-dim); margin-bottom: 32px; font-size: 0.95rem; }

/* Hero Typography */
.hero { max-width: 600px; }
.hero h1 {
  font-size: 3.5rem; line-height: 1.1; font-weight: 800;
  background: linear-gradient(135deg, #fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.hero p { font-size: 1.1rem; color: var(--text-dim); max-width: 480px; }

/* ======================================================
   STEPPER
====================================================== */
.stepper { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.step:hover { background: rgba(255, 255, 255, 0.04); }
.step.active {
  border-color: var(--primary);
  background: rgba(255, 106, 0, 0.08);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 106, 0, 0.2);
}
.step i { font-size: 1.1rem; }
.step-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.step-panel { display: none; animation: fadeIn 0.3s ease; }
.step-panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 1024px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { background: transparent; border: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.5rem; }
}

/* Links discretos (login / recovery) */
.link { color: var(--text-dim); text-decoration: none; }
.link:hover { color: var(--text); text-decoration: underline; }

/* Mobile sidebar backdrop */
.sidebar-backdrop{
  display:none;
  position:fixed;
  inset:0;
  background: rgba(0,0,0,0.55);
  z-index:14;
}
body.sidebar-open .sidebar-backdrop{ display:block; }
@media (max-width: 768px){
  body.sidebar-open{ overflow:hidden; }
body.sheet-open{ overflow:hidden; }
}
/* Badge/Pill de perfil (Admin/User) — garante contraste */
.badge,
.pill,
.role-badge,
.user-role,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.12);
}

/* Se o badge vier com fundo branco por algum motivo, força texto escuro */
.badge.is-light,
.pill.is-light,
.role-badge.is-light,
.user-role.is-light {
  background: rgba(255,255,255,.92);
  color: rgba(15, 23, 42, .95);
  border-color: rgba(0,0,0,.10);
}

/* Padrão (dark): fundo escuro translúcido e texto claro */
.badge:not(.is-light),
.pill:not(.is-light),
.role-badge:not(.is-light),
.user-role:not(.is-light) {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
}

/* Específico para ADMIN: ligeiro destaque sem estourar no dark */
.role-admin,
.badge-admin,
.pill-admin {
  background: rgba(255, 106, 0, .12) !important; /* seu laranja */
  color: rgba(255,255,255,.95) !important;
  border-color: rgba(255, 106, 0, .30) !important;
}

/* Específico para USER */
.role-user,
.badge-user,
.pill-user {
  background: rgba(59, 130, 246, .12) !important;
  color: rgba(255,255,255,.95) !important;
  border-color: rgba(59, 130, 246, .30) !important;
}

/* ======================================================
   UX LAYER (toasts, notifications, mobile nav)
   - Mobile-first
   - Reutilizável em todo o Statiz
====================================================== */

/* Toasts (canto superior direito) */
.toast-area{
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 28px));
  pointer-events: none;
}

.toast{
  pointer-events: auto;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 18px;
  background: rgba(11, 17, 27, 0.92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transform: translateY(-4px);
  opacity: 0;
  animation: toastIn .22s var(--ease) forwards;
}

.toast::before{
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
}

.toast .t-ico{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text);
}

.toast .t-ico i{ font-size: 18px; }
.toast .t-title{ font-weight: 900; color: var(--text); line-height: 1.15; }
.toast .t-sub{ margin-top: 3px; font-size: 12px; color: var(--text-dim); line-height: 1.35; }

.toast .t-actions{ display:flex; gap:8px; align-items:center; justify-content:flex-end; }
.toast .t-btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-weight: 800;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.toast .t-btn:hover{ background: rgba(255,255,255,.10); transform: translateY(-1px); }
.toast .t-close{ width: 38px; height: 38px; display:inline-flex; align-items:center; justify-content:center; border-radius:14px; }

.toast.info .t-ico{ background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.22); color: #93c5fd; }
.toast.success .t-ico{ background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.22); color: #86efac; }
.toast.warn .t-ico{ background: rgba(255,106,0,.14); border-color: rgba(255,106,0,.24); color: var(--primary); }
.toast.danger .t-ico{ background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.24); color: #fca5a5; }

@keyframes toastIn{
  from{ opacity:0; transform: translateY(-8px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toastOut{
  from{ opacity:1; transform: translateY(0) scale(1); }
  to{ opacity:0; transform: translateY(-6px) scale(.98); }
}

@media (max-width: 480px){
  .toast-area{ left: 12px; right: 12px; top: 12px; max-width: calc(100vw - 24px); }
  .toast{ grid-template-columns: 38px 1fr auto; }
}

/* Notificações (sininho) */
.notif-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(239,68,68,.92);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}

.notif-menu{ width: min(380px, 92vw); }
.notif-list{ display:flex; flex-direction:column; gap: 8px; padding: 6px; }
.notif-item{
  display:flex;
  align-items:flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  text-decoration: none;
  color: var(--text);
  transition: all .18s var(--ease);
}
.notif-item:hover{ background: rgba(255,255,255,.07); transform: translateY(-1px); }
.notif-ico{
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
}
.notif-ico i{ font-size: 16px; }
.notif-item.danger .notif-ico{ background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.22); color: #fca5a5; }
.notif-item.warn .notif-ico{ background: rgba(255,106,0,.14); border-color: rgba(255,106,0,.22); color: var(--primary); }
.notif-item.info .notif-ico{ background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.22); color: #93c5fd; }
.notif-title{ font-weight: 900; font-size: 13px; line-height: 1.2; }
.notif-sub{ margin-top: 2px; font-size: 12px; color: var(--text-dim); line-height: 1.35; }

/* Mobile bottom navigation (first mobile) */
.mobile-nav{
  display: none;
}

@media (max-width: 768px){
  body.has-mobile-nav .content{ padding-bottom: calc(108px + var(--safe-bottom)); }

  .mobile-nav{
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    z-index: 999;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding:  10px;
    padding-bottom: calc(10px + var(--safe-bottom));
    border-radius: 22px;
    background: rgba(11,17,27,.78);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 20px 70px rgba(0,0,0,.50);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
  }

  .mnav-item{
    text-decoration:none;
    color: var(--text-dim);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 16px;
    border: 1px solid transparent;
    transition: all .18s var(--ease);
    min-height: 56px;
  }
  .mnav-item i{ font-size: 18px; }
  .mnav-item span{ font-size: 10px; font-weight: 900; letter-spacing: .02em; }
  .mnav-item.active{
    background: rgba(255,106,0,.12);
    border-color: rgba(255,106,0,.22);
    color: var(--primary);
  }
  .mnav-item.active i{ color: var(--primary); }
}


/* ======================================================
   APP-LIKE UI (mobile-first)
====================================================== */

/* Helpers (compat) */
.d-flex{ display:flex; }
.flex-column{ flex-direction:column; }
.text-center{ text-align:center; }
.mb-2{ margin-bottom: 10px; }
.gap-2{ gap: 8px; }
.table-responsive{ overflow-x:auto; -webkit-overflow-scrolling: touch; }

/* Status text helpers */
.text-success{ color: var(--success); }
.text-warning{ color: rgba(245,158,11,.95); }
.text-danger{ color: var(--danger); }

/* KPI number */
.stat-number{ font-size: 32px; font-weight: 900; line-height: 1.15; letter-spacing: -0.02em; color: var(--text); }
@media (max-width: 768px){ .stat-number{ font-size: 30px; } }

/* Buttons */
.btn.btn-sm{ padding: 10px 12px; border-radius: 12px; font-size: 0.85rem; min-height: 40px; }
.btn.btn-icon{ width: var(--tap); height: var(--tap); padding: 0; border-radius: 14px; }

/* Page header (large title) */
.page-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.page-head .titles{ min-width:0; }
.page-head .page-title{
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 1.75rem;
  line-height: 1.12;
}
.page-head .page-sub{
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.35;
}
@media (max-width: 768px){
  .page-head{ align-items:flex-start; }
  .page-head .page-title{ font-size: 1.45rem; }
}

/* Search bar */
.searchbar{
  position: relative;
  width: 100%;
  max-width: 420px;
}
.searchbar i{
  position:absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 18px;
  pointer-events:none;
}
.searchbar input{
  padding-left: 44px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
.searchbar input:focus{
  background: rgba(255,255,255,0.06);
}

/* Responsive toggles */
.mobile-only{ display:none; }
.desktop-only{ display:block; }
@media (max-width: 768px){
  .mobile-only{ display:block; }
  .desktop-only{ display:none; }
}

/* App-like lists (cells) */
.list{
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}
.cell{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 14px;
  min-height: var(--tap);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  transition: background .18s var(--ease);
}
.cell:last-child{ border-bottom: none; }
.cell:hover{ background: rgba(255,255,255,0.04); }

.cell-leading{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,106,0,0.12);
  border: 1px solid rgba(255,106,0,0.22);
  color: var(--primary);
  font-weight: 900;
  flex: 0 0 auto;
}
.cell-leading.is-muted{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
}

.cell-body{ flex: 1; min-width:0; }
.cell-title{ font-weight: 900; line-height: 1.2; }
.cell-sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-trailing{
  display:flex;
  align-items:center;
  gap: 10px;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.cell-meta{
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.85);
}
.cell-chevron{ font-size: 18px; opacity: .7; }

/* Sheets (mobile-first bottom sheet, desktop centers) */
.sheet-overlay{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  padding: 12px;
  background: rgba(0,0,0,0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sheet-overlay.open{ display:flex; align-items:flex-end; justify-content:center; }
.sheet{
  width: min(520px, 100%);
  border-radius: 24px;
  background: rgba(11,17,27,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transform: translateY(16px);
  opacity: 0;
  animation: sheetIn .20s var(--ease) forwards;
}
@keyframes sheetIn{ to{ transform: translateY(0); opacity:1; } }
@media (min-width: 769px){
  .sheet-overlay.open{ align-items:center; }
  .sheet{ border-radius: 22px; }
}

.sheet-inner{ padding: 14px 14px 12px; }
.sheet-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sheet-title{ font-weight: 900; font-size: 16px; line-height: 1.2; }
.sheet-sub{ margin-top: 3px; font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.sheet-body{ padding-top: 12px; }
.sheet-actions{ display:flex; flex-direction:column; gap: 10px; padding-top: 12px; }


/* Motion accessibility */
@media (prefers-reduced-motion: reduce){
  .toast{ animation: none; opacity: 1; transform: none; }
  .navlink:hover, .navsublink:hover, .notif-item:hover, .mnav-item{ transition: none; }
}


/* ======================================================
   SURFACES (premium panels) + TOOLBARS
====================================================== */
.surface{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.surface-head{
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.surface-title{
  margin:0;
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 1rem;
}
.surface-sub{
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.35;
}
.surface-body{ padding: 20px; }
.surface-body.flush{ padding: 0; }

/* Compact toolbar grid (forms no topo) */
.toolbar{
  display:grid;
  gap: 10px;
  align-items:end;
}
.toolbar.cols-3{ grid-template-columns: 1.4fr 0.8fr auto; }
.toolbar.cols-4{ grid-template-columns: 1.4fr 0.8fr 0.8fr auto; }

.toolbar .toolbar-actions{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap: wrap;
}

@media (max-width: 900px){
  .toolbar.cols-3,
  .toolbar.cols-4{
    grid-template-columns: 1fr;
  }
  .toolbar .toolbar-actions{ justify-content:flex-start; }
}

/* Wizard: no mobile, stepper vira scroll horizontal (mais “app”) */
@media (max-width: 768px){
  .stepper{
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
  .step{ flex: 0 0 auto; }
}

/* Repeater cards (ex.: atividades físicas) */
.repeat{
  display:flex;
  flex-direction: column;
  gap: 12px;
}
.repeat-item{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  border-radius: calc(var(--radius) + 6px);
  padding: 14px;
}
.repeat-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.repeat-title{
  font-weight: 900;
  letter-spacing: -0.01em;
}
.repeat-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

/* spans (12-col) */
.span-12{ grid-column: span 12; }
.span-8{ grid-column: span 8; }
.span-6{ grid-column: span 6; }
.span-4{ grid-column: span 4; }
.span-3{ grid-column: span 3; }
.span-2{ grid-column: span 2; }
.span-1{ grid-column: span 1; }

@media (max-width: 768px){
  .repeat-grid{ grid-template-columns: 1fr; }
  .span-12,.span-8,.span-6,.span-4,.span-3,.span-2,.span-1{ grid-column: span 1; }
}


/* KPI text (cards) */
.kpi{
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 6px;
}
.kpi .unit{
  font-size: 14px;
  font-weight: 800;
  color: var(--text-dim);
  margin-left: 6px;
}
.kpi-sub{
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.35;
}

/* Embedded frames (Body Map) */
.iframe-wrapper{
  width: 100%;
  height: 560px;
  border: 0;
  border-radius: calc(var(--radius) + 6px);
  background: rgba(0,0,0,0.18);
}
@media (max-width: 768px){
  .iframe-wrapper{ height: 440px; }
}
