:root {
  --bg: #07090b;
  --panel: #0d1114;
  --panel-2: #11161a;
  --panel-3: #090d10;
  --text: #f6f7f8;
  --muted: #9fa8b0;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.13);
  --red: #ed151c;
  --red-hover: #ff252c;
  --danger: #b80f15;
  --radius: 14px;
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

html { background: var(--bg); }

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 84% 5%, rgba(237,21,28,.075), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

/* LOGIN */
.login-box {
  width: min(460px, calc(100% - 32px));
  margin: 10vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 25px;
}

.login-box > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-box .btn { width: 100%; }

.password-control {
  position: relative;
  width: 100%;
}

.password-control input[type="password"],
.password-control input[type="text"] {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #67717a;
  cursor: pointer;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.password-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

/* ESTRUTURA */
.admin-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 50px;
}

.admin-top {
  min-height: 72px;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.admin-title-mark {
  width: 5px;
  height: 34px;
  flex: 0 0 5px;
  border-radius: 999px;
  background: var(--red);
}

.admin-title h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.08;
}

.admin-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.admin-section-title {
  margin: 30px 0 14px;
}

.admin-section-title.first-admin-section {
  margin-top: 0;
}

.admin-section-title h2 {
  margin: 0;
  font-size: 20px;
}

.admin-section-title p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.head-section-title { margin-top: 34px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}

.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.024), rgba(255,255,255,.008)),
    var(--panel);
  box-shadow:
    0 14px 38px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.018);
}

.asset-card,
.head-card {
  display: flex;
  flex-direction: column;
}

.card-head {
  min-height: 82px;
  padding: 17px 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
}

.card-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* PRÉVIAS FIXAS — IMPEDE IMAGENS GIGANTES */
.asset-preview {
  position: relative;
  width: 100%;
  height: 126px;
  min-height: 126px;
  max-height: 126px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.012), rgba(255,255,255,0)),
    #080b0d;
  border-bottom: 1px solid var(--line);
}

.asset-preview img {
  display: block;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}

.logo-preview img {
  max-width: min(100%, 270px) !important;
  max-height: 64px !important;
}

.favicon-preview {
  justify-content: flex-start;
}

.favicon-preview img {
  width: 64px !important;
  height: 64px !important;
  max-width: 64px !important;
  max-height: 64px !important;
  margin-left: 2px;
  padding: 6px;
  object-fit: contain !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.asset-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* HEAD */
.preview-wrap {
  padding: 16px 20px 18px;
  background: var(--panel-3);
}

.preview-wrap img {
  display: block;
  width: 100%;
  height: 205px;
  max-height: 205px;
  object-fit: cover;
  object-position: center center;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.empty-preview {
  min-height: 205px;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-preview-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237,21,28,.28);
  border-radius: 50%;
  color: var(--red);
  font-size: 26px;
}

.empty-preview strong {
  margin-bottom: 6px;
  color: #fff;
  font-size: 14px;
}

.empty-preview span {
  max-width: 360px;
  font-size: 12px;
  line-height: 1.5;
}

/* FORMULÁRIOS */
.form {
  padding: 18px 20px;
}

.field {
  margin: 0 0 14px;
}

.field label {
  display: block;
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 700;
}

.field input[type=file],
.field input[type=password],
.field input[type=text] {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  outline: none;
  background: #0a0e11;
  color: #fff;
}

.field input[type=file] {
  padding: 6px;
}

.field input[type=file]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.field input:focus {
  border-color: rgba(237,21,28,.72);
  box-shadow: 0 0 0 3px rgba(237,21,28,.09);
}

.help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.meta {
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* BOTÕES */
.btn,
button.btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover,
button.btn:hover {
  background: var(--red-hover);
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.btn.danger {
  background: var(--danger);
}

.asset-card .form .btn,
.asset-remove-form .btn,
.compact-remove .btn {
  width: max-content;
  max-width: 100%;
}

.asset-remove-form {
  padding: 0 20px 18px;
  margin-top: -4px;
}

.compact-remove {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}

/* ALERTAS */
.alert {
  margin: 0 0 20px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.5;
}

.alert.success {
  background: rgba(39,179,106,.09);
  border-color: rgba(39,179,106,.33);
}

.alert.error {
  background: rgba(237,21,28,.08);
  border-color: rgba(237,21,28,.34);
}

/* RESPONSIVO */
@media (max-width: 900px) {
  .admin-shell {
    width: min(100% - 28px, 720px);
    padding-top: 22px;
  }

  .admin-top {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 18px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .btn {
    flex: 1;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .asset-preview {
    height: 116px;
    min-height: 116px;
    max-height: 116px;
  }

  .logo-preview img {
    max-width: min(100%, 240px) !important;
    max-height: 58px !important;
  }

  .preview-wrap img {
    height: 188px;
    max-height: 188px;
  }
}

@media (max-width: 560px) {
  .admin-shell {
    width: calc(100% - 22px);
    padding: 18px 0 34px;
  }

  .login-box {
    margin-top: 7vh;
    padding: 22px;
  }

  .admin-title h1 {
    font-size: 22px;
  }

  .admin-section-title {
    margin: 24px 0 12px;
  }

  .card-head {
    min-height: auto;
    padding: 15px 16px;
  }

  .asset-preview {
    height: 102px;
    min-height: 102px;
    max-height: 102px;
    padding: 14px 16px;
  }

  .logo-preview img {
    max-width: min(100%, 205px) !important;
    max-height: 50px !important;
  }

  .favicon-preview img {
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
  }

  .form,
  .preview-wrap {
    padding: 15px 16px;
  }

  .preview-wrap img {
    height: 165px;
    max-height: 165px;
  }

  .asset-remove-form,
  .meta {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
  }

  .asset-card .form .btn,
  .asset-remove-form .btn,
  .compact-remove .btn {
    width: 100%;
  }
}

/* PÁGINA SERVIÇOS — GERENCIAMENTO DE IMAGENS */
.services-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.service-media-card {
  display: flex;
  flex-direction: column;
}

.service-admin-preview {
  height: 160px;
  min-height: 160px;
  padding: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.012), rgba(255,255,255,0)),
    #080b0d;
  border-bottom: 1px solid var(--line);
}

.service-admin-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.service-admin-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .services-admin-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .service-admin-preview {
    height: 180px;
    min-height: 180px;
  }
}

@media (max-width: 560px) {
  .service-admin-preview {
    height: 150px;
    min-height: 150px;
  }
}

