/* Polimento visual do editor (camada final, só apresentação).
   Carregado depois de app.css e design.css: não altera os slides,
   apenas o "chrome" do editor (header, painéis, botões, formulários,
   estados vazios, login e mobile). */

:root {
  --radius-sm: .45rem;
  --radius: .65rem;
  --radius-lg: .95rem;
  --shadow-xs: 0 1px 2px #1c25400f;
  --shadow-sm: 0 1px 2px #1c25400d, 0 6px 18px -10px #1c254026;
  --shadow-md: 0 2px 4px #1c25400d, 0 18px 40px -18px #1c254040;
  --ring: 0 0 0 3px #6bae4540;
  --green-ink: #3f6f27;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-display: Montserrat, Inter, "Segoe UI", Arial, sans-serif;
}

body { background: var(--paper); -webkit-font-smoothing: antialiased; }
::selection { background: #cfe5bf; color: var(--ink-deep); }

/* Títulos do editor com a tipografia da marca */
:is(.toolbar, .workspace, .login-layout, dialog, .archive-heading) :is(h1, h2):not(.slide *) {
  font-family: var(--font-display);
  letter-spacing: -.015em;
}
.panel-heading h2, .live-heading h3 { font-weight: 700; }

/* Scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: #c9c1b2 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfc7b8; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #b5ac9b; }

/* ---------- Botões ---------- */
.btn {
  border-radius: var(--radius-sm);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .08s var(--ease);
}
.btn:not(.quiet):not(.tab):not(.primary):not(.danger) { box-shadow: var(--shadow-xs); }
.btn:not(:disabled):hover { border-color: #cbc2b2; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 2px #1c254033, inset 0 1px 0 #ffffff14; }
.btn.primary:not(:disabled):hover { box-shadow: 0 4px 12px -4px #1c254066, inset 0 1px 0 #ffffff14; }
.btn.destructive:not(:disabled):hover { background: #f8e8e9; border-color: #e5c2c5; }
.btn:disabled { box-shadow: none; }

/* ---------- Campos ---------- */
input, select, textarea {
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #c6bdac; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #6bae45; box-shadow: var(--ring); background: #fff; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::placeholder { color: #8a92a5; }
input[type="file"] {
  padding: .55rem;
  border-style: dashed;
  border-width: 1.5px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}
input[type="file"]:hover { border-color: #6bae45; background: #f4f8f0; }
input[type="file"]::file-selector-button {
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  padding: .4rem .7rem;
  border-radius: .35rem;
  margin-right: .6rem;
  transition: background-color .15s var(--ease);
}
input[type="file"]::file-selector-button:hover { background: var(--ink-deep); }

/* ---------- Header ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 1.1rem;
  padding: .7rem 1.5rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom-color: #e6e0d5;
  box-shadow: 0 1px 0 #ffffff inset;
}
.brand { mix-blend-mode: multiply; }
.toolbar nav {
  gap: .15rem;
  padding: .22rem;
  margin-left: .2rem;
  border-left: 0;
  background: var(--sand);
  border: 1px solid #e6e0d5;
  border-radius: calc(var(--radius-sm) + .22rem);
}
.toolbar nav .btn.tab { padding: .45rem .85rem; border-radius: var(--radius-sm); color: var(--muted); }
.toolbar nav .btn.tab:not([aria-current="page"]):hover { background: #ffffffa6; color: var(--ink); border-color: transparent; }
.toolbar nav .btn.tab[aria-current="page"] { background: var(--surface); color: var(--ink-deep); border-color: #e2dbcf; box-shadow: var(--shadow-sm); }
.toolbar-actions { gap: .5rem; }
.toolbar-actions .btn { padding: .55rem 1rem; }
.toolbar-actions .btn[data-act="present"]::before { content: "▶"; font-size: .62em; margin-right: .5rem; vertical-align: .14em; color: #a9d48d; }

.contextbar {
  padding: .35rem 1.5rem;
  background: var(--paper);
  border-bottom-color: #ebe5da;
  font-size: .78rem;
}
.contextbar > span { font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: .45rem; }
.contextbar > span::before { content: ""; width: .5rem; height: .5rem; border-radius: 2px; background: var(--green); transform: rotate(45deg); flex: none; }
.contextbar div { gap: .6rem; }
.presence summary { padding: .26rem .6rem; border-radius: 999px; border: 1px solid transparent; font-size: .76rem; }
.presence summary:hover, .presence[open] summary { border-color: #c9dcbc; }
.presence-dot { box-shadow: 0 0 0 0 #4c852e66; animation: pulse 2.4s ease-out infinite; }
.presence ul { border-radius: var(--radius); box-shadow: var(--shadow-md); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #4c852e66; } 70% { box-shadow: 0 0 0 .45rem #4c852e00; } 100% { box-shadow: 0 0 0 0 #4c852e00; } }

/* ---------- Painéis ---------- */
.workspace { padding-top: 1.1rem; gap: 1rem; }
.rail, .inspector, .comments, .point-detail, .stage, .team {
  border-color: #e6e0d5;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.rail, .inspector, .comments, .point-detail, .stage { padding: 1rem; }
.panel-heading { margin-bottom: .8rem; }
.panel-heading > span { font-variant-numeric: tabular-nums; background: var(--sand); padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.design-mode .stage, .stage {
  background:
    radial-gradient(circle at 1px 1px, #d9d1c3 1px, transparent 0) 0 0 / 18px 18px,
    #efeae1;
}
.design-mode .canvas-panes .slide, .canvas-panes .slide { box-shadow: 0 1px 2px #1c25401a, 0 24px 48px -24px #1c254059; border-color: transparent; }
.canvas-hint { font-size: .74rem; }

/* Lista de slides e de pontos */
.rail-item { border-radius: var(--radius); transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.rail-item.has-thumb { padding: .45rem; }
.rail-item.has-thumb .rail-thumb { transition: box-shadow .15s var(--ease), transform .2s var(--ease); }
.rail-item.has-thumb:hover .rail-thumb { box-shadow: 0 0 0 1px #c9bfae, 0 8px 18px -10px #1c254055; }
.rail-item.has-thumb[aria-current="true"] { background: #eef5e8; border-color: #cfe0c3; }
.rail-item.has-thumb[aria-current="true"] .rail-label { color: #2c4d20; }
.rail-item .slide-number { font-variant-numeric: tabular-nums; }

.point-item { position: relative; padding: .6rem .7rem .6rem .85rem; border-color: transparent; }
.point-item::before { content: ""; position: absolute; left: .3rem; top: .7rem; bottom: .7rem; width: 3px; border-radius: 3px; background: transparent; transition: background-color .15s var(--ease); }
.point-item[aria-current="true"] { background: #eef5e8; border-color: #cfe0c3; color: var(--ink-deep); }
.point-item[aria-current="true"]::before { background: var(--green); }
.points-layout .rail .panel-heading { align-items: center; }

/* ---------- Pontos em aberto ---------- */
.point-title { align-items: center; gap: .75rem; padding-bottom: .9rem; margin-bottom: .4rem; border-bottom: 1px solid #eee8de; }
.point-title h1 { text-wrap: balance; }
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem .28rem .55rem; letter-spacing: .01em; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .85; }
.point-detail > h2 { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-family: Inter, "Segoe UI", Arial, sans-serif; }
.attachments img { border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.comment-list li { background: var(--paper); border: 1px solid #eee8de; border-radius: var(--radius); padding: .75rem .8rem; }
.comments .subtle, .point-detail .subtle { padding: .85rem; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--paper); text-align: center; }

/* ---------- Acervo ---------- */
.archive-heading { padding: .4rem 0 .9rem; }
.archive-heading h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.archive-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: .2rem;
  padding: clamp(2.5rem, 7vw, 4.5rem) 1.5rem;
  border: 1.5px dashed #d6cebf;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 1px 1px, #e3dccf 1px, transparent 0) 0 0 / 18px 18px,
    var(--surface);
}
.archive-empty::before {
  content: "";
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: .8rem;
  border-radius: 1rem;
  background:
    linear-gradient(135deg, transparent 52%, #6bae45 52%) ,
    var(--ink);
  box-shadow: var(--shadow-md);
}
.archive-empty strong, .archive-empty h2 { font-family: var(--font-display); font-size: 1.1rem; }
.archive-empty p { max-width: 42ch; }
.archive-item { border-color: #e6e0d5; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.archive-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.archive-item > img, .archive-file-preview { background: #ece7de; }

/* ---------- Equipe ---------- */
.team { padding: 1.4rem; }
.team table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.team table tbody tr { transition: background-color .15s var(--ease); }
.team table tbody tr:hover { background: var(--paper); }

/* ---------- Login ---------- */
.login-layout {
  margin: 0 auto;
  min-height: 420px;
  width: min(calc(100% - 2rem), 860px);
  border-color: #e6e0d5;
  border-radius: 1.2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  top: max(1rem, calc(50vh - 230px));
  margin-bottom: 2rem;
}
.login-intro { position: relative; overflow: hidden; background: linear-gradient(160deg, #2b3758 0%, var(--ink-deep) 100%); }
.login-intro::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34%;
  height: 30%;
  background: var(--green);
  opacity: .8;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  pointer-events: none;
}
.login-intro > * { position: relative; z-index: 1; }
.login-intro h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 2.8vw, 2.1rem); line-height: 1.12; }
.login-intro p { max-width: 28ch; }
.login-form { gap: 1rem; }
.login-form h2 { font-family: var(--font-display); font-size: 1.4rem; }
.login-form .btn.primary { padding-block: .75rem; margin-top: .3rem; }
.form-error:not([hidden]) { background: #f8e8e9; border: 1px solid #ecc9cc; padding: .55rem .7rem; border-radius: var(--radius-sm); }

/* ---------- Diálogos e avisos ---------- */
dialog { border-color: #e6e0d5; border-radius: var(--radius-lg); box-shadow: 0 30px 80px -20px #1c254066; padding: 1.4rem; }
dialog[open] { animation: dialog-in .2s var(--ease); }
dialog::backdrop { background: #1c25407a; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#feedback { border-radius: var(--radius); box-shadow: var(--shadow-md); padding: .8rem 1.05rem; font-size: .9rem; animation: toast-in .25s var(--ease); border-left: 4px solid var(--green); }
#feedback.error { border-left-color: #f0b8bd; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Carregando ---------- */
#app[aria-busy="true"] .start { display: flex; align-items: center; gap: .7rem; color: var(--muted); }
#app[aria-busy="true"] .start::before { content: ""; width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .presence-dot, dialog[open], #feedback, #app[aria-busy="true"] .start::before { animation: none; }
  .btn, .rail-item, .archive-item { transition: none; }
  .archive-item:hover { transform: none; }
}

/* ---------- Telas menores ---------- */
@media (max-width: 935px) {
  .toolbar { padding-inline: 1rem; }
}
@media (max-width: 620px) {
  .toolbar { padding: .6rem .75rem; row-gap: .55rem; }
  .brand { width: 120px; }
  .toolbar nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .toolbar nav::-webkit-scrollbar { display: none; }
  .toolbar nav .btn.tab { padding: .42rem .7rem; flex: 1 0 auto; }
  .toolbar-actions .btn { padding: .45rem .7rem; }
  .contextbar { align-items: center; padding-block: .3rem; }
  .contextbar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .contextbar > span::before { display: none; }
  .contextbar div > span:not([id]) { display: none; }
  .contextbar div { flex: none; }
  .login-layout { top: 1rem; min-height: 0; }
  .login-intro { padding-block: 1.6rem; }
  .login-intro::after { width: 22%; height: 38%; opacity: .55; }
}
