* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0a0a0a; color: #00ff41; font-family: 'Courier New', monospace; min-height: 100vh; }
nav { background: #0d0d0d; border-bottom: 1px solid #00ff4133; padding: 12px 24px; display: flex; gap: 24px; align-items: center; }
nav a { color: #00ff41; text-decoration: none; font-size: 14px; opacity: 0.6; transition: opacity 0.2s; }
nav a:hover, nav a.active { opacity: 1; }
nav .brand { font-size: 18px; font-weight: bold; margin-right: auto; color: #00ff41; }
.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
h1 { font-size: 24px; margin-bottom: 24px; color: #00ff41; }
h2 { font-size: 16px; margin-bottom: 12px; color: #00ccff; }
.card { background: #0d0d0d; border: 1px solid #00ff4133; border-radius: 4px; padding: 20px; margin-bottom: 20px; }
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 2px; font-size: 12px; font-weight: bold; }
.status-badge.connected { background: #00ff4122; color: #00ff41; border: 1px solid #00ff41; }
.status-badge.disconnected { background: #ff444422; color: #ff4444; border: 1px solid #ff4444; }
.qr-wrap { text-align: center; padding: 20px 0; }
.qr-wrap img { border: 4px solid #00ff41; border-radius: 4px; max-width: 260px; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat .num { font-size: 36px; font-weight: bold; color: #00ccff; }
.stat .label { font-size: 12px; opacity: 0.6; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; border-bottom: 1px solid #00ff4133; color: #00ccff; font-size: 12px; text-transform: uppercase; }
td { padding: 8px 12px; border-bottom: 1px solid #ffffff0a; vertical-align: top; }
tr:hover td { background: #ffffff05; }
input[type="text"], textarea, select { background: #0a0a0a; border: 1px solid #00ff4144; color: #00ff41; font-family: 'Courier New', monospace; font-size: 13px; padding: 8px; border-radius: 2px; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
input[type="text"]:focus, textarea:focus, select:focus { outline: none; border-color: #00ff41; }
button, .btn { background: #00000000; border: 1px solid #00ff41; color: #00ff41; font-family: 'Courier New', monospace; font-size: 13px; padding: 8px 18px; cursor: pointer; border-radius: 2px; transition: background 0.2s, color 0.2s; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #00ff41; color: #000; }
.notes-input { max-width: 220px; }
.msg { padding: 8px 12px; margin-bottom: 8px; border-radius: 2px; font-size: 13px; }
.msg.success { background: #00ff4122; border-left: 3px solid #00ff41; }
.msg.error { background: #ff444422; border-left: 3px solid #ff4444; }
label { display: block; font-size: 12px; color: #00ccff; margin-bottom: 6px; margin-top: 16px; text-transform: uppercase; letter-spacing: 1px; }
label:first-child { margin-top: 0; }
.mode-badge { display: inline-block; font-size: 11px; font-weight: bold; padding: 2px 8px; border: 1px solid; letter-spacing: 1px; font-family: 'Courier New', monospace; }

/* ── Mobile / Responsive ─────────────────────────────────────────────────── */

/* Prevent horizontal overflow globally */
html, body { overflow-x: hidden; }
* { max-width: 100%; }

/* Nav — collapse on small screens */
nav {
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
}
nav .brand { font-size: 15px; }
nav a { font-size: 13px; }

/* Container padding tighter on mobile */
@media (max-width: 600px) {
  .container { padding: 16px 12px; }
  h1 { font-size: 18px; margin-bottom: 16px; }
  h2 { font-size: 14px; }

  /* Nav: brand takes full row, links wrap below */
  nav { padding: 10px 12px; gap: 6px; }
  nav .brand { width: 100%; font-size: 14px; margin-right: 0; }
  nav a { font-size: 12px; padding: 4px 0; }
  nav button { font-size: 11px; padding: 4px 10px; margin-left: 0 !important; }

  /* Cards */
  .card { padding: 14px 12px; }

  /* Tables — scroll horizontally instead of overflow */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 12px; }
  th, td { padding: 6px 8px; white-space: nowrap; }

  /* Stats row — stack on very small screens */
  .stats { gap: 12px; }
  .stat .num { font-size: 26px; }

  /* Inputs full width */
  input[type="text"], input[type="password"], textarea, select {
    font-size: 16px; /* prevent iOS zoom on focus */
  }

  /* Buttons */
  button, .btn { font-size: 12px; padding: 8px 14px; }

  /* Groups grid — single column */
  .group-grid { grid-template-columns: 1fr !important; }

  /* Config style grid — single column */
  .style-grid { grid-template-columns: 1fr !important; }

  /* Contacts table — hide less important cols, show key ones */
  .notes-input { width: 100% !important; max-width: 100% !important; }

  /* Dashboard debrief buttons row — stack vertically */
  #debrief-row { flex-direction: column; gap: 8px; }
  #debrief-row button { width: 100%; }

  /* Toggle labels in groups — keep them from wrapping oddly */
  .toggle-row { flex-wrap: nowrap; gap: 8px; }
  .toggle-row label:first-child { font-size: 11px; }

  /* OTP digit inputs — slightly smaller on phones */
  .otp-inputs, .otp-row { gap: 6px; }
  .otp-digit { width: 38px !important; height: 46px !important; font-size: 20px !important; }

  /* Login card padding */
  .card.login-box, .login-box { padding: 28px 20px !important; }

  /* Seal */
  .seal-wrap { width: 90px !important; height: 90px !important; }
  .seal-wrap img { width: 90px !important; height: 90px !important; }
}

@media (max-width: 400px) {
  .otp-digit { width: 34px !important; height: 42px !important; font-size: 18px !important; }
  nav .brand { font-size: 13px; }
}
