/* Admin UI. Deliberately plain and dense -- this is a tool, not a showpiece. */

:root {
  --bg: #f4f2ef;
  --panel: #ffffff;
  --ink: #1c1b19;
  --soft: #5d574f;
  --muted: #8b847a;
  --line: #e0dbd3;
  --accent: #8a5a3c;
  --danger: #a5443a;
  --ok: #4d7a52;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --panel: #201f1c;
    --ink: #ebe7e0;
    --soft: #bdb6ab;
    --muted: #8b847a;
    --line: #322f2a;
    --accent: #c99367;
    --danger: #d77e73;
    --ok: #86b085;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ------------------------------------------------------------------- shell */

.ashell { display: flex; min-height: 100vh; }

.asidebar {
  width: 15rem;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.abrand {
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.abrand span {
  font-weight: 500;
  color: var(--muted);
}
.anav { display: flex; flex-direction: column; gap: 0.15rem; }
.anav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--soft);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.anav-link:hover { background: var(--bg); color: var(--ink); }
.anav-link.is-active { background: var(--bg); color: var(--ink); font-weight: 600; }
.asidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.15rem; }
.alogout { color: var(--danger); }

.amain { flex: 1; min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.5rem) 5rem; }
.abare { max-width: 24rem; margin: 12vh auto; padding: 0 1.25rem; }

@media (max-width: 46rem) {
  .ashell { flex-direction: column; }
  .asidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .anav { flex-direction: row; flex-wrap: wrap; }
  .asidebar-foot { flex-direction: row; margin-top: 0; }
}

/* ------------------------------------------------------------------ blocks */

.atitle { font-size: 1.5rem; font-weight: 600; margin: 0 0 1.25rem; }
.ahead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.aback {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 0.75rem;
}
.aback:hover { color: var(--ink); }

.acard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.acard.apad0 { padding: 0; overflow: hidden; }
.acard h2 { font-size: 0.95rem; margin: 1.5rem 0 0.75rem; }
.acard h2:first-child { margin-top: 0; }
.aauth h1 { font-size: 1.2rem; margin: 0 0 0.75rem; }
.aauth-links { font-size: 0.85rem; color: var(--muted); margin: 1rem 0 0; text-align: center; }
.aauth-links a { color: var(--accent); text-decoration: none; }
.aauth-links a:hover { text-decoration: underline; }

.anote {
  font-size: 0.82rem;
  color: var(--soft);
  background: var(--bg);
  border-left: 2px solid var(--accent);
  padding: 0.6rem 0.85rem;
  border-radius: 0 4px 4px 0;
  margin: 0 0 1.25rem;
}
.awarn {
  font-size: 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
}
.amuted { color: var(--muted); font-size: 0.85em; }

.aurl { margin: 0 0 0.5rem; font-size: 0.95rem; }
.aurl a { color: var(--accent); text-decoration: none; }
.aurl a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------- stats */

.astats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.astat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
}
.astat:hover { border-color: var(--accent); }
.astat-n { display: block; font-size: 1.65rem; font-weight: 600; line-height: 1; }
.astat-l {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* ------------------------------------------------------------------ tables */

.atable { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.atable th, .atable td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.atable th {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.atable tbody tr:last-child td { border-bottom: 0; }
.atable tbody tr:hover { background: var(--bg); }
.aright { text-align: right; white-space: nowrap; }

.arow-actions { display: inline-flex; gap: 0.15rem; }
.aicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--soft);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}
.aicon:hover { border-color: var(--accent); color: var(--ink); }
.aicon.adanger:hover { border-color: var(--danger); color: var(--danger); }

/* ------------------------------------------------------------------- forms */

.aform { display: flex; flex-direction: column; gap: 1rem; }
.afield { display: flex; flex-direction: column; gap: 0.3rem; }
.alabel { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--soft); }
.afield input, .afield select, .afield textarea, .acaption {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.5rem 0.65rem;
  width: 100%;
}
.afield input:disabled { opacity: 0.6; }
.afield textarea { resize: vertical; line-height: 1.6; }
.afield input:focus, .afield select:focus, .afield textarea:focus, .acaption:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.ahint { font-size: 0.75rem; color: var(--muted); }
.acheck { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }

.abtn {
  align-self: flex-start;
  font: inherit;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.abtn:hover { border-color: var(--accent); }
.abtn.aprimary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.abtn.aprimary:hover { opacity: 0.88; }
.abtn.adanger { color: var(--danger); border-color: var(--danger); }
.abtn.asmall { padding: 0.25rem 0.6rem; font-size: 0.78rem; }
.abtn[disabled] { opacity: 0.5; cursor: default; }
.aform .abtn { margin-top: 0.25rem; }

/* ------------------------------------------------------------------- media */

.adrop {
  display: block;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  margin-bottom: 1rem;
}
.adrop:hover, .adrop.is-over { border-color: var(--accent); color: var(--ink); }

.amedia-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.amedia {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--bg);
}
.amedia img { width: 5rem; height: 3.75rem; object-fit: cover; border-radius: 4px; flex: none; }
.amedia-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }

.atiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}
.atile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.atile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.atile-meta { font-size: 0.78rem; word-break: break-all; }

/* ------------------------------------------------------------------ avatar */

.aavatar-uploader { display: flex; align-items: center; gap: 1rem; }
.aavatar-preview {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* ------------------------------------------------------------------- toast */

.atoast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 50;
  max-width: min(90vw, 30rem);
}
.atoast[hidden] { display: none; }
.atoast.is-error { background: var(--danger); color: #fff; }
