/* =============================================================
   Apicultura – Componentes reutilizáveis
   Importa tokens.css antes deste arquivo.
   ============================================================= */

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent-strong);
  background: var(--glass);
  padding: 6px 14px;
  border-radius: var(--pill);
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-sm);
  
}
.badge::before {
  content: "";
  width: 8px;
  height: 9px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.badge.on {
  background: rgba(255,255,255,.28);
  color: var(--panel-ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}

/* ── BOTÕES ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--f-ui);
  font-weight: 500;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: var(--pill);
  border: 0;
  color: var(--btn-text);
  background: linear-gradient(180deg, var(--btn-from), var(--btn-to));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 22px -12px rgba(42,26,0,.8);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  background: var(--glass);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-sm);
  
}
.btn.sm   { padding: 9px 18px; font-size: 14px; }
.btn.xs   { padding: 6px 14px; font-size: 13px; }
.btn.danger {
  background: linear-gradient(180deg, #C0392B, #922b21);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 20px -10px rgba(192,57,43,.8);
}

.btn .ar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid;
  place-items: center;
  font-size: 12px;
}

/* ── NAV PÍLULA ── */
.navwrap {
  position: sticky;
  top: calc(10px + env(safe-area-inset-top, 0px));
  z-index: 20;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  margin-top: 10px;
}
nav.pill {
  max-width: 960px;
  margin: 0 auto;
  background: var(--glass);
  
  border-radius: var(--pill);
  padding: 8px 8px 8px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: inset 0 0 0 1px var(--line), var(--sh);
}
nav.pill .links {
  margin-left: auto;
  margin-right: auto;
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: var(--pill);
  padding: 5px;
}
nav.pill .links a {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--pill);
  text-decoration: none;
  color: var(--text-soft);
  font-family: var(--f-ui);
}
nav.pill .links a:hover, nav.pill .links a[aria-current="page"] {
  color: var(--ink);
  background: var(--paper);
}
nav.pill .cta { margin-left: auto; }

@media (max-width: 900px) {
  nav.pill .links { display: none; }
  nav.pill { padding-left: 18px; }
  nav.pill .cta { margin-left: auto; }
}

/* ── CARDS ── */
.card {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card-sm {
  background: var(--paper);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.card-honey {
  background: linear-gradient(165deg, var(--panel-1), var(--panel-2));
  color: var(--panel-ink);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card-honey h3 { color: var(--panel-ink); }
.card-night {
  background: var(--night);
  color: var(--on-night);
  border-radius: var(--r-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ── TABELA ── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl th {
  text-align: left;
  color: var(--text-mute);
  font-weight: 600;
  font-size: 11.5px;
  font-family: var(--f-ui);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl .hm { }
@media (max-width: 640px) { .tbl .hm { display: none; } }

/* ── STATUS PILL ── */
.st {
  display: inline-block;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--pill);
  letter-spacing: .02em;
}
.st.ok   { background: var(--good-soft); color: var(--good); }
.st.warn { background: var(--warn-soft); color: var(--warn); }
.st.bad  { background: var(--bad-soft);  color: var(--bad);  }

/* ── FORMULÁRIO ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: .03em;
}
.form-group input,
.form-group select,
.form-group textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-mute); }
.form-group textarea { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.form-error {
  font-size: 12.5px;
  color: var(--bad);
  margin-top: 2px;
  font-family: var(--f-ui);
}
.form-hint {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 2px;
  font-family: var(--f-ui);
}

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--sh), inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(12px);
  transition: transform .2s ease;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 { margin: 0; }
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--text-mute);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--bg-2); color: var(--ink); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  right: max(24px, calc(env(safe-area-inset-right, 0px) + 16px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: var(--r);
  padding: 14px 18px;
  box-shadow: var(--sh), inset 0 0 0 1px var(--line);
  font-family: var(--f-ui);
  font-size: 14px;
  color: var(--ink);
  pointer-events: auto;
  transform: translateX(calc(100% + 32px));
  transition: transform .3s cubic-bezier(.25,.8,.25,1);
  max-width: 340px;
}
.toast.show  { transform: translateX(0); }
.toast.info  { border-left: 3px solid var(--accent); }
.toast.ok    { border-left: 3px solid var(--good); }
.toast.warn  { border-left: 3px solid var(--warn); }
.toast.error { border-left: 3px solid var(--bad);  }

/* ── CHIP (filtro/sugestão) ── */
.chip {
  font: inherit;
  font-size: 13.5px;
  font-family: var(--f-ui);
  padding: 8px 16px;
  border-radius: var(--pill);
  border: 0;
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-sm);
  
  transition: background .15s;
}
.chip:hover { background: var(--paper); }
.chip.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ── METER (progresso) ── */
.meter {
  height: 8px;
  border-radius: 99px;
  background: var(--bg-2);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #FFC83D, #F5A300);
  border-radius: 99px;
  transition: width .4s ease;
}
.meter-fill.warn { background: linear-gradient(90deg, #E8A000, var(--warn)); }
.meter-fill.bad  { background: linear-gradient(90deg, var(--warn), var(--bad)); }

/* ── SIDEBAR DE PAINEL ── */
.panel-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .logo { margin-bottom: 20px; padding: 0 10px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: var(--paper); color: var(--ink); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar nav a .nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-mute);
  font-family: var(--f-ui);
  padding-inline: 10px;
}
.panel-main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-x: hidden;
}
.panel-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.panel-topbar h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.panel-topbar .spacer { flex: 1; }

@media (max-width: 900px) {
  .panel-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .panel-main { padding: 20px 16px; }
}

/* ── GRADE DE CARDS ── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width:  900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width:  640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── STAT CARD ── */
.stat-card {
  background: var(--paper);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .label {
  font-family: var(--f-ui);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat-card .value {
  font-family: var(--f-ui);
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 500;
  letter-spacing: -.025em;
  color: var(--ink);
  line-height: 1;
}
.stat-card .sub {
  font-size: 12.5px;
  color: var(--text-mute);
}
.stat-card .sub.up   { color: var(--good); }
.stat-card .sub.down { color: var(--bad);  }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: var(--pill);
  padding: 5px;
  width: fit-content;
}
.tab {
  font: inherit;
  font-family: var(--f-ui);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
  padding: 7px 18px;
  border-radius: var(--pill);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink); background: var(--paper); }
.tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--sh-sm);
}

/* ── KEY DISPLAY ── */
.key-display {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  background: var(--night);
  color: #F4E8C8;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.key-display .copy-btn {
  flex-shrink: 0;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #F4E8C8;
  cursor: pointer;
  transition: background .15s;
}
.key-display .copy-btn:hover { background: rgba(255,255,255,.2); }

/* ── CODE BLOCK ── */
.code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px;
  background: var(--night);
  color: #F4E8C8;
  border-radius: var(--r-sm);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.7;
}
.code .k { color: #FFC95C; }
.code .s { color: #A8E0B0; }
.code .c { color: #9a8f72; }

/* ── FAB ── */
.fab {
  position: fixed;
  right: max(18px, calc(env(safe-area-inset-right, 0px) + 12px));
  bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(180deg,#FFC83D,#F5A300);
  color: #2A1A00;
  box-shadow: 0 12px 26px -8px rgba(160,90,0,.7);
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--bg-2); border-color: var(--accent); color: var(--ink); }

/* ── SECTION HELPERS ── */
.band { padding-block: 96px; }
@media (max-width: 640px) { .band { padding-block: 64px; } }

.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  margin-bottom: 48px;
}
.section-head p { color: var(--text-soft); font-size: 17px; max-width: 56ch; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-mute);
  font-family: var(--f-ui);
}
.empty-state .icon { font-size: 36px; opacity: .5; }
.empty-state p { max-width: 36ch; font-size: 14px; }

/* ── ALERT INLINE ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 14px;
  font-family: var(--f-ui);
}
.alert.ok   { background: var(--good-soft); color: #0E5E35; }
.alert.warn { background: var(--warn-soft); color: #7A4300; }
.alert.bad  { background: var(--bad-soft);  color: #7A1A14; }
.alert.info { background: var(--accent-soft); color: var(--accent-strong); }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-ui);
  font-size: 14px;
}
.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--text-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  transition: background .15s;
}
.page-btn:hover { background: var(--bg-2); color: var(--ink); }
.page-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── SKELETON / LOADING ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--line) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.6s ease infinite;
  border-radius: 8px;
}
@keyframes skeleton-wave {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; background: var(--bg-2); } }

/* ── DROPDOWN ── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--paper);
  border-radius: var(--r-sm);
  box-shadow: var(--sh), inset 0 0 0 1px var(--line);
  padding: 6px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s;
}
.dropdown-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dropdown-menu a, .dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--f-ui);
  color: var(--text);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-2); color: var(--ink); }
.dropdown-menu .sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ── QR CODE PLACEHOLDER ── */
.qr-placeholder {
  width: 160px;
  height: 160px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--text-mute);
  font-size: 12px;
  font-family: var(--f-ui);
  text-align: center;
  margin: 0 auto;
}

