:root {
  --couro: #262626;
  --hortela: #b8e000;
  --pinho: #0d3b2e;
  --fuoco: #e30613;
  --marmore: #f0f0f0;
  --line: #d7d0c4;
  --font-display: Georgia, serif;
  --font-body: "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
body.admin-body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--couro);
  background: #f4f1ea;
}
a { color: var(--pinho); }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--pinho);
  color: #fff;
}
.admin-brand { color: #fff; text-decoration: none; font-weight: 700; }
.admin-user { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; font-size: 0.92rem; }
.admin-user a { color: var(--hortela); text-decoration: none; }
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 52px); }
.admin-side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 1rem;
}
.admin-side a {
  display: block;
  padding: 0.65rem 0.75rem;
  text-decoration: none;
  color: var(--couro);
  border-radius: 8px;
  margin-bottom: 0.25rem;
}
.admin-side a.is-active,
.admin-side a:hover { background: #e8efe9; color: var(--pinho); }
.admin-main { padding: 1.5rem; }
.admin-main h1 { margin: 0 0 1rem; font-size: 1.6rem; color: var(--pinho); }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: #fff;
}
.flash-success { background: #eef8f2; color: #1f6b4a; border-color: #9dceb5; }
.flash-error { background: #fdf1f1; color: #9b2c2c; border-color: #e2b4b4; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.stat strong { display: block; font-size: 1.8rem; color: var(--pinho); }
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
}
.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.95rem;
}
.table th { background: #faf7f1; }
.thumb {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #ddd;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  background: var(--pinho);
  color: #fff;
}
.btn:hover { filter: brightness(1.05); color: #fff; }
.btn-ghost { background: #fff; color: var(--couro); border-color: var(--line); }
.btn-danger { background: var(--fuoco); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  max-width: 920px;
}
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="file"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.help { color: #666; font-size: 0.88rem; margin: 0.25rem 0 0; }
.cover-current {
  margin: 1.25rem 0;
}
.cover-current .help {
  margin: 0 0 0.55rem;
}
.cover-thumb {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1920 / 1080;
  height: auto;
  object-fit: cover;
  background: #ebe6dc;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.admin-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100% - 2rem);
}
.admin-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.admin-modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
}
.admin-modal-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  color: var(--pinho);
}
.admin-modal-card p {
  margin: 0 0 1.1rem;
  line-height: 1.5;
  color: var(--couro);
}
.tox-tinymce { border-radius: 8px !important; height: 800px !important; }
.tox-editor-header .tox-toolbar-overlord,
.tox-editor-header .tox-toolbar__primary {
  flex-wrap: wrap !important;
}
.tox-toolbar__overflow {
  display: none !important;
}
.tox-dialog .tox-dialog__body-nav-item:first-child {
  display: none !important;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: #ebe6dc;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.login-card h1 { margin: 0 0 1.75rem; color: var(--pinho); font-size: 1.45rem; }
.login-brand {
  display: block;
  width: min(168px, 58%);
  height: auto;
  margin: 0.15rem auto 1.85rem;
}
.login-card .muted { color: #666; margin: 0 0 1.25rem; font-size: 0.92rem; }
.login-card .flash { margin: -0.55rem 0 1.25rem; }
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}
.gallery-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.gallery-bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.gallery-bulk-count {
  color: #666;
  font-size: 0.86rem;
}
.gallery-bulk-count[hidden] { display: none !important; }
.gallery-admin-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.gallery-admin-item.is-selected {
  border-color: var(--pinho);
  box-shadow: 0 0 0 1px var(--pinho);
}
.gallery-admin-check {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.gallery-admin-check input {
  margin: 0;
  cursor: pointer;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.gallery-admin-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.gallery-admin-item .meta {
  padding: 0.55rem 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
}
.gallery-admin-item .meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-edit-card {
  width: min(520px, 100%);
}
.gallery-edit-preview {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0 0 1rem;
  background: #ebe6dc;
}
.tox-tinymce { border-radius: 8px !important; }
@media (max-width: 1100px) {
  .gallery-admin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: 1fr; }
  .gallery-admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .gallery-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
