* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: #f5f5f5;
  color: #222;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #2c3e50;
  color: #fff;
}

.topbar .title {
  font-weight: 600;
  font-size: 1.2rem;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

#userName {
  overflow-wrap: anywhere;
}

.topbar button {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.topbar button:hover {
  background: #c0392b;
}

main {
  padding: 24px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}

.block {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.block > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.block > summary::-webkit-details-marker {
  display: none;
}

.block > summary::before {
  content: "▸";
  color: #888;
}

.block[open] > summary::before {
  content: "▾";
}

.block-content {
  padding: 4px 18px 18px;
  border-top: 1px solid #eee;
}

.profile-details {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 16px;
  margin: 14px 0 18px;
}

.profile-details dt {
  font-weight: 600;
  color: #555;
}

.profile-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.block-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #2c3e50;
  color: #fff;
}

.block-actions button:hover {
  background: #1a242f;
}

.block-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.block-actions button.secondary {
  background: #eee;
  color: #222;
}

.block-actions button.secondary:hover {
  background: #ddd;
}

.block-actions button.danger {
  background: #e74c3c;
}

.block-actions button.danger:hover {
  background: #c0392b;
}

.block form {
  margin-top: 14px;
}

.block form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.block form input,
.block form select {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

dialog {
  border: none;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog h3 {
  margin-top: 0;
}

dialog form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

dialog form input,
dialog form select {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.time-select-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.time-select-group select {
  margin-top: 0;
  width: auto;
  flex: 1;
}

.success {
  color: #27ae60;
  margin-top: 12px;
  font-size: 0.85rem;
}

.muted {
  color: #888;
  font-size: 0.9rem;
  margin: 14px 0 4px;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  white-space: nowrap;
}

.data-table th {
  color: #555;
  font-weight: 600;
}

.toggle-btn {
  padding: 4px 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.row-menu-btn {
  padding: 2px 10px;
  border: none;
  border-radius: 4px;
  background: none;
  color: #555;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.row-menu-btn:hover {
  background: #eee;
}

.row-menu {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 4px 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.row-menu[hidden] {
  display: none;
}

.row-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.row-menu button + button {
  border-top: 1px solid #eee;
}

.row-menu button:hover {
  background: #f0f0f0;
}

.toggle-btn.active {
  background: #27ae60;
  color: #fff;
}

.toggle-btn.inactive {
  background: #ccc;
  color: #444;
}

#sessionsTableBody tr {
  cursor: pointer;
}

#sessionsTableBody tr:hover {
  background: #f5f7fa;
}

#sessionsTableBody tr.selected-row {
  background: #e3ecf7;
}

.block-subtitle {
  margin: 18px 0 4px;
  font-size: 0.95rem;
  color: #333;
}

.details-table td:first-child {
  font-weight: 600;
  color: #555;
  width: 180px;
}

.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 0;
}

.lang-switcher button {
  padding: 4px 12px;
  border: 1px solid #ccc;
  background: #fff;
  color: #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.lang-switcher button.active {
  background: #2c3e50;
  color: #fff;
  border-color: #2c3e50;
}

.login-box {
  max-width: 320px;
  margin: 80px auto;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.login-box label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.login-box input {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.login-box button {
  width: 100%;
  padding: 10px;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.login-box button:hover {
  background: #1a242f;
}

.error {
  color: #e74c3c;
  margin-top: 12px;
  font-size: 0.85rem;
}

.payment-dialog {
  max-width: 560px;
}

/* QR code on the left, payee details on the right; stacks on narrow screens. */
.payment-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.payment-qr {
  width: 180px;
  height: 180px;
  flex: 0 0 auto;
}

.payment-details {
  flex: 1 1 200px;
  margin: 0;
  font-size: 0.9rem;
}

.payment-details dt {
  color: #777;
  font-size: 0.8rem;
  margin-top: 8px;
}

.payment-details dt:first-child {
  margin-top: 0;
}

.payment-details dd {
  margin: 2px 0 0;
  word-break: break-word;
}

/* Second row of the payment dialog: TWINT hint and contact on the left, contact QR on the right. */
.payment-contact {
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.payment-hint {
  margin: 0 0 10px;
  font-weight: 600;
}

.payment-details dl {
  margin: 0;
}

/* Users table (admin): sortable headers and selectable rows. */
.sort-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sort-btn::after {
  content: "";
  display: inline-block;
  width: 1em;
  margin-left: 4px;
  color: #999;
}

th[aria-sort="ascending"] .sort-btn::after {
  content: "▲";
}

th[aria-sort="descending"] .sort-btn::after {
  content: "▼";
}

.flag-cell {
  color: #27ae60;
  font-weight: 600;
}

#usersTableBody tr {
  cursor: pointer;
}

#usersTableBody tr:hover {
  background: #f5f7fa;
}

#usersTableBody tr.selected-row {
  background: #e3ecf7;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
}

dialog form .checkbox-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

dialog form .checkbox-row input {
  width: auto;
  margin: 0;
}

#editUserDialog {
  max-height: 90vh;
  overflow-y: auto;
}
