/* =====================================================================
   GAZETA GASPARENSE — Painel administrativo (v2)
   ===================================================================== */
:root{
  --ink:#15191f; --ink-soft:#4a5260; --ink-faint:#8a92a0;
  --bg:#f4f5f7; --panel:#ffffff; --line:#e6e8ec; --line-strong:#d3d7de;
  --brand:#b11226; --brand-dark:#8a0e1d; --brand-tint:#fbecee;
  --link:#b11226; --ok:#15803d; --warn:#c2410c; --danger:#b91c1c;
  --sidebar:#15191f; --sidebar-soft:#232831; --sidebar-text:#c3c9d3;
  --sans:"Schibsted Grotesk",system-ui,-apple-system,"Segoe UI",sans-serif;
  --display:"Fraunces",Georgia,serif;
  --radius:14px; --r-ui:10px;
  --shadow:0 1px 2px rgba(21,25,31,.04),0 8px 24px rgba(21,25,31,.05);
  --ease:cubic-bezier(.2,.7,.2,1);
}
*{ box-sizing:border-box; }
body{ margin:0; font-family:var(--sans); background:var(--bg); color:var(--ink); font-size:15px; line-height:1.55; -webkit-font-smoothing:antialiased; }
a{ color:var(--link); text-decoration:none; }
a:hover{ color:var(--brand-dark); }
img{ max-width:100%; display:block; }
:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }
code{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.86em; }

/* ======================= LOGIN ======================= */
.login-body{ background:var(--paper, #fff); }
.login{ min-height:100vh; min-height:100dvh; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.login__side{
  position:relative; overflow:hidden; background:var(--sidebar); color:#d5dae2;
  display:flex; flex-direction:column; justify-content:center; padding:56px clamp(32px,6vw,88px);
}
.login__side::after{ /* faixa vermelho-gazeta na borda, como a fita da "última hora" */
  content:""; position:absolute; top:0; right:0; width:6px; height:100%; background:var(--brand);
}
.login__side-logo{ height:44px; width:auto; max-width:100%; align-self:flex-start; object-fit:contain; margin-bottom:40px; }
.login__side-title{ font-family:var(--display); font-weight:900; font-size:clamp(2.2rem,3.6vw,3.2rem); line-height:1.02; letter-spacing:-.02em; color:#fff; margin:0 0 16px; }
.login__side-text{ font-size:1.05rem; line-height:1.6; max-width:34ch; margin:0; color:#aeb5c0; }
.login__side-foot{ position:absolute; left:clamp(32px,6vw,88px); bottom:32px; font-size:.82rem; color:#7d8592; }
.login__panel{ display:flex; align-items:center; justify-content:center; padding:40px 24px; background:#fff; }
.login__card{ width:100%; max-width:380px; }
.login__logo{ height:34px; width:auto; margin:0 0 34px; display:none; }
.login__title{ font-family:var(--display); font-weight:900; font-size:2rem; line-height:1.1; letter-spacing:-.02em; margin:0 0 6px; }
.login__lead{ color:var(--ink-soft); margin:0 0 26px; }
.login__hint{ font-size:.85rem; color:var(--ink-soft); background:var(--bg); border-radius:var(--r-ui); padding:12px 14px; margin:20px 0 0; }
.login__back{ display:inline-block; margin-top:26px; font-size:.88rem; color:var(--ink-soft); }
.login__back:hover{ color:var(--brand); }
.pass{ position:relative; }
.pass .input{ padding-right:88px; }
.pass__toggle{
  position:absolute; top:50%; right:6px; transform:translateY(-50%);
  height:34px; padding:0 12px; border:0; border-radius:8px; background:var(--bg);
  font-family:inherit; font-size:.8rem; font-weight:600; color:var(--ink-soft); cursor:pointer;
}
.pass__toggle:hover{ background:var(--line); color:var(--ink); }

/* ======================= SHELL ======================= */
.shell{ display:grid; grid-template-columns:256px minmax(0,1fr); min-height:100vh; }
.aside{ background:var(--sidebar); color:var(--sidebar-text); position:sticky; top:0; height:100vh; display:flex; flex-direction:column; z-index:60; }
.aside__brand{ padding:24px 22px 18px; border-bottom:1px solid var(--sidebar-soft); }
.aside__logo{ height:26px; width:auto; display:block; }
.aside__brand small{ display:block; font-weight:500; font-size:.78rem; color:#7d8592; margin-top:8px; }
.aside nav{ padding:12px; flex:1; overflow:auto; scrollbar-width:thin; }
.aside .grp{ font-size:.74rem; font-weight:600; color:#6b7380; padding:16px 12px 6px; }
.aside a.item{ display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px; color:var(--sidebar-text); font-weight:500; margin-bottom:2px; transition:background .15s, color .15s; }
.aside a.item:hover{ background:var(--sidebar-soft); color:#fff; }
.aside a.item.is-active{ background:var(--brand); color:#fff; }
.aside a.item svg{ width:18px; height:18px; flex:none; opacity:.9; }
.aside__foot{ padding:14px 14px 18px; border-top:1px solid var(--sidebar-soft); }
.aside__user{ display:flex; align-items:center; gap:10px; padding:4px 8px 12px; }
.aside__user .av{ width:36px; height:36px; border-radius:50%; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; flex:none; }
.aside__user b{ color:#fff; font-size:.88rem; display:block; line-height:1.25; }
.aside__user span{ color:#7d8592; font-size:.76rem; }
.aside__links{ display:flex; gap:6px; }
.aside__links a{ flex:1; text-align:center; padding:8px 10px; border-radius:8px; font-size:.84rem; font-weight:500; color:var(--sidebar-text); background:var(--sidebar-soft); }
.aside__links a:hover{ color:#fff; background:#2d333d; }

.main{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  position:sticky; top:0; z-index:20; height:64px; display:flex; align-items:center; gap:14px; padding:0 28px;
  background:rgba(255,255,255,.9); -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
}
.topbar h1{ font-family:var(--display); font-size:1.35rem; font-weight:800; letter-spacing:-.01em; margin:0; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .actions{ display:flex; gap:10px; flex:none; }
.menu-toggle{ display:none; width:40px; height:40px; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--ink); cursor:pointer; align-items:center; justify-content:center; flex:none; }
.content{ padding:28px; max-width:1240px; width:100%; }

/* ======================= BOTÕES ======================= */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid transparent; cursor:pointer; font-family:inherit; font-weight:600; font-size:.9rem; line-height:1; height:40px; padding:0 16px; border-radius:var(--r-ui); background:var(--ink); color:#fff; transition:background .15s, border-color .15s, color .15s; white-space:nowrap; }
.btn:hover{ background:#000; color:#fff; }
.btn--brand{ background:var(--brand); } .btn--brand:hover{ background:var(--brand-dark); }
.btn--ghost{ background:#fff; color:var(--ink); border-color:var(--line-strong); } .btn--ghost:hover{ background:var(--bg); color:var(--ink); }
.btn--sm{ height:32px; padding:0 12px; font-size:.82rem; border-radius:8px; }
.btn--danger{ background:#fff; color:var(--danger); border-color:#f0cccc; } .btn--danger:hover{ background:#fdecec; color:var(--danger); }
.btn--block{ width:100%; height:46px; font-size:.95rem; }

/* ======================= PAINÉIS ======================= */
.panel{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); min-width:0; }
.panel__head{ padding:16px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.panel__head h2, .panel__head b{ font-size:1rem; font-weight:700; margin:0; }
.panel__head form{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.panel__body{ padding:20px; }
.form-narrow{ max-width:760px; }
.form-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.readonly{ padding:10px 0 2px; }
.login-code{ background:var(--bg); border:1px solid var(--line); border-radius:6px; padding:2px 7px; color:var(--ink); }

/* ======================= INDICADORES ======================= */
.stats{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.stat{ background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.stat .n{ font-family:var(--display); font-size:2.2rem; font-weight:800; line-height:1; letter-spacing:-.02em; }
.stat .l{ color:var(--ink-soft); font-size:.86rem; margin-top:8px; }
.stat .ic{ width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; margin-bottom:16px; color:#fff; }

/* ======================= TABELAS ======================= */
.table-wrap{ overflow-x:auto; }
.table{ width:100%; border-collapse:collapse; }
.table th{ text-align:left; font-size:.8rem; font-weight:600; color:var(--ink-faint); padding:12px 16px 10px; border-bottom:1px solid var(--line); white-space:nowrap; }
.table td{ padding:13px 16px; border-bottom:1px solid var(--line); vertical-align:middle; }
.table tr:last-child td{ border-bottom:0; }
.table tbody tr{ transition:background .12s; }
.table tbody tr:hover td{ background:#fafbfc; }
.table .thumb{ width:60px; height:42px; object-fit:cover; border-radius:8px; background:var(--bg); }
.table .ttl{ font-weight:600; line-height:1.35; }
.table .ttl small{ display:block; color:var(--ink-faint); font-weight:400; font-size:.8rem; margin-top:2px; }
.table .acoes{ text-align:right; white-space:nowrap; }

/* ======================= BADGES ======================= */
.badge{ display:inline-flex; align-items:center; gap:6px; font-size:.76rem; font-weight:600; padding:4px 10px; border-radius:999px; white-space:nowrap; }
.badge--ok{ background:#e8f6ee; color:var(--ok); }
.badge--draft{ background:#eef0f3; color:var(--ink-soft); }
.badge--brand{ background:var(--brand-tint); color:var(--brand); }
.badge--dot::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ======================= FORMULÁRIOS ======================= */
.form-grid{ display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:24px; align-items:start; }
.field{ margin-bottom:18px; }
.field label{ display:block; font-weight:600; font-size:.88rem; margin-bottom:7px; }
.hint, .field .hint{ color:var(--ink-faint); font-size:.8rem; font-weight:400; }
.input,.select,.textarea{ width:100%; min-height:44px; border:1px solid var(--line-strong); border-radius:var(--r-ui); padding:10px 13px; font-family:inherit; font-size:.95rem; background:#fff; color:var(--ink); transition:border-color .15s, box-shadow .15s; }
.input:hover,.select:hover,.textarea:hover{ border-color:#bfc5cf; }
.input:focus,.select:focus,.textarea:focus{ outline:none; border-color:var(--ink); box-shadow:0 0 0 4px rgba(21,25,31,.07); }
.select{ appearance:none; -webkit-appearance:none; padding-right:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5260' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 14px center; }
.textarea{ resize:vertical; min-height:96px; }
.row2{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; }
.check{ display:flex; align-items:center; gap:10px; padding:12px 14px; border:1px solid var(--line-strong); border-radius:var(--r-ui); cursor:pointer; transition:border-color .15s, background .15s; }
.check:hover{ background:#fafbfc; }
.check:has(input:checked){ border-color:var(--brand); background:var(--brand-tint); }
.check input{ width:18px; height:18px; accent-color:var(--brand); flex:none; }
.check b{ font-size:.9rem; display:block; } .check span{ display:block; color:var(--ink-soft); font-size:.8rem; font-weight:400; }

/* ======================= EDITOR ======================= */
.editor-toolbar{ display:flex; flex-wrap:wrap; gap:4px; border:1px solid var(--line-strong); border-bottom:0; border-radius:var(--r-ui) var(--r-ui) 0 0; padding:8px; background:#fafbfc; position:sticky; top:64px; z-index:5; }
.editor-toolbar button{ background:#fff; border:1px solid var(--line); min-width:34px; height:32px; padding:0 8px; border-radius:7px; cursor:pointer; font-weight:700; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; }
.editor-toolbar button:hover{ background:var(--bg); color:var(--ink); }
.editor-toolbar .sep{ width:1px; background:var(--line); margin:3px 4px; }
.editor{ border:1px solid var(--line-strong); border-radius:0 0 var(--r-ui) var(--r-ui); min-height:360px; padding:20px 22px; font-family:"Source Serif 4",Georgia,serif; font-size:1.08rem; line-height:1.7; background:#fff; }
.editor:focus{ outline:none; border-color:var(--ink); }
.editor h2{ font-family:var(--display); font-size:1.5rem; }
.editor blockquote{ border-left:3px solid var(--brand); margin:1em 0; padding-left:1em; font-style:italic; color:var(--ink-soft); }
.editor img{ border-radius:8px; margin:.6em 0; }

/* ======================= UPLOAD ======================= */
.dropzone{ border:2px dashed var(--line-strong); border-radius:var(--radius); padding:24px; text-align:center; cursor:pointer; transition:border-color .15s, background .15s; background:#fafbfc; }
.dropzone:hover{ border-color:var(--brand); background:var(--brand-tint); }
.dropzone img{ max-height:170px; margin:0 auto 10px; border-radius:10px; }
.dropzone .ic{ color:var(--ink-faint); }

/* ======================= MÍDIAS ======================= */
.media-list{ display:flex; flex-direction:column; gap:10px; }
.media-item{ display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:12px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:var(--r-ui); background:#fff; }
.media-item .tag{ font-size:.72rem; font-weight:700; padding:3px 8px; border-radius:6px; background:var(--bg); color:var(--ink-soft); }

/* ======================= MENSAGENS ======================= */
.flash{ padding:13px 16px; border-radius:var(--r-ui); margin-bottom:20px; font-weight:500; font-size:.92rem; line-height:1.5; }
.flash--ok{ background:#e8f6ee; color:#166534; border:1px solid #bfe5cd; }
.flash--erro{ background:#fdecec; color:#991b1b; border:1px solid #f3c6c6; }

.color-swatch{ width:18px; height:18px; border-radius:5px; display:inline-block; vertical-align:middle; border:1px solid rgba(0,0,0,.1); }
.empty{ text-align:center; padding:52px 20px; color:var(--ink-soft); }

/* ======================= RESPONSIVO ======================= */
@media (max-width:1100px){
  .stats{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .form-grid{ grid-template-columns:1fr; }
}
@media (max-width:900px){
  .login{ grid-template-columns:1fr; }
  .login__side{ display:none; }
  .login__logo{ display:block; }

  .shell{ grid-template-columns:1fr; }
  .aside{ position:fixed; top:0; left:0; bottom:0; width:280px; height:100%; transform:translateX(-100%); transition:transform .28s var(--ease); box-shadow:none; }
  .shell.menu-aberto .aside{ transform:none; box-shadow:0 0 60px rgba(0,0,0,.35); }
  .shell.menu-aberto::after{ content:""; position:fixed; inset:0; background:rgba(12,14,18,.45); z-index:55; }
  .menu-toggle{ display:inline-flex; }
  .topbar{ padding:0 16px; }
  .content{ padding:18px 16px; }
  .row2{ grid-template-columns:1fr; gap:0; }
  .editor-toolbar{ top:64px; }
}
@media (max-width:560px){
  .stats{ grid-template-columns:1fr 1fr; gap:10px; }
  .stat{ padding:16px; }
  .stat .n{ font-size:1.7rem; }
  .topbar .actions .btn{ height:36px; padding:0 12px; font-size:.84rem; }
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ transition-duration:.01ms !important; animation-duration:.01ms !important; }
}
