:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #22c55e;
  --error: #ef4444;
  --border: #1f2937;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji"; }
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-weight: 700; margin: 16px 0 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
label { display: block; margin: 10px 0; font-size: 0.95rem; }
input, select, textarea { width: 100%; padding: 10px; margin-top: 6px; border-radius: 8px; border: 1px solid var(--border); background: #0b1220; color: var(--text); }
/* Nicer file input + browse button */
input[type="file"] { color: var(--muted); }
input[type="file"]::file-selector-button { background: var(--primary); color: #052e12; border: none; padding: 8px 12px; margin-right: 10px; border-radius: 8px; cursor: pointer; font-weight: 700; }
input[type="file"]::file-selector-button:hover { filter: brightness(1.05); }
button { background: var(--primary); color: #052e12; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-weight: 700; }
button:hover { filter: brightness(1.05); }
.btn { background: var(--primary); color: #052e12; border: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.btn.secondary { background: #16a34a; }
.btn.warn { background: #f59e0b; color: #1f2937; }
.btn.danger { background: #ef4444; color: #fff; }
.btn.info { background: #06b6d4; color: #07242a; }
.btn.small { padding: 4px 8px; font-size: 0.9rem; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-group .flex-break { flex-basis: 100%; height: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid .msg { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.msg { margin-top: 10px; font-weight: 600; }
.msg.success { color: var(--primary); }
.msg.error { color: var(--error); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; }
.hidden { display: none; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.user-actions-cell { display: flex; align-items: center; gap: 10px; min-width: 420px; }
.user-actions-cell .user-pwd-input { min-width: 240px; }

/* Passkey login button: match default button size and use a modern blue */
#passkey-login-btn {
  padding: 10px 14px;
  background: #3b82f6; /* blue */
  color: #ffffff;
  display: block;
  margin: 0 auto; /* center when fixed width is applied via JS */
}
#passkey-login-btn:hover { filter: brightness(1.05); }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; background: var(--card); border-bottom: 1px solid var(--border); padding: 8px 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 32px; width: auto; object-fit: contain; }
.brand-title { font-weight: 700; }
.icon-button { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.menu-dropdown { position: absolute; right: 16px; top: 56px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; min-width: 220px; box-shadow: 0 10px 24px rgba(0,0,0,0.30); display: none; }
.menu-dropdown.open { display: block; }
.menu-item { width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 10px 12px; border-radius: 8px; cursor: pointer; display: block; }
.menu-item:hover { background: #0b1220; }
/* Remove underline from icon-button links as well */
.icon-button:hover { text-decoration: none; }

/* Simple modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { width: min(520px, 92vw); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 32px rgba(0,0,0,0.4); }
.modal-header { font-weight: 700; margin-bottom: 8px; }
.modal-body label { display: block; margin: 8px 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Icon-only button */
.icon-btn { background: transparent; color: var(--text); border: none; padding: 4px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn .icon { font-size: 16px; line-height: 1; }
.icon-btn .icon-emoji { font-size: 18px; line-height: 1; display: inline-block; }
.icon-btn:hover { color: var(--primary); background: transparent; }
.icon-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Suggestions dropdown */
.suggest-wrapper { position: relative; }
.suggest-box { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,0.30); z-index: 150; max-height: 240px; overflow: auto; }
.suggest-item { padding: 8px 10px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.suggest-item:hover { background: #0b1220; }
.suggest-name { font-weight: 600; }
.suggest-type { color: var(--muted); font-size: 0.9rem; }

/* Pretty toggle for Fail2Ban enable checkbox */
.switch-row { display: flex; align-items: center; gap: 10px; }
/* Toggle track enlarged by 1.5x */
input.toggle { appearance: none; -webkit-appearance: none; width: 84px; height: 30px; background: #1f2937; border: none; border-radius: 999px; position: relative; cursor: pointer; transition: background 0.1s ease; outline: none; }
/* Larger thumb with safe travel to avoid overflow */
/* Center thumb in current track: (30 - 24) / 2 = 3px */
input.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #94a3b8; border-radius: 50%; transition: transform 0.4s ease, background 0.1s ease; }
input.toggle:checked { background: var(--primary); }
/* Travel doubled from previous (8.67px → 17.34px) */
input.toggle:checked::after { transform: translateX(23px); background: #052e12; }
input.toggle:focus-visible { box-shadow: 0 0 0 2px rgba(34,197,94,0.35); }

/* Responsive tweaks: stack action buttons on mobile */
@media (max-width: 640px) {
  /* Stack buttons vertically to avoid horizontal overflow */
  .btn-group { flex-direction: column; align-items: stretch; gap: 8px; }
  .btn-group .flex-break { display: none; }
  .btn-group .btn,
  .btn-group .icon-btn { width: 100%; justify-content: center; }
  /* Hide Email and Type columns in requests list */
  #requests-list-section th.col-email,
  #requests-list-section td.col-email,
  #requests-list-section th.col-type,
  #requests-list-section td.col-type { display: none; }
  /* Allow tables to scroll horizontally as a safety net */
  table { display: block; width: 100%; overflow-x: auto; }
  thead, tbody { display: table; width: 100%; }
}
