@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;650;700;750;800&display=swap');

:root {
  color-scheme: dark;
  font: 14px/1.55 Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0d1018;
  color: #eef1f8;
  --panel: #141923;
  --raised: #1a2130;
  --line: #283246;
  --muted: #a0adc4;
  --cyan: #63e1ea;
  --violet: #bba9ff;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 92px; }
body { min-height: 100vh; margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.045em; line-height: 1.2; }
h2 { font-size: 1.17rem; font-weight: 750; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.admin-header {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #0d1018f2;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  width: min(1440px, 100%);
  min-height: 66px;
  margin: auto;
  padding: 10px 32px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.admin-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.admin-brand:hover { text-decoration: none; }
.brand-mark {
  display: flex;
  width: 32px;
  height: 32px;
  padding: 7px;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  color: #101722;
  background: var(--cyan);
  border-radius: 8px;
  transform: skew(-6deg);
}
.brand-mark i { width: 4px; height: 12px; border-radius: 1px; background: currentColor; }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 9px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 14px; }
.header-actions a { color: var(--muted); font-size: .88rem; white-space: nowrap; }

.admin-shell { width: min(1440px, 100%); margin: auto; padding: 30px 32px 64px; }
#dashboard { display: grid; grid-template-columns: 158px minmax(0, 1fr); gap: 30px; align-items: start; }
.side-nav { position: sticky; top: 90px; min-width: 0; padding: 11px 0; }
.side-nav nav { display: grid; gap: 4px; }
.side-nav a { padding: 10px 12px; color: #dae4f4; border-radius: 8px; font-weight: 600; }
.side-nav a:hover { background: var(--raised); color: var(--cyan); text-decoration: none; }
.workspace { min-width: 0; }
.page-heading, .panel-heading, .record-heading, .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px 12px;
}
.page-heading { margin-bottom: 22px; }
.panel-heading { margin-bottom: 12px; }
.dashboard-tools, .request-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel, .request, .login-panel {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  overflow-wrap: anywhere;
}
.record-section { margin-top: 26px; }
.inventory-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 275px), 1fr)); }
.inventory-help { margin-bottom: 12px; }
.inventory-item:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#inventory-lookup-result .source-link { margin-left: 8px; }
.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 14px;
}
.admin-pagination button { min-height: 32px; padding: 5px 9px; }
.member-search {
  display: grid;
  grid-template-columns: minmax(0, 300px) auto;
  justify-content: start;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}
.member-search button { min-height: 40px; }
.member-list-status, .admin-list-status { margin-bottom: 10px; }
.member-list-status:empty, .admin-list-status:empty { display: none; }
.after-sales-description { white-space: pre-wrap; }
.after-sales-request-link { min-height: 26px; padding: 2px 6px; }
.recommendation-form { display: grid; gap: 8px; margin-top: 9px; }
.recommendation-status:empty { display: none; }
.recommendation-form .actions { margin-top: 0; }
.listing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.member-records { display: grid; gap: 8px; }
.member-record {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  align-items: center;
  gap: 10px 14px;
  padding-block: 13px;
}
.member-record h3 { overflow-wrap: anywhere; }
.member-record .member-meta { margin-top: 4px; }
.member-role-form, .member-row-actions, .member-confirmation {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
}
.member-role-form label { min-width: 96px; }
.member-role-form button, .member-row-actions button { min-height: 40px; }
.member-danger { border-color: #6f4047; color: #ffb6bf; }
.member-danger:hover { border-color: #aa626e; color: #ffe2e5; background: #512833; }
.member-confirmation {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px solid #6f4047;
  border-radius: 8px;
  background: #291c24;
}
.member-confirmation p { flex-basis: 100%; margin: 0; }
@media (max-width: 900px) {
  .member-record { grid-template-columns: minmax(0, 1fr); }
}
.watch-row .adjust-price { min-height: 30px; padding: 4px 8px; }
.giveaway-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.giveaway-dates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 10px;
}
.giveaway-dates input { max-width: 100%; }
.giveaway-form button { justify-self: start; }
.giveaway-records { display: grid; gap: 10px; min-width: 0; }
.giveaway-prize { color: #d7e2f5; white-space: pre-wrap; }
.count, .badge {
  display: inline-flex;
  width: fit-content;
  gap: 6px;
  padding: 3px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}
.count:empty { display: none; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge[data-tone="good"] { color: var(--cyan); border-color: #30646d; background: #172d39; }
.badge[data-tone="hold"] { color: var(--violet); border-color: #484064; background: #26243a; }
.muted { color: var(--muted); }
.small { font-size: .83rem; }
.actions { justify-content: flex-start; margin-top: 12px; }

button, input, textarea, select { font: inherit; }
button, input, textarea, select { border: 1px solid var(--line); border-radius: 8px; }
button {
  min-height: 37px;
  padding: 7px 12px;
  background: var(--raised);
  color: #e0e8f7;
  font-size: .86rem;
  font-weight: 650;
  cursor: pointer;
}
button:hover { border-color: #4b6584; background: #222c3e; }
button:disabled { cursor: wait; opacity: .55; }
button.primary { border-color: var(--cyan); color: #10232d; background: var(--cyan); }
button.primary:hover { border-color: #92f1f4; background: #92f1f4; }
form, label { display: grid; gap: 10px; min-width: 0; }
label { gap: 6px; color: #b9c5d9; font-size: .88rem; font-weight: 550; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  color: #e7eef9;
  background: #0f131d;
}
input::placeholder, textarea::placeholder { color: #8794af; }
textarea { min-height: 76px; resize: vertical; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 8px; }
.catalog-import, .request details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
summary { cursor: pointer; color: #c8d4e9; font-size: .9rem; }
.catalog-import label { margin: 9px 0; }
input::file-selector-button {
  margin-right: 8px;
  padding: 4px 8px;
  color: #e0e8f7;
  border: 0;
  border-radius: 4px;
  background: var(--raised);
  cursor: pointer;
}
#watch-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
#watch-form button { min-height: 40px; }
.watch-list:not(:empty) { margin-top: 12px; border-top: 1px solid var(--line); }
.watch-row, .match-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  padding: 8px 0;
  font-size: .86rem;
}
.watch-row + .watch-row, .match-row + .match-row { border-top: 1px solid var(--line); }
.watch-row time { margin-left: auto; color: var(--muted); }
.watch-message { flex-basis: 100%; }
.watch-resale-review { flex-basis: 100%; display: grid; justify-items: start; gap: 8px; }
.watch-resale-review form { width: 100%; }
.watch-resale-confirm { display: flex; align-items: center; gap: 8px; }
.watch-resale-confirm input { width: auto; }

.record-heading { margin-bottom: 10px; }
.request dl, .sync-facts { display: grid; gap: 8px; margin: 12px 0; }
.request dl > div, .sync-facts > div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  font-size: .88rem;
}
.request dt, .sync-facts dt { color: var(--muted); }
.request dd, .sync-facts dd { margin: 0; }
.request .price { color: var(--cyan); font-size: 1.14rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.request .internal { margin-top: 12px; padding: 12px; border: 1px solid #34314a; border-radius: 8px; background: #1d1d2d; }
.request .internal strong { color: var(--violet); font-size: .85rem; }
.request .internal p { margin-top: 3px; }
.request .quote-form { margin-top: 13px; }
.request .quote-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.request-chat-log { display: grid; gap: 8px; max-height: 18rem; overflow: auto; margin: 10px 0; }
.request-chat-message { padding: 8px 10px; border-radius: 8px; background: #252338; }
.request-chat-message[data-actor="owner"] { background: #17323c; }
.request-chat-message time { margin-left: 8px; }
.request-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.request-chat form { margin-top: 8px; }
.request .record-date { margin-top: 13px; font-size: .82rem; color: var(--muted); }
.source-link { color: var(--cyan); }
.inventory-item .source-link { display: inline-block; margin-top: 5px; }
.listing-form { margin-top: 10px; }
.listing-price-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.listing-form button { justify-self: start; }
.empty {
  grid-column: 1 / -1;
  padding: 22px 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #111621;
}
.feedback:empty { display: none; }
.feedback:not(:empty) {
  position: fixed;
  z-index: 3;
  right: 20px;
  bottom: 20px;
  width: min(440px, calc(100% - 40px));
  padding: 11px 15px;
  border: 1px solid #416775;
  border-radius: 9px;
  color: #e1f3f6;
  background: #182b37;
  box-shadow: 0 12px 30px #05070b88;
  overflow-wrap: anywhere;
}

.login-panel {
  width: min(100%, 440px);
  margin: clamp(24px, 8vh, 112px) auto;
  padding: clamp(22px, 5vw, 34px);
  background: radial-gradient(ellipse at 96% 0%, #302648 0%, transparent 65%), var(--panel);
}
.login-heading { margin-bottom: 22px; }
.login-panel button { min-height: 42px; }

@media (max-width: 1080px) {
  .admin-shell, .header-inner { padding-right: 22px; padding-left: 22px; }
  #dashboard { grid-template-columns: 132px minmax(0, 1fr); gap: 18px; }
  #watch-form { grid-template-columns: 1fr; }
  #watch-form button { width: fit-content; }
}
@media (max-width: 740px) {
  .admin-shell { padding-top: 17px; }
  #dashboard { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .side-nav { position: static; padding: 0; }
  .side-nav nav { display: flex; flex-wrap: wrap; }
  .side-nav a { border: 1px solid var(--line); padding: 6px 8px; font-size: .83rem; }
  .dashboard-tools, .request-grid, .giveaway-admin { grid-template-columns: minmax(0, 1fr); }
  .inventory-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); }
}
@media (max-width: 420px) {
  .admin-shell, .header-inner { padding-right: 14px; padding-left: 14px; }
  .header-actions { gap: 8px; }
  .panel, .request { padding: 15px; }
}
:root .request-filter { max-width: 420px; margin: 0 0 14px; }
