:root {
  --bg: #0b0c10;
  --panel: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.10);
  --text: #eaeaea;
  --muted: rgba(255,255,255,0.70);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,10,12,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand { font-weight: 800; letter-spacing: .3px; }

.links a {
  color: var(--text);
  text-decoration: none;
  margin-left: 12px;
  opacity: .9;
}
.links a:hover { opacity: 1; text-decoration: underline; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 18px;
}

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 18px;
  border-top: 1px solid var(--border);
}

h1 { margin-top: 0; }
h2 { margin: 0 0 12px 0; }

.err {
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.25);
  padding: 10px 12px;
  border-radius: 10px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
}

label { display:block; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  outline: none;
}

button {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}
button:hover { background: rgba(255,255,255,0.10); }

a.btn, button.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  margin-right: 8px;
  font: inherit;
}
a.btn:hover, button.btn:hover { background: rgba(255,255,255,0.10); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 10px;
  vertical-align: top;
  font-size: 14px;
}

th { text-align:left; color: var(--muted); background: rgba(255,255,255,0.03); }

.grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

/* Combo (searchable officer picker) */
.combo { position: relative; }
.combo-pop {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  display: none;
  background: rgba(10,10,12,0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 20;
}
.combo-pop.open { display: block; }
.combo-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  margin: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.combo-item:hover { background: rgba(255,255,255,0.06); }
.combo-empty { padding: 10px 12px; color: var(--muted); }
.hint { color: var(--muted); }


.entry-grid {
  grid-template-columns: 1fr 2fr;
  align-items: start;
}

@media (max-width: 900px) {
  .entry-grid {
    grid-template-columns: 1fr;
  }
}

/* Operations picker */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .ops-grid { grid-template-columns: 1fr; }
}

.op-card {
  display: block;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
}

.op-card:hover {
  background: rgba(255,255,255,0.06);
}

.op-title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 6px;
}

.op-sub {
  opacity: .75;
}
.row { display: flex; }

.countdown{
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  display: inline-block;
}
/* Scroll container */
.table-scroll {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* IMPORTANT: override your global table rule that breaks sticky */
.table-scroll table {
  width: 100%;
  border-collapse: separate !important; /* sticky works better */
  border-spacing: 0 !important;
  border: 0 !important;                /* border is on wrapper */
  border-radius: 0 !important;
  overflow: visible !important;        /* THIS is the big one */
  background: transparent !important;
}

/* Sticky header (apply to both thead and th for best compatibility) */
.table-scroll thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(10,10,12,0.95); /* must be solid */
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.88);
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #111318;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal .card {
  background: rgba(0,0,0,0.25);
}
.modal h2 { margin: 0 0 16px 0; }
.modal-close {
  float: right;
  margin: -8px -8px 12px 12px;
  padding: 6px 10px;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: .8;
}
.modal-close:hover { opacity: 1; }
.modal .question-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.modal .question-row input { flex: 1; margin: 0; }
.modal .question-row .btn-remove { margin: 0; flex-shrink: 0; }
.modal-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.modal .webhook-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.modal .webhook-row .webhook-select { width: 180px; flex-shrink: 0; margin: 0; }
.modal .webhook-row input { flex: 1; margin: 0; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }
.checkbox-label input[type="checkbox"] { width: auto; margin: 0; }

/* Presets page */
.presets-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.presets-page-header h1 { margin: 0; }
.btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }

.presets-section { margin-bottom: 32px; }
.presets-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}
.presets-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.presets-table-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.presets-table-header .presets-col-name { grid-column: 1 / span 2; }
.presets-row {
  border-top: 1px solid var(--border);
}
.presets-row-main {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
}
.presets-row-main:hover { background: rgba(255,255,255,0.04); }
.presets-expand-btn {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  margin: 0;
  line-height: 1;
}
.presets-expand-btn:hover { opacity: 0.8; }
.presets-expand-icon { display: inline-block; }
.presets-op-name { font-size: 14px; }
.presets-col-status { white-space: nowrap; }
.presets-col-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.presets-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}
.status-draft { background: rgba(255,255,255,0.1); color: var(--muted); }
.status-active { background: rgba(34,197,94,0.2); color: #4ade80; }
.presets-action {
  background: transparent;
  border: 0;
  padding: 4px 0;
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}
.presets-action-edit { color: #60a5fa; }
.presets-action-edit:hover { text-decoration: underline; }
.presets-action-duplicate { color: var(--muted); }
.presets-action-duplicate:hover { color: var(--text); }
.presets-action-start { color: #4ade80; }
.presets-action-start:hover { text-decoration: underline; }
.presets-action-terminate { color: #f87171; }
.presets-action-terminate:hover { text-decoration: underline; }
.presets-action-delete { color: #f87171; }
.presets-action-delete:hover { text-decoration: underline; }
.presets-questions-panel {
  padding: 16px 16px 16px 44px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
}
.presets-end-date {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.presets-questions-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.presets-questions-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* Entries page (expandable table rows) */
.entries-expand-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.entries-row:hover td {
  background: rgba(255,255,255,0.04);
}
.entries-expand-btn {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  margin: 0;
  line-height: 1;
}
.entries-expand-btn:hover { opacity: 0.8; }
.entries-expand-icon { display: inline-block; }
.entries-actions-cell {
  white-space: nowrap;
}
.entries-action {
  background: transparent;
  border: 0;
  padding: 4px 0;
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}
.entries-action-edit { color: #60a5fa; }
.entries-action-edit:hover { text-decoration: underline; }
.entries-action-delete { color: #f87171; }
.entries-action-delete:hover { text-decoration: underline; }
.entries-details-row td {
  border-bottom: 1px solid var(--border);
  padding: 0;
  vertical-align: top;
}
.entries-details-cell {
  padding: 16px 16px 16px 44px !important;
  background: rgba(0,0,0,0.2);
}
.entries-details-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.entries-qa-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.entries-qa-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}
.entries-qa-item dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.entries-qa-item dd {
  margin: 0;
  color: var(--text);
}
