/* =========================================================
   ROTAPP – CLEAN APP.CSS
   (Theme preserved; layout + portal fixes consolidated)
   ========================================================= */

/* ---------- THEME ---------- */
:root{
  --bg: #070A12;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.68);
  --shadow: 0 18px 60px rgba(0,0,0,0.55);
  --r: 22px;

  /* Optional: single knob for overall width */
  --page-max: 1400px;
}

/* ---------- BASE ---------- */
*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1400px 700px at 10% 0%, rgba(90,250,170,0.15), transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(120,180,255,0.15), transparent 55%),
    radial-gradient(900px 700px at 50% 100%, rgba(255,130,200,0.10), transparent 60%),
    var(--bg);
  overflow-x:hidden;
}

h1{ margin:0 0 6px; font-size: 28px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.hide{ display:none !important; }

/* Background glow */
.bg .glow{
  position:fixed;
  width:520px;height:520px;
  filter: blur(70px);
  opacity:0.55;
  border-radius:50%;
  z-index:-1;
}
.bg .g1{ left:-120px; top:-120px; background: rgba(90,250,170,0.45); }
.bg .g2{ right:-160px; top:40px; background: rgba(120,180,255,0.40); }
.bg .g3{ left:20%; bottom:-220px; background: rgb(255, 130, 201); }

/* ---------- HEADER / NAV ---------- */
.topbar{
  max-width: var(--page-max);
  margin: 22px auto 0;
  padding: 12px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border:1px solid var(--border);
  border-radius: 999px;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}

.brand{ display:flex; align-items:center; gap:12px; }
.logo{
  width:38px;height:38px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, rgba(90,250,170,0.9), rgba(120,180,255,0.85));
  color:#0b1020;
  font-weight:800;
}
.brandName{ font-weight:800; letter-spacing:0.2px; }
.brandTag{ font-size:12px; color: var(--muted); margin-top:2px; }

.nav{ display:flex; gap:10px; align-items:center; }
.nav a{
  color: var(--muted);
  text-decoration:none;
  padding:10px 12px;
  border-radius: 999px;
  border:1px solid transparent;
}
.nav a:hover{
  color: var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}

/* ---------- PAGE LAYOUT ---------- */
.container{
  max-width: var(--page-max);
  margin: 22px auto 0;
  padding: 0 18px 40px;
}

/* Card shells (login/dashboard/rota) */
.card{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255, 255, 255, 0.04));
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 28px; /* cleaner than stacking many tweak blocks */
}

/* ---------- FORMS / INPUTS ---------- */
.form{ margin-top: 18px; display:flex; flex-direction:column; gap:10px; }

label{ font-size: 13px; color: var(--muted); margin-top:4px; }

input, select, textarea{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline:none;
}
textarea{ min-height: 110px; resize: vertical; }

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.row > input,
.row > select,
.row > textarea{
  flex: 1 1 260px;
  min-width: 260px;
}

.msg{
  min-height: 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.78);
}

.hint{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pill{
  display:inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  font-size: 12px;
}

/* ---------- BUTTONS ---------- */
.btn{
  cursor:pointer;
  padding: 11px 14px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.btn:hover{ background: rgba(255,255,255,0.10); }

.btn.primary{
  border-color: rgba(90,250,170,0.35);
  background: linear-gradient(135deg, rgba(90,250,170,0.22), rgba(120,180,255,0.18));
}
.btn.ghost{ background: transparent; }

/* ---------- DASHBOARD / PANELS ---------- */
.dashHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 14px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 14px;
}
@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
}

.panel{
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
  border-radius: 18px;
  padding: 16px;
  min-width: 0; /* important: prevents tables/forms forcing column wider */
}

/* Make “big panels” span full width */
.span2{ grid-column: 1 / -1; }

.panelTitle{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.82);
  font-weight: 600;
}

.dot{
  width:10px;height:10px;border-radius:50%;
  background: rgba(90,250,170,0.90);
  box-shadow: 0 0 18px rgba(90,250,170,0.65);
}

.kv{
  display:grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.82);
}
.k{ color: var(--muted); }

.toolbar{
  display:flex;
  justify-content:flex-end;
  margin-bottom: 10px;
}

/* Preformatted blocks */
.pre{
  margin:0;
  padding: 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  overflow:auto;
  max-height: 280px;
  font-size: 12px;
  line-height: 1.35;
}

/* Rota buttons row */
.rotaBtns{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin: 10px 0 12px;
}

/* ---------- TABLES / WRAPS ---------- */
.tableWrap{
  overflow:auto;
  max-height: 360px;
  width: 100%;
}

/* Ensure generated tables fill the panel width */
.tableWrap table{ width:100%; border-collapse: collapse; }

/* Table alignment + action column cleanup */
.table td, .table th{ vertical-align: middle; }
.table th:last-child,
.table td:last-child{ width: 140px; text-align: right; white-space: nowrap; }

.table td:last-child .btn{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  min-width: 96px;
  margin: 6px 0;
}

/* ---------- MODAL (INVITE) ---------- */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
  z-index: 9999;
}
.modal.hide{ display:none; }

.modalCard{
  width: min(980px, 100%);
  max-height: 88vh;
  overflow:auto;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.30);
  backdrop-filter: blur(14px);
  padding: 16px;
}

.modalHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.inviteLinkRow{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.inviteLinkRow input{ flex:1 1 320px; min-width: 320px; }
.inviteLinkRow .btn{ flex:0 0 auto; }

.qrBox{
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  padding: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 240px;
}
#inviteQr{
  width: 220px;
  height: 220px;
  object-fit: contain;
  display:block;
  border-radius: 14px;
}

/* ---------- PORTAL CLICK SAFETY (your previous fix) ---------- */
#btnOpenInvites, #btnOpenRota, #btnBackToDash{
  pointer-events: auto !important;
  position: relative;
  z-index: 9999;
}

/* ---------- FOOTER ---------- */
.footer{
  margin-top: 15px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding: 0 6px;
}
