/* ═══════════════════════════════════════════
   GDF3 Dashboard — Folha de estilos principal
   Variáveis de cor são sobrescritas via JS
   após carregar GET /account (primary_color)
═══════════════════════════════════════════ */
/* Garante que [hidden] sempre prevaleça sobre display de classes CSS */
[hidden] { display: none !important; }

:root {
  --brand:        #E07B20;
  --brand-dark:   #c46a18;
  --brand-light:  rgba(224,123,32,.12);
  --sidebar:      #1a1a2e;
  --body:         #f0f2f5;
  --card:         #fff;
  --text:         #1a1a2e;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --green:        #1e8449;
  --green-bg:     #d5f5e3;
  --red:          #c0392b;
  --red-bg:       #fadbd8;
  --blue:         #1a5276;
  --blue-bg:      #d6eaf8;
  --radius:       10px;
  --shadow:       0 2px 8px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--body); color: var(--text); font-size: 13px; }

/* ── Login ── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sidebar) 0%, #16213e 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px 36px;
  width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,.35); text-align: center;
}
.login-logo { margin-bottom: 16px; }
.login-logo-placeholder {
  width: 64px; height: 64px; border-radius: 12px; background: var(--brand);
  color: #fff; font-weight: 800; font-size: 20px; display: inline-flex;
  align-items: center; justify-content: center;
}
.login-logo img { max-width: 160px; max-height: 50px; object-fit: contain; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.login-error { background: var(--red-bg); color: var(--red); font-size: 12px;
  border-radius: 7px; padding: 8px 12px; margin-bottom: 12px; text-align: left; }
.btn-login {
  width: 100%; padding: 11px; background: var(--brand); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer;
  margin-top: 4px; transition: background .15s; font-family: inherit;
}
.btn-login:hover { background: var(--brand-dark); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }
.login-powered { font-size: 11px; color: var(--muted); margin-top: 24px; }

/* ── Shell ── */
.app-shell { display: grid; grid-template-columns: 64px 1fr; min-height: 100vh; background: #f7f8fa; }

/* ── Sidebar slim ── */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 0;
  z-index: 50;
}
.s-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.s-dot {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand); flex-shrink: 0;
  transition: background .3s;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
/* hide text labels — icon-only sidebar */
.s-name, .s-sub { display: none; }

.s-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  overflow-y: auto;
  width: 100%;
}

.ni {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  transition: all .15s;
  position: relative;
  border: 1.5px solid transparent;
}
.ni:hover {
  background: var(--brand-light);
  color: var(--brand);
}
.ni.active {
  background: var(--brand-light);
  color: var(--brand);
  border-color: rgba(224,123,32,.25);
}

/* Tooltip on hover */
.ni::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
.ni:hover::after { opacity: 1; }

/* emoji inside .ni — strip the text node that was there */
.ni-icon { font-size: 18px; line-height: 1; }

.s-foot {
  padding: 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.s-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: default;
  border: 2px solid var(--brand-light);
}
/* hide name/role labels in slim sidebar */
.s-user-name, .s-user-role { display: none; }
.s-logout {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; line-height: 1; transition: color .15s;
  padding: 4px;
}
.s-logout:hover { color: var(--brand); }

/* ── Topbar ── */
.main-area { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 60px; background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 12px;
  position: sticky; top: 0; z-index: 9;
}
.tb-titles { flex: 1; }
.tb-title { font-size: 16px; font-weight: 700; color: var(--text); }
.tb-sub   { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tb-actions { display: flex; gap: 8px; align-items: center; }

/* User chip no topbar */
.tb-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 20px;
  background: var(--body); border: 1px solid var(--border);
  cursor: default;
}
.tb-user-name { font-size: 12px; font-weight: 600; }
.tb-user-role { font-size: 10px; color: var(--muted); }

.page-content { padding: 24px; flex: 1; }
.page-loading { text-align: center; padding: 60px; color: var(--muted); }

/* ── Componentes reutilizáveis ── */
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 700; }
.card-body  { padding: 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px;
  border-radius: 7px; border: 1.5px solid var(--border); background: #fff;
  color: var(--text); font-size: 12px; cursor: pointer; font-weight: 500;
  transition: all .15s; font-family: inherit;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn.ghost { border-color: transparent; background: transparent; padding: 4px 8px; }

.fg { margin-bottom: 14px; }
.fg label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.fg input, .fg select, .fg textarea {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 12px; outline: none; font-family: inherit; transition: border-color .15s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--brand); }
.fg .hint { font-size: 10px; color: var(--muted); margin-top: 4px; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }

/* Overlay / Modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: none; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 540px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { width: 680px; }
.mh { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 2; }
.mt { font-size: 14px; font-weight: 700; }
.mc { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.mb { padding: 18px 20px; }
.mf { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--sidebar);
  color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 12px;
  display: none; align-items: center; gap: 8px; z-index: 300;
  box-shadow: 0 4px 20px rgba(0,0,0,.3); max-width: 400px;
}
.toast.show { display: flex; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

/* Table base */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); background: #fafafa; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tab { padding: 10px 24px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Alert */
.alert { border-radius: 8px; padding: 11px 14px; font-size: 12px; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.alert.info { background: var(--blue-bg); border: 1px solid #aed6f1; color: var(--blue); }
.alert.warn { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }
.alert.success { background: var(--green-bg); border: 1px solid #82e0aa; color: var(--green); }
.alert.danger { background: var(--red-bg); border: 1px solid #f1aeb5; color: var(--red); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .emo { font-size: 40px; margin-bottom: 12px; }
