:root {
  --bg: #10161e;
  --panel: #182230;
  --line: #2b3a4d;
  --text: #e8edf2;
  --muted: #9aa3ad;
  --accent: #d4a017;
  --hot: #3a2410;
  --ended: #1b2430;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.45; }
a { color: #f0c14b; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 0.6rem; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; color: #d7dee6; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.9rem 1.4rem; background: #0c1118; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
nav { display: flex; gap: 1rem; }
.actions { margin-left: auto; display: flex; gap: 0.5rem; }
button {
  background: var(--accent); color: #1a1404; border: 0; border-radius: 6px;
  padding: 0.45rem 0.8rem; font-weight: 700; cursor: pointer;
}
button.ghost, a.button { background: transparent; color: var(--text); border: 1px solid var(--line); }
a.button { border-radius: 6px; padding: 0.45rem 0.8rem; font-weight: 700; }
a.button:hover { text-decoration: none; }

main { padding: 1.25rem 1.4rem 3rem; max-width: 1280px; }
.page-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.page-top .active-wrap { margin-bottom: 0; flex: 0 0 22rem; max-width: 22rem; }
.page-top form[data-notify-form] { flex: 0 1 auto; width: max-content; max-width: min(42rem, 100%); }
.active-wrap {
  max-width: 28rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(24, 34, 48, 0.35);
}
.active-table { width: 100%; border-collapse: collapse; background: transparent; }
.active-table th,
.active-table td {
  padding: 0.28rem 0.7rem;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.84rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.active-table th { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.active-table td:last-child,
.active-table th:last-child { border-right: 0; }
.active-table tr:last-child td { border-bottom: 0; }
.active-table .cell-num {
  width: 8.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.active-table tr.is-current td { color: var(--text); }
a.cell-link { color: inherit; }
a.cell-link:hover { color: var(--text); }

.meta, .sub, .crumb { color: var(--muted); }
.sub { font-size: 0.85rem; margin-top: 0.2rem; }
.filters { display: flex; gap: 1rem; margin: 1rem 0; }
label { color: var(--muted); font-size: 0.85rem; }
select { display: block; margin-top: 0.25rem; background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 0.35rem 0.5rem; border-radius: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 0.8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr.hot { background: var(--hot); }
tr.is-picked { box-shadow: inset 3px 0 0 var(--accent); }
.check { width: 2.4rem; text-align: center; }
input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--accent); }
tr.ended { background: var(--ended); color: #c5ced6; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.empty { color: var(--muted); text-align: center; }

.detail-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin: 0.6rem 0 1rem; }
.price-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; min-width: 160px; }
.price-box span, .price-box em { display: block; color: var(--muted); font-size: 0.8rem; font-style: normal; }
.price-box strong { font-size: 1.8rem; }
.description { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
section { margin: 1.4rem 0; }
.status-pending { color: #f0c14b; }
.status-fired { color: #7dcea0; }
.status-missed { color: #e07a7a; }
.external { display: inline-block; margin-bottom: 0.6rem; }
.external + .photos-link { margin-left: 1.1rem; }
.item-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.25rem; }
.photos-link { font-size: 0.85rem; }

body.slideshow-open { overflow: hidden; }
.slideshow {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.slideshow.is-open { display: flex !important; }
.slideshow[hidden] { display: none !important; }
.slideshow.is-open[hidden] { display: flex !important; }
.slideshow-backdrop {
  position: absolute; inset: 0; border: 0; padding: 0; margin: 0;
  background: rgba(8, 12, 18, 0.78); cursor: pointer;
}
.slideshow-dialog {
  position: relative; z-index: 1;
  width: min(920px, 94vw);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.slideshow-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 0.7rem; min-height: 2.2rem;
}
.slideshow-top h2 {
  margin: 0; font-size: 1rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slideshow-close {
  flex: 0 0 auto;
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
.slideshow-stage {
  position: relative;
  width: 100%;
  height: min(62vh, 560px);
  flex: 0 0 min(62vh, 560px);
}
.slideshow-well {
  position: absolute;
  inset: 0 3.4rem;
  display: flex; align-items: center; justify-content: center;
  background: #0c1118;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.slideshow-well img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
}
.slideshow-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2;
  width: 2.6rem; height: 2.6rem; padding: 0;
  background: #0c1118; color: var(--text); border: 1px solid var(--line);
  font-size: 1.6rem; line-height: 1;
}
.slideshow-nav[data-slideshow-prev] { left: 0; }
.slideshow-nav[data-slideshow-next] { right: 0; }
.slideshow-caption {
  margin: 0.7rem 0 0; text-align: center; color: var(--muted); font-size: 0.85rem;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.notice-ok { background: #1c3326; color: #b7e4c7; }
.notice-err { background: #3a1d1d; color: #f0b4b4; }
form[data-notify-form] { margin: 0; }
.notify-panel {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(24, 34, 48, 0.55);
}
.notify-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.15rem; }
.notify-head h2 { margin: 0; }
.notify-panel h2 { margin-bottom: 0.2rem; font-size: 1rem; }
.notify-note { margin: 0 0 0.55rem; font-size: 0.8rem; line-height: 1.3; }
.notify-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: flex-end;
  margin-top: 0;
}
.notify-grid > div,
.notify-grid > label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 0 1 auto;
  min-width: 0;
  width: auto;
}
.notify-grid select,
.notify-grid input[type="email"],
.notify-grid input[type="tel"],
.notify-grid input[type="number"] {
  width: 12.5rem;
  max-width: 100%;
}
.field-label { color: var(--muted); font-size: 0.85rem; }
.method-choice { display: flex; gap: 0.7rem; min-height: 2rem; align-items: center; }
.notify-grid > .notify-destination {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
}
label.inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
}
label.inline input { margin: 0; }
input[type="email"], input[type="tel"], input[type="text"], input[type="number"], input[type="search"] {
  display: block;
  background: #101820;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  width: 100%;
  max-width: 22rem;
  min-width: 0;
}
.notify-actions { display: flex; align-items: center; gap: 0.75rem; }
.notify-grid > .notify-actions {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}
.notify-actions-end { margin-top: 0.8rem; }
.saved-line { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.45rem; align-items: center; }
.saved-line:not(:has(.saved-block:not([hidden]))) { display: none; }
.saved-block { display: flex; align-items: center; gap: 0.35rem; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
button.chip {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 600;
  padding: 0.28rem 0.6rem;
}
button.chip:hover { border-color: var(--accent); }
.destination { word-break: break-word; }
.status-waiting { color: var(--muted); }
.status-due { color: #f0c14b; }
.status-sent { color: #7dcea0; }
.status-expired, .status-error { color: #e07a7a; }
td form { margin: 0; }

button.item-filter-toggle {
  background: transparent;
  color: #4c9dff;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.item-filter-caret {
  width: 0;
  height: 0;
  border-left: 0.28rem solid transparent;
  border-right: 0.28rem solid transparent;
  border-top: 0.38rem solid #4c9dff;
  display: inline-block;
}
.item-filter-drop {
  position: fixed;
  z-index: 40;
  background: #182230;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.item-filter-drop input {
  display: block;
  width: 16rem;
  max-width: 70vw;
  margin: 0;
}

@media (max-width: 900px) {
  .page-top { flex-direction: column; }
  .page-top .active-wrap,
  .page-top form[data-notify-form] { flex-basis: auto; max-width: none; width: 100%; }
}
@media (max-width: 720px) {
  .topbar, .detail-head { flex-direction: column; align-items: flex-start; }
  .actions { margin-left: 0; }
  .slideshow { padding: 0.7rem; }
  .slideshow-stage { height: min(56vh, 420px); flex-basis: min(56vh, 420px); }
  .slideshow-well { inset: 0 2.8rem; }
  .notify-grid > div,
  .notify-grid > label { flex-basis: 100%; }
}
