:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #6b7480;
  --line: #e3e6ea;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; margin: 0; color: var(--brand); }

.drive-status { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-unknown { background: #cbd5e1; }
.dot-on { background: var(--green); }
.dot-off { background: var(--red); }

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.field > span { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row input, .row select { flex: 1; min-width: 0; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }

.btn {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: #f1f2f5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #eef2ff; color: var(--brand-dark); border-color: #dfe4ff; }

.create-event { margin: 8px 0 14px; }
.create-event summary { cursor: pointer; color: var(--brand); font-size: 14px; margin-bottom: 8px; }

.event-meta {
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}
.event-meta .tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.tag-live { background: #dcfce7; color: var(--green); }
.tag-draft { background: #fef3c7; color: var(--amber); }

.actions { display: flex; gap: 8px; }

.list { list-style: none; padding: 0; margin: 6px 0 16px; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.list .sub { color: var(--muted); font-size: 12px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--brand-dark); }
.pill-eod { background: #fef3c7; color: var(--amber); }

.status-view { overflow-x: auto; }
.status-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.status-table th, .status-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.status-table th:first-child, .status-table td:first-child { text-align: left; white-space: nowrap; }
.cell-yes { color: var(--green); font-weight: 700; }
.cell-no { color: #cbd5e1; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.badge-in { background: #dcfce7; color: var(--green); }
.badge-out { background: #fee2e2; color: var(--red); }
.badge-pending { background: #f1f5f9; color: var(--muted); }

.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 50;
}
.toast.error { background: var(--red); }

/* Editable question rows */
.qedit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qedit .qday { font-size: 12px; color: var(--muted); white-space: nowrap; }
.qedit .q-day { width: 52px; margin-left: 4px; }
.qedit .q-win { flex: 0 0 auto; }
.qedit .q-text { flex: 1 1 160px; min-width: 120px; }
.qedit .q-del { color: var(--red); }

/* Join link section */
.join-section { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.join-section h3 { margin: 0 0 6px; font-size: 15px; }
.join-url-row { display: flex; gap: 8px; margin: 8px 0; }
.join-url-row input { flex: 1 1 auto; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.join-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.join-qr { display: block; width: 160px; height: 160px; border: 1px solid var(--line); border-radius: 8px; }
