:root {
  --bg-main: #0c0f17;
  --bg-card: #151a26;
  --bg-input: #1d2433;
  --border-color: #273147;
  --text-main: #f0f4fc;
  --text-muted: #8b99b5;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.view {
  width: 100%;
  min-height: 100vh;
}

#loginView {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loginCard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.brandLogo {
  text-align: center;
  margin-bottom: 20px;
}

.brandLogo h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.brandLogo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.authTabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.authTabBtn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.authTabBtn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.formGroup {
  margin-bottom: 18px;
}

.formGroup label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.formGroup input,
.formGroup select,
.formGroup textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 14px;
  transition: border-color 0.2s;
}

.formGroup input:focus,
.formGroup select:focus,
.formGroup textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}

.formGroup small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btnPrimary {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btnPrimary:hover {
  background: var(--color-primary-hover);
}

.btnSecondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btnSecondary:hover {
  background: #252e40;
}

.btnDanger {
  background: var(--color-danger);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btnDanger:hover {
  background: #dc2626;
}

.btnGhost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btnGhost:hover {
  color: var(--text-main);
}

.btnLarge {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.btnDisabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none;
}

.alertError {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 16px;
}

.alertNotice {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 16px;
}

.topBar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.barBrand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.barBrand h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.capacityBadge {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.topBarControls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.workspacePicker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.workspaceLabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.workspaceSelect {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.workspaceSelect option {
  background: var(--bg-card);
  color: var(--text-main);
}

.userMenu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.userBadge {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

.badgeCounter {
  background: var(--color-danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 6px;
}

.contentArea {
  flex: 1;
  padding: 24px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.sectionHeader h2 {
  font-size: 20px;
  font-weight: 700;
}

.sectionHeader p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.profilesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.profileCard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
}

.profileCard:hover {
  transform: translateY(-2px);
  border-color: #3b82f644;
}

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

.cardTitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.badgeScope {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badgePersonal {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badgeTeam {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.statusIndicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.statusActive {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.statusInactive {
  background: var(--bg-input);
  color: var(--text-muted);
}

.statusLocked {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.activeDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.lockedDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.cardBody {
  margin-bottom: 20px;
}

.cardMeta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  word-break: break-all;
}

.cardNotes {
  font-size: 12px;
  color: #cbd5e1;
  background: var(--bg-input);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

.cardActions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.actionRow {
  display: flex;
  gap: 8px;
}

.actionRow button {
  flex: 1;
}

.emptyState {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
}

.emptyState p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 14px;
}

.emptySubState {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
}

.modalCard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  max-height: 92vh;
  overflow-y: auto;
}

.modalCardLarge {
  max-width: 860px;
}

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

.modalHeader h3 {
  font-size: 18px;
  font-weight: 700;
}

.closeBtn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.closeBtn:hover {
  color: var(--text-main);
}

.modalDesc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.scopeRadioGroup {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.scopeRadioOption {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.scopeRadioOption input {
  width: auto;
}

.adminTabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.adminTabBtn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.adminTabBtn.active {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-main);
}

.adminPanel {
  min-height: 240px;
}

.pendingUserCard {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pendingUserHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pendingUserName {
  font-size: 15px;
  font-weight: 700;
}

.pendingUserMeta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.pendingUserActions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.teamSelectionInline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.tableResponsive {
  overflow-x: auto;
  width: 100%;
}

.dataTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.dataTable th {
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.dataTable td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.teamCreationBox {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.teamCreationBox h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

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

.teamFormInline input {
  flex: 1;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
}

.teamsListGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.teamCard {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.teamCard h5 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.teamCard p {
  font-size: 12px;
  color: var(--text-muted);
}

.viewerOverlay {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.viewerTopBar {
  background: #111622;
  border-bottom: 1px solid #1f293d;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  gap: 10px;
}

.viewerLeftGroup,
.viewerCenterGroup,
.viewerRightGroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btnTouch {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12px;
}

.btnChip {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  transition: all 0.2s;
}

.btnChip:hover,
.btnChip:active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.viewerInfo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.modeBadge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timerBadge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.viewerFrameContainer {
  flex: 1;
  width: 100%;
  height: calc(100% - 56px);
  position: relative;
  background: #000000;
}

.viewerFrameContainer iframe {
  width: 100%;
  height: 100%;
  border: none;
}

#virtualKeyboardTrigger {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
}

@media (min-width: 769px) {
  .viewerOverlay.mobileMode .viewerFrameContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #080a0f;
    padding: 12px 0;
  }
  .viewerOverlay.mobileMode iframe {
    width: 412px;
    height: 915px;
    max-height: calc(100vh - 72px);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 0 8px #1f293d;
  }
}

@media (max-width: 768px) {
  .topBar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  .topBarControls {
    width: 100%;
    justify-content: space-between;
  }
  .workspacePicker {
    flex: 1;
  }
  .sectionHeader {
    flex-direction: column;
    align-items: flex-start;
  }
  .sectionHeader button {
    width: 100%;
  }
  .viewerTopBar {
    padding: 6px 8px;
    gap: 6px;
    min-height: 44px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .viewerTopBar::-webkit-scrollbar {
    display: none;
  }
  .viewerLeftGroup,
  .viewerCenterGroup,
  .viewerRightGroup {
    flex-shrink: 0;
    gap: 4px;
  }
  .viewerRightGroup button,
  .viewerLeftGroup button {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
  }
  .viewerFrameContainer {
    height: calc(100% - 44px);
  }
}
