/* ============================================================
   AttendX v2 — Universal Stylesheet
   Clean, modern, dark. Works beautifully on large screens.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core palette */
  --bg:           #07090f;
  --bg2:          #0d1117;
  --bg3:          #161b26;
  --bg4:          #1e2736;
  --bg5:          #252e40;

  /* Borders */
  --border:       #1c2333;
  --border2:      #263042;
  --border3:      #2e3d56;

  /* Text */
  --text:         #e6edf3;
  --text2:        #8b98a8;
  --text3:        #4d5f73;

  /* Brand */
  --primary:      #4f7cff;
  --primary-h:    #3b6af5;
  --primary-dim:  rgba(79,124,255,.1);
  --primary-glow: 0 0 28px rgba(79,124,255,.22);

  /* Status */
  --success:      #23d18b;
  --warning:      #f0a732;
  --danger:       #f75c5c;
  --info:         #58a6ff;
  --purple:       #a78bfa;

  /* Layout */
  --sidebar-w:    264px;
  --topbar-h:     58px;

  /* Shape */
  --r:            14px;
  --r-sm:         9px;
  --r-xs:         5px;

  /* Shadows */
  --sh-sm:   0 1px 4px rgba(0,0,0,.4);
  --sh-md:   0 4px 16px rgba(0,0,0,.5);
  --sh-lg:   0 8px 40px rgba(0,0,0,.65);
  --sh-xl:   0 20px 60px rgba(0,0,0,.8);

  /* Transition */
  --t: .16s ease;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--bg5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border3); }

/* ── Selection ────────────────────────────────────────────── */
::selection { background: var(--primary-dim); color: var(--text); }


/* ╔══════════════════════════════════════╗
   ║  SIDEBAR                             ║
   ╚══════════════════════════════════════╝ */

.sidebar {
  position: fixed;
  inset-y: 0; left: 0;
  width: var(--sidebar-w);
  z-index: 300;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform var(--t), box-shadow var(--t);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c5fff 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: var(--primary-glow);
  flex-shrink: 0;
}
.logo-text {
  font-size: 16px; font-weight: 800;
  letter-spacing: -.4px;
  color: var(--text);
  flex: 1;
}
.logo-text span { color: var(--primary); }
.sidebar-close {
  display: none;
  background: none; border: none;
  color: var(--text3); font-size: 17px;
  padding: 5px; border-radius: 6px;
  line-height: 1;
  transition: color var(--t), background var(--t);
}
.sidebar-close:hover { color: var(--text); background: var(--bg4); }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text3);
  padding: 12px 12px 5px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500;
  color: var(--text2);
  transition: all var(--t);
  position: relative;
  cursor: pointer;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon  { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c5fff);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--border2);
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 11px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logout-btn {
  color: var(--text3); font-size: 17px; padding: 4px;
  border-radius: 6px; display: flex; align-items: center;
  transition: color var(--t), background var(--t);
}
.logout-btn:hover { color: var(--danger); background: rgba(247,92,92,.1); }

/* Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 299;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(3px);
}


/* ╔══════════════════════════════════════╗
   ║  MAIN LAYOUT                         ║
   ╚══════════════════════════════════════╝ */

.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left var(--t);
}

.topbar {
  position: sticky; top: 0; z-index: 200;
  height: var(--topbar-h);
  background: rgba(7,9,15,.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(1.5);
  display: flex; align-items: center;
  padding: 0 28px; gap: 14px;
}
.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 6px 9px;
  border-radius: var(--r-sm);
  font-size: 16px; line-height: 1;
  cursor: pointer;
  transition: all var(--t);
}
.menu-btn:hover { color: var(--text); background: var(--bg3); }
.menu-btn:active { transform: scale(.94); }

.topbar-title {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 7px; margin-left: auto; }

.topbar-notif {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); font-size: 16px; color: var(--text2);
  border: 1px solid transparent;
  transition: all var(--t);
}
.topbar-notif:hover { background: var(--bg3); color: var(--text); border-color: var(--border); }
.notif-badge {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c5fff);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--border2);
  transition: box-shadow var(--t);
}
.topbar-avatar:hover { box-shadow: 0 0 0 2px var(--primary); }

.page-content {
  flex: 1;
  padding: 32px 36px;
  width: 100%;
  max-width: 1340px;
}


/* ╔══════════════════════════════════════╗
   ║  AUTH / PUBLIC PAGES                 ║
   ╚══════════════════════════════════════╝ */

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 65% 5%,  rgba(79,124,255,.14) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 90%, rgba(124,92,252,.09) 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 38px;
  width: 100%; max-width: 430px;
  box-shadow: var(--sh-xl);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px;
  background: linear-gradient(135deg, var(--primary), #7c5fff);
  border-radius: 18px; font-size: 28px; margin-bottom: 14px;
  box-shadow: var(--primary-glow);
}
.auth-logo h1 {
  font-size: 26px; font-weight: 900; letter-spacing: -.5px;
  color: var(--text);
}
.auth-logo h1 span { color: var(--primary); }
.auth-logo p { font-size: 13px; color: var(--text2); margin-top: 3px; }
.auth-card > h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--text); }


/* ╔══════════════════════════════════════╗
   ║  TYPOGRAPHY                          ║
   ╚══════════════════════════════════════╝ */

.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title   { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.4px; line-height: 1.2; }
.page-subtitle{ font-size: 13px; color: var(--text2); margin-top: 4px; }
h2 { font-size: 17px; font-weight: 700; color: var(--text); }
h3 { font-size: 14px; font-weight: 600; color: var(--text); }


/* ╔══════════════════════════════════════╗
   ║  CARDS                               ║
   ╚══════════════════════════════════════╝ */

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 24px;
}
.card-title {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-grid   { display: grid; gap: 16px; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 22px;
  transition: border-color var(--t), box-shadow var(--t);
}
.stat-card:hover { border-color: var(--border3); box-shadow: var(--sh-sm); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; margin-bottom: 14px;
}
.stat-value { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 5px; font-weight: 500; }


/* ╔══════════════════════════════════════╗
   ║  BUTTONS                             ║
   ╚══════════════════════════════════════╝ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; line-height: 1.4;
  transition: all var(--t);
}
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.96); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); box-shadow: 0 4px 18px rgba(79,124,255,.38); }

.btn-secondary { background: var(--bg4); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover:not(:disabled) { background: var(--bg5); border-color: var(--border3); }

.btn-danger { background: rgba(247,92,92,.12); color: var(--danger); border-color: rgba(247,92,92,.28); }
.btn-danger:hover:not(:disabled) { background: rgba(247,92,92,.2); }

.btn-success { background: rgba(35,209,139,.12); color: var(--success); border-color: rgba(35,209,139,.28); }
.btn-success:hover:not(:disabled) { background: rgba(35,209,139,.2); }

.btn-ghost { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }

.btn-sm  { padding: 5px 11px; font-size: 12px; border-radius: var(--r-xs); }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; }


/* ╔══════════════════════════════════════╗
   ║  FORMS                               ║
   ╚══════════════════════════════════════╝ */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text2); margin-bottom: 7px; letter-spacing: .02em;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 14px;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  appearance: none;
}
.form-control::placeholder { color: var(--text3); }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,124,255,.16);
}
.form-control:disabled { opacity: .5; cursor: not-allowed; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234d5f73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 84px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint  { font-size: 11px; color: var(--text3); margin-top: 5px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 5px; }

/* Toggle */
.toggle-wrap {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.toggle-info p     { font-size: 13px; color: var(--text); font-weight: 500; }
.toggle-info small { font-size: 11px; color: var(--text3); display: block; margin-top: 2px; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg5); border-radius: 11px;
  border: 1px solid var(--border3); cursor: pointer;
  transition: all var(--t);
}
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text3); transition: transform var(--t), background var(--t);
}
.toggle input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .toggle-slider::after { transform: translateX(18px); background: #fff; }

/* Range */
.range-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); margin-top: 5px; }
input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }

/* Search */
.search-wrap { position: relative; }
.search-wrap input { padding-left: 38px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text3); pointer-events: none; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: flex-end; }
.filters .form-control { width: auto; }


/* ╔══════════════════════════════════════╗
   ║  TABLES                              ║
   ╚══════════════════════════════════════╝ */

.table-wrap { 
  width: 100%;
  overflow-x: auto; 
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* Enables smooth native momentum scrolling on iOS */
  border-radius: var(--r-sm);
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  font-size: 13px; 
}

thead tr { 
  border-bottom: 1px solid var(--border2); 
}

thead th {
  padding: 11px 16px; 
  text-align: left;
  font-size: 10.5px; 
  font-weight: 700;
  color: var(--text3); 
  text-transform: uppercase; 
  letter-spacing: .06em;
  white-space: nowrap; /* Keeps headers from stacking */
}

tbody tr { 
  border-bottom: 1px solid var(--border); 
  transition: background var(--t); 
}

tbody tr:last-child { 
  border-bottom: none; 
}

tbody tr:hover { 
  background: rgba(255,255,255,.022); 
}

tbody td { 
  padding: 12px 16px; 
  color: var(--text); 
  vertical-align: middle; 
  white-space: nowrap; /* CRITICAL: Prevents cell content from squishing, forcing the container to scroll instead */
}

.td-muted { color: var(--text2); }
.td-xs    { font-size: 11px; color: var(--text3); }


/* ╔══════════════════════════════════════╗
   ║  BADGES                              ║
   ╚══════════════════════════════════════╝ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-present  { background: rgba(35,209,139,.12);  color: #23d18b; }
.badge-late     { background: rgba(240,167,50,.12);  color: #f0a732; }
.badge-muted    { background: rgba(100,116,139,.12); color: #94a3b8; }
.badge-live     { background: rgba(35,209,139,.12);  color: #23d18b; }
.badge-upcoming { background: rgba(79,124,255,.12);  color: #4f7cff; }
.badge-ended    { background: rgba(77,95,115,.12);   color: #4d5f73; }
.badge-inperson { background: rgba(88,166,255,.12);  color: #58a6ff; }
.badge-virtual  { background: rgba(167,139,250,.12); color: #a78bfa; }
.badge-hybrid   { background: rgba(45,212,191,.12);  color: #2dd4bf; }
.badge-tag      { background: var(--bg4); color: var(--text2); border: 1px solid var(--border2); }

.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #23d18b; animation: pulse 1.5s infinite; }


/* ╔══════════════════════════════════════╗
   ║  MEETING CARDS                       ║
   ╚══════════════════════════════════════╝ */

.meeting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.meeting-card {
  display: block;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  cursor: pointer;
}
.meeting-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--primary-glow);
  transform: translateY(-2px);
}
.meeting-card-head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px; margin-bottom: 12px;
}
.meeting-card-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.meeting-card-meta  { font-size: 12px; color: var(--text2); display: flex; flex-direction: column; gap: 5px; }
.meeting-card-meta span { display: flex; align-items: center; gap: 7px; }
.meeting-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
}
.meeting-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }


/* ╔══════════════════════════════════════╗
   ║  CHECKIN PAGE                        ║
   ╚══════════════════════════════════════╝ */

.checkin-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 70% 10%, rgba(79,124,255,.12) 0%, transparent 55%),
    radial-gradient(ellipse at 5% 90%,  rgba(124,92,252,.08) 0%, transparent 50%),
    var(--bg);
}
.checkin-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 38px 34px;
  width: 100%; max-width: 460px;
  text-align: center;
  box-shadow: var(--sh-xl);
}
.checkin-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.checkin-card .meta { font-size: 13px; color: var(--text2); margin-bottom: 24px; line-height: 1.6; }

/* QR */
.qr-wrap  { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; }
.qr-box   { background: #fff; border-radius: 14px; padding: 14px; display: inline-flex; box-shadow: var(--sh-md); }
.qr-meta  { text-align: center; }
.qr-meta h3 { font-size: 15px; font-weight: 700; }
.qr-meta p  { font-size: 12px; color: var(--text2); margin-top: 3px; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Live feed */
.live-feed { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.live-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 14px;
  animation: slideIn .3s ease;
}
.live-user  { display: flex; align-items: center; gap: 10px; }
.avatar-sm  {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c5fff);
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-lg  {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c5fff);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.live-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.live-time  { font-size: 11px; color: var(--text3); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 18px; border-left: 3px solid; line-height: 1.5; }
.alert-success { background: rgba(35,209,139,.08);  color: var(--success); border-color: var(--success); }
.alert-error   { background: rgba(247,92,92,.08);   color: var(--danger);  border-color: var(--danger); }
.alert-warning { background: rgba(240,167,50,.08);  color: var(--warning); border-color: var(--warning); }
.alert-info    { background: rgba(88,166,255,.08);  color: var(--info);    border-color: var(--info); }

/* Toast */
#toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg4); border: 1px solid var(--border3);
  border-radius: var(--r-sm); padding: 13px 18px;
  font-size: 13px; max-width: 340px;
  box-shadow: var(--sh-md);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .22s ease;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger);  }
.toast-info    { border-left: 3px solid var(--info);    }
.toast-warning { border-left: 3px solid var(--warning); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(4px); z-index: 500; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--r); padding: 28px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--sh-xl); animation: modalIn .2s ease; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 20px; cursor: pointer; padding: 3px; border-radius: 5px; line-height: 1; transition: all var(--t); }
.modal-close:hover { color: var(--text); background: var(--bg3); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Misc */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state-icon { font-size: 46px; margin-bottom: 14px; opacity: .45; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 7px; }
.empty-state p  { font-size: 13px; color: var(--text2); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; border: 1px solid var(--border); color: var(--text2); transition: all var(--t); }
.pagination a:hover   { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.pagination .current  { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .28; pointer-events: none; }

.progress-bar  { height: 7px; background: var(--bg5); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .55s ease; }
.progress-success { background: linear-gradient(90deg, var(--success), #00e5a0); }
.progress-warning { background: linear-gradient(90deg, var(--warning), #f59e0b); }
.progress-danger  { background: linear-gradient(90deg, var(--danger),  #ef4444); }

.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text2); width: 120px; flex-shrink: 0; }
.detail-val   { color: var(--text); }
.section-divider { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border2); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 56px; }

.or-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text3); font-size: 12px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Share link box */
.share-box { display: flex; gap: 8px; align-items: center; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: 10px 14px; }
.share-url { flex: 1; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: monospace; }
.copy-btn  { flex-shrink: 0; }


/* ╔══════════════════════════════════════╗
   ║  ANIMATIONS                          ║
   ╚══════════════════════════════════════╝ */

@keyframes pulse   { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes spin    { to{transform:rotate(360deg)} }
@keyframes slideIn { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }
@keyframes toastIn { from{opacity:0;transform:translateX(18px)} to{opacity:1;transform:translateX(0)} }
@keyframes modalIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn  { from{opacity:0} to{opacity:1} }
@keyframes pop     { 0%{transform:scale(.9);opacity:0} 70%{transform:scale(1.04)} 100%{transform:scale(1);opacity:1} }


/* ╔══════════════════════════════════════╗
   ║  RESPONSIVE                          ║
   ╚══════════════════════════════════════╝ */

@media (max-width: 1080px) {
  .page-content { padding: 24px 22px; }
  .card-grid-4  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--sh-xl); }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .menu-btn  { display: inline-flex; align-items: center; justify-content: center; }
  .topbar    { padding: 0 14px; }
  .page-content { padding: 16px; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  .filters   { flex-direction: column; }
  .filters .form-control { width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .meeting-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .checkin-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  :root { --sidebar-w: 100vw; }
  .page-title  { font-size: 20px; }
  .stat-value  { font-size: 26px; }
}


/* ── Checkin mobile fixes ─────────────────────────────────── */
.checkin-wrap {
  padding: 16px;
  align-items: flex-start;
  padding-top: 32px;
}

.checkin-card {
  max-height: none;
  overflow: visible;
}

/* Prevent any horizontal overflow on mobile */
body {
  overflow-x: hidden;
}

.page-content {
  overflow-x: hidden;
}

/* Fix form-row collapsing on very small screens */
@media (max-width: 400px) {
  .checkin-card {
    padding: 24px 16px;
    border-radius: 14px;
  }
  .checkin-card .form-row {
    grid-template-columns: 1fr;
  }
  .auth-card {
    padding: 24px 16px;
    border-radius: 14px;
  }
}

/* Ensure modal doesn't go off-screen on mobile */
@media (max-width: 768px) {
  .modal {
    padding: 20px 16px;
    max-height: 95vh;
    margin: 0;
  }
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .qr-wrap {
    padding: 12px;
  }
  .qr-box canvas {
    max-width: 100% !important;
    height: auto !important;
  }
}