:root {
  --clay: #c45c26;
  --clay-dark: #9a4318;
  --cream: #fbf6ee;
  --olive: #3d5c4a;
  --ink: #1c1612;
  --muted: #5c534c;
  --paper: #fffdf9;
  --line: rgba(28, 22, 18, 0.1);
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.is-hidden { display: none !important; }

h1, h2 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 0.6rem;
}

h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clay-dark);
  margin: 0.4rem 0;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1.1rem;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 0.7rem;
}

.login-card img {
  border-radius: 50%;
}

.editor {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  min-width: 0;
}

input, select, textarea, button {
  font: inherit;
  max-width: 100%;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.85rem 0.9rem;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
}

textarea {
  min-height: 160px;
  resize: vertical;
}

input[type="file"] {
  min-height: 0;
  padding: 0.55rem;
}

button, .ghost {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  min-height: 48px;
}

button[type="submit"],
#btn-salvar {
  background: var(--clay);
  color: #fff;
}

.ghost, #btn-sair, #btn-cancelar {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
  background: rgba(255, 253, 249, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand, .topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  min-width: 0;
}

.brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand img { border-radius: 50%; flex-shrink: 0; }

.topbar-actions a,
.topbar-actions button {
  white-space: nowrap;
}

.layout {
  width: min(1100px, calc(100% - 1.6rem));
  margin: 1.1rem auto 3rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.2rem;
}

.status {
  min-height: 1.2em;
  color: var(--olive);
  font-size: 0.9rem;
  margin: 0;
}

.post-item {
  border-top: 1px solid var(--line);
  padding: 0.9rem 0;
}

.post-item:first-child { border-top: 0; padding-top: 0; }

.post-item h3 {
  font-size: 1.05rem;
  margin: 0 0 0.3rem;
}

.post-item p {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-item .item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-item button {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  min-height: 44px;
}

.danger {
  background: #8a2b2b;
  color: #fff;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
  margin: -0.35rem 0 0.4rem;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}

.thumb {
  position: relative;
}

.thumb img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 0.7rem;
  display: block;
}

.thumb button {
  position: absolute;
  left: 0.3rem;
  right: 0.3rem;
  bottom: 0.3rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.7rem;
  min-height: 32px;
  background: rgba(28, 22, 18, 0.8);
  color: #fff;
}

.empty {
  color: var(--muted);
}

@media (max-width: 860px) {
  .layout,
  .row {
    grid-template-columns: 1fr;
  }

  .layout {
    width: calc(100% - 1.2rem);
    margin-bottom: 2rem;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button {
    width: 100%;
  }

  .post-item .item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 1rem;
    border-radius: 1rem;
  }

  .brand span {
    font-size: 0.95rem;
  }
}
