/* Admin panel — reuses tokens, buttons and fields from styles.css */
body.admin { background: #f4f6fc; min-height: 100vh; }

/* Login */
.login { min-height: calc(100vh - var(--bar)); display: grid; place-items: center; padding: 2rem 1rem; background: var(--cobalt-deep); }
.login__card { width: min(400px, 100%); background: #fff; border-radius: 20px; padding: 2rem; display: grid; gap: 1rem; }
.login__card h1 { font-size: 1.8rem; font-weight: 720; }
.login__card > p { color: var(--muted); }
.login__back { justify-self: center; color: var(--muted); font-size: .92rem; }
.form-error { color: #b42318; font-size: .92rem; font-weight: 550; min-height: 1.2em; }
.form-error:empty { display: none; }

/* Layout */
.dash { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - var(--bar)); }
.dash__side { background: var(--ink); color: #c9cfdd; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: 0; height: calc(100vh - var(--bar)); }
.dash__brand { color: #fff; font-weight: 750; font-size: 1.15rem; text-decoration: none; padding: 0 .6rem; font-variation-settings: 'opsz' 40, 'wdth' 88; }
.dash__side nav { display: grid; gap: .25rem; }
.tab {
  font: inherit; font-weight: 600; text-align: left; color: #c9cfdd; background: transparent; border: 0;
  padding: .7rem .8rem; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.tab:hover { background: #1c2740; color: #fff; }
.tab[aria-current] { background: var(--cobalt); color: #fff; }
.tab__n { font-size: .8rem; background: rgba(255,255,255,.14); border-radius: 999px; padding: .05rem .5rem; }
.tab__n:empty { display: none; }
.dash__side-foot { margin-top: auto; display: grid; gap: .5rem; padding: 0 .6rem; font-size: .95rem; }
.dash__side-foot a, .dash__side-foot button { color: #c9cfdd; background: none; border: 0; font: inherit; padding: 0; text-align: left; cursor: pointer; }
.dash__side-foot a:hover, .dash__side-foot button:hover { color: #fff; }

.dash__main { padding: 2.2rem clamp(1rem, 3vw, 2.6rem) 4rem; min-width: 0; }
.panel__head { margin-bottom: 1.6rem; max-width: 70ch; }
.panel__head h1 { font-size: 2.2rem; font-weight: 740; }
.panel__head p { color: var(--muted); margin-top: .4rem; }
.jump { display: none; }
.panel__grid { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 1.4rem; align-items: start; }

.card { background: #fff; border-radius: 16px; border: 1px solid var(--line); padding: 1.4rem; display: grid; gap: 1rem; }
.card h2 { font-size: 1.25rem; font-weight: 700; font-variation-settings: 'opsz' 30, 'wdth' 92; }
.card--narrow { max-width: 520px; }
.card--narrow p { color: var(--muted); }
.card .btn { justify-self: start; }
.field textarea { font: inherit; font-size: 1rem; color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; padding: .62rem .75rem; resize: vertical; width: 100%; }
.field textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(29,59,216,.18); }

/* Image drop zone */
.drop {
  border: 2px dashed #b9c3e8; border-radius: 12px; background: var(--sky); cursor: pointer;
  min-height: 150px; display: grid; place-items: center; overflow: hidden; position: relative;
}
.drop:hover, .drop.is-over { border-color: var(--cobalt); background: #e3e8fd; }
.drop img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.drop__empty { display: grid; justify-items: center; gap: .25rem; padding: 1.2rem; text-align: center; color: var(--muted); }
.drop__empty svg { color: var(--cobalt); }
.drop__empty b { color: var(--ink); }
.drop__empty span { font-size: .86rem; max-width: 32ch; }
.drop__row { display: flex; gap: .8rem; align-items: center; margin-top: .5rem; }
.drop__row input { flex: 1; font: inherit; font-size: .95rem; border: 1.5px solid var(--line); border-radius: 10px; padding: .55rem .7rem; min-width: 0; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch > span { width: 42px; height: 24px; border-radius: 999px; background: #c8cfe3; position: relative; transition: background-color .15s ease; flex: none; }
.switch > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.switch input:checked + span { background: var(--cobalt); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.switch--sm { font-size: .88rem; color: var(--muted); }

/* Rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 1rem; align-items: center; padding: .9rem 0; border-top: 1px solid var(--line); }
#noticeList .row { grid-template-columns: 1fr auto auto; }
.row__thumb { width: 84px; height: 56px; border-radius: 8px; object-fit: cover; display: block; }
.row__thumb--empty { background: linear-gradient(135deg, var(--cobalt), var(--cobalt-deep)); }
.row__main { display: grid; gap: .2rem; min-width: 0; }
.row__main b { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.row__meta { font-size: .85rem; color: var(--muted); }
.rows__empty { color: var(--muted); padding: 1rem 0; border-top: 1px solid var(--line); }

.link-btn { font: inherit; font-weight: 600; font-size: .92rem; background: none; border: 0; padding: .3rem .4rem; cursor: pointer; color: var(--cobalt); border-radius: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn--danger { color: #b42318; }
.btn--danger { background: #b42318; color: #fff; }
.btn--danger:hover { background: #912018; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 140%); z-index: 60;
  background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 12px; font-weight: 600;
  box-shadow: 0 16px 40px rgba(8,14,40,.3); transition: transform .25s ease, visibility .25s; max-width: calc(100vw - 2rem);
  visibility: hidden;
}
.toast.is-on { transform: translate(-50%, 0); visibility: visible; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

@media (max-width: 960px) {
  input, select, textarea { font-size: 16px !important; }
  .dash { grid-template-columns: 1fr; }
  /* compact two-line header: brand + links, then swipeable tabs */
  .dash__side {
    position: sticky; top: 0; z-index: 20; height: auto; padding: .6rem 1rem .5rem;
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .4rem .8rem;
  }
  .dash__brand { padding: 0; font-size: 1.05rem; }
  .dash__side-foot { grid-column: 2; grid-row: 1; margin: 0; display: flex; gap: .9rem; padding: 0; font-size: .85rem; }
  .dash__side-foot #viewSite { display: none; }
  .dash__side nav { grid-column: 1 / -1; display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; margin: 0 -.2rem; }
  .dash__side nav::-webkit-scrollbar { display: none; }
  .tab { flex: none; padding: .45rem .8rem; gap: .5rem; }
  .dash__main { padding: 1.4rem 1rem 4rem; }
  .panel__head h1 { font-size: 1.8rem; }
  .jump { display: inline-flex; margin-top: 1rem; }
  .panel__grid { grid-template-columns: 1fr; }
  .card--list { order: -1; }   /* manage existing items first on phones */
  .card { padding: 1.1rem; }
  #postForm, #noticeForm { scroll-margin-top: 110px; }
}
@media (max-width: 560px) {
  .row { grid-template-columns: 72px 1fr; gap: .4rem .8rem; }
  .row__thumb { width: 72px; height: 50px; }
  .row .switch { grid-column: 2; }
  .row .link-btn { grid-column: 2; justify-self: start; padding-left: 0; }
  #noticeList .row { grid-template-columns: 1fr auto; }
  #noticeList .row .switch { grid-column: 1; }
  #noticeList .row .link-btn { grid-column: 2; grid-row: 2; justify-self: end; }
  .drop__row { flex-wrap: wrap; }
  .login__card { padding: 1.5rem; }
}

.sample { display: inline-block; margin-left: .5rem; font-size: .72rem; font-weight: 700; padding: .05rem .4rem; border-radius: 5px; background: #fff3cf; color: #8a5a00; vertical-align: 1px; }
