/* =====================================================================
   ÁREA ADMINISTRATIVA (MASTER) — tema CLARO institucional
   Consistente com o restante do site (creme/verde/rosa, Fraunces + Inter,
   cartões de vidro suaves). Carregar SOZINHO (não depende do design-system).
   ===================================================================== */
:root {
  --a-bg: #fdf8f4;
  --a-bg2: #f4ece6;
  --a-panel: rgba(255, 255, 255, 0.82);
  --a-panel-solid: #ffffff;
  --a-border: rgba(15, 46, 28, 0.1);
  --a-border-strong: rgba(46, 125, 70, 0.34);
  --a-green: #2e7d46;
  --a-green-strong: #1f4d2e;
  --a-green-soft: rgba(46, 125, 70, 0.1);
  --a-rose: #c0526a;
  --a-gold: #a6790c;
  --a-text: #21302a;
  --a-heading: #1c3a26;
  --a-muted: #7a887e;
  --a-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --a-sans: "Inter", system-ui, -apple-system, sans-serif;
  --a-display: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html:has(.login-wrap) { overscroll-behavior: none; touch-action: manipulation; }
.admin {
  margin: 0; font-family: var(--a-sans); color: var(--a-text);
  background:
    radial-gradient(46rem 34rem at 6% -12%, rgba(46, 125, 70, 0.08), transparent 60%),
    radial-gradient(40rem 30rem at 108% 0%, rgba(224, 114, 138, 0.06), transparent 58%),
    linear-gradient(180deg, var(--a-bg), var(--a-bg2));
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
.admin a { color: var(--a-green); text-decoration: none; }
.admin h1, .admin h2, .admin h3 { font-family: var(--a-display); font-weight: 600; color: var(--a-heading); letter-spacing: -0.005em; }
.admin ::selection { background: rgba(46, 125, 70, 0.18); color: var(--a-green-strong); }
.admin :focus-visible { outline: 2px solid var(--a-green); outline-offset: 2px; }

/* cartão de vidro claro */
.a-glass {
  background: var(--a-panel); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--a-border); border-radius: 16px;
  box-shadow: 0 12px 36px rgba(15, 46, 28, 0.07);
}

/* ênfase (antes "neon") — agora só cor, sem brilho */
.neon { color: var(--a-green-strong); }
.neon-green { color: var(--a-green); }
.neon-rose { color: var(--a-rose); }
.mono { font-family: var(--a-mono); }

/* botões */
.a-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.3rem; cursor: pointer;
  font: inherit; font-weight: 700; border-radius: 10px; border: 1px solid var(--a-border-strong);
  background: var(--a-green-soft); color: var(--a-green-strong);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.a-btn:hover { background: rgba(46, 125, 70, 0.16); }
.a-btn.solid { background: linear-gradient(135deg, var(--a-green), var(--a-green-strong)); color: #fff; border: none; box-shadow: 0 8px 20px rgba(46, 125, 70, 0.26); }
.a-btn.solid:hover { filter: brightness(1.05); }
.a-btn.ghost { background: transparent; color: var(--a-green-strong); border-color: var(--a-border); }
.a-btn.ghost:hover { background: var(--a-green-soft); }
.a-btn.danger { border-color: rgba(192, 82, 106, 0.5); color: var(--a-rose); background: rgba(192, 82, 106, 0.07); }
.a-btn.danger:hover { background: var(--a-rose); color: #fff; border-color: var(--a-rose); }
.a-btn:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }
.brand-line { font-family: var(--a-sans); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.16em; color: var(--a-green); text-transform: uppercase; margin: 0 0 0.4rem; }
.a-sub { color: var(--a-muted); margin: 0.25rem 0 0; }

/* ---------- LOGIN ADMINISTRATIVO ---------- */
.login-wrap {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow: auto;
}
.login-card { width: min(430px, 100%); max-height: calc(100svh - 2rem); overflow: auto; padding: clamp(1.35rem, 4vh, 2rem); scrollbar-width: thin; }
.login-head { text-align: center; margin-bottom: 1.6rem; }
.login-logo {
  width: 56px; height: 56px; padding: 2px; border-radius: 50%; background: #fffdf9; object-fit: contain;
  margin: 0.45rem auto 0.25rem; display: block; border: 1px solid var(--a-border);
  box-shadow: 0 12px 28px rgba(46, 125, 70, 0.18);
}
.login-card .brand-line { font-family: var(--a-sans); font-size: 0.74rem; letter-spacing: 0.18em; color: var(--a-green); text-transform: uppercase; }
.login-card h1 { font-size: 1.6rem; margin: 0.4rem 0 0.25rem; }
.login-card .sub { color: var(--a-muted); font-size: 0.9rem; margin: 0; }
.admin-login-form { display: block; text-align: left; }
.login-submit { width: 100%; justify-content: center; margin-top: 0.2rem; }
.form-status { font-family: var(--a-sans); font-size: 0.82rem; color: var(--a-muted); min-height: 1.25em; margin: 0.9rem 0 0; }
.form-status.ok { color: var(--a-green); }
.form-status.err { color: var(--a-rose); }
.login-foot { margin: 1.4rem 0 0; font-size: 0.82rem; text-align: center; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.a-field { margin-bottom: 1rem; }
.a-field label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--a-green-strong); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.05em; }
.a-field input, .a-field select, .a-field textarea {
  width: 100%; min-height: 46px; padding: 0.75rem 0.9rem; font: inherit; font-size: 16px; color: var(--a-text);
  background: #fff; border: 1px solid var(--a-border); border-radius: 10px;
}
.a-field input:focus, .a-field select:focus, .a-field textarea:focus { outline: none; border-color: var(--a-green); box-shadow: 0 0 0 3px rgba(46, 125, 70, 0.16); }
.a-demo { margin-top: 1.2rem; font-family: var(--a-sans); font-size: 0.78rem; color: var(--a-muted); border: 1px dashed var(--a-border); border-radius: 10px; padding: 0.7rem 0.9rem; background: rgba(46, 125, 70, 0.04); }

/* ---------- LAYOUT DO PAINEL ---------- */
.a-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.a-side { padding: 1.4rem 1rem; border-right: 1px solid var(--a-border); background: rgba(255, 255, 255, 0.55); }
.a-side .a-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.6rem; }
.a-side .a-brand img { width: 38px; height: 38px; padding: 2px; border-radius: 50%; background: #fffdf9; border: 1px solid var(--a-border); object-fit: contain; }
.a-side .a-brand b { color: var(--a-heading); display: block; font-family: var(--a-display); font-weight: 600; font-size: 1.02rem; }
.a-side .a-brand small { display: block; color: var(--a-muted); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.1rem; }
.a-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.a-nav a { padding: 0.7rem 0.9rem; border-radius: 10px; color: var(--a-text); font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 0.6rem; transition: background 0.15s ease, color 0.15s ease; }
.a-nav a:hover { background: var(--a-green-soft); color: var(--a-green-strong); }
.a-nav a.active { background: var(--a-green); color: #fff; box-shadow: 0 8px 18px rgba(46, 125, 70, 0.24); }
.a-side-foot { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--a-border); display: grid; gap: 0.9rem; }
.a-side-foot strong { display: block; margin-top: 0.55rem; color: var(--a-heading); font-size: 0.92rem; }
.a-side-foot small { display: block; color: var(--a-muted); margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; }
.a-main { padding: 1.7rem 2rem; }
.a-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; gap: 1rem; flex-wrap: wrap; }
.a-topbar h1 { font-size: 1.75rem; }

.a-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.a-stat { padding: 1.2rem 1.3rem; }
.a-stat .label { font-size: 0.76rem; color: var(--a-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.a-stat .num { font-size: 1.9rem; font-weight: 700; margin-top: 0.2rem; font-family: var(--a-display); color: var(--a-green-strong); }
.a-grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 1rem; margin-top: 1rem; }
.a-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.a-panel { padding: 1.3rem; }
.a-panel.compact { display: grid; gap: 0.8rem; align-content: start; }
.a-panel h2 { margin: 0; font-size: 1.15rem; }
.a-panel p { color: var(--a-muted); margin: 0; line-height: 1.55; }
.a-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.a-form { display: grid; gap: 0.15rem; }
.a-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.a-check-row { display: grid; gap: 0.55rem; margin: 0.2rem 0 1rem; }
.a-check-row label { display: flex; align-items: flex-start; gap: 0.55rem; color: var(--a-text); font-size: 0.88rem; line-height: 1.35; }
.a-check-row input { accent-color: var(--a-green); margin-top: 0.1rem; }
.a-help { color: var(--a-muted); font-size: 0.8rem; line-height: 1.6; padding: 0.8rem 0.9rem; border: 1px dashed var(--a-border); border-radius: 10px; background: rgba(46, 125, 70, 0.04); }
.a-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.7rem; margin-top: 1rem; }
.a-form-actions .form-status { margin: 0 auto 0 0; align-self: center; }
.a-settings-grid { display: grid; gap: 1rem; }
.a-settings-group { border: 1px solid var(--a-border); border-radius: 14px; padding: 1rem; margin: 0; background: rgba(255, 255, 255, 0.5); }
.a-settings-group legend { padding: 0 0.45rem; color: var(--a-green); font-family: var(--a-sans); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.12em; }
.terminal.mini { margin-top: 1rem; max-height: 180px; }

/* console de logs (mantido escuro — padrão para logs, como um bloco de código) */
.terminal { background: #182219; border: 1px solid rgba(15, 46, 28, 0.2); border-radius: 14px; font-family: var(--a-mono); font-size: 0.82rem; padding: 1rem 1.2rem; line-height: 1.7; max-height: 340px; overflow-y: auto; color: #dbe7de; }
.terminal .ln { display: flex; gap: 0.7rem; }
.terminal .ts { color: #8fa79a; flex-shrink: 0; }
.terminal .lv-info { color: #7fc8e8; }
.terminal .lv-ok { color: #79d18f; }
.terminal .lv-warn { color: #ecc766; }
.terminal .lv-crit { color: #ff8fa0; }

/* alertas */
.a-alert { border-radius: 14px; padding: 1rem 1.3rem; display: flex; align-items: center; gap: 0.9rem; border: 1px solid; }
.a-alert.crit { background: rgba(192, 82, 106, 0.1); border-color: rgba(192, 82, 106, 0.42); color: #8f2438; }
.a-alert.warn { background: rgba(166, 121, 12, 0.1); border-color: rgba(166, 121, 12, 0.4); color: #6d5410; }
.a-alert .pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--a-rose); box-shadow: 0 0 0 0 rgba(192, 82, 106, 0.5); animation: aPulse 1.6s infinite; flex-shrink: 0; }
@keyframes aPulse { 0% { box-shadow: 0 0 0 0 rgba(192, 82, 106, 0.5); } 70% { box-shadow: 0 0 0 12px rgba(192, 82, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(192, 82, 106, 0); } }

/* tabelas */
.a-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.a-table th { text-align: left; color: var(--a-muted); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--a-border); }
.a-table td { padding: 0.8rem; border-bottom: 1px solid rgba(15, 46, 28, 0.07); }
.a-table small { color: var(--a-muted); }
.a-table-wrap { overflow-x: auto; }
.a-row-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.a-mini-btn { border: 1px solid var(--a-border); color: var(--a-green-strong); background: var(--a-green-soft); border-radius: 8px; padding: 0.35rem 0.55rem; font: inherit; font-size: 0.76rem; font-weight: 700; cursor: pointer; transition: background 0.15s ease; }
.a-mini-btn:hover { background: rgba(46, 125, 70, 0.18); }
.a-pill { font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid currentColor; }
.a-pill.ok { color: var(--a-green); } .a-pill.warn { color: var(--a-gold); } .a-pill.crit { color: var(--a-rose); } .a-pill.muted { color: var(--a-muted); }

.a-contact-list { display: grid; gap: 0.8rem; }
.a-contact-item { padding: 1rem; border: 1px solid var(--a-border); border-radius: 12px; background: rgba(255, 255, 255, 0.6); }
.a-contact-item header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; }
.a-contact-item header strong { color: var(--a-heading); }
.a-contact-item header span, .a-contact-item a { color: var(--a-muted); font-size: 0.8rem; }
.a-contact-item h3 { margin: 0.55rem 0 0.35rem; font-size: 1rem; color: var(--a-green-strong); }
.a-contact-item p { margin: 0; color: var(--a-text); white-space: pre-wrap; }

.a-shell, .a-side, .a-main, .a-panel, .a-panel-head, .a-topbar, .a-stats, .a-grid-2, .a-grid-3, .a-form-grid, .a-settings-group, .a-contact-item { min-width: 0; }
.a-panel p, .a-sub, .brand-line, .a-contact-item p, .a-field input, .a-field textarea, .a-field select { overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .a-shell { grid-template-columns: minmax(0, 1fr); }
  .a-side { border-right: none; border-bottom: 1px solid var(--a-border); }
  .a-nav { flex-direction: row; flex-wrap: wrap; }
  .a-stats { grid-template-columns: 1fr 1fr; }
  .a-grid-2, .a-grid-3, .a-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .a-main { padding: 1.2rem; }
  .a-stats { grid-template-columns: 1fr; }
  .a-form-actions { justify-content: stretch; }
  .a-form-actions .a-btn { width: 100%; justify-content: center; }
}

@media (max-width: 700px) {
  .login-wrap { padding: 0.7rem; }
  .login-card { padding: 1rem; border-radius: 16px; }
  .login-logo { width: 48px; height: 48px; margin-top: 0.2rem; }
  .login-head { margin-bottom: 1rem; }
  .login-card .brand-line { font-size: 0.66rem; letter-spacing: 0.14em; }
  .login-card h1, .login-brand h1 { font-size: 1.3rem; }
  .login-card .sub { font-size: 0.82rem; }
  .a-field { margin-bottom: 0.75rem; }
  .a-field label { font-size: 0.7rem; }
  .a-field input, .a-field select, .a-field textarea { min-height: 42px; padding: 0.64rem 0.75rem; }
  .a-btn { min-height: 42px; justify-content: center; padding: 0.65rem 1rem; }
  .login-foot { margin-top: 1rem; }
  .a-side { padding: 1rem; }
  .a-side .a-brand { margin-bottom: 1rem; }
  .a-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
  .a-nav a { justify-content: center; text-align: center; padding: 0.7rem 0.55rem; }
  .a-side-foot { grid-template-columns: 1fr; }
  .a-main { padding: 1rem; }
  .a-topbar { align-items: flex-start; flex-direction: column; }
  .a-topbar h1 { font-size: 1.45rem; }
  .a-panel { padding: 1rem; border-radius: 14px; }
  .a-panel-head { align-items: flex-start; flex-direction: column; }
  .a-settings-group { padding: 0.85rem; }
  .terminal { font-size: 0.76rem; padding: 0.85rem; }
  .terminal .ln { display: block; padding-bottom: 0.45rem; }
  .a-contact-item header { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
}

@media (max-width: 480px) {
  .a-nav { grid-template-columns: 1fr; }
  .a-table-wrap .a-table { min-width: 680px; }
  .a-form-actions { display: grid; grid-template-columns: 1fr; }
  .a-form-actions .form-status { margin: 0; order: 2; }
  .a-alert { align-items: flex-start; padding: 0.9rem; }
  .a-main { padding: 0.75rem; }
  .a-stats { gap: 0.75rem; }
  .a-stat { padding: 0.95rem; }
  .a-stat .num { font-size: 1.5rem; }
  .a-grid-2, .a-grid-3 { gap: 0.75rem; margin-top: 0.75rem; }
}

/* Cards do hub do dashboard */
.a-card-link { display: flex; flex-direction: column; gap: 0.75rem; text-decoration: none; color: var(--a-text); transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease; }
.a-card-link:hover { border-color: var(--a-border-strong); transform: translateY(-4px); box-shadow: 0 22px 48px rgba(15, 46, 28, 0.1); }
.a-card-link h2 { margin: 0; font-size: 1.15rem; }
.a-card-link p { margin: 0; color: var(--a-muted); font-size: 0.88rem; line-height: 1.5; flex: 1; }
.a-card-link .a-btn { align-self: flex-start; pointer-events: none; margin-top: auto; }
