/* ============================================================
   NONO — Global Stylesheet
   ============================================================
   1.  Reset & Base
   2.  Design Tokens
   3.  Layout
   4.  Sidebar
   5.  Topbar
   6.  Botões
   7.  Home
   8.  Banco Naiser
   9.  Modais
   10. Formulários
   11. Footer
   12. Animações
   13. Login
   ============================================================ */

/* 1. Reset & Base ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Geist', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 13px;
}

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

/* 2. Design Tokens ────────────────────────────────────────── */
:root {
  --bg:            #191919;
  --sidebar-bg:    #1e1e1e;
  --surface:       #262626;
  --surface-hover: #2e2e2e;
  --border:        #2f2f2f;
  --text-primary:  #e8e8e8;
  --text-secondary:#999;
  --text-muted:    #666;
  --accent:        #4d9e75;
  --accent-soft:   rgba(77,158,117,0.15);
  --sidebar-w:     240px;
}

/* 3. Layout ───────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.main::-webkit-scrollbar       { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* 4. Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease;
}
.sidebar.collapsed { width: 0; border-right-color: transparent; }
.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-header {
  padding: 12px 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 6px;
  margin: 4px 6px;
  transition: background 0.15s;
  white-space: nowrap;
}
.sidebar-header:hover { background: var(--surface-hover); }

.workspace-icon {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #4d9e75, #2d6a4f);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.workspace-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-actions {
  padding: 2px 10px 8px;
  display: flex; gap: 2px;
  white-space: nowrap;
}

.sb-action-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.sb-action-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.sb-action-btn.active { color: var(--text-primary); }

.sidebar-section { padding: 0 6px; margin-bottom: 4px; white-space: nowrap; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  font-size: 13px; font-weight: 400;
}
.sb-item:hover  { background: var(--surface-hover); color: var(--text-primary); }
.sb-item.active { background: var(--surface);       color: var(--text-primary); }

.sb-item-icon  { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.sb-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 5. Topbar ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 10;
}

.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}

.topbar-actions { margin-left: auto; display: flex; gap: 4px; }

.topbar-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background 0.15s;
}
.topbar-btn:hover { background: var(--surface-hover); color: var(--text-primary); }

.toggle-sidebar-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.toggle-sidebar-btn:hover { background: var(--surface-hover); color: var(--text-primary); }

/* 6. Botões ───────────────────────────────────────────────── */
.btn-action {
  font-size: 12px; font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(77,158,117,0.25);
  border-radius: 6px;
  padding: 4px 12px;
  transition: background 0.15s;
}
.btn-action:hover { background: rgba(77,158,117,0.25); }

.btn-sm {
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  padding: 3px 10px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn-sm:hover { background: #3a3a3a; color: var(--text-primary); }
.btn-sm.btn-danger       { color: #c0392b; border-color: rgba(192,57,43,0.3); }
.btn-sm.btn-danger:hover { background: rgba(192,57,43,0.15); color: #e74c3c; }
.btn-expand { width: 28px; padding: 3px 0; text-align: center; }

.btn-primary {
  font-size: 12.5px; font-weight: 600;
  background: var(--accent);
  color: #fff; border: none;
  border-radius: 6px;
  padding: 7px 18px;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  font-size: 12.5px; font-weight: 500;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 18px;
  transition: background 0.12s;
}
.btn-secondary:hover { background: var(--surface-hover); }

/* 7. Home ─────────────────────────────────────────────────── */
.home-content {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px 40px;
}

.greeting {
  font-size: 32px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 40px;
  letter-spacing: -0.5px;
}

.section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
}
.section-header-icon { font-size: 14px; opacity: 0.7; }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 40px;
}

.recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer; overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 110px;
  display: flex; flex-direction: column;
}
.recent-card:hover { border-color: #3f3f3f; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }

.card-cover {
  height: 52px;
  background: var(--surface-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.card-cover.banco        { background: linear-gradient(135deg, #1a3a2a 0%, #2d6a4f 100%); }
.card-cover.games        { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
.card-cover.aniversarios { background: linear-gradient(135deg, #2d1b4e 0%, #4a1a6e 100%); }
.card-cover.bonato       { background: linear-gradient(135deg, #1e2a3a 0%, #2a3f5f 100%); }
.card-cover.vpn          { background: linear-gradient(135deg, #2a1a1a 0%, #4a2a2a 100%); }

.card-body {
  padding: 10px 12px; flex: 1;
  display: flex; flex-direction: column; justify-content: space-between;
}
.card-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* 8. Banco Naiser ─────────────────────────────────────────── */
.banco-content {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }

.pessoa-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }

.pessoa-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }

.pessoa-info  { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pessoa-nome  { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pessoa-apelido { font-size: 12px; color: var(--text-muted); }

.pessoa-totais { display: flex; gap: 20px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.totais-item strong { font-weight: 600; }

.pessoa-actions { display: flex; gap: 6px; flex-shrink: 0; }

.emprestimos-wrap { border-top: 1px solid var(--border); }
.emp-empty, .emp-loading { padding: 12px 16px; font-size: 12px; color: var(--text-muted); }

.emp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.emp-table th {
  text-align: left; padding: 8px 12px;
  color: var(--text-muted); font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--surface); white-space: nowrap;
}
.emp-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.emp-table tr:last-child td { border-bottom: none; }
.emp-table tr:hover td { background: var(--surface-hover); }

.td-desc { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge { font-size: 10.5px; font-weight: 500; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.badge-green  { background: rgba(77,158,117,0.15); color: #4d9e75; }
.badge-orange { background: rgba(224,123,57,0.15); color: #e07b39; }
.badge-red    { background: rgba(192,57,43,0.15);  color: #c0392b; }

.green  { color: #4d9e75; }
.orange { color: #e07b39; }

.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted); font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}

/* 9. Modais ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%; max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 14px;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.12s;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text-primary); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* 10. Formulários ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }

.form-group input,
.form-group select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group select { cursor: pointer; }

.form-info { font-size: 13px; font-weight: 600; color: var(--text-primary); padding: 6px 0; }
.form-info.orange { color: #e07b39; }

/* 11. Footer ──────────────────────────────────────────────── */
.footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-muted);
  font-size: 14px;
}

.sidebar-section-label {
  padding: 12px 8px 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 8px 6px;
  border-top: 1px solid var(--border);
}

.sb-logout-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 13px; text-align: left;
  transition: background 0.12s, color 0.12s;
}
.sb-logout-btn:hover { background: var(--surface-hover); color: #e07b39; }

/* 12. Animações ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home-content > *              { animation: fadeInUp 0.35s ease both; }
.home-content > *:nth-child(1) { animation-delay: 0.05s; }
.home-content > *:nth-child(2) { animation-delay: 0.10s; }
.home-content > *:nth-child(3) { animation-delay: 0.15s; }
.home-content > *:nth-child(4) { animation-delay: 0.20s; }
.home-content > *:nth-child(5) { animation-delay: 0.25s; }
.home-content > *:nth-child(6) { animation-delay: 0.30s; }

/* 13. Login ───────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}

.login-container { width: 100%; max-width: 360px; padding: 24px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  overflow: hidden;
}

.login-header {
  padding: 28px 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}

.login-logo { width: 40px; height: 40px; font-size: 14px; }

.login-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }

.login-sub { font-size: 12px; color: var(--text-muted); }

.login-body {
  padding: 24px 28px 28px;
  display: flex; flex-direction: column; gap: 16px;
}

.login-btn { width: 100%; padding: 9px; font-size: 13.5px; }

.login-error { font-size: 12px; color: #e07b39; min-height: 16px; }

/* 14. Admin ───────────────────────────────────────────────── */
.admin-content {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 40px;
}

.usuarios-table td { vertical-align: middle; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-avatar-initials {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #4d9e75, #2d6a4f);
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}

.user-avatar-lg { width: 56px; height: 56px; font-size: 20px; }

.foto-upload-row {
  display: flex; align-items: center; gap: 12px;
}

.foto-label {
  cursor: pointer;
  display: inline-block;
}
