/* Hashira admin console - extends the public site's stylesheet.
   Loaded after style.css, so its CSS variables (--line, --ink, --grad, ...) are
   already defined. Two audiences share this file: the customer-facing account
   pages (views.py) and the operator console (admin_views.py). */

.adminbody { background: #f4f6fa; }

/* ---------------------------------------------------------------- top bar */

.adminbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.adminbar__inner,
.adminbar .wrap {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; gap: 20px;
}
.adminbrand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--ink); font-size: 16px; letter-spacing: -.02em;
}
.adminbrand .mark {
  width: 28px; height: 28px; display: block;
  object-fit: contain; flex: 0 0 auto;
}
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--body); }
.who__email { color: var(--muted); }
.who a { color: var(--ink); text-decoration: none; }
.who a:hover { text-decoration: underline; text-underline-offset: 3px; }
.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--g1);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- shell */

.adminwrap {
  max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: 216px minmax(0, 1fr);
  align-items: start;
}
.adminnav {
  position: sticky; top: 62px;
  padding: 26px 14px 40px 24px;
  display: flex; flex-direction: column; gap: 4px;
}
.adminnav__link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; color: var(--body);
  text-decoration: none; transition: background .15s, color .15s;
}
.adminnav__link:hover { background: #fff; color: var(--ink); }
.adminnav__link.is-active {
  background: #fff; color: var(--g1);
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-sm);
}
.adminnav__link--out { margin-top: 18px; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.navbadge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #f59e0b; color: #fff; font-size: 11.5px; font-weight: 700;
  line-height: 20px; text-align: center;
}

.adminmain { max-width: 780px; margin: 0 auto; padding: 40px 24px 80px; }
.adminwrap .adminmain { max-width: none; margin: 0; padding: 30px 34px 96px; }

/* ---------------------------------------------------------------- headings */

.pagehead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 24px;
}
.pagehead__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pageh1 { font-size: 26px; margin: 0 0 6px; }
.adminmain .sub { font-size: 14.5px; color: var(--body); margin: 0; }
.accounthead { font-size: 19px; margin: 34px 0 14px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 32px; box-shadow: var(--sh-sm);
}
.card h1 { font-size: 24px; margin-bottom: 8px; }
.card .sub { margin-bottom: 22px; }
.card .foot { margin-top: 20px; font-size: 14px; color: var(--muted); }
.card .foot a { color: var(--g1); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- notices */

.notice {
  border-radius: var(--r-sm); padding: 14px 18px; font-size: 14px;
  margin-bottom: 18px; border: 1px solid var(--line);
}
.notice--error { background: #fef2f2; border-color: #fbcaca; color: #991b1b; }
.notice--warn  { background: #fffbeb; border-color: #f5e0a3; color: #92400e; }
.notice--ok    { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.notice--info  { background: var(--soft); border-color: var(--line-2); color: var(--body); }
.notice code {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; font-size: 12.5px;
}
.notice a { color: var(--g1); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }

/* ---------------------------------------------------------------- forms */

.form { display: grid; gap: 16px; }
.form label, .editform label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.form input, .editform input, .editform select, .editform textarea,
.filterbar input, .filterbar select, .notebox textarea {
  font: inherit; font-size: 15px; color: var(--ink);
  padding: 11px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: #fff; width: 100%;
}
.editform textarea, .notebox textarea { resize: vertical; line-height: 1.55; }
.editform textarea[name="specs"], .editform textarea[name="includes"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px;
}
.form input:focus, .editform input:focus, .editform select:focus, .editform textarea:focus,
.filterbar input:focus, .filterbar select:focus, .notebox textarea:focus {
  outline: none; border-color: var(--g1); box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.filterbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px;
}
.filterbar input[type="search"] { flex: 1 1 220px; min-width: 180px; }
.filterbar select { flex: 0 1 170px; width: auto; min-width: 140px; }

/* ---------------------------------------------------------------- data */

.kv { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 14px; flex: 0 0 auto; }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; font-size: 14.5px; text-align: right; }
.kv__stack { display: grid; gap: 2px; font-weight: 500; line-height: 1.5; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap;
}
.pill--ok   { background: #e9f7f0; border-color: #cfeadd; color: #0f7a4d; }
.pill--warn { background: #fffbeb; border-color: #f5e0a3; color: #92400e; }
.pill--off  { background: #f3f4f6; border-color: #e5e7eb; color: #6b7280; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.inline { display: inline; }

.tablecard {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm);
}
.admintable { width: 100%; border-collapse: collapse; font-size: 14px; }
.admintable th {
  text-align: left; padding: 13px 18px; background: var(--soft);
  border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap;
}
.admintable td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admintable tbody tr:last-child td { border-bottom: 0; }
.admintable tbody tr:hover td { background: #fbfcfe; }
.admintable b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.admintable .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted);
}
.admintable .num { text-align: right; }
.admintable .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admintable .empty { text-align: center; color: var(--muted); padding: 40px; }
/* Never let a two-character action label break across lines. */
.admintable .btn, .panel .btn, .actionstack .btn { white-space: nowrap; }
.admintable tfoot td {
  background: var(--soft); border-top: 1px solid var(--line);
  border-bottom: 0; font-size: 13.5px; color: var(--body);
}
.admintable tfoot tr.totals td {
  font-weight: 700; color: var(--ink); font-size: 15px; background: #fff;
  border-top: 2px solid var(--line-2);
}

.btn--xs { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn--danger { background: #fff; border-color: #fbcaca; color: #b91c1c; }
.btn--danger:hover { background: #fef2f2; border-color: #f09595; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- dashboard */

.statgrid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 26px; }
.statgrid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.statcard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 22px; box-shadow: var(--sh-sm);
  display: grid; gap: 6px; align-content: start;
}
.statcard--warn { border-color: #f5e0a3; background: #fffdf6; }
.statcard__label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.statcard__value { font-size: 27px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.statcard__hint { font-size: 12.5px; color: var(--muted); }

.dashgrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); overflow: hidden;
}
.panel--wide { grid-column: 1 / -1; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel__head h2 { font-size: 15px; margin: 0; }
.panel__more { font-size: 13px; color: var(--g1); text-decoration: none; font-weight: 600; }
.panel__more:hover { text-decoration: underline; text-underline-offset: 3px; }
.panel .admintable th { background: #fff; }
.panel .admintable td { padding: 12px 20px; }
.panel .admintable th { padding: 10px 20px; }
.panel .admintable th:last-child,
.panel .admintable td:last-child { text-align: right; }

/* ---------------------------------------------------------------- actions */

.actionstack { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; }
.actionstack form { display: block; }
.actionstack .btn { width: 100%; text-align: center; }

.notebox { display: grid; gap: 10px; padding: 0 20px 20px; }
.notebox label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }

.dangerzone { margin: 6px 20px 20px; padding: 16px 18px; border: 1px solid #fbcaca;
  border-radius: var(--r); background: #fffafa; }
.dangerzone h3 { font-size: 13px; margin: 0 0 10px; color: #b91c1c; letter-spacing: .02em; }
.dangerzone__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- pager */

.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.pager__step, .pager__num {
  display: inline-block; min-width: 34px; padding: 7px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--body);
  font-size: 13.5px; font-weight: 600; text-decoration: none; text-align: center;
}
.pager__step:hover, .pager__num:hover { border-color: var(--line-2); background: var(--soft); }
.pager__num.is-current { background: var(--grad); border-color: transparent; color: #fff; }
.pager__step.is-disabled { opacity: .45; pointer-events: none; }
.pager__gap { color: var(--muted); padding: 0 2px; }
.pager__count { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- edit form */

.editform { display: grid; gap: 20px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 30px; box-shadow: var(--sh-sm); }
.formsection { font-size: 16px; margin: 6px 0 -8px; padding-top: 18px;
  border-top: 1px solid var(--line); }
.formsection:first-child { border-top: 0; padding-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.editactions { display: flex; gap: 12px; align-items: center; padding-top: 6px;
  border-top: 1px solid var(--line); }
.editactions .btn--danger { margin-left: auto; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .statgrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .statgrid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ---------------------------------------------------------------- gallery */

.card--shots { margin-top: 22px; }
.cardh2 { font-size: 17px; margin: 0 0 6px; }
.card--shots .hint { margin: 0 0 16px; }

.shotgrid {
  display: grid; gap: 14px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.shot {
  margin: 0; border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: #fff;
}
.shot img {
  display: block; width: 100%; height: 128px; object-fit: cover; background: #f7f8fb;
}
.shot figcaption {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; font-size: 12.5px; border-top: 1px solid var(--line);
}
.shot__no { color: var(--muted); font-weight: 600; }
.shot__ops { display: flex; gap: 4px; }
.iconbtn {
  width: 26px; height: 26px; padding: 0; line-height: 1;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--body); cursor: pointer; font-size: 13px;
}
.iconbtn:hover:not(:disabled) { background: #f3f5fa; }
.iconbtn:disabled { opacity: .35; cursor: default; }
.iconbtn--danger { color: #b91c1c; border-color: #fbcaca; }
.iconbtn--danger:hover { background: #fef2f2; }

.uploadform {
  display: grid; gap: 12px; padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.uploadform input[type="file"] { padding: 10px; }
.uploadform .hint { margin: 0; }
.uploadform .btn { justify-self: start; }

/* ---------------------------------------------------------------- messages */

.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--g1); margin-right: 7px; vertical-align: middle;
}
.admintable tr.is-unread td { background: #fbfaff; font-weight: 600; }
.msgbody {
  margin-top: 16px; padding: 18px; border-radius: var(--r);
  background: #f7f8fb; border: 1px solid var(--line);
  white-space: pre-wrap; line-height: 1.7; color: var(--body);
  word-break: break-word;
}
.card .empty { color: var(--muted); padding: 26px 0; margin: 0 0 18px; }

/* One-off password display after an admin reset. */
.pwbox {
  margin: 0; padding: 18px 20px; border-radius: var(--r);
  background: #f7f8fb; border: 1px dashed var(--line);
  font-size: 20px; letter-spacing: .06em; word-break: break-all;
  color: var(--ink); font-weight: 600;
}

@media (max-width: 900px) {
  .adminwrap { grid-template-columns: minmax(0, 1fr); }
  .adminnav {
    position: static; flex-direction: row; overflow-x: auto; gap: 6px;
    padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fff;
  }
  .adminnav__link { white-space: nowrap; padding: 8px 13px; }
  .adminnav__link--out { margin-top: 0; }
  .adminwrap .adminmain { padding: 24px 18px 70px; }
  .dashgrid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .statgrid, .statgrid--3 { grid-template-columns: 1fr; }
  .admintable .actions { flex-direction: column; }
  .card { padding: 24px; }
  .editform { padding: 22px; }
  .filterbar select, .filterbar input[type="search"] { flex: 1 1 100%; }
  /* Let wide tables scroll sideways instead of squashing every column. */
  .tablecard { overflow-x: auto; }
  .admintable { min-width: 640px; }
  .panel .admintable { min-width: 480px; }
}

/* ---------- SMTP test lamp ---------- */

.lampline {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 4px; font-size: 13.5px;
}
.lamp {
  width: 10px; height: 10px; border-radius: 50%;
  flex: 0 0 auto; display: inline-block; background: #b4b2a9;
}
.lamp--ok   { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); }
.lamp--fail { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }
.lamp--idle { background: #b4b2a9; }
.lamp__text { color: var(--body); }

.btn--ghost {
  background: #fff;
  border: 1px solid var(--line-2);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--soft); border-color: var(--g1); }
