/* Verde Nação · Painel — Esteira de Aprovação */

:root {
  --ground: #08221a;
  --panel: #0d2f24;
  --panel-raised: #123829;
  --line: #1c4a39;
  --line-soft: #16402f;
  --ink: #e9f3ed;
  --ink-2: #a3bfb0;
  --ink-3: #7fa190;

  --verde: #3fae3f;
  --verde-claro: #5fd66f;
  --amarelo: #f5c518;
  --azul: #2f6fed;
  --vermelho: #ff6b5b;
  --cinza-estado: #8fa69b;

  --tri: linear-gradient(90deg, var(--verde) 0%, var(--amarelo) 50%, var(--azul) 100%);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --shadow-lift: 0 18px 44px -14px rgba(0, 0, 0, .65);

  --font-ui: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Archivo Black', 'Archivo', system-ui, sans-serif;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: var(--font-ui);
  background: var(--ground);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

::selection { background: var(--amarelo); color: var(--ground); }

:focus-visible {
  outline: 2px solid var(--amarelo);
  outline-offset: 2px;
  border-radius: 4px;
}

* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--ground); }
*::-webkit-scrollbar-track { background: transparent; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--verde-claro); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; display: block; }

.dots {
  position: fixed; pointer-events: none; z-index: 0; opacity: .5;
  width: 180px; height: 180px;
  background-image: radial-gradient(circle, var(--line) 2.5px, transparent 2.5px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(135deg, #000 30%, transparent 75%);
  mask-image: linear-gradient(135deg, #000 30%, transparent 75%);
}
.dots--br { right: 0; bottom: 0; transform: rotate(180deg); }
.dots--tl { left: 0; top: 0; }

/* ============ LOGIN ============ */

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-wave {
  position: fixed; left: 0; right: 0; bottom: -2px; z-index: 0;
  width: 100%; height: clamp(120px, 22vh, 240px);
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 28px;
  padding: 40px 8px;
}

.logo-plate {
  display: inline-flex;
  background: #f2f6f1;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px -6px rgba(0, 0, 0, .4);
}

.login-logo { width: 148px; }
.login-card > div > .logo-plate { margin-bottom: 18px; }

.login-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.6rem);
  line-height: 1.04;
  text-transform: uppercase;
  letter-spacing: .01em;
}
.login-title em { font-style: normal; color: var(--verde-claro); display: block; }

.tri-rule { width: 148px; height: 5px; background: var(--tri); border-radius: 3px; margin-top: 14px; }

.login-sub { color: var(--ink-2); max-width: 34ch; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.field input {
  font: inherit; color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  caret-color: var(--amarelo);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus { outline: none; border-color: var(--verde-claro); background: var(--panel-raised); }
.field input:focus-visible { outline: 2px solid var(--amarelo); outline-offset: 1px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; letter-spacing: .015em;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), box-shadow .2s var(--ease-out), opacity .15s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }

.btn-primary { background: var(--verde-claro); color: var(--ground); box-shadow: 0 6px 20px -8px rgba(95, 214, 111, .5); }
.btn-primary:hover:not([disabled]) { background: #74e082; }

.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover:not([disabled]) { color: var(--ink); border-color: var(--ink-3); }

.btn-danger-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-danger-ghost:hover:not([disabled]) { color: var(--vermelho); border-color: var(--vermelho); }

.form-error {
  display: none;
  background: rgba(255, 107, 91, .1);
  border: 1px solid rgba(255, 107, 91, .4);
  color: #ffb4aa;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .9rem;
}
.form-error.show { display: block; }

/* ============ APP SHELL ============ */

.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 36px);
  background: rgba(8, 34, 26, .92);
  backdrop-filter: blur(10px);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--tri);
}

.header-logo { width: 92px; flex: none; }
.app-header .logo-plate { padding: 5px 9px; flex: none; }

.header-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.1;
}
.header-title small { display: block; font-family: var(--font-ui); font-weight: 500; font-size: .74rem; letter-spacing: .08em; color: var(--ink-2); }

.header-spacer { flex: 1; }

.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px 7px 8px;
  font-weight: 600; font-size: .88rem;
  transition: border-color .15s;
}
.user-chip:hover { border-color: var(--ink-3); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--tri);
  color: var(--ground);
  display: grid; place-items: center;
  font-weight: 800; font-size: .78rem;
}
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  display: none;
  z-index: 50;
}
.user-pop.open { display: block; }
.user-pop button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 7px;
  font-weight: 500; font-size: .92rem;
  color: var(--ink-2);
}
.user-pop button:hover { background: var(--line-soft); color: var(--ink); }
.user-pop svg { width: 16px; height: 16px; }

/* ============ BOARD ============ */

.board-wrap { padding: clamp(12px, 1.6vw, 18px) clamp(16px, 4vw, 36px) 80px; position: relative; z-index: 1; }

.tabs {
  display: none;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 6px;
  border-radius: 999px;
  font-weight: 600; font-size: .86rem;
  color: var(--ink-2);
  transition: background .18s var(--ease-out), color .18s;
}
.tab .count { font-variant-numeric: tabular-nums; font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--line-soft); color: var(--ink-2); }
.tab.active { background: var(--line-soft); color: var(--ink); }
.tab.active[data-lane="pending"] .count { background: var(--amarelo); color: var(--ground); }
.tab.active[data-lane="posted"] .count { background: var(--verde-claro); color: var(--ground); }
.tab.active[data-lane="rejected"] .count { background: var(--cinza-estado); color: var(--ground); }

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  align-items: start;
}

.lane-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  position: relative;
}
.lane-head::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 3px; border-radius: 2px;
  background: var(--lane-ink);
}
.lane-title {
  font-family: var(--font-display);
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.lane-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: .82rem;
  color: var(--ground);
  background: var(--lane-ink);
  border-radius: 999px;
  padding: 2px 10px;
}
.lane[data-lane="pending"] { --lane-ink: var(--amarelo); }
.lane[data-lane="posted"] { --lane-ink: var(--verde-claro); }
.lane[data-lane="rejected"] { --lane-ink: var(--cinza-estado); }

.lane-body { display: flex; flex-direction: column; gap: 18px; }
.lane-body > * { flex-shrink: 0; }

/* ---- cards ---- */

.post-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: card-in .5s var(--ease-out) backwards;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.post-card.leaving {
  transition: opacity .4s var(--ease-out), transform .45s var(--ease-out);
  opacity: 0; transform: translateX(28px) scale(.97);
}

.post-media { position: relative; aspect-ratio: 4 / 5; background: var(--line-soft); }
.post-media img { width: 100%; height: 100%; object-fit: cover; }

.status-chip {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ground);
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: 0 4px 14px -4px rgba(0,0,0,.5);
}
.status-chip svg { width: 12px; height: 12px; }
.status-chip.pending { background: var(--amarelo); }
.status-chip.publishing { background: var(--amarelo); animation: pulse-chip 1.2s ease-in-out infinite; }
.status-chip.posted { background: var(--verde-claro); }
.status-chip.rejected { background: var(--cinza-estado); }
.status-chip.failed { background: var(--vermelho); }
@keyframes pulse-chip { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.post-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 10px; }

.post-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.post-title { font-weight: 700; font-size: 1.02rem; }
.post-cat { font-size: .76rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); flex: none; }

.caption-box { position: relative; }
.caption-text {
  color: var(--ink-2);
  font-size: .9rem;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.caption-box.expanded .caption-text { -webkit-line-clamp: unset; }
.caption-toggle {
  margin-top: 6px;
  font-weight: 600; font-size: .82rem;
  color: var(--verde-claro);
  display: inline-flex; align-items: center; gap: 5px;
}
.caption-toggle svg { width: 13px; height: 13px; transition: transform .2s var(--ease-out); }
.caption-box.expanded .caption-toggle svg { transform: rotate(180deg); }

.caption-edit { display: none; flex-direction: column; gap: 10px; }
.caption-box.editing .caption-edit { display: flex; }
.caption-box.editing .caption-text, .caption-box.editing .caption-toggle { display: none; }
.caption-edit textarea {
  font: inherit; font-size: .9rem; color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  min-height: 150px;
  resize: vertical;
  caret-color: var(--amarelo);
}
.caption-edit textarea:focus { outline: none; border-color: var(--verde-claro); }
.caption-edit-row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.caption-count { margin-right: auto; font-variant-numeric: tabular-nums; font-size: .78rem; color: var(--ink-3); }
.caption-count.over { color: var(--vermelho); font-weight: 700; }

.post-error {
  background: rgba(255, 107, 91, .09);
  border: 1px solid rgba(255, 107, 91, .35);
  color: #ffb4aa;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .85rem;
  display: flex; gap: 9px; align-items: flex-start;
}
.post-error svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.post-meta { font-size: .8rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.post-meta svg { width: 13px; height: 13px; }

.post-actions { display: flex; gap: 10px; }
.post-actions .btn { flex: 1; padding: 11px 10px; font-size: .88rem; white-space: nowrap; }
.post-actions .btn-approve { flex: 1.4; }

.permalink-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  font-weight: 700; font-size: .92rem;
  color: var(--verde-claro);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.permalink-btn:hover { border-color: var(--verde-claro); background: rgba(95, 214, 111, .07); }
.permalink-btn svg { width: 15px; height: 15px; }

/* hold-to-approve */
.btn-approve {
  position: relative;
  overflow: hidden;
  background: var(--verde-claro);
  color: var(--ground);
  touch-action: none;
}
.btn-approve .fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--amarelo), var(--verde));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s var(--ease-out);
}
.btn-approve.holding .fill { transform: scaleX(1); transition: transform 1.1s linear; }
.btn-approve .lbl { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; }
.btn-approve .lbl svg { width: 15px; height: 15px; }

/* ---- empty state ---- */
.lane-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ink-3);
}
.lane-empty .big {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-2);
}
.lane-empty svg { width: 40px; height: 40px; color: var(--line); }
.lane-empty p { font-size: .88rem; max-width: 26ch; }

/* ---- toast ---- */
.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 13px 16px;
  font-size: .92rem; font-weight: 500;
  animation: toast-in .45s var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.toast.out { transition: opacity .3s, transform .3s; opacity: 0; transform: translateY(8px); }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success svg { color: var(--verde-claro); }
.toast.error svg { color: var(--vermelho); }
.toast a { font-weight: 700; }

/* ---- dialog ---- */
dialog {
  background: var(--panel-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 26px;
  width: min(400px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(4, 16, 12, .7); backdrop-filter: blur(3px); }
dialog h2 {
  font-family: var(--font-display);
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 18px;
}
dialog .field { margin-bottom: 12px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
dialog .dlg-body { color: var(--ink-2); font-size: .95rem; }
dialog .dlg-body strong { color: var(--ink); }
.btn-danger { background: var(--vermelho); color: var(--ground); }
.btn-danger:hover:not([disabled]) { background: #ff8577; }

/* board wave — template signature geometry in the panel chrome */
.board-wave {
  position: fixed; left: 0; right: 0; bottom: -2px;
  width: 100%; height: clamp(60px, 10vh, 110px);
  z-index: 0; pointer-events: none; opacity: .55;
}

/* skeleton */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--panel) 40%, var(--panel-raised) 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: sk 1.4s infinite linear;
  aspect-ratio: 4 / 5;
}
@keyframes sk { to { background-position: -200% 0; } }

/* ============ RESPONSIVE ============ */

@media (max-width: 1023px) {
  .tabs { display: flex; position: sticky; top: 68px; z-index: 30; }
  .board { grid-template-columns: 1fr; }
  .lane { display: none; }
  .lane.active { display: block; }
  .lane-head { display: none; }
  .header-title small { display: none; }
  .header-title { font-size: .92rem; }
  .header-logo { width: 74px; }
}

@media (min-width: 1024px) {
  .lane-body { max-height: calc(100vh - 185px); overflow-y: auto; padding: 2px 6px 24px 2px; }
  .caption-text { -webkit-line-clamp: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
