/* ============================================================
   Tribuna — sistema de design ("mesa editorial")
   Tokens + componentes compartilhados por todas as páginas.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Superfícies e tinta */
  --bg:        #eceef1;
  --surface:   #ffffff;
  --surface-2: #f6f7f9;
  --ink:       #171e2b;
  --ink-2:     #566072;
  --ink-3:     #8a93a1;
  --line:      #dfe3e8;
  --line-2:    #eceef1;

  /* Âmbar = sinal / marca (usar com parcimônia) */
  --accent:      #b5730a;
  --accent-soft: #f4e9d6;
  --accent-ink:  #6f4700;

  /* Cores de status do pipeline */
  --draft:      #8a93a1;
  --approved:   #2f6fd6;
  --scheduled:  #b5730a;
  --publishing: #6c4cd6;
  --published:  #1f8a52;
  --failed:     #c0392b;

  /* Tipografia */
  --display: 'Fraunces', Georgia, serif;
  --sans:    'Hanken Grotesk', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Estrutura */
  --radius:   10px;
  --radius-s: 7px;
  --shadow:   0 1px 2px rgba(23,30,43,.04), 0 4px 16px rgba(23,30,43,.06);
  --shadow-lg:0 8px 40px rgba(23,30,43,.12);
  --sidebar:  244px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Utilitários tipográficos ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.display { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.muted   { color: var(--ink-2); }

/* ============================================================
   APP SHELL — sidebar + conteúdo
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: #cdd3dd;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.wordmark {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  color: #fff;
  padding: 6px 10px 20px;
  letter-spacing: -.02em;
}
.wordmark span { color: var(--accent); }

.nav-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6b7688;
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-s);
  color: #cdd3dd;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(181,115,10,.16); color: #fff; }
.nav-item.active .ico { color: var(--accent); }
.nav-item .ico { width: 17px; height: 17px; color: #8a93a1; flex: none; }

.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.acct { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.acct .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.acct .who { font-size: 13px; line-height: 1.25; overflow: hidden; }
.acct .who b { color: #fff; font-weight: 600; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.acct .who small { color: #7c8697; font-size: 11px; }

/* ---------- Área de conteúdo ---------- */
.main { padding: 30px 40px 64px; max-width: 1120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -.02em; }
.page-head p { color: var(--ink-2); font-size: 14px; margin-top: 4px; }

/* ============================================================
   COMPONENTES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }

/* Botões */
.btn {
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 8px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--line-2); }
.btn-danger { background: transparent; color: var(--failed); border-color: transparent; }
.btn-danger:hover { background: #fbecea; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* Campos */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13px; font-weight: 600;
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--ink-3); margin: -2px 0 8px; font-weight: 400; }
.input, .textarea, select.input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

/* Pílulas de status */
.pill {
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill::before { content:''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.draft      { color: var(--draft);      background: #eef0f2; }
.pill.approved   { color: var(--approved);   background: #eaf1fc; }
.pill.scheduled  { color: var(--scheduled);  background: var(--accent-soft); }
.pill.publishing { color: var(--publishing); background: #efeafb; }
.pill.published  { color: var(--published);  background: #e7f4ee; }
.pill.failed     { color: var(--failed);     background: #fbecea; }

/* Pipeline (elemento-assinatura) */
.pipeline { display: flex; align-items: center; gap: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.pipeline .step { display: flex; align-items: center; gap: 7px; color: var(--ink-3); }
.pipeline .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.pipeline .step.done { color: var(--ink); }
.pipeline .step.done .dot { background: var(--accent); border-color: var(--accent); }
.pipeline .step.current .dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pipeline .bar { width: 34px; height: 2px; background: var(--line); margin: 0 8px; }
.pipeline .bar.done { background: var(--accent); }

/* Toast / feedback */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-s);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--failed); }

/* Aviso de configuração */
.notice {
  background: var(--accent-soft); border: 1px solid #e6d3ac;
  color: var(--accent-ink); border-radius: var(--radius-s);
  padding: 12px 15px; font-size: 13px; margin-bottom: 22px;
  display: flex; gap: 10px; align-items: flex-start;
}
.notice code { font-family: var(--mono); font-size: 12px; background: rgba(111,71,0,.1); padding: 1px 5px; border-radius: 4px; }

/* Estado vazio */
.empty { text-align: center; padding: 60px 20px; }
.empty h3 { font-family: var(--display); font-size: 22px; font-weight: 500; margin-bottom: 8px; }
.empty p { color: var(--ink-2); font-size: 14px; margin-bottom: 20px; }

/* Grid de duas colunas */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.split-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

/* Modal simples */
.modal-bg { position: fixed; inset: 0; background: rgba(23,30,43,.4); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal-bg.show { display: grid; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; }

/* Responsivo */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .wordmark { padding: 6px 10px; }
  .nav-label { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .main { padding: 22px 18px 50px; }
  .split, .split-3 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

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