/* ══════════════════════════════════════════
   CONTROLE DPA — Design System
   Paleta: Azul escuro (#0B1C30) + Branco
   ══════════════════════════════════════════ */

:root {
  --color-primary: #0B1C30;
  --color-primary-variant: #132B4A;
  --color-primary-light: #1E3A5F;
  --color-accent: #1565C0;
  --color-accent-light: #5B9BFF;
  --color-on-primary: #FFFFFF;
  --color-background: #F8F9FF;
  --color-surface: #FFFFFF;
  --color-on-surface: #0B1C30;
  --color-muted: #45464D;
  --color-muted-light: #8a9fc0;
  --color-drawer-muted: #6B84A8;
  --color-border: #E8EDF5;
  --color-success: #16a34a;
  --color-warning: #ea580c;
  --color-danger: #dc2626;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: var(--font-family);
  background: var(--color-background);
  color: var(--color-on-surface);
  overscroll-behavior-y: contain;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, textarea, select { font-family: inherit; }

/* ── TOPBAR ── */
.topbar {
  background: var(--color-primary);
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  height: calc(56px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #FFFFFF;
  flex-shrink: 0;
  transition: background .15s;
}
.topbar-btn:active { background: rgba(255,255,255,.12); }
.topbar-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

.topbar-title {
  flex: 1;
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 700;
  padding-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── CONTENT ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ── DRAWER (gaveta lateral) ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 270px;
  max-width: 82vw;
  background: var(--color-primary);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.22,1,.36,1);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 24px rgba(0,0,0,.2);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  padding: 20px 16px;
}
.drawer-header .title {
  flex: 1;
  color: #FFFFFF;
  font-size: 19px;
  font-weight: 700;
}
.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.drawer-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.drawer-divider {
  height: 1px;
  background: var(--color-primary-light);
  margin: 0 20px;
}

.drawer-label {
  color: var(--color-drawer-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  padding: 20px 20px 12px;
}

.drawer-item {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 14px;
  margin: 0 10px 6px;
  border-radius: var(--radius-md);
  transition: background .15s;
}
.drawer-item:active { background: var(--color-primary-light); }

.drawer-item-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.drawer-item-icon svg { width: 18px; height: 18px; stroke: var(--color-accent-light); fill: none; stroke-width: 2; }

.drawer-item-text {
  flex: 1;
  padding: 0 14px;
  overflow: hidden;
}
.drawer-item-text .name {
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-item-text .desc {
  color: var(--color-drawer-muted);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-item-arrow svg { width: 14px; height: 14px; stroke: #4A6FA5; fill: none; stroke-width: 2; }

.drawer-spacer { flex: 1; }

.drawer-profile {
  display: flex;
  align-items: center;
  height: 76px;
  padding: 0 14px;
  margin: 8px 10px 20px;
  border-radius: var(--radius-md);
  transition: background .15s;
}
.drawer-profile:active { background: var(--color-primary-light); }

.drawer-profile-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary-light);
  background: var(--color-primary-light);
  flex-shrink: 0;
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-primary);
  display: flex;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.15);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0 10px;
  color: var(--color-drawer-muted);
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.nav-item span { font-size: 10px; font-weight: 600; }
.nav-item.active { color: #FFFFFF; }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--color-primary-light);
  z-index: -1;
}

/* ── CARDS ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 16px;
}
.card-blue {
  background: rgba(21,101,192,.06);
  border: 1px solid rgba(21,101,192,.15);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* ── BUTTONS ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); opacity: .9; }
.btn-primary { background: var(--color-accent); color: #FFFFFF; }
.btn-success { background: var(--color-success); color: #FFFFFF; }
.btn-outline { background: var(--color-surface); color: var(--color-primary); border: 1px solid var(--color-border); }

/* ── INPUTS ── */
.input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 14px;
  color: var(--color-on-surface);
  background: var(--color-surface);
}
.input:focus { outline: none; border-color: var(--color-accent); }

/* ── BADGES / STATUS ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: var(--color-success); color: #FFF; }
.badge-warning { background: var(--color-warning); color: #FFF; }
.badge-info { background: rgba(21,101,192,.1); color: var(--color-accent); }
.badge-muted { background: #F0F2F5; color: var(--color-muted); }

/* ── LOADING ── */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ── */
.toast-wrap {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--color-primary);
  color: #FFF;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastIn .25s ease;
  max-width: 100%;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--color-muted-light); }
.empty-state svg { width: 44px; height: 44px; stroke: #C8D5E8; fill: none; stroke-width: 1.5; margin-bottom: 14px; }
.empty-state h3 { font-size: 14px; font-weight: 700; color: var(--color-muted); margin-bottom: 6px; }
.empty-state p { font-size: 12px; }

/* ── UTILS ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.p-16 { padding: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
