:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --accent: #3d8bfd;
  --ok: #2fb344;
  --bad: #e03131;
  --border: #2d3a4f;
}
* { box-sizing: border-box; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  justify-content: flex-end;
}
header nav a { margin-left: 0; text-decoration: none; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.65rem; }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #121a26;
  color: var(--text);
}
button, .btn {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  min-height: 38px;
}
button.secondary, .btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-danger { background: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row { display: flex; gap: 0.5rem; }
.row > * { flex: 1; }
.row.actions { flex-wrap: wrap; }
.row.actions > * { flex: 0 0 auto; margin-top: 0; }
table button { white-space: nowrap; }
#status { margin-bottom: 0.75rem; color: #a7f3d0; }
.hidden { display: none; }
pre {
  background: #121a26;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  overflow: auto;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#eventsTbl {
  table-layout: fixed;
  width: 100%;
  font-size: 0.82rem;
}
#eventsTbl th, #eventsTbl td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}
#eventsTbl th:nth-child(1), #eventsTbl td:nth-child(1) { width: 6%; }
#eventsTbl th:nth-child(2), #eventsTbl td:nth-child(2) { width: 17%; }
#eventsTbl th:nth-child(3), #eventsTbl td:nth-child(3) { width: 7%; }
#eventsTbl th:nth-child(4), #eventsTbl td:nth-child(4) { width: 12%; }
#eventsTbl th:nth-child(5), #eventsTbl td:nth-child(5) { width: 9%; }
#eventsTbl th:nth-child(6), #eventsTbl td:nth-child(6) { width: 12%; }
#eventsTbl th:nth-child(7), #eventsTbl td:nth-child(7) { width: 27%; }
#eventsTbl th:nth-child(8), #eventsTbl td:nth-child(8) { width: 10%; }

@media (max-width: 1024px) {
  #eventsTbl { font-size: 0.79rem; }
  #eventsTbl th:nth-child(2), #eventsTbl td:nth-child(2) { width: 20%; }
  #eventsTbl th:nth-child(7), #eventsTbl td:nth-child(7) { width: 24%; }
}

@media (max-width: 760px) {
  #eventsTbl { font-size: 0.76rem; }
  #eventsTbl th:nth-child(1), #eventsTbl td:nth-child(1) { width: 8%; }
  #eventsTbl th:nth-child(2), #eventsTbl td:nth-child(2) { width: 24%; }
  #eventsTbl th:nth-child(3), #eventsTbl td:nth-child(3) { width: 8%; }
  #eventsTbl th:nth-child(4), #eventsTbl td:nth-child(4) { width: 14%; }
  #eventsTbl th:nth-child(5), #eventsTbl td:nth-child(5) { width: 10%; }
  #eventsTbl th:nth-child(6), #eventsTbl td:nth-child(6) { width: 12%; }
  #eventsTbl th:nth-child(7), #eventsTbl td:nth-child(7) { width: 24%; }
  #eventsTbl th:nth-child(8), #eventsTbl td:nth-child(8) { width: 10%; }
}
@media (max-width: 920px) {
  .wrap { padding: 1rem; }
  .grid2 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .row.actions { flex-direction: row; }
  .row.actions > * { flex: 1 1 auto; }
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 0.5rem 0.45rem; }
}

@media (max-width: 640px) {
  .wrap { padding: 0.75rem; }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  header nav {
    width: 100%;
    justify-content: flex-start;
  }
  h1 { font-size: 1.05rem !important; }
  .card { padding: 0.8rem; border-radius: 8px; }
  input, select, textarea, button, .btn { font-size: 16px; }
  .row.actions > * { min-width: 0; }
}

.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.photo-modal.hidden {
  display: none;
}

.photo-modal-content {
  width: min(1100px, 96vw);
  max-height: 94vh;
  background: #101b2a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  overflow: auto;
}

.photo-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.photo-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.photo-modal-meta {
  color: #93a8c0;
  font-size: 0.9rem;
  margin: 0 0 0.55rem 0;
}

.photo-modal-plate {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 0.7rem 0;
}

.photo-modal-plate span {
  min-width: 22px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #2f435d;
  background: #0b1320;
  color: #f6fbff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.photo-modal-img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a1019;
}
