.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;
}

:root {
  --bg: #0d0f14;
  --surface: #161a22;
  --border: #2a3142;
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #c9a227;
  --accent-dim: #8a7020;
  --success: #3d9e6e;
  --danger: #c44c4c;
  --fenrir: #7eb8da;
  --war: #e07a7a;
  --style: #c89ae0;
  --font: "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1a2233 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

header.site {
  text-align: center;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

header.site h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(201, 162, 39, 0.25);
}

header.site p.tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.announce {
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.12), rgba(201, 162, 39, 0.04));
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.announce strong {
  color: var(--accent);
  margin-right: 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.search {
  flex: 1;
  min-width: 200px;
}

.search input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search input:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  border-color: var(--accent-dim);
  background: #1c212c;
}

.btn.primary {
  background: linear-gradient(180deg, #a8892a, var(--accent-dim));
  border-color: var(--accent);
  color: #0d0f14;
  font-weight: 600;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.danger {
  border-color: var(--danger);
  color: #f0a0a0;
}

.btn.small {
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.auth-bar span.user {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  background: #1e2430;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

table.data tbody tr:hover {
  background: rgba(201, 162, 39, 0.06);
}

table.data td.num {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
}

th.col-fenrir {
  color: var(--fenrir);
}
th.col-war {
  color: var(--war);
}
th.col-style {
  color: var(--style);
}

td.cat {
  color: var(--muted);
  font-size: 0.88rem;
}

.actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.badge-empty {
  color: var(--muted);
}

footer.meta {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.notice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.notice-card,
.ad-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.notice-card h2,
.notice-card h3 {
  margin: 0 0 0.55rem;
}

.notice-card h2 {
  color: var(--accent);
  font-size: 1.1rem;
}

.notice-card h3 {
  color: var(--text);
  font-size: 1rem;
}

.notice-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.notice-warning {
  border-color: rgba(201, 162, 39, 0.45);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.12), rgba(22, 26, 34, 0.96));
}

.notice-danger {
  border-color: rgba(196, 76, 76, 0.45);
  background: linear-gradient(180deg, rgba(196, 76, 76, 0.12), rgba(22, 26, 34, 0.96));
}

.marketplace {
  margin-top: 2rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 1.25rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.ads-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.ad-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ad-card.empty {
  color: var(--muted);
  justify-content: center;
}

.ad-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ad-head h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--text);
}

.ad-created {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.ad-description {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  white-space: pre-line;
}

.ad-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.price-pill.fenrir {
  color: var(--fenrir);
  border-color: rgba(126, 184, 218, 0.35);
}

.price-pill.war {
  color: var(--war);
  border-color: rgba(224, 122, 122, 0.35);
}

.price-pill.style {
  color: var(--style);
  border-color: rgba(200, 154, 224, 0.35);
}

.ad-contact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.ad-contact-line strong {
  color: var(--text);
}

.ad-whatsapp {
  width: fit-content;
  color: #90e6b0;
  text-decoration: none;
}

.ad-whatsapp:hover {
  text-decoration: underline;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal.modal-wide {
  max-width: 580px;
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--accent);
}

.field {
  margin-bottom: 0.85rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field textarea {
  min-height: 70px;
  resize: vertical;
}

.form-tip {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row input {
  margin-top: 0.2rem;
}

.row-prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.row-prices .field {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.msg-error {
  background: rgba(196, 76, 76, 0.15);
  border: 1px solid var(--danger);
  color: #f0a0a0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.security-note {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.security-note h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

@media (max-width: 640px) {
  .notice-grid,
  .ads-list {
    grid-template-columns: 1fr;
  }

  .ad-head,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .row-prices {
    grid-template-columns: 1fr;
  }
}
